mirror of
https://github.com/yattee/yattee.git
synced 2025-11-22 06:31:26 +00:00
Fix tab selection timing to wait for account sign-in
Tab selection was being set immediately during app configuration, before the user account had completed sign-in. This caused tabs that require authentication (like Subscriptions and Playlists) to not be properly selected on startup since they weren't visible yet. Changes: - Add notification system for account configuration completion - Post notification after all account types finish configuration: * Accounts with existing tokens * Accounts requiring sign-in (after network request completes) * Anonymous/public accounts * Error cases (missing credentials, network failures) - Set up observer before account configuration to ensure notification is received - Set tab selection only when account is fully configured
This commit is contained in:
@@ -162,6 +162,23 @@ struct YatteeApp: App {
|
||||
|
||||
SDWebImageManager.defaultImageCache = PINCache(name: "stream.yattee.app")
|
||||
|
||||
NotificationCenter.default.addObserver(
|
||||
forName: .accountConfigurationComplete,
|
||||
object: nil,
|
||||
queue: .main
|
||||
) { _ in
|
||||
let startupSection = Defaults[.startupSection]
|
||||
var section: TabSelection? = startupSection.tabSelection
|
||||
|
||||
#if os(macOS)
|
||||
if section == .playlists {
|
||||
section = .search
|
||||
}
|
||||
#endif
|
||||
|
||||
NavigationModel.shared.tabSelection = section ?? .search
|
||||
}
|
||||
|
||||
if !Defaults[.lastAccountIsPublic] {
|
||||
AccountsModel.shared.configureAccount()
|
||||
}
|
||||
@@ -180,17 +197,6 @@ struct YatteeApp: App {
|
||||
}
|
||||
}
|
||||
|
||||
let startupSection = Defaults[.startupSection]
|
||||
var section: TabSelection? = startupSection.tabSelection
|
||||
|
||||
#if os(macOS)
|
||||
if section == .playlists {
|
||||
section = .search
|
||||
}
|
||||
#endif
|
||||
|
||||
NavigationModel.shared.tabSelection = section ?? .search
|
||||
|
||||
DispatchQueue.main.async {
|
||||
playlists.load()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user