mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Prevent the system from automatically hiding the sidebar when backgrounding the app
This commit is contained in:
committed by
Stefan Ceriu
parent
db6aa06ec1
commit
da967e24be
@@ -329,6 +329,7 @@ private struct NavigationSplitCoordinatorView: View {
|
|||||||
@State private var columnVisibility = NavigationSplitViewVisibility.all
|
@State private var columnVisibility = NavigationSplitViewVisibility.all
|
||||||
|
|
||||||
@Environment(\.horizontalSizeClass) private var horizontalSizeClass
|
@Environment(\.horizontalSizeClass) private var horizontalSizeClass
|
||||||
|
@Environment(\.scenePhase) private var scenePhase
|
||||||
|
|
||||||
@Bindable var navigationSplitCoordinator: NavigationSplitCoordinator
|
@Bindable var navigationSplitCoordinator: NavigationSplitCoordinator
|
||||||
|
|
||||||
@@ -352,6 +353,12 @@ private struct NavigationSplitCoordinatorView: View {
|
|||||||
module.coordinator?.toPresentable()
|
module.coordinator?.toPresentable()
|
||||||
.id(module.id)
|
.id(module.id)
|
||||||
}
|
}
|
||||||
|
.onChange(of: columnVisibility) { oldValue, _ in
|
||||||
|
// Preserve the current column visibility when backgrounding the app
|
||||||
|
if scenePhase == .background {
|
||||||
|
columnVisibility = oldValue
|
||||||
|
}
|
||||||
|
}
|
||||||
.ignoresSafeArea() // Necessary when embedded in a TabView on iPadOS otherwise there's a gap at the top (as of 18.5).
|
.ignoresSafeArea() // Necessary when embedded in a TabView on iPadOS otherwise there's a gap at the top (as of 18.5).
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user