스플래시 페이지 추가

This commit is contained in:
Yu Sung
2023-08-09 16:52:36 +09:00
parent 058c907609
commit 84d3dd61ca
27 changed files with 932 additions and 6 deletions

View File

@@ -0,0 +1,58 @@
//
// AppState.swift
// SodaLive
//
// Created by klaus on 2023/08/09.
//
import Foundation
class AppState: ObservableObject {
static let shared = AppState()
private var appStepBackStack = [AppStep]()
@Published private(set) var appStep: AppStep = .splash
@Published var isShowPlayer = false {
didSet {
if isShowPlayer {
}
}
}
@Published var isShowNotificationSettingsDialog = false
@Published var pushRoomId = 0
@Published var pushChannelId = 0
@Published var pushAudioContentId = 0
@Published var roomId = 0 {
didSet {
if roomId <= 0 {
isShowPlayer = false
}
}
}
func setAppStep(step: AppStep) {
switch step {
case .splash, .main:
appStepBackStack.removeAll()
default:
appStepBackStack.append(appStep)
}
DispatchQueue.main.async {
self.appStep = step
}
}
func back() {
if let step = appStepBackStack.popLast() {
self.appStep = step
} else {
self.appStep = .main
}
}
}