parent
d85ffb4156
commit
e89eaeec09
|
@ -24,9 +24,6 @@ final class MainCoordinator: NavigationCoordinatable {
|
||||||
@Injected(\.logService)
|
@Injected(\.logService)
|
||||||
private var logger
|
private var logger
|
||||||
|
|
||||||
@Injected(\.currentUserSession)
|
|
||||||
private var userSession
|
|
||||||
|
|
||||||
var stack: Stinsen.NavigationStack<MainCoordinator>
|
var stack: Stinsen.NavigationStack<MainCoordinator>
|
||||||
|
|
||||||
@Root
|
@Root
|
||||||
|
@ -53,7 +50,7 @@ final class MainCoordinator: NavigationCoordinatable {
|
||||||
do {
|
do {
|
||||||
try await SwiftfinStore.setupDataStack()
|
try await SwiftfinStore.setupDataStack()
|
||||||
|
|
||||||
if userSession != nil, !Defaults[.signOutOnClose] {
|
if Container.shared.currentUserSession() != nil, !Defaults[.signOutOnClose] {
|
||||||
await MainActor.run {
|
await MainActor.run {
|
||||||
withAnimation(.linear(duration: 0.1)) {
|
withAnimation(.linear(duration: 0.1)) {
|
||||||
let _ = root(\.serverCheck)
|
let _ = root(\.serverCheck)
|
||||||
|
@ -121,7 +118,7 @@ final class MainCoordinator: NavigationCoordinatable {
|
||||||
@objc
|
@objc
|
||||||
func didChangeCurrentServerURL(_ notification: Notification) {
|
func didChangeCurrentServerURL(_ notification: Notification) {
|
||||||
|
|
||||||
guard userSession != nil else { return }
|
guard Container.shared.currentUserSession() != nil else { return }
|
||||||
|
|
||||||
Container.shared.currentUserSession.reset()
|
Container.shared.currentUserSession.reset()
|
||||||
Notifications[.didSignIn].post()
|
Notifications[.didSignIn].post()
|
||||||
|
|
|
@ -66,7 +66,7 @@ struct SwiftfinApp: App {
|
||||||
// Swiftfin
|
// Swiftfin
|
||||||
|
|
||||||
// don't keep last user id
|
// don't keep last user id
|
||||||
if Defaults[.signOutOnClose] || Container.shared.currentUserSession() == nil {
|
if Defaults[.signOutOnClose] {
|
||||||
Defaults[.lastSignedInUserID] = nil
|
Defaults[.lastSignedInUserID] = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue