스플래시 변경
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 FirebaseRemoteConfig
|
||||
|
||||
import AVKit
|
||||
|
||||
struct SplashView: View {
|
||||
|
||||
@State private var player: AVPlayer?
|
||||
@State private var isShowForcedUpdatePopup = false
|
||||
@State private var isShowUpdatePopup = false
|
||||
|
||||
|
@ -17,19 +19,22 @@ struct SplashView: View {
|
|||
|
||||
var body: some View {
|
||||
ZStack(alignment: .top) {
|
||||
Image("splash_bg")
|
||||
.resizable()
|
||||
.scaledToFill()
|
||||
.edgesIgnoringSafeArea(.all)
|
||||
|
||||
VStack(spacing: 0) {
|
||||
Image("splash_text")
|
||||
.padding(.top, 130)
|
||||
|
||||
Spacer()
|
||||
|
||||
Image("splash_logo")
|
||||
.padding(.bottom, 50)
|
||||
VStack {
|
||||
if let player = player {
|
||||
VideoPlayer(player: player)
|
||||
.ignoresSafeArea(.all)
|
||||
.onAppear {
|
||||
player.play()
|
||||
}
|
||||
.onDisappear {
|
||||
player.pause()
|
||||
}
|
||||
} else {
|
||||
Color(hex: "#ecedf3")
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
loadVideo()
|
||||
}
|
||||
|
||||
if isShowUpdatePopup {
|
||||
|
@ -59,11 +64,20 @@ 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()
|
||||
}
|
||||
}
|
||||
|
||||
private func fetchLastestVersion() {
|
||||
|
@ -78,18 +92,14 @@ struct SplashView: View {
|
|||
checkAppVersion(latestVersion: remoteConfig["ios_latest_version"].stringValue)
|
||||
}
|
||||
} else {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 2.5) {
|
||||
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)
|
||||
}
|
||||
}
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -115,33 +125,25 @@ struct SplashView: View {
|
|||
} else if latestMajor == major && latestMinor == minor && latestPatch > patch {
|
||||
self.isShowUpdatePopup = true
|
||||
} else {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
|
||||
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)
|
||||
}
|
||||
}
|
||||
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 {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
|
||||
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)
|
||||
}
|
||||
}
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue