스플래시 변경
This commit is contained in:
parent
6d83869cae
commit
c1d63675db
|
@ -1,21 +0,0 @@
|
||||||
{
|
|
||||||
"images" : [
|
|
||||||
{
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "1x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "2x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename" : "splash_bg.jpg",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "3x"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info" : {
|
|
||||||
"author" : "xcode",
|
|
||||||
"version" : 1
|
|
||||||
}
|
|
||||||
}
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.9 MiB |
|
@ -1,21 +0,0 @@
|
||||||
{
|
|
||||||
"images" : [
|
|
||||||
{
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "1x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "2x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename" : "splash_logo.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "3x"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info" : {
|
|
||||||
"author" : "xcode",
|
|
||||||
"version" : 1
|
|
||||||
}
|
|
||||||
}
|
|
Binary file not shown.
Before Width: | Height: | Size: 4.0 KiB |
|
@ -1,21 +0,0 @@
|
||||||
{
|
|
||||||
"images" : [
|
|
||||||
{
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "1x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "2x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename" : "splash_text.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "3x"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info" : {
|
|
||||||
"author" : "xcode",
|
|
||||||
"version" : 1
|
|
||||||
}
|
|
||||||
}
|
|
Binary file not shown.
Before Width: | Height: | Size: 106 KiB |
Binary file not shown.
|
@ -8,8 +8,10 @@
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import FirebaseRemoteConfig
|
import FirebaseRemoteConfig
|
||||||
|
|
||||||
struct SplashView: View {
|
import AVKit
|
||||||
|
|
||||||
|
struct SplashView: View {
|
||||||
|
@State private var player: AVPlayer?
|
||||||
@State private var isShowForcedUpdatePopup = false
|
@State private var isShowForcedUpdatePopup = false
|
||||||
@State private var isShowUpdatePopup = false
|
@State private var isShowUpdatePopup = false
|
||||||
|
|
||||||
|
@ -17,19 +19,22 @@ struct SplashView: View {
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
ZStack(alignment: .top) {
|
ZStack(alignment: .top) {
|
||||||
Image("splash_bg")
|
VStack {
|
||||||
.resizable()
|
if let player = player {
|
||||||
.scaledToFill()
|
VideoPlayer(player: player)
|
||||||
.edgesIgnoringSafeArea(.all)
|
.ignoresSafeArea(.all)
|
||||||
|
.onAppear {
|
||||||
VStack(spacing: 0) {
|
player.play()
|
||||||
Image("splash_text")
|
}
|
||||||
.padding(.top, 130)
|
.onDisappear {
|
||||||
|
player.pause()
|
||||||
Spacer()
|
}
|
||||||
|
} else {
|
||||||
Image("splash_logo")
|
Color(hex: "#ecedf3")
|
||||||
.padding(.bottom, 50)
|
}
|
||||||
|
}
|
||||||
|
.onAppear {
|
||||||
|
loadVideo()
|
||||||
}
|
}
|
||||||
|
|
||||||
if isShowUpdatePopup {
|
if isShowUpdatePopup {
|
||||||
|
@ -59,9 +64,18 @@ struct SplashView: View {
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
.onAppear {
|
}
|
||||||
|
|
||||||
|
private func loadVideo() {
|
||||||
|
guard let url = Bundle.main.url(forResource: "video", withExtension: "mp4") else {
|
||||||
|
fetchLastestVersion()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
player = AVPlayer(url: url)
|
||||||
|
NotificationCenter.default
|
||||||
|
.addObserver(forName: .AVPlayerItemDidPlayToEndTime, object: player?.currentItem, queue: .main) { _ in
|
||||||
fetchLastestVersion()
|
fetchLastestVersion()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,8 +92,6 @@ struct SplashView: View {
|
||||||
checkAppVersion(latestVersion: remoteConfig["ios_latest_version"].stringValue)
|
checkAppVersion(latestVersion: remoteConfig["ios_latest_version"].stringValue)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + 2.5) {
|
|
||||||
withAnimation {
|
|
||||||
if AppState.shared.pushRoomId > 0 {
|
if AppState.shared.pushRoomId > 0 {
|
||||||
liveViewModel.enterLiveRoom(roomId: AppState.shared.pushRoomId)
|
liveViewModel.enterLiveRoom(roomId: AppState.shared.pushRoomId)
|
||||||
} else if AppState.shared.pushChannelId > 0 {
|
} else if AppState.shared.pushChannelId > 0 {
|
||||||
|
@ -92,8 +104,6 @@ struct SplashView: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private func checkAppVersion(latestVersion: String?) {
|
private func checkAppVersion(latestVersion: String?) {
|
||||||
let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String
|
let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String
|
||||||
|
@ -115,8 +125,6 @@ struct SplashView: View {
|
||||||
} else if latestMajor == major && latestMinor == minor && latestPatch > patch {
|
} else if latestMajor == major && latestMinor == minor && latestPatch > patch {
|
||||||
self.isShowUpdatePopup = true
|
self.isShowUpdatePopup = true
|
||||||
} else {
|
} else {
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
|
|
||||||
withAnimation {
|
|
||||||
if AppState.shared.pushRoomId > 0 {
|
if AppState.shared.pushRoomId > 0 {
|
||||||
liveViewModel.enterLiveRoom(roomId: AppState.shared.pushRoomId)
|
liveViewModel.enterLiveRoom(roomId: AppState.shared.pushRoomId)
|
||||||
} else if AppState.shared.pushChannelId > 0 {
|
} else if AppState.shared.pushChannelId > 0 {
|
||||||
|
@ -127,11 +135,7 @@ struct SplashView: View {
|
||||||
AppState.shared.setAppStep(step: .main)
|
AppState.shared.setAppStep(step: .main)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
|
|
||||||
withAnimation {
|
|
||||||
if AppState.shared.pushRoomId > 0 {
|
if AppState.shared.pushRoomId > 0 {
|
||||||
liveViewModel.enterLiveRoom(roomId: AppState.shared.pushRoomId)
|
liveViewModel.enterLiveRoom(roomId: AppState.shared.pushRoomId)
|
||||||
} else if AppState.shared.pushChannelId > 0 {
|
} else if AppState.shared.pushChannelId > 0 {
|
||||||
|
@ -144,8 +148,6 @@ struct SplashView: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct SplashView_Previews: PreviewProvider {
|
struct SplashView_Previews: PreviewProvider {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
|
|
Loading…
Reference in New Issue