Fix settings close button

This commit is contained in:
Thomas Ricouard 2023-11-18 11:58:04 +01:00
parent c1c7c666cb
commit 1e35ffb82b
3 changed files with 5 additions and 3 deletions

View file

@ -101,7 +101,7 @@ extension View {
StatusEditHistoryView(statusId: status)
.withEnvironments()
case .settings:
SettingsTabs(popToRootTab: .constant(.settings))
SettingsTabs(popToRootTab: .constant(.settings), isModal: true)
.withEnvironments()
.preferredColorScheme(Theme.shared.selectedScheme == .dark ? .dark : .light)
case .accountPushNotficationsSettings:

View file

@ -29,6 +29,8 @@ struct SettingsTabs: View {
@State private var timelineCache = TimelineCache()
@Binding var popToRootTab: Tab
let isModal: Bool
@Query(sort: \LocalTimeline.creationDate, order: .reverse) var localTimelines: [LocalTimeline]
@Query(sort: \TagGroup.creationDate, order: .reverse) var tagGroups: [TagGroup]
@ -48,7 +50,7 @@ struct SettingsTabs: View {
.navigationBarTitleDisplayMode(.inline)
.toolbarBackground(theme.primaryBackgroundColor.opacity(0.50), for: .navigationBar)
.toolbar {
if UIDevice.current.userInterfaceIdiom == .phone {
if UIDevice.current.userInterfaceIdiom == .phone || isModal {
ToolbarItem {
Button {
dismiss()

View file

@ -47,7 +47,7 @@ enum Tab: Int, Identifiable, Hashable {
case .messages:
MessagesTab(popToRootTab: popToRootTab)
case .settings:
SettingsTabs(popToRootTab: popToRootTab)
SettingsTabs(popToRootTab: popToRootTab, isModal: false)
case .profile:
ProfileTab(popToRootTab: popToRootTab)
case .other: