From f2d2db0f857c35a3116f88701abd1f9c56d9fd94 Mon Sep 17 00:00:00 2001 From: Ice Cream Machine <14133305+icecreammachine@users.noreply.github.com> Date: Mon, 18 Nov 2024 22:50:45 -0500 Subject: [PATCH] Cleanup --- Bluesnooze.xcodeproj/project.pbxproj | 72 ++++++++-------------------- Bluesnooze/AppDelegate.swift | 17 +------ Bluesnooze/Base.lproj/MainMenu.xib | 11 +---- Bluesnooze/Info.plist | 2 + Cartfile | 1 - Cartfile.resolved | 1 - README.md | 25 +--------- 7 files changed, 28 insertions(+), 101 deletions(-) delete mode 100644 Cartfile delete mode 100644 Cartfile.resolved diff --git a/Bluesnooze.xcodeproj/project.pbxproj b/Bluesnooze.xcodeproj/project.pbxproj index fa5cb24..665d9c9 100644 --- a/Bluesnooze.xcodeproj/project.pbxproj +++ b/Bluesnooze.xcodeproj/project.pbxproj @@ -3,16 +3,13 @@ archiveVersion = 1; classes = { }; - objectVersion = 54; + objectVersion = 77; objects = { /* Begin PBXBuildFile section */ 4F229ABE243CC29500B1784C /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F229ABD243CC29500B1784C /* AppDelegate.swift */; }; 4F229AC0243CC29600B1784C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4F229ABF243CC29600B1784C /* Assets.xcassets */; }; 4F229AC3243CC29600B1784C /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4F229AC1243CC29600B1784C /* MainMenu.xib */; }; - 4FDC9C13243DCC0300FB0C4E /* LaunchAtLogin.framework.dSYM in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4FDC9C12243DCC0300FB0C4E /* LaunchAtLogin.framework.dSYM */; }; - 4FDC9C14243DCC6B00FB0C4E /* LaunchAtLogin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FDC9C0E243DCB7B00FB0C4E /* LaunchAtLogin.framework */; }; - 4FDC9C15243DCC6B00FB0C4E /* LaunchAtLogin.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 4FDC9C0E243DCB7B00FB0C4E /* LaunchAtLogin.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -22,7 +19,6 @@ dstPath = ""; dstSubfolderSpec = 16; files = ( - 4FDC9C13243DCC0300FB0C4E /* LaunchAtLogin.framework.dSYM in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -32,7 +28,6 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - 4FDC9C15243DCC6B00FB0C4E /* LaunchAtLogin.framework in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -47,8 +42,6 @@ 4F229AC4243CC29600B1784C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 4F229AC5243CC29600B1784C /* Bluesnooze.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Bluesnooze.entitlements; sourceTree = ""; }; 4F229ACB243CC72800B1784C /* Bluesnooze-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Bluesnooze-Bridging-Header.h"; sourceTree = ""; }; - 4FDC9C0E243DCB7B00FB0C4E /* LaunchAtLogin.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = LaunchAtLogin.framework; path = Carthage/Build/Mac/LaunchAtLogin.framework; sourceTree = ""; }; - 4FDC9C12243DCC0300FB0C4E /* LaunchAtLogin.framework.dSYM */ = {isa = PBXFileReference; lastKnownFileType = wrapper.dsym; name = LaunchAtLogin.framework.dSYM; path = Carthage/Build/Mac/LaunchAtLogin.framework.dSYM; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -56,7 +49,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4FDC9C14243DCC6B00FB0C4E /* LaunchAtLogin.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -96,8 +88,6 @@ 4FDC9C0D243DCB7B00FB0C4E /* Frameworks */ = { isa = PBXGroup; children = ( - 4FDC9C12243DCC0300FB0C4E /* LaunchAtLogin.framework.dSYM */, - 4FDC9C0E243DCB7B00FB0C4E /* LaunchAtLogin.framework */, ); name = Frameworks; sourceTree = ""; @@ -115,7 +105,6 @@ 4F229AB8243CC29500B1784C /* Resources */, 4FDC9C0C243DCB0B00FB0C4E /* CopyFiles */, 4FDC9C16243DCC6B00FB0C4E /* Embed Frameworks */, - 4FDC9C11243DCBD700FB0C4E /* Run Script */, ); buildRules = ( ); @@ -144,7 +133,6 @@ }; }; buildConfigurationList = 4F229AB5243CC29500B1784C /* Build configuration list for PBXProject "Bluesnooze" */; - compatibilityVersion = "Xcode 9.3"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( @@ -152,6 +140,7 @@ Base, ); mainGroup = 4F229AB1243CC29500B1784C; + preferredProjectObjectVersion = 77; productRefGroup = 4F229ABB243CC29500B1784C /* Products */; projectDirPath = ""; projectRoot = ""; @@ -192,25 +181,6 @@ shellPath = /bin/sh; shellScript = "export PATH=\"$PATH:/opt/homebrew/bin\"\n\nif which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n"; }; - 4FDC9C11243DCBD700FB0C4E /* Run Script */ = { - isa = PBXShellScriptBuildPhase; - alwaysOutOfDate = 1; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - ); - name = "Run Script"; - outputFileListPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PROJECT_DIR}/Carthage/Build/Mac/LaunchAtLogin.framework/Resources/copy-helper.sh\"\n"; - }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -288,7 +258,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.13; + MACOSX_DEPLOYMENT_TARGET = 15.0; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -344,7 +314,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.13; + MACOSX_DEPLOYMENT_TARGET = 15.0; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; SDKROOT = macosx; @@ -359,27 +329,26 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Bluesnooze/Bluesnooze.entitlements; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; DEAD_CODE_STRIPPING = YES; - DEVELOPMENT_TEAM = 7X3FR535W8; + DEVELOPMENT_TEAM = ""; ENABLE_HARDENED_RUNTIME = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Carthage/Build/Mac", - ); + FRAMEWORK_SEARCH_PATHS = ""; INFOPLIST_FILE = Bluesnooze/Info.plist; + INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 12.0; - MARKETING_VERSION = 1.2; - PRODUCT_BUNDLE_IDENTIFIER = com.oliverpeate.Bluesnooze; + MACOSX_DEPLOYMENT_TARGET = 15.0; + MARKETING_VERSION = 1.3; + PRODUCT_BUNDLE_IDENTIFIER = com.icecreammachine.Bluesnooze; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Bluesnooze/Bluesnooze-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; }; name = Debug; }; @@ -389,26 +358,25 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Bluesnooze/Bluesnooze.entitlements; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; DEAD_CODE_STRIPPING = YES; - DEVELOPMENT_TEAM = 7X3FR535W8; + DEVELOPMENT_TEAM = ""; ENABLE_HARDENED_RUNTIME = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Carthage/Build/Mac", - ); + FRAMEWORK_SEARCH_PATHS = ""; INFOPLIST_FILE = Bluesnooze/Info.plist; + INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 12.0; - MARKETING_VERSION = 1.2; - PRODUCT_BUNDLE_IDENTIFIER = com.oliverpeate.Bluesnooze; + MACOSX_DEPLOYMENT_TARGET = 15.0; + MARKETING_VERSION = 1.3; + PRODUCT_BUNDLE_IDENTIFIER = com.icecreammachine.Bluesnooze; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Bluesnooze/Bluesnooze-Bridging-Header.h"; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; }; name = Release; }; diff --git a/Bluesnooze/AppDelegate.swift b/Bluesnooze/AppDelegate.swift index 7071f8d..dff6713 100644 --- a/Bluesnooze/AppDelegate.swift +++ b/Bluesnooze/AppDelegate.swift @@ -8,9 +8,8 @@ import Cocoa import IOBluetooth -import LaunchAtLogin -@NSApplicationMain +@main class AppDelegate: NSObject, NSApplicationDelegate { @IBOutlet weak var statusMenu: NSMenu! @@ -20,18 +19,11 @@ class AppDelegate: NSObject, NSApplicationDelegate { func applicationDidFinishLaunching(_ aNotification: Notification) { initStatusItem() - setLaunchAtLoginState() setupNotificationHandlers() setBluetooth(powerOn: true) } // MARK: Click handlers - - @IBAction func launchAtLoginClicked(_ sender: NSMenuItem) { - LaunchAtLogin.isEnabled = !LaunchAtLogin.isEnabled - setLaunchAtLoginState() - } - @IBAction func quitClicked(_ sender: NSMenuItem) { NSApplication.shared.terminate(self) } @@ -62,7 +54,7 @@ class AppDelegate: NSObject, NSApplicationDelegate { // MARK: UI state - private func initStatusItem() { + @MainActor private func initStatusItem() { if UserDefaults.standard.bool(forKey: "hideIcon") { return } @@ -75,9 +67,4 @@ class AppDelegate: NSObject, NSApplicationDelegate { } statusItem.menu = statusMenu } - - private func setLaunchAtLoginState() { - let state = LaunchAtLogin.isEnabled ? NSControl.StateValue.on : NSControl.StateValue.off - launchAtLoginMenuItem.state = state - } } diff --git a/Bluesnooze/Base.lproj/MainMenu.xib b/Bluesnooze/Base.lproj/MainMenu.xib index a37036f..9c3d48f 100644 --- a/Bluesnooze/Base.lproj/MainMenu.xib +++ b/Bluesnooze/Base.lproj/MainMenu.xib @@ -1,8 +1,8 @@ - + - + @@ -14,19 +14,12 @@ - - - - - - - diff --git a/Bluesnooze/Info.plist b/Bluesnooze/Info.plist index 3b6bb76..2b1cd2f 100644 --- a/Bluesnooze/Info.plist +++ b/Bluesnooze/Info.plist @@ -36,5 +36,7 @@ NSSupportsSuddenTermination + NSBluetoothAlwaysUsageDescription + This app uses Bluetooth to connect to devices and transfer data. diff --git a/Cartfile b/Cartfile deleted file mode 100644 index 3819bb8..0000000 --- a/Cartfile +++ /dev/null @@ -1 +0,0 @@ -github "sindresorhus/LaunchAtLogin" diff --git a/Cartfile.resolved b/Cartfile.resolved deleted file mode 100644 index 0c1d8c9..0000000 --- a/Cartfile.resolved +++ /dev/null @@ -1 +0,0 @@ -github "sindresorhus/LaunchAtLogin" "v4.0.0" diff --git a/README.md b/README.md index 2a40efd..f410ed1 100644 --- a/README.md +++ b/README.md @@ -2,17 +2,7 @@ # Bluesnooze -[Download the latest release][download-latest] or install via Homebrew: - -```sh -brew install bluesnooze -``` - -Please note the latest release requires MacOS Monterey (12.0) or higher. - -## Enjoying Bluesnooze? ❤️ - -Perhaps you could [buy me a coffee](https://www.buymeacoffee.com/odlp) to say thanks :coffee: +Please note the latest release requires MacOS Sequoia (15.0) or higher. ## About @@ -24,31 +14,20 @@ With Bluesnooze the Bluetooth connection is switched off when your Mac sleeps, a ![Screenshot showing Bluesnooze in the status bar](images/screenshot.png) -You might also want to check-out Whisper – [the volume limiter for MacOS](https://apps.apple.com/gb/app/whisper-volume-limiter/id1438132944?mt=12). - ## Installation 1. Download `Bluesnooze.zip` from the [latest release][download-latest] 1. In Finder, open `Bluesnooze.zip` in your `Downloads` directory 1. Drag `Bluesnooze.app` to your `Applications` directory -1. *Optional*: Configure 'Launch at login' ## Caveats -- Please note this app is not compatible with the “Allow your Apple Watch to unlock your Mac” feature. - Unfortunately this app can't be distributed via the App Store because it uses a private API to switch Bluetooth on/off (but the release version is notarized by Apple). -[download-latest]: https://github.com/odlp/bluesnooze/releases/latest +[download-latest]: https://github.com/icecreammachine/bluesnooze/releases ## FAQs -### Can you add support for selectively disconnecting certain devices? - -Bluesnooze is a really simple app which toggles the Bluetooth power on/off. -Disconnecting specific devices would require a complete rewrite, and I don't -need this functionality or the complexity it brings. Please feel free to fork & -experiment as you like ✌️ - ### How can I hide the Bluesnooze icon? In your terminal run the following command: