iOS 14/macOS Big Sur Support

This commit is contained in:
Arkadiusz Fal
2021-11-28 15:37:55 +01:00
parent 696751e07c
commit 5ef89ac9f4
57 changed files with 1147 additions and 813 deletions

View File

@@ -10,11 +10,16 @@ struct SettingsView: View {
#endif
#if os(iOS)
@Environment(\.dismiss) private var dismiss
@Environment(\.presentationMode) private var presentationMode
#endif
@EnvironmentObject<AccountsModel> private var accounts
@State private var presentingInstanceForm = false
@State private var savedFormInstanceID: Instance.ID?
@Default(.instances) private var instances
var body: some View {
#if os(macOS)
TabView {
@@ -65,8 +70,14 @@ struct SettingsView: View {
}
}
#endif
InstancesSettings()
.environmentObject(accounts)
Section(header: Text("Instances")) {
ForEach(instances) { instance in
AccountsNavigationLink(instance: instance)
}
addInstanceButton
}
BrowsingSettings()
PlaybackSettings()
ServicesSettings()
@@ -76,7 +87,7 @@ struct SettingsView: View {
ToolbarItem(placement: .navigationBarTrailing) {
#if !os(tvOS)
Button("Done") {
dismiss()
presentationMode.wrappedValue.dismiss()
}
.keyboardShortcut(.cancelAction)
#endif
@@ -87,11 +98,20 @@ struct SettingsView: View {
.listStyle(.insetGrouped)
#endif
}
.sheet(isPresented: $presentingInstanceForm) {
InstanceForm(savedInstanceID: $savedFormInstanceID)
}
#if os(tvOS)
.background(.black)
.background(Color.black)
#endif
#endif
}
private var addInstanceButton: some View {
Button("Add Instance...") {
presentingInstanceForm = true
}
}
}
struct SettingsView_Previews: PreviewProvider {