getting states read
This commit is contained in:
@@ -13,6 +13,7 @@ struct InnerCircleView: View {
|
|||||||
@EnvironmentObject var authSessionStore: AuthSessionStore
|
@EnvironmentObject var authSessionStore: AuthSessionStore
|
||||||
@EnvironmentObject var navigationStack: NavigationStack
|
@EnvironmentObject var navigationStack: NavigationStack
|
||||||
|
|
||||||
|
|
||||||
@State var selectedFriendIndex: String? = nil
|
@State var selectedFriendIndex: String? = nil
|
||||||
|
|
||||||
let universalSize = UIScreen.main.bounds
|
let universalSize = UIScreen.main.bounds
|
||||||
|
|||||||
@@ -19,16 +19,31 @@ enum NavigationPages {
|
|||||||
struct RouterView: View {
|
struct RouterView: View {
|
||||||
@EnvironmentObject var authSessionStore: AuthSessionStore
|
@EnvironmentObject var authSessionStore: AuthSessionStore
|
||||||
@EnvironmentObject var navigationStack: NavigationStack
|
@EnvironmentObject var navigationStack: NavigationStack
|
||||||
|
@Environment(\.scenePhase) var scenePhase
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
switch self.authSessionStore.sessionState {
|
ZStack {
|
||||||
case SessionState.notCheckedYet:
|
switch self.authSessionStore.sessionState {
|
||||||
SplashView()
|
case SessionState.notCheckedYet:
|
||||||
case SessionState.isAuthenticated:
|
SplashView()
|
||||||
InnerCircleView()
|
case SessionState.isAuthenticated:
|
||||||
case SessionState.isLoggedOut:
|
InnerCircleView()
|
||||||
WelcomeView()
|
case SessionState.isLoggedOut:
|
||||||
|
WelcomeView()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
.onChange(of: scenePhase) { newPhase in
|
||||||
|
if newPhase == .inactive {
|
||||||
|
print("user is offline")
|
||||||
|
// set firestore user document isOnline to false
|
||||||
|
} else if newPhase == .active {
|
||||||
|
print("user is online again")
|
||||||
|
// set firestore user document isOnline to true
|
||||||
|
} else if newPhase == .background {
|
||||||
|
print("app is in backgroun")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user