This commit is contained in:
Thomas Ricouard 2023-12-06 18:56:19 +01:00
parent 3d2171d716
commit 4f9e23296f
2 changed files with 43 additions and 64 deletions

View file

@ -66,64 +66,51 @@ extension View {
func withSheetDestinations(sheetDestinations: Binding<SheetDestination?>) -> some View { func withSheetDestinations(sheetDestinations: Binding<SheetDestination?>) -> some View {
sheet(item: sheetDestinations) { destination in sheet(item: sheetDestinations) { destination in
Group {
switch destination { switch destination {
case let .replyToStatusEditor(status): case let .replyToStatusEditor(status):
StatusEditorView(mode: .replyTo(status: status)) StatusEditorView(mode: .replyTo(status: status))
.withEnvironments()
case let .newStatusEditor(visibility): case let .newStatusEditor(visibility):
StatusEditorView(mode: .new(visibility: visibility)) StatusEditorView(mode: .new(visibility: visibility))
.withEnvironments()
case let .editStatusEditor(status): case let .editStatusEditor(status):
StatusEditorView(mode: .edit(status: status)) StatusEditorView(mode: .edit(status: status))
.withEnvironments()
case let .quoteStatusEditor(status): case let .quoteStatusEditor(status):
StatusEditorView(mode: .quote(status: status)) StatusEditorView(mode: .quote(status: status))
.withEnvironments()
case let .mentionStatusEditor(account, visibility): case let .mentionStatusEditor(account, visibility):
StatusEditorView(mode: .mention(account: account, visibility: visibility)) StatusEditorView(mode: .mention(account: account, visibility: visibility))
.withEnvironments()
case .listCreate: case .listCreate:
ListCreateView() ListCreateView()
.withEnvironments()
case let .listEdit(list): case let .listEdit(list):
ListEditView(list: list) ListEditView(list: list)
.withEnvironments()
case let .listAddAccount(account): case let .listAddAccount(account):
ListAddAccountView(account: account) ListAddAccountView(account: account)
.withEnvironments()
case .addAccount: case .addAccount:
AddAccountView() AddAccountView()
.withEnvironments()
case .addRemoteLocalTimeline: case .addRemoteLocalTimeline:
AddRemoteTimelineView() AddRemoteTimelineView()
.withEnvironments()
case .addTagGroup: case .addTagGroup:
EditTagGroupView() EditTagGroupView()
.withEnvironments()
case let .statusEditHistory(status): case let .statusEditHistory(status):
StatusEditHistoryView(statusId: status) StatusEditHistoryView(statusId: status)
.withEnvironments()
case .settings: case .settings:
SettingsTabs(popToRootTab: .constant(.settings), isModal: true) SettingsTabs(popToRootTab: .constant(.settings), isModal: true)
.withEnvironments()
.preferredColorScheme(Theme.shared.selectedScheme == .dark ? .dark : .light) .preferredColorScheme(Theme.shared.selectedScheme == .dark ? .dark : .light)
case .accountPushNotficationsSettings: case .accountPushNotficationsSettings:
if let subscription = PushNotificationsService.shared.subscriptions.first(where: { $0.account.token == AppAccountsManager.shared.currentAccount.oauthToken }) { if let subscription = PushNotificationsService.shared.subscriptions.first(where: { $0.account.token == AppAccountsManager.shared.currentAccount.oauthToken }) {
PushNotificationsView(subscription: subscription) PushNotificationsView(subscription: subscription)
.withEnvironments()
} else { } else {
EmptyView() EmptyView()
} }
case let .report(status): case let .report(status):
ReportView(status: status) ReportView(status: status)
.withEnvironments()
case let .shareImage(image, status): case let .shareImage(image, status):
ActivityView(image: image, status: status) ActivityView(image: image, status: status)
case let .editTagGroup(tagGroup, onSaved): case let .editTagGroup(tagGroup, onSaved):
EditTagGroupView(tagGroup: tagGroup, onSaved: onSaved) EditTagGroupView(tagGroup: tagGroup, onSaved: onSaved)
.withEnvironments()
} }
} }
.withEnvironments()
}
} }
func withEnvironments() -> some View { func withEnvironments() -> some View {

View file

@ -88,14 +88,6 @@ public struct AppAccountsSelectorView: View {
} }
} }
private var accountBackgroundColor: Color {
if #available(iOS 16.4, *) {
Color.clear
} else {
theme.secondaryBackgroundColor
}
}
private var accountsView: some View { private var accountsView: some View {
NavigationStack { NavigationStack {
List { List {
@ -124,7 +116,7 @@ public struct AppAccountsSelectorView: View {
} }
.listStyle(.insetGrouped) .listStyle(.insetGrouped)
.scrollContentBackground(.hidden) .scrollContentBackground(.hidden)
.background(accountBackgroundColor) .background(.clear)
.navigationTitle("settings.section.accounts") .navigationTitle("settings.section.accounts")
.navigationBarTitleDisplayMode(.inline) .navigationBarTitleDisplayMode(.inline)
.toolbar { .toolbar {