diff --git a/Model/Accounts/Account.swift b/Model/Accounts/Account.swift index 5bbf85c0..43f7d636 100644 --- a/Model/Accounts/Account.swift +++ b/Model/Accounts/Account.swift @@ -28,8 +28,8 @@ struct Account: Defaults.Serializable, Hashable, Identifiable { self.sid = sid ?? "" } - var instance: Instance { - Defaults[.instances].first { $0.id == instanceID }! + var instance: Instance! { + Defaults[.instances].first { $0.id == instanceID } } var anonymizedSID: String { diff --git a/Model/Accounts/AccountsModel.swift b/Model/Accounts/AccountsModel.swift index 71347829..31575b30 100644 --- a/Model/Accounts/AccountsModel.swift +++ b/Model/Accounts/AccountsModel.swift @@ -23,7 +23,7 @@ final class AccountsModel: ObservableObject { } var app: VideosApp { - current?.instance.app ?? .invidious + current?.instance?.app ?? .invidious } var api: VideosAPI { diff --git a/Shared/Settings/SettingsView.swift b/Shared/Settings/SettingsView.swift index 146d3f72..4091f1c4 100644 --- a/Shared/Settings/SettingsView.swift +++ b/Shared/Settings/SettingsView.swift @@ -13,11 +13,14 @@ struct SettingsView: View { @Environment(\.dismiss) private var dismiss #endif + @EnvironmentObject private var accounts + var body: some View { #if os(macOS) TabView { Form { InstancesSettings() + .environmentObject(accounts) } .tabItem { Label("Instances", systemImage: "server.rack") @@ -63,6 +66,7 @@ struct SettingsView: View { } #endif InstancesSettings() + .environmentObject(accounts) BrowsingSettings() PlaybackSettings() ServicesSettings() diff --git a/Shared/Videos/VerticalCells.swift b/Shared/Videos/VerticalCells.swift index 81dd15a8..08ff6fda 100644 --- a/Shared/Videos/VerticalCells.swift +++ b/Shared/Videos/VerticalCells.swift @@ -54,7 +54,6 @@ struct VerticalCells: View { #endif } - var scrollViewShowsIndicators: Bool { #if !os(tvOS) true diff --git a/Shared/YatteeApp.swift b/Shared/YatteeApp.swift index 493fc4e8..dfe0615f 100644 --- a/Shared/YatteeApp.swift +++ b/Shared/YatteeApp.swift @@ -26,6 +26,7 @@ struct YatteeApp: App { #if os(macOS) Settings { SettingsView() + .environmentObject(AccountsModel()) .environmentObject(InstancesModel()) } #endif