Skip to content

Commit

Permalink
Always display back button on catalyst
Browse files Browse the repository at this point in the history
On iOS, you can dismiss modals by dragging down on them, or by tapping
outside of the modal. The same affordances are not made on MacOS. This
means that, if you open the contact details view on catalyst at the
moment, it is impossible to close the view, since we have disabled
showing the back button in AddTopLevelNavigation when the size class is
regular (which is normally the case on MacOS).

Therefore, if the current target is mac catalyst, we should always
display back buttons on modals, so that users can dismiss them without
having to force close the app.

Thanks lissine for finding this, and suggesting how to fix it.

Co-authored-by: lissine <[email protected]>
  • Loading branch information
2 people authored and tmolitor-stud-tu committed Sep 1, 2024
1 parent eff3c7e commit 009becf
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Monal/Classes/SwiftuiHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,11 @@ struct AddTopLevelNavigation<Content: View>: View {
.navigationBarTitleDisplayMode(.automatic)
.navigationBarBackButtonHidden(true) // will not be shown because swiftui does not know we navigated here from UIKit
.toolbar {
#if targetEnvironment(macCatalyst)
let shouldDisplayBackButton = true
#else
let shouldDisplayBackButton = UIUserInterfaceSizeClass(rawValue: sizeClass.horizontal) == .compact
#endif
if shouldDisplayBackButton {
ToolbarItem(placement: .topBarLeading) {
Button(action : {
Expand Down

0 comments on commit 009becf

Please sign in to comment.