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

@@ -21,7 +21,7 @@ struct SubscriptionsView: View {
.onAppear {
loadResources()
}
.onChange(of: accounts.account) { _ in
.onChange(of: accounts.current) { _ in
loadResources(force: true)
}
}

View File

@@ -39,6 +39,10 @@ struct VideoContextMenuView: View {
removeFromPlaylistButton(playlistID: id)
}
}
#if os(tvOS)
Button("Cancel", role: .cancel) {}
#endif
}
var playNowButton: some View {

View File

@@ -1,3 +1,4 @@
import Defaults
import SwiftUI
struct WelcomeScreen: View {
@@ -6,6 +7,8 @@ struct WelcomeScreen: View {
@EnvironmentObject<AccountsModel> private var accounts
@EnvironmentObject<NavigationModel> private var navigation
@Default(.accounts) private var allAccounts
var body: some View {
VStack {
Spacer()
@@ -14,7 +17,7 @@ struct WelcomeScreen: View {
.font(.largeTitle)
.padding(.bottom, 10)
if accounts.all.isEmpty {
if allAccounts.isEmpty {
Text("To start, configure your Instances in Settings")
.foregroundColor(.secondary)
} else {
@@ -28,12 +31,12 @@ struct WelcomeScreen: View {
} label: {
Text("Start")
}
.opacity(accounts.account.isNil ? 0 : 1)
.disabled(accounts.account.isNil)
.opacity(accounts.current.isNil ? 0 : 1)
.disabled(accounts.current.isNil)
#else
AccountsMenuView()
.onChange(of: accounts.account) { _ in
.onChange(of: accounts.current) { _ in
dismiss()
}
#if os(macOS)