스플래시 페이지 추가
This commit is contained in:
58
SodaLive/Sources/App/AppState.swift
Normal file
58
SodaLive/Sources/App/AppState.swift
Normal 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
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user