diff --git a/SodaLive/Resources/Assets.xcassets/splash/splash_bg.imageset/Contents.json b/SodaLive/Resources/Assets.xcassets/splash/splash_bg.imageset/Contents.json new file mode 100644 index 0000000..42acdde --- /dev/null +++ b/SodaLive/Resources/Assets.xcassets/splash/splash_bg.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "splash_bg.jpg", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/SodaLive/Resources/Assets.xcassets/splash/splash_bg.imageset/splash_bg.jpg b/SodaLive/Resources/Assets.xcassets/splash/splash_bg.imageset/splash_bg.jpg new file mode 100644 index 0000000..8ad8359 Binary files /dev/null and b/SodaLive/Resources/Assets.xcassets/splash/splash_bg.imageset/splash_bg.jpg differ diff --git a/SodaLive/Resources/Assets.xcassets/splash/splash_text.imageset/Contents.json b/SodaLive/Resources/Assets.xcassets/splash/splash_text.imageset/Contents.json new file mode 100644 index 0000000..1214b3d --- /dev/null +++ b/SodaLive/Resources/Assets.xcassets/splash/splash_text.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "splash_text.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/SodaLive/Resources/Assets.xcassets/splash/splash_text.imageset/splash_text.png b/SodaLive/Resources/Assets.xcassets/splash/splash_text.imageset/splash_text.png new file mode 100644 index 0000000..ad50301 Binary files /dev/null and b/SodaLive/Resources/Assets.xcassets/splash/splash_text.imageset/splash_text.png differ diff --git a/SodaLive/Resources/Assets.xcassets/splash/splash_title.imageset/Contents.json b/SodaLive/Resources/Assets.xcassets/splash/splash_title.imageset/Contents.json new file mode 100644 index 0000000..99818bd --- /dev/null +++ b/SodaLive/Resources/Assets.xcassets/splash/splash_title.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "splash_title.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/SodaLive/Resources/Assets.xcassets/splash/splash_title.imageset/splash_title.png b/SodaLive/Resources/Assets.xcassets/splash/splash_title.imageset/splash_title.png new file mode 100644 index 0000000..2f86681 Binary files /dev/null and b/SodaLive/Resources/Assets.xcassets/splash/splash_title.imageset/splash_title.png differ diff --git a/SodaLive/Resources/video.mp4 b/SodaLive/Resources/video.mp4 deleted file mode 100644 index fbcf9d6..0000000 Binary files a/SodaLive/Resources/video.mp4 and /dev/null differ diff --git a/SodaLive/Sources/Splash/SplashView.swift b/SodaLive/Sources/Splash/SplashView.swift index 6fa6bbb..cb2e9f8 100644 --- a/SodaLive/Sources/Splash/SplashView.swift +++ b/SodaLive/Sources/Splash/SplashView.swift @@ -8,10 +8,7 @@ import SwiftUI import FirebaseRemoteConfig -import AVKit - struct SplashView: View { - @State private var player: AVPlayer? @State private var isShowForcedUpdatePopup = false @State private var isShowUpdatePopup = false @@ -19,22 +16,19 @@ struct SplashView: View { var body: some View { ZStack(alignment: .top) { - VStack { - if let player = player { - VideoPlayer(player: player) - .ignoresSafeArea(.all) - .onAppear { - player.play() - } - .onDisappear { - player.pause() - } - } else { - Color(hex: "#ecedf3") - } - } - .onAppear { - loadVideo() + Image("splash_bg") + .resizable() + .scaledToFill() + .edgesIgnoringSafeArea(.all) + + VStack(spacing: 0) { + Image("splash_title") + .padding(.top, 60) + + Spacer() + + Image("splash_text") + .padding(.bottom, 36) } if isShowUpdatePopup { @@ -65,19 +59,9 @@ struct SplashView: View { ) } } - } - - private func loadVideo() { - guard let url = Bundle.main.url(forResource: "video", withExtension: "mp4") else { + .onAppear { fetchLastestVersion() - return } - - player = AVPlayer(url: url) - NotificationCenter.default - .addObserver(forName: .AVPlayerItemDidPlayToEndTime, object: player?.currentItem, queue: .main) { _ in - fetchLastestVersion() - } } private func fetchLastestVersion() { @@ -92,14 +76,18 @@ struct SplashView: View { checkAppVersion(latestVersion: remoteConfig["ios_latest_version"].stringValue) } } else { - if AppState.shared.pushRoomId > 0 { - liveViewModel.enterLiveRoom(roomId: AppState.shared.pushRoomId) - } else if AppState.shared.pushChannelId > 0 { - AppState.shared.setAppStep(step: .creatorDetail(userId: AppState.shared.pushChannelId)) - } else if AppState.shared.pushAudioContentId > 0 { - AppState.shared.setAppStep(step: .contentDetail(contentId: AppState.shared.pushAudioContentId)) - } else { - AppState.shared.setAppStep(step: .main) + DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) { + withAnimation { + if AppState.shared.pushRoomId > 0 { + liveViewModel.enterLiveRoom(roomId: AppState.shared.pushRoomId) + } else if AppState.shared.pushChannelId > 0 { + AppState.shared.setAppStep(step: .creatorDetail(userId: AppState.shared.pushChannelId)) + } else if AppState.shared.pushAudioContentId > 0 { + AppState.shared.setAppStep(step: .contentDetail(contentId: AppState.shared.pushAudioContentId)) + } else { + AppState.shared.setAppStep(step: .main) + } + } } } } @@ -125,25 +113,33 @@ struct SplashView: View { } else if latestMajor == major && latestMinor == minor && latestPatch > patch { self.isShowUpdatePopup = true } else { - if AppState.shared.pushRoomId > 0 { - liveViewModel.enterLiveRoom(roomId: AppState.shared.pushRoomId) - } else if AppState.shared.pushChannelId > 0 { - AppState.shared.setAppStep(step: .creatorDetail(userId: AppState.shared.pushChannelId)) - } else if AppState.shared.pushAudioContentId > 0 { - AppState.shared.setAppStep(step: .contentDetail(contentId: AppState.shared.pushAudioContentId)) - } else { - AppState.shared.setAppStep(step: .main) + DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) { + withAnimation { + if AppState.shared.pushRoomId > 0 { + liveViewModel.enterLiveRoom(roomId: AppState.shared.pushRoomId) + } else if AppState.shared.pushChannelId > 0 { + AppState.shared.setAppStep(step: .creatorDetail(userId: AppState.shared.pushChannelId)) + } else if AppState.shared.pushAudioContentId > 0 { + AppState.shared.setAppStep(step: .contentDetail(contentId: AppState.shared.pushAudioContentId)) + } else { + AppState.shared.setAppStep(step: .main) + } + } } } } else { - if AppState.shared.pushRoomId > 0 { - liveViewModel.enterLiveRoom(roomId: AppState.shared.pushRoomId) - } else if AppState.shared.pushChannelId > 0 { - AppState.shared.setAppStep(step: .creatorDetail(userId: AppState.shared.pushChannelId)) - } else if AppState.shared.pushAudioContentId > 0 { - AppState.shared.setAppStep(step: .contentDetail(contentId: AppState.shared.pushAudioContentId)) - } else { - AppState.shared.setAppStep(step: .main) + DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) { + withAnimation { + if AppState.shared.pushRoomId > 0 { + liveViewModel.enterLiveRoom(roomId: AppState.shared.pushRoomId) + } else if AppState.shared.pushChannelId > 0 { + AppState.shared.setAppStep(step: .creatorDetail(userId: AppState.shared.pushChannelId)) + } else if AppState.shared.pushAudioContentId > 0 { + AppState.shared.setAppStep(step: .contentDetail(contentId: AppState.shared.pushAudioContentId)) + } else { + AppState.shared.setAppStep(step: .main) + } + } } } }