Skip to content

Commit

Permalink
feat(SwiftUI App Lifecycle): Prevent initial lock
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippeWeidmann committed Jul 4, 2023
1 parent b13fd88 commit 5ee2dfc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions Mail/Views/Settings/SettingsToggleCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ struct SettingsToggleCell: View {
@State private var toggleIsOn: Bool {
didSet {
UserDefaults.shared[keyPath: userDefaults] = toggleIsOn

// AppStorage updates the views only if directly called
if userDefaults == \.isAppLockEnabled {
AppStorage(UserDefaults.shared.key(.appLock)).wrappedValue = UserDefaults.shared.isAppLockEnabled
if UserDefaults.shared.isAppLockEnabled {
appLockHelper.setTime()
}
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion Mail/Views/SplitView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class SplitViewManager: ObservableObject {
@Published var showSearch = false
@Published var selectedFolder: Folder?
var splitViewController: UISplitViewController?

func adaptToProminentThreadView() {
splitViewController?.hide(.primary)
if splitViewController?.splitBehavior == .overlay {
Expand Down

0 comments on commit 5ee2dfc

Please sign in to comment.