스플래시 2024/09

This commit is contained in:
Yu Sung 2024-08-27 00:06:10 +09:00
parent 534a6e737e
commit f5445a3c48
8 changed files with 113 additions and 54 deletions

View File

@ -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

View 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
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View 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
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

View File

@ -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)
}
}
}
}
}