Save last used account instead of having to set default

This commit is contained in:
Arkadiusz Fal
2021-10-19 23:27:04 +02:00
parent 00d706766c
commit 2d075e7b3a
23 changed files with 169 additions and 273 deletions

View File

@@ -85,15 +85,17 @@ struct ContentView: View {
SiestaLog.Category.enabled = .common
// TODO: Remove when piped supports videos information
if let account = instances.defaultAccount ??
accounts.all.first(where: { $0.instance.app == .invidious })
if let account = accounts.lastUsed ??
instances.lastUsed?.anonymousAccount ??
instances.all.first?.anonymousAccount
{
accounts.setAccount(account)
accounts.setCurrent(account)
}
if accounts.account.isNil {
if accounts.current.isNil {
navigation.presentingWelcomeScreen = true
}
player.accounts = accounts
playlists.accounts = accounts
search.accounts = accounts
@@ -101,7 +103,7 @@ struct ContentView: View {
}
func openWelcomeScreenIfAccountEmpty() {
guard accounts.isEmpty else {
guard Defaults[.instances].isEmpty else {
return
}