diff --git a/Passepartout/Library/Sources/AppUIMain/Views/AppMenu/macOS/AppMenu.swift b/Passepartout/Library/Sources/AppUIMain/Views/AppMenu/macOS/AppMenu.swift index 935a5c47..89f3597d 100644 --- a/Passepartout/Library/Sources/AppUIMain/Views/AppMenu/macOS/AppMenu.swift +++ b/Passepartout/Library/Sources/AppUIMain/Views/AppMenu/macOS/AppMenu.swift @@ -32,6 +32,9 @@ import SwiftUI public struct AppMenu: View { + @AppStorage(AppPreference.keepsInMenu.key) + private var keepsInMenu = true + @ObservedObject private var profileManager: ProfileManager @@ -51,6 +54,7 @@ public struct AppMenu: View { Divider() showToggle loginToggle + keepToggle Divider() profilesList Divider() @@ -71,7 +75,11 @@ private extension AppMenu { } var loginToggle: some View { - Toggle(Strings.AppMenu.Items.launchOnLogin, isOn: $model.launchesOnLogin) + Toggle(Strings.Views.Settings.launchesOnLogin, isOn: $model.launchesOnLogin) + } + + var keepToggle: some View { + Toggle(Strings.Views.Settings.keepsInMenu, isOn: $keepsInMenu) } var profilesList: some View { diff --git a/Passepartout/Library/Sources/AppUIMain/Views/Settings/SettingsSectionGroup.swift b/Passepartout/Library/Sources/AppUIMain/Views/Settings/SettingsSectionGroup.swift index 3d4e54c3..0f4949f0 100644 --- a/Passepartout/Library/Sources/AppUIMain/Views/Settings/SettingsSectionGroup.swift +++ b/Passepartout/Library/Sources/AppUIMain/Views/Settings/SettingsSectionGroup.swift @@ -31,13 +31,16 @@ import SwiftUI struct SettingsSectionGroup: View { @AppStorage(AppPreference.keepsInMenu.key) - private var keepsInMenu = false + private var keepsInMenu = true @AppStorage(AppPreference.locksInBackground.key) private var locksInBackground = false let profileManager: ProfileManager + @StateObject + private var model = AppMenu.Model() + @State private var isConfirmingEraseiCloud = false @@ -49,6 +52,7 @@ struct SettingsSectionGroup: View { lockInBackgroundToggle #endif #if os(macOS) + launchesOnLoginToggle keepsInMenuToggle #endif eraseCloudKitButton @@ -56,6 +60,11 @@ struct SettingsSectionGroup: View { } private extension SettingsSectionGroup { + var launchesOnLoginToggle: some View { + Toggle(Strings.Views.Settings.launchesOnLogin, isOn: $model.launchesOnLogin) + .themeSectionWithSingleRow(footer: Strings.Views.Settings.LaunchesOnLogin.footer) + } + var keepsInMenuToggle: some View { Toggle(Strings.Views.Settings.keepsInMenu, isOn: $keepsInMenu) .themeSectionWithSingleRow(footer: Strings.Views.Settings.KeepsInMenu.footer) diff --git a/Passepartout/Library/Sources/UILibrary/L10n/SwiftGen+Strings.swift b/Passepartout/Library/Sources/UILibrary/L10n/SwiftGen+Strings.swift index 1abaf8da..70c7569a 100644 --- a/Passepartout/Library/Sources/UILibrary/L10n/SwiftGen+Strings.swift +++ b/Passepartout/Library/Sources/UILibrary/L10n/SwiftGen+Strings.swift @@ -32,8 +32,6 @@ public enum Strings { } public enum AppMenu { public enum Items { - /// Launch on Login - public static let launchOnLogin = Strings.tr("Localizable", "app_menu.items.launch_on_login", fallback: "Launch on Login") /// Quit %@ public static func quit(_ p1: Any) -> String { return Strings.tr("Localizable", "app_menu.items.quit", String(describing: p1), fallback: "Quit %@") @@ -772,6 +770,8 @@ public enum Strings { public static let eraseIcloud = Strings.tr("Localizable", "views.settings.erase_icloud", fallback: "Erase iCloud store") /// Keep in menu bar public static let keepsInMenu = Strings.tr("Localizable", "views.settings.keeps_in_menu", fallback: "Keep in menu bar") + /// Launch on login + public static let launchesOnLogin = Strings.tr("Localizable", "views.settings.launches_on_login", fallback: "Launch on login") /// Lock in background public static let locksInBackground = Strings.tr("Localizable", "views.settings.locks_in_background", fallback: "Lock in background") public enum EraseIcloud { @@ -782,6 +782,10 @@ public enum Strings { /// Enable this to keep the app in the menu bar after closing it. public static let footer = Strings.tr("Localizable", "views.settings.keeps_in_menu.footer", fallback: "Enable this to keep the app in the menu bar after closing it.") } + public enum LaunchesOnLogin { + /// Open the app in background after login. + public static let footer = Strings.tr("Localizable", "views.settings.launches_on_login.footer", fallback: "Open the app in background after login.") + } public enum LocksInBackground { /// Lock the app with FaceID when sent to the background. public static let footer = Strings.tr("Localizable", "views.settings.locks_in_background.footer", fallback: "Lock the app with FaceID when sent to the background.") diff --git a/Passepartout/Library/Sources/UILibrary/Resources/en.lproj/Localizable.strings b/Passepartout/Library/Sources/UILibrary/Resources/en.lproj/Localizable.strings index c7886393..c563ea69 100644 --- a/Passepartout/Library/Sources/UILibrary/Resources/en.lproj/Localizable.strings +++ b/Passepartout/Library/Sources/UILibrary/Resources/en.lproj/Localizable.strings @@ -129,6 +129,8 @@ "views.profile.rows.add_module" = "Add module"; "views.profile.module_list.section.footer" = "Drag modules to rearrange them, as their order determines priority."; +"views.settings.launches_on_login" = "Launch on login"; +"views.settings.launches_on_login.footer" = "Open the app in background after login."; "views.settings.keeps_in_menu" = "Keep in menu bar"; "views.settings.keeps_in_menu.footer" = "Enable this to keep the app in the menu bar after closing it."; "views.settings.locks_in_background" = "Lock in background"; @@ -238,7 +240,6 @@ // MARK: - App menu -"app_menu.items.launch_on_login" = "Launch on Login"; "app_menu.items.quit" = "Quit %@"; // MARK: - Theme