Fix removing instance

This commit is contained in:
Arkadiusz Fal 2021-11-12 21:46:15 +01:00
parent c94687f54e
commit dd8d6b6c4a
5 changed files with 8 additions and 4 deletions

View File

@ -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 {

View File

@ -23,7 +23,7 @@ final class AccountsModel: ObservableObject {
}
var app: VideosApp {
current?.instance.app ?? .invidious
current?.instance?.app ?? .invidious
}
var api: VideosAPI {

View File

@ -13,11 +13,14 @@ struct SettingsView: View {
@Environment(\.dismiss) private var dismiss
#endif
@EnvironmentObject<AccountsModel> 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()

View File

@ -54,7 +54,6 @@ struct VerticalCells: View {
#endif
}
var scrollViewShowsIndicators: Bool {
#if !os(tvOS)
true

View File

@ -26,6 +26,7 @@ struct YatteeApp: App {
#if os(macOS)
Settings {
SettingsView()
.environmentObject(AccountsModel())
.environmentObject(InstancesModel())
}
#endif