diff --git a/Morphic/Morphic/About Box/AboutBoxWindowController.swift b/Morphic/Morphic/About Box/AboutBoxWindowController.swift index 46d7cbc9..4b8a2a51 100644 --- a/Morphic/Morphic/About Box/AboutBoxWindowController.swift +++ b/Morphic/Morphic/About Box/AboutBoxWindowController.swift @@ -29,7 +29,9 @@ class AboutBoxWindowController: NSWindowController, NSWindowDelegate { @IBOutlet weak var versionTextField: NSTextField! @IBOutlet weak var buildTextField: NSTextField! - + + @IBOutlet weak var copyrightTextField: NSTextField! + override var windowNibName: NSNib.Name? { return NSNib.Name("AboutBoxWindowController") } @@ -59,16 +61,18 @@ class AboutBoxWindowController: NSWindowController, NSWindowDelegate { // populate the version and build # in our labels if let shortVersionAsString = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String { - versionTextField.stringValue = "version " + shortVersionAsString + self.versionTextField.stringValue = "version " + shortVersionAsString } else { - versionTextField.stringValue = "[version is unknown]" + self.versionTextField.stringValue = "[version is unknown]" } // if let buildAsString = Bundle.main.infoDictionary?["CFBundleVersion" as String] { - buildTextField.stringValue = "(build \(buildAsString))" + self.buildTextField.stringValue = "(build \(buildAsString))" } else { - buildTextField.stringValue = "[build version is unknown]" + self.buildTextField.stringValue = "[build version is unknown]" } + + self.copyrightTextField.stringValue = "Copyright (c) 2020-2024 Raising the Floor - US Inc." } func centerOnScreen() { diff --git a/Morphic/Morphic/About Box/Base.lproj/AboutBoxWindowController.xib b/Morphic/Morphic/About Box/Base.lproj/AboutBoxWindowController.xib index 37079067..70b83745 100644 --- a/Morphic/Morphic/About Box/Base.lproj/AboutBoxWindowController.xib +++ b/Morphic/Morphic/About Box/Base.lproj/AboutBoxWindowController.xib @@ -1,14 +1,15 @@ - + - + + @@ -18,63 +19,73 @@ - + - + - - + + - - + + - - + + - - - + + + + + + + + + + + - + - - + + - - + + + + diff --git a/Morphic/Morphic/AppDelegate.swift b/Morphic/Morphic/AppDelegate.swift index 52698562..9754e7e3 100644 --- a/Morphic/Morphic/AppDelegate.swift +++ b/Morphic/Morphic/AppDelegate.swift @@ -43,9 +43,12 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate, NSMenuDele @IBOutlet weak var showMorphicBarMenuItem: NSMenuItem? @IBOutlet weak var hideMorphicBarMenuItem: NSMenuItem? @IBOutlet weak var copySettingsBetweenComputersMenuItem: NSMenuItem! + @IBOutlet weak var saveCurrentSettingsMenuItem: NSMenuItem! + @IBOutlet weak var howToCopySettingsMenuItem: NSMenuItem! @IBOutlet weak var loginMenuItem: NSMenuItem! @IBOutlet weak var logoutMenuItem: NSMenuItem? @IBOutlet weak var selectMorphicBarMenuItem: NSMenuItem! + @IBOutlet weak var customizeMorphicBarMenuItem: NSMenuItem! @IBOutlet weak var automaticallyStartMorphicAtLoginMenuItem: NSMenuItem! @IBOutlet weak var showMorphicBarAtStartMenuItem: NSMenuItem! @@ -96,18 +99,33 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate, NSMenuDele let commonConfiguration = self.getCommonConfiguration() ConfigurableFeatures.shared.morphicBarVisibilityAfterLogin = commonConfiguration.morphicBarVisibilityAfterLogin ConfigurableFeatures.shared.morphicBarExtraItems = commonConfiguration.extraMorphicBarItems + // +// ConfigurableFeatures.shared.atOnDemandIsEnbled = commonConfiguration.atOnDemandIsEnabled // NOTE: Windows-exclusive feature in current release +// ConfigurableFeatures.shared.atUseCounterIsEnabled = commonConfiguration.atUseCounterIsEnabled // NOTE: Windows-exclusive feature in current release ConfigurableFeatures.shared.autorunConfig = commonConfiguration.autorunConfig ConfigurableFeatures.shared.checkForUpdatesIsEnabled = commonConfiguration.checkForUpdatesIsEnabled +// ConfigurableFeatures.shared.cloudSettingsTransferIsEnabled = commonConfiguration.cloudSettingsTransferIsEnabled // NOTE: currently specified in Session instead of ConfigurableFeatures + ConfigurableFeatures.shared.customMorphicBarsIsEnabled = commonConfiguration.customMorphicBarsIsEnabled ConfigurableFeatures.shared.resetSettingsIsEnabled = commonConfiguration.resetSettingsIsEnabled + ConfigurableFeatures.shared.signInIsEnabled = commonConfiguration.signInIsEnabled + // ConfigurableFeatures.shared.telemetryIsEnabled = telemetryIsEnabled Session.shared.isCaptureAndApplyEnabled = commonConfiguration.cloudSettingsTransferIsEnabled Session.shared.isServerPreferencesSyncEnabled = true ConfigurableFeatures.shared.telemetrySiteId = commonConfiguration.telemetrySiteId + // + // public var hideMorphicAfterLoginUntil: Date? = nil // NOTE: Windows-exclusive feature in current release if ConfigurableFeatures.shared.telemetryIsEnabled == true { self.configureTelemetry() } + // NOTE: if ConfigurableFeatures.shared.signInIsEnabled is false, then cascade this 'false' setting to force-disable related login-related features + if ConfigurableFeatures.shared.signInIsEnabled == false { + Session.shared.isCaptureAndApplyEnabled = false + ConfigurableFeatures.shared.customMorphicBarsIsEnabled = false + } + #if DEBUG // do not run the auto-updater checks in debug mode #else @@ -133,13 +151,29 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate, NSMenuDele self.resetSettings() } - self.copySettingsBetweenComputersMenuItem?.isHidden = (Session.shared.isCaptureAndApplyEnabled == false) + let hideCopySettingsMenuItems = (Session.shared.isCaptureAndApplyEnabled == false) + self.copySettingsBetweenComputersMenuItem?.isHidden = hideCopySettingsMenuItems + self.saveCurrentSettingsMenuItem?.isHidden = hideCopySettingsMenuItems + self.howToCopySettingsMenuItem?.isHidden = hideCopySettingsMenuItems - self.loginMenuItem?.isHidden = (Session.shared.user != nil) - self.logoutMenuItem?.isHidden = (Session.shared.user == nil) + if ConfigurableFeatures.shared.signInIsEnabled == true { + // if ConfigurableFeatures.shared.signInIsEnabled is true, then show the appropriate login/logout menu item (and hide the opposite menu item) + self.loginMenuItem?.isHidden = (Session.shared.user != nil) + self.logoutMenuItem?.isHidden = (Session.shared.user == nil) + } else { + // if ConfigurableFeatures.shared.signInIsEnabled is false, then hide the settings which allow the user to sign in + self.loginMenuItem?.isHidden = true + self.logoutMenuItem?.isHidden = true + } self.mainMenu?.delegate = self + // show/hide our 'switch MorphicBar' and 'customize MorphicBar' menu items depending on whether or not custom MorphicBars are enabled + let hideCustomMorphicBarMenuItems = !ConfigurableFeatures.shared.customMorphicBarsIsEnabled + self.selectMorphicBarMenuItem.isHidden = hideCustomMorphicBarMenuItems + self.customizeMorphicBarMenuItem.isHidden = hideCustomMorphicBarMenuItems + + // update our list of custom MorphicBars self.updateSelectMorphicBarMenuItem() @@ -677,10 +711,10 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate, NSMenuDele guard let session = notification.object as? Session else { return } - self.loginMenuItem?.isHidden = (session.user != nil) - self.logoutMenuItem?.isHidden = (session.user == nil) + self.loginMenuItem?.isHidden = (session.user != nil || ConfigurableFeatures.shared.signInIsEnabled == false) + self.logoutMenuItem?.isHidden = (session.user == nil || ConfigurableFeatures.shared.signInIsEnabled == false) - if session.user != nil { + if session.user != nil && ConfigurableFeatures.shared.customMorphicBarsIsEnabled == true { // reload the custom bar reloadCustomMorphicBars() { success, error in @@ -746,10 +780,14 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate, NSMenuDele public let scope: String? } // +// internal let atOnDemand: EnabledFeature? // NOTE: Windows-exclusive feature in current release +// internal let atUseCounter: EnabledFeature? // NOTE: Windows-exclusive feature in current release internal let autorunAfterLogin: EnabledFeature? internal let checkForUpdates: EnabledFeature? internal let cloudSettingsTransfer: EnabledFeature? + internal let customMorphicBars: EnabledFeature? internal let resetSettings: EnabledFeature? + internal let signIn: EnabledFeature? } internal struct MorphicBarConfigSection: Decodable { @@ -775,38 +813,50 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate, NSMenuDele let disableTelemetryFileExists = FileManager.default.fileExists(atPath: disableTelemetryFilePath) return disableTelemetryFileExists } - + struct CommonConfigurationContents { - public var autorunConfig: ConfigurableFeatures.AutorunConfigOption? = nil + public var autorunConfig: ConfigurableFeatures.AutorunConfigOption? // - public var checkForUpdatesIsEnabled: Bool = false - public var cloudSettingsTransferIsEnabled: Bool = false - public var resetSettingsIsEnabled: Bool = false +// public var atOnDemandIsEnabled: Bool // NOTE: Windows-exclusive feature in current release +// public var atUseCounterIsEnabled: Bool // NOTE: Windows-exclusive feature in current release + public var checkForUpdatesIsEnabled: Bool + public var cloudSettingsTransferIsEnabled: Bool + public var customMorphicBarsIsEnabled: Bool + public var resetSettingsIsEnabled: Bool + public var signInIsEnabled: Bool // - public var morphicBarVisibilityAfterLogin: ConfigurableFeatures.MorphicBarVisibilityAfterLoginOption? = nil - public var extraMorphicBarItems: [MorphicBarExtraItem] = [] + public var morphicBarVisibilityAfterLogin: ConfigurableFeatures.MorphicBarVisibilityAfterLoginOption? + public var extraMorphicBarItems: [MorphicBarExtraItem] // - public var telemetrySiteId: String? = nil + public var telemetrySiteId: String? } func getCommonConfiguration() -> CommonConfigurationContents { // set up default configuration - var result = CommonConfigurationContents() - // - // autorun - result.autorunConfig = nil - // - // check for updates - result.checkForUpdatesIsEnabled = true - // - // copy settings to/from cloud - result.cloudSettingsTransferIsEnabled = true - // - // reset settings (to standard) - result.resetSettingsIsEnabled = false - // - // morphic bar (visibility and extra items) - result.morphicBarVisibilityAfterLogin = nil - result.extraMorphicBarItems = [] + var result = CommonConfigurationContents( + // autorun + autorunConfig: nil, + // + // AT on Demand +// atOnDemandIsEnabled = true, // NOTE: Windows-exclusive feature in current release + // AT Use counter +// atUseCounterIsEnabled = false, // NOTE: Windows-exclusive feature in current release + // check for updates + checkForUpdatesIsEnabled: true, + // copy settings to/from cloud + cloudSettingsTransferIsEnabled: true, + // enable use of custom MorphicBars (from cloud) + customMorphicBarsIsEnabled: true, + // reset settings (to standard) + resetSettingsIsEnabled: false, + // enable sign-in to Morphic services (settings transfer, custom MorphicBars, etc.) + signInIsEnabled: true, + // + // morphic bar (visibility and extra items) + morphicBarVisibilityAfterLogin: nil, + extraMorphicBarItems: [], + // + telemetrySiteId: nil + ) guard let applicationSupportPath = NSSearchPathForDirectoriesInDomains(.applicationSupportDirectory, .localDomainMask, true).first else { os_log(.error, log: logger, "Could not locate system application support directory") @@ -881,10 +931,20 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate, NSMenuDele result.cloudSettingsTransferIsEnabled = configFileCloudSettingsTransferIsEnabled } + // capture the custom MorphicBars "is enabled" setting + if let configFileCustomMorphicBarsIsEnabled = decodedConfigFile.features?.customMorphicBars?.enabled { + result.customMorphicBarsIsEnabled = configFileCustomMorphicBarsIsEnabled + } + // capture the reset settings (to standard) "is enabled" setting if let configFileResetSettingsIsEnabled = decodedConfigFile.features?.resetSettings?.enabled { result.resetSettingsIsEnabled = configFileResetSettingsIsEnabled } + + // cature the sign-in enable/disable setting + if let configFileSignInIsEnabled = decodedConfigFile.features?.signIn?.enabled { + result.signInIsEnabled = configFileSignInIsEnabled + } // capture the desired after-login (autorun) visibility of the MorphicBar switch decodedConfigFile.morphicBar?.visibilityAfterLogin @@ -1224,8 +1284,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate, NSMenuDele } func updateSelectMorphicBarMenuItem() { - self.selectMorphicBarMenuItem.isHidden = false - // TODO: we should determine if the user has a subscription; if so we should display the "Edit my MorphicBars..." item in the menu as well // remove all the menu items before the 'Basic MorphicBar' menu item @@ -1421,8 +1479,13 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate, NSMenuDele self.updateSelectMorphicBarMenuItem() } - self.loginMenuItem?.isHidden = false - self.logoutMenuItem?.isHidden = true + if ConfigurableFeatures.shared.signInIsEnabled == true { + self.loginMenuItem?.isHidden = false + self.logoutMenuItem?.isHidden = true + } else { + self.loginMenuItem?.isHidden = true + self.logoutMenuItem?.isHidden = true + } } } diff --git a/Morphic/Morphic/Base.lproj/Main.xib b/Morphic/Morphic/Base.lproj/Main.xib index 7528e7ba..f82590b8 100644 --- a/Morphic/Morphic/Base.lproj/Main.xib +++ b/Morphic/Morphic/Base.lproj/Main.xib @@ -1,8 +1,8 @@ - + - + @@ -10,11 +10,14 @@ + + + diff --git a/Morphic/Morphic/ConfigurableFeatures.swift b/Morphic/Morphic/ConfigurableFeatures.swift index 14d3b1b6..16985e16 100644 --- a/Morphic/Morphic/ConfigurableFeatures.swift +++ b/Morphic/Morphic/ConfigurableFeatures.swift @@ -36,14 +36,21 @@ internal class ConfigurableFeatures case restore } +// public var atOnDemandIsEnbled: Bool = true // NOTE: Windows-exclusive feature in current release +// public var atUseCounterIsEnabled: Bool = false // NOTE: Windows-exclusive feature in current release public var autorunConfig: AutorunConfigOption? = nil - public var checkForUpdatesIsEnabled: Bool = false + public var checkForUpdatesIsEnabled: Bool = true +// public var cloudSettingsTransferIsEnabled: Bool = true // NOTE: currently specified in Session instead of ConfigurableFeatures + public var customMorphicBarsIsEnabled: Bool = true public var resetSettingsIsEnabled: Bool = false - public var telemetryIsEnabled: Bool = true + public var signInIsEnabled: Bool = true public var morphicBarVisibilityAfterLogin: MorphicBarVisibilityAfterLoginOption? = nil public var morphicBarExtraItems: [AppDelegate.MorphicBarExtraItem] = [] + // public var hideMorphicAfterLoginUntil: Date? = nil // NOTE: Windows-exclusive feature in current release + + public var telemetryIsEnabled: Bool = true public var telemetrySiteId: String? static var shared: ConfigurableFeatures = {