From fdb07fa32d9a971c1384bdc7d86e1d1d8434dad0 Mon Sep 17 00:00:00 2001 From: Kai Azim Date: Thu, 4 Jul 2024 13:35:53 -0600 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9C=A8=20iCloud=20sync?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Loop.xcodeproj/project.pbxproj | 15 +-- Loop/AppDelegate.swift | 4 + Loop/Extensions/Defaults+Extensions.swift | 140 +++++++++++----------- Loop/Info.plist | 5 + Loop/Loop.entitlements | 7 +- 5 files changed, 91 insertions(+), 80 deletions(-) create mode 100644 Loop/Info.plist diff --git a/Loop.xcodeproj/project.pbxproj b/Loop.xcodeproj/project.pbxproj index 42c9e9a1..553fcecf 100644 --- a/Loop.xcodeproj/project.pbxproj +++ b/Loop.xcodeproj/project.pbxproj @@ -19,7 +19,6 @@ A81D8D0A2C068B8700188E12 /* LuminarePreviewView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A81D8D092C068B8700188E12 /* LuminarePreviewView.swift */; }; A81D8D0C2C06950000188E12 /* LuminareManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A81D8D0B2C06950000188E12 /* LuminareManager.swift */; }; A82521EE29E235AC00139654 /* PermissionsManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A82521ED29E235AC00139654 /* PermissionsManager.swift */; }; - A826BE592C322BD600B4C10D /* Luminare in Frameworks */ = {isa = PBXBuildFile; productRef = A826BE582C322BD600B4C10D /* Luminare */; }; A82740982AB00FCE00B9BDC5 /* Color+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = A82740972AB00FCE00B9BDC5 /* Color+Extensions.swift */; }; A827409A2AB0208500B9BDC5 /* TriggerKeycorder.swift in Sources */ = {isa = PBXBuildFile; fileRef = A82740992AB0208500B9BDC5 /* TriggerKeycorder.swift */; }; A82B1AEE2BD352A100E2F3F9 /* AccentColorConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = A82B1AED2BD352A100E2F3F9 /* AccentColorConfiguration.swift */; }; @@ -147,6 +146,7 @@ A88E83C42B37B354009D332F /* CGEvent+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CGEvent+Extensions.swift"; sourceTree = ""; }; A89307302BAE6D0100566AEE /* CustomWindowActionUnit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomWindowActionUnit.swift; sourceTree = ""; }; A893D3632BD3299000063510 /* IconConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IconConfiguration.swift; sourceTree = ""; }; + A89E84592C3713B50039D220 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; A8A1C51D2BD3705A00515A14 /* PaddingConfigurationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PaddingConfigurationView.swift; sourceTree = ""; }; A8A1C5202BD4863B00515A14 /* KeybindingsConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeybindingsConfiguration.swift; sourceTree = ""; }; A8A2ABE62A3FB0370067B5A9 /* KeybindMonitor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeybindMonitor.swift; sourceTree = ""; }; @@ -413,6 +413,7 @@ A8E59C37297F5E9A0064D4BA /* Loop */ = { isa = PBXGroup; children = ( + A89E84592C3713B50039D220 /* Info.plist */, A80521312A84878200BF7E22 /* Config.xcconfig */, A8E59C38297F5E9A0064D4BA /* LoopApp.swift */, A85CB5842ACFA5F700BF63E6 /* AppDelegate.swift */, @@ -782,7 +783,7 @@ ENABLE_HARDENED_RUNTIME = YES; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_FILE = ""; + INFOPLIST_FILE = Loop/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = Loop; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities"; INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2024 Loop"; @@ -817,7 +818,7 @@ ENABLE_HARDENED_RUNTIME = YES; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_FILE = ""; + INFOPLIST_FILE = Loop/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = Loop; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities"; INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2024 Loop"; @@ -868,14 +869,6 @@ kind = branch; }; }; - A826BE572C322BD600B4C10D /* XCRemoteSwiftPackageReference "Luminare" */ = { - isa = XCRemoteSwiftPackageReference; - repositoryURL = "https://github.com/MrKai77/Luminare"; - requirement = { - branch = main; - kind = branch; - }; - }; A8DCC9792980D5F500D41065 /* XCRemoteSwiftPackageReference "Defaults" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/sindresorhus/Defaults"; diff --git a/Loop/AppDelegate.swift b/Loop/AppDelegate.swift index 31a3da87..78ed0204 100644 --- a/Loop/AppDelegate.swift +++ b/Loop/AppDelegate.swift @@ -23,6 +23,10 @@ class AppDelegate: NSObject, NSApplicationDelegate { } func applicationDidFinishLaunching(_: Notification) { + Task { + await Defaults.iCloud.waitForSyncCompletion() + } + // Check & ask for accessibility access AccessibilityManager.requestAccess() UNUserNotificationCenter.current().delegate = self diff --git a/Loop/Extensions/Defaults+Extensions.swift b/Loop/Extensions/Defaults+Extensions.swift index e2999d91..a50e6a01 100644 --- a/Loop/Extensions/Defaults+Extensions.swift +++ b/Loop/Extensions/Defaults+Extensions.swift @@ -11,87 +11,91 @@ import SwiftUI // Add variables for default values (which are stored even then the app is closed) extension Defaults.Keys { // Icon - static let currentIcon = Key("currentIcon", default: "AppIcon-Classic") - static let timesLooped = Key("timesLooped", default: 0) - static let showDockIcon = Key("showDockIcon", default: false) - static let notificationWhenIconUnlocked = Key("notificationWhenIconUnlocked", default: true) + static let currentIcon = Key("currentIcon", default: "AppIcon-Classic", iCloud: true) + static let timesLooped = Key("timesLooped", default: 0, iCloud: true) + static let showDockIcon = Key("showDockIcon", default: false, iCloud: true) + static let notificationWhenIconUnlocked = Key("notificationWhenIconUnlocked", default: true, iCloud: true) // Accent Color - static let useSystemAccentColor = Key("useSystemAccentColor", default: true) - static let customAccentColor = Key("customAccentColor", default: Color(.white)) - static let useGradient = Key("useGradient", default: true) - static let gradientColor = Key("gradientColor", default: Color(.black)) + static let useSystemAccentColor = Key("useSystemAccentColor", default: true, iCloud: true) + static let customAccentColor = Key("customAccentColor", default: Color(.white), iCloud: true) + static let useGradient = Key("useGradient", default: true, iCloud: true) + static let gradientColor = Key("gradientColor", default: Color(.black), iCloud: true) // Radial Menu - static let radialMenuVisibility = Key("radialMenuVisibility", default: true) - static let disableCursorInteraction = Key("disableCursorInteraction", default: false) - static let radialMenuCornerRadius = Key("radialMenuCornerRadius", default: 50) - static let radialMenuThickness = Key("radialMenuThickness", default: 22) + static let radialMenuVisibility = Key("radialMenuVisibility", default: true, iCloud: true) + static let disableCursorInteraction = Key("disableCursorInteraction", default: false, iCloud: true) + static let radialMenuCornerRadius = Key("radialMenuCornerRadius", default: 50, iCloud: true) + static let radialMenuThickness = Key("radialMenuThickness", default: 22, iCloud: true) // Preview - static let previewVisibility = Key("previewVisibility", default: true) - static let previewPadding = Key("previewPadding", default: 10) - static let previewCornerRadius = Key("previewCornerRadius", default: 10) - static let previewBorderThickness = Key("previewBorderThickness", default: 5) + static let previewVisibility = Key("previewVisibility", default: true, iCloud: true) + static let previewPadding = Key("previewPadding", default: 10, iCloud: true) + static let previewCornerRadius = Key("previewCornerRadius", default: 10, iCloud: true) + static let previewBorderThickness = Key("previewBorderThickness", default: 5, iCloud: true) // Behavior - static let launchAtLogin = Key("launchAtLogin", default: false) - static let hideMenuBarIcon = Key("hideMenuBarIcon", default: false) - static let animationConfiguration = Key("animationConfiguration", default: .fast) - static let windowSnapping = Key("windowSnapping", default: false) - static let restoreWindowFrameOnDrag = Key("restoreWindowFrameOnDrag", default: false) - static let enablePadding = Key("enablePadding", default: false) - static let padding = Key("padding", default: .zero) - static let useScreenWithCursor = Key("useScreenWithCursor", default: true) - static let moveCursorWithWindow = Key("moveCursorWithWindow", default: false) - static let resizeWindowUnderCursor = Key("resizeWindowUnderCursor", default: false) - static let focusWindowOnResize = Key("focusWindowOnResize", default: true) - static let respectStageManager = Key("respectStageManager", default: true) - static let stageStripSize = Key("stageStripSize", default: 150) + static let launchAtLogin = Key("launchAtLogin", default: false, iCloud: true) + static let hideMenuBarIcon = Key("hideMenuBarIcon", default: false, iCloud: true) + static let animationConfiguration = Key("animationConfiguration", default: .fast, iCloud: true) + static let windowSnapping = Key("windowSnapping", default: false, iCloud: true) + static let restoreWindowFrameOnDrag = Key("restoreWindowFrameOnDrag", default: false, iCloud: true) + static let enablePadding = Key("enablePadding", default: false, iCloud: true) + static let padding = Key("padding", default: .zero, iCloud: true) + static let useScreenWithCursor = Key("useScreenWithCursor", default: true, iCloud: true) + static let moveCursorWithWindow = Key("moveCursorWithWindow", default: false, iCloud: true) + static let resizeWindowUnderCursor = Key("resizeWindowUnderCursor", default: false, iCloud: true) + static let focusWindowOnResize = Key("focusWindowOnResize", default: true, iCloud: true) + static let respectStageManager = Key("respectStageManager", default: true, iCloud: true) + static let stageStripSize = Key("stageStripSize", default: 150, iCloud: true) // Keybindings - static let triggerKey = Key>("trigger", default: [.kVK_Function]) - static let triggerDelay = Key("triggerDelay", default: 0) - static let doubleClickToTrigger = Key("doubleClickToTrigger", default: false) - static let middleClickTriggersLoop = Key("middleClickTriggersLoop", default: false) - static let keybinds = Key<[WindowAction]>("keybinds", default: [ - WindowAction(.maximize, keybind: [.kVK_Space]), - WindowAction(.center, keybind: [.kVK_Return]), - WindowAction(.init(localized: "Top Cycle"), [ - .init(.topHalf), - .init(.topThird), - .init(.topTwoThirds) - ], [.kVK_UpArrow]), - WindowAction(.init(localized: "Bottom Cycle"), [ - .init(.bottomHalf), - .init(.bottomThird), - .init(.bottomTwoThirds) - ], [.kVK_DownArrow]), - WindowAction(.init(localized: "Right Cycle"), [ - .init(.rightHalf), - .init(.rightThird), - .init(.rightTwoThirds) - ], [.kVK_RightArrow]), - WindowAction(.init(localized: "Left Cycle"), [ - .init(.leftHalf), - .init(.leftThird), - .init(.leftTwoThirds) - ], [.kVK_LeftArrow]), - - WindowAction(.topLeftQuarter, keybind: [.kVK_UpArrow, .kVK_LeftArrow]), - WindowAction(.topRightQuarter, keybind: [.kVK_UpArrow, .kVK_RightArrow]), - WindowAction(.bottomRightQuarter, keybind: [.kVK_DownArrow, .kVK_RightArrow]), - WindowAction(.bottomLeftQuarter, keybind: [.kVK_DownArrow, .kVK_LeftArrow]) - ]) + static let triggerKey = Key>("trigger", default: [.kVK_Function], iCloud: true) + static let triggerDelay = Key("triggerDelay", default: 0, iCloud: true) + static let doubleClickToTrigger = Key("doubleClickToTrigger", default: false, iCloud: true) + static let middleClickTriggersLoop = Key("middleClickTriggersLoop", default: false, iCloud: true) + static let keybinds = Key<[WindowAction]>( + "keybinds", + default: [ + WindowAction(.maximize, keybind: [.kVK_Space]), + WindowAction(.center, keybind: [.kVK_Return]), + WindowAction(.init(localized: "Top Cycle"), [ + .init(.topHalf), + .init(.topThird), + .init(.topTwoThirds) + ], [.kVK_UpArrow]), + WindowAction(.init(localized: "Bottom Cycle"), [ + .init(.bottomHalf), + .init(.bottomThird), + .init(.bottomTwoThirds) + ], [.kVK_DownArrow]), + WindowAction(.init(localized: "Right Cycle"), [ + .init(.rightHalf), + .init(.rightThird), + .init(.rightTwoThirds) + ], [.kVK_RightArrow]), + WindowAction(.init(localized: "Left Cycle"), [ + .init(.leftHalf), + .init(.leftThird), + .init(.leftTwoThirds) + ], [.kVK_LeftArrow]), + + WindowAction(.topLeftQuarter, keybind: [.kVK_UpArrow, .kVK_LeftArrow]), + WindowAction(.topRightQuarter, keybind: [.kVK_UpArrow, .kVK_RightArrow]), + WindowAction(.bottomRightQuarter, keybind: [.kVK_DownArrow, .kVK_RightArrow]), + WindowAction(.bottomLeftQuarter, keybind: [.kVK_DownArrow, .kVK_LeftArrow]) + ], + iCloud: true + ) // Advanced - static let animateWindowResizes = Key("animateWindowResizes", default: false) // BETA - static let hideUntilDirectionIsChosen = Key("hideUntilDirectionIsChosen", default: false) - static let hapticFeedback = Defaults.Key("hapticFeedback", default: true) + static let animateWindowResizes = Key("animateWindowResizes", default: false, iCloud: true) // BETA + static let hideUntilDirectionIsChosen = Key("hideUntilDirectionIsChosen", default: false, iCloud: true) + static let hapticFeedback = Defaults.Key("hapticFeedback", default: true, iCloud: true) // About - static let includeDevelopmentVersions = Key("includeDevelopmentVersions", default: false) + static let includeDevelopmentVersions = Key("includeDevelopmentVersions", default: false, iCloud: true) - static let excludedApps = Key<[URL]>("excludedApps", default: []) - static let sizeIncrement = Key("sizeIncrement", default: 20) + static let excludedApps = Key<[URL]>("excludedApps", default: [], iCloud: true) + static let sizeIncrement = Key("sizeIncrement", default: 20, iCloud: true) } diff --git a/Loop/Info.plist b/Loop/Info.plist new file mode 100644 index 00000000..0c67376e --- /dev/null +++ b/Loop/Info.plist @@ -0,0 +1,5 @@ + + + + + diff --git a/Loop/Loop.entitlements b/Loop/Loop.entitlements index 0c67376e..c280ba75 100644 --- a/Loop/Loop.entitlements +++ b/Loop/Loop.entitlements @@ -1,5 +1,10 @@ - + + com.apple.developer.icloud-container-identifiers + + com.apple.developer.ubiquity-kvstore-identifier + $(TeamIdentifierPrefix)$(CFBundleIdentifier) + From ed73d8608e70a95c2ecd3ecf14dd36928f84d706 Mon Sep 17 00:00:00 2001 From: Kai Azim Date: Thu, 4 Jul 2024 13:39:02 -0600 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=8E=A8=20Format?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Loop/Extensions/Defaults+Extensions.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/Loop/Extensions/Defaults+Extensions.swift b/Loop/Extensions/Defaults+Extensions.swift index a50e6a01..e7b2f5e7 100644 --- a/Loop/Extensions/Defaults+Extensions.swift +++ b/Loop/Extensions/Defaults+Extensions.swift @@ -79,7 +79,6 @@ extension Defaults.Keys { .init(.leftThird), .init(.leftTwoThirds) ], [.kVK_LeftArrow]), - WindowAction(.topLeftQuarter, keybind: [.kVK_UpArrow, .kVK_LeftArrow]), WindowAction(.topRightQuarter, keybind: [.kVK_UpArrow, .kVK_RightArrow]), WindowAction(.bottomRightQuarter, keybind: [.kVK_DownArrow, .kVK_RightArrow]),