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,63 +66,50 @@ 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
switch destination { Group {
case let .replyToStatusEditor(status): switch destination {
StatusEditorView(mode: .replyTo(status: status)) case let .replyToStatusEditor(status):
.withEnvironments() StatusEditorView(mode: .replyTo(status: status))
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)) case let .quoteStatusEditor(status):
.withEnvironments() StatusEditorView(mode: .quote(status: status))
case let .quoteStatusEditor(status): case let .mentionStatusEditor(account, visibility):
StatusEditorView(mode: .quote(status: status)) StatusEditorView(mode: .mention(account: account, visibility: visibility))
.withEnvironments() case .listCreate:
case let .mentionStatusEditor(account, visibility): ListCreateView()
StatusEditorView(mode: .mention(account: account, visibility: visibility)) case let .listEdit(list):
.withEnvironments() ListEditView(list: list)
case .listCreate: case let .listAddAccount(account):
ListCreateView() ListAddAccountView(account: account)
.withEnvironments() case .addAccount:
case let .listEdit(list): AddAccountView()
ListEditView(list: list) case .addRemoteLocalTimeline:
.withEnvironments() AddRemoteTimelineView()
case let .listAddAccount(account): case .addTagGroup:
ListAddAccountView(account: account) EditTagGroupView()
.withEnvironments() case let .statusEditHistory(status):
case .addAccount: StatusEditHistoryView(statusId: status)
AddAccountView() case .settings:
.withEnvironments() SettingsTabs(popToRootTab: .constant(.settings), isModal: true)
case .addRemoteLocalTimeline: .preferredColorScheme(Theme.shared.selectedScheme == .dark ? .dark : .light)
AddRemoteTimelineView() case .accountPushNotficationsSettings:
.withEnvironments() if let subscription = PushNotificationsService.shared.subscriptions.first(where: { $0.account.token == AppAccountsManager.shared.currentAccount.oauthToken }) {
case .addTagGroup: PushNotificationsView(subscription: subscription)
EditTagGroupView() } else {
.withEnvironments() EmptyView()
case let .statusEditHistory(status): }
StatusEditHistoryView(statusId: status) case let .report(status):
.withEnvironments() ReportView(status: status)
case .settings: case let .shareImage(image, status):
SettingsTabs(popToRootTab: .constant(.settings), isModal: true) ActivityView(image: image, status: status)
.withEnvironments() case let .editTagGroup(tagGroup, onSaved):
.preferredColorScheme(Theme.shared.selectedScheme == .dark ? .dark : .light) EditTagGroupView(tagGroup: tagGroup, onSaved: onSaved)
case .accountPushNotficationsSettings:
if let subscription = PushNotificationsService.shared.subscriptions.first(where: { $0.account.token == AppAccountsManager.shared.currentAccount.oauthToken }) {
PushNotificationsView(subscription: subscription)
.withEnvironments()
} else {
EmptyView()
} }
case let .report(status):
ReportView(status: status)
.withEnvironments()
case let .shareImage(image, status):
ActivityView(image: image, status: status)
case let .editTagGroup(tagGroup, onSaved):
EditTagGroupView(tagGroup: tagGroup, onSaved: onSaved)
.withEnvironments()
} }
.withEnvironments()
} }
} }

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 {