1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-13 05:40:32 +05:30

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 ?? "" self.sid = sid ?? ""
} }
var instance: Instance { var instance: Instance! {
Defaults[.instances].first { $0.id == instanceID }! Defaults[.instances].first { $0.id == instanceID }
} }
var anonymizedSID: String { var anonymizedSID: String {

View File

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

View File

@ -13,11 +13,14 @@ struct SettingsView: View {
@Environment(\.dismiss) private var dismiss @Environment(\.dismiss) private var dismiss
#endif #endif
@EnvironmentObject<AccountsModel> private var accounts
var body: some View { var body: some View {
#if os(macOS) #if os(macOS)
TabView { TabView {
Form { Form {
InstancesSettings() InstancesSettings()
.environmentObject(accounts)
} }
.tabItem { .tabItem {
Label("Instances", systemImage: "server.rack") Label("Instances", systemImage: "server.rack")
@ -63,6 +66,7 @@ struct SettingsView: View {
} }
#endif #endif
InstancesSettings() InstancesSettings()
.environmentObject(accounts)
BrowsingSettings() BrowsingSettings()
PlaybackSettings() PlaybackSettings()
ServicesSettings() ServicesSettings()

View File

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

View File

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