스플래시 2024/09
This commit is contained in:
parent
534a6e737e
commit
f5445a3c48
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 1.3 MiB |
21
SodaLive/Resources/Assets.xcassets/splash/splash_text.imageset/Contents.json
vendored
Normal file
21
SodaLive/Resources/Assets.xcassets/splash/splash_text.imageset/Contents.json
vendored
Normal file
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
BIN
SodaLive/Resources/Assets.xcassets/splash/splash_text.imageset/splash_text.png
vendored
Normal file
BIN
SodaLive/Resources/Assets.xcassets/splash/splash_text.imageset/splash_text.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 21 KiB |
21
SodaLive/Resources/Assets.xcassets/splash/splash_title.imageset/Contents.json
vendored
Normal file
21
SodaLive/Resources/Assets.xcassets/splash/splash_title.imageset/Contents.json
vendored
Normal file
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
BIN
SodaLive/Resources/Assets.xcassets/splash/splash_title.imageset/splash_title.png
vendored
Normal file
BIN
SodaLive/Resources/Assets.xcassets/splash/splash_title.imageset/splash_title.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
Binary file not shown.
|
@ -8,10 +8,7 @@
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import FirebaseRemoteConfig
|
import FirebaseRemoteConfig
|
||||||
|
|
||||||
import AVKit
|
|
||||||
|
|
||||||
struct SplashView: View {
|
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
|
||||||
|
|
||||||
|
@ -19,22 +16,19 @@ struct SplashView: View {
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
ZStack(alignment: .top) {
|
ZStack(alignment: .top) {
|
||||||
VStack {
|
Image("splash_bg")
|
||||||
if let player = player {
|
.resizable()
|
||||||
VideoPlayer(player: player)
|
.scaledToFill()
|
||||||
.ignoresSafeArea(.all)
|
.edgesIgnoringSafeArea(.all)
|
||||||
.onAppear {
|
|
||||||
player.play()
|
VStack(spacing: 0) {
|
||||||
}
|
Image("splash_title")
|
||||||
.onDisappear {
|
.padding(.top, 60)
|
||||||
player.pause()
|
|
||||||
}
|
Spacer()
|
||||||
} else {
|
|
||||||
Color(hex: "#ecedf3")
|
Image("splash_text")
|
||||||
}
|
.padding(.bottom, 36)
|
||||||
}
|
|
||||||
.onAppear {
|
|
||||||
loadVideo()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if isShowUpdatePopup {
|
if isShowUpdatePopup {
|
||||||
|
@ -65,19 +59,9 @@ struct SplashView: View {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
.onAppear {
|
||||||
|
|
||||||
private func loadVideo() {
|
|
||||||
guard let url = Bundle.main.url(forResource: "video", withExtension: "mp4") else {
|
|
||||||
fetchLastestVersion()
|
fetchLastestVersion()
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
player = AVPlayer(url: url)
|
|
||||||
NotificationCenter.default
|
|
||||||
.addObserver(forName: .AVPlayerItemDidPlayToEndTime, object: player?.currentItem, queue: .main) { _ in
|
|
||||||
fetchLastestVersion()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private func fetchLastestVersion() {
|
private func fetchLastestVersion() {
|
||||||
|
@ -92,14 +76,18 @@ struct SplashView: View {
|
||||||
checkAppVersion(latestVersion: remoteConfig["ios_latest_version"].stringValue)
|
checkAppVersion(latestVersion: remoteConfig["ios_latest_version"].stringValue)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if AppState.shared.pushRoomId > 0 {
|
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
|
||||||
liveViewModel.enterLiveRoom(roomId: AppState.shared.pushRoomId)
|
withAnimation {
|
||||||
} else if AppState.shared.pushChannelId > 0 {
|
if AppState.shared.pushRoomId > 0 {
|
||||||
AppState.shared.setAppStep(step: .creatorDetail(userId: AppState.shared.pushChannelId))
|
liveViewModel.enterLiveRoom(roomId: AppState.shared.pushRoomId)
|
||||||
} else if AppState.shared.pushAudioContentId > 0 {
|
} else if AppState.shared.pushChannelId > 0 {
|
||||||
AppState.shared.setAppStep(step: .contentDetail(contentId: AppState.shared.pushAudioContentId))
|
AppState.shared.setAppStep(step: .creatorDetail(userId: AppState.shared.pushChannelId))
|
||||||
} else {
|
} else if AppState.shared.pushAudioContentId > 0 {
|
||||||
AppState.shared.setAppStep(step: .main)
|
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 {
|
} else if latestMajor == major && latestMinor == minor && latestPatch > patch {
|
||||||
self.isShowUpdatePopup = true
|
self.isShowUpdatePopup = true
|
||||||
} else {
|
} else {
|
||||||
if AppState.shared.pushRoomId > 0 {
|
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
|
||||||
liveViewModel.enterLiveRoom(roomId: AppState.shared.pushRoomId)
|
withAnimation {
|
||||||
} else if AppState.shared.pushChannelId > 0 {
|
if AppState.shared.pushRoomId > 0 {
|
||||||
AppState.shared.setAppStep(step: .creatorDetail(userId: AppState.shared.pushChannelId))
|
liveViewModel.enterLiveRoom(roomId: AppState.shared.pushRoomId)
|
||||||
} else if AppState.shared.pushAudioContentId > 0 {
|
} else if AppState.shared.pushChannelId > 0 {
|
||||||
AppState.shared.setAppStep(step: .contentDetail(contentId: AppState.shared.pushAudioContentId))
|
AppState.shared.setAppStep(step: .creatorDetail(userId: AppState.shared.pushChannelId))
|
||||||
} else {
|
} else if AppState.shared.pushAudioContentId > 0 {
|
||||||
AppState.shared.setAppStep(step: .main)
|
AppState.shared.setAppStep(step: .contentDetail(contentId: AppState.shared.pushAudioContentId))
|
||||||
|
} else {
|
||||||
|
AppState.shared.setAppStep(step: .main)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if AppState.shared.pushRoomId > 0 {
|
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
|
||||||
liveViewModel.enterLiveRoom(roomId: AppState.shared.pushRoomId)
|
withAnimation {
|
||||||
} else if AppState.shared.pushChannelId > 0 {
|
if AppState.shared.pushRoomId > 0 {
|
||||||
AppState.shared.setAppStep(step: .creatorDetail(userId: AppState.shared.pushChannelId))
|
liveViewModel.enterLiveRoom(roomId: AppState.shared.pushRoomId)
|
||||||
} else if AppState.shared.pushAudioContentId > 0 {
|
} else if AppState.shared.pushChannelId > 0 {
|
||||||
AppState.shared.setAppStep(step: .contentDetail(contentId: AppState.shared.pushAudioContentId))
|
AppState.shared.setAppStep(step: .creatorDetail(userId: AppState.shared.pushChannelId))
|
||||||
} else {
|
} else if AppState.shared.pushAudioContentId > 0 {
|
||||||
AppState.shared.setAppStep(step: .main)
|
AppState.shared.setAppStep(step: .contentDetail(contentId: AppState.shared.pushAudioContentId))
|
||||||
|
} else {
|
||||||
|
AppState.shared.setAppStep(step: .main)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue