From f8d4c137bd8bba709ad67635cf83f1f1029b0f1e Mon Sep 17 00:00:00 2001 From: skimaniac <44727542+skimaniac@users.noreply.github.com> Date: Sat, 25 Jul 2026 16:14:08 -0400 Subject: [PATCH] Add App Intents to enable/disable BG speech via Shortcuts --- LoopFollow.xcodeproj/project.pbxproj | 26 +++++++++++-------- LoopFollow/Controllers/SpeakBGIntents.swift | 24 +++++++++++++++++ .../RestartLiveActivityIntent.swift | 14 +++++++++- 3 files changed, 52 insertions(+), 12 deletions(-) create mode 100644 LoopFollow/Controllers/SpeakBGIntents.swift diff --git a/LoopFollow.xcodeproj/project.pbxproj b/LoopFollow.xcodeproj/project.pbxproj index 560cd2f8e..36c627e5d 100644 --- a/LoopFollow.xcodeproj/project.pbxproj +++ b/LoopFollow.xcodeproj/project.pbxproj @@ -97,6 +97,10 @@ exceptions = ( D736FE5E8494B2581A4EA95F /* Exceptions for "LoopFollow" folder in "LoopFollow" target */, ); + explicitFileTypes = { + }; + explicitFolders = ( + ); path = LoopFollow; sourceTree = ""; }; @@ -104,6 +108,10 @@ isa = PBXFileSystemSynchronizedRootGroup; exceptions = ( ); + explicitFileTypes = { + }; + explicitFolders = ( + ); path = Shared; sourceTree = ""; }; @@ -258,8 +266,8 @@ isa = PBXNativeTarget; buildConfigurationList = FC97882D2485969C00A7906C /* Build configuration list for PBXNativeTarget "LoopFollow" */; buildPhases = ( - DD7F4BEA2DD48B9600D449E9 /* Swiftformat */, B038D39450A1F9A97D2B8BA4 /* [CP] Check Pods Manifest.lock */, + DD7F4BEA2DD48B9600D449E9 /* Swiftformat */, FC9788102485969B00A7906C /* Sources */, FC9788112485969B00A7906C /* Frameworks */, FC9788122485969B00A7906C /* Resources */, @@ -366,14 +374,10 @@ inputFileListPaths = ( "${PODS_ROOT}/Target Support Files/Pods-LoopFollow/Pods-LoopFollow-frameworks-${CONFIGURATION}-input-files.xcfilelist", ); - inputPaths = ( - ); name = "[CP] Embed Pods Frameworks"; outputFileListPaths = ( "${PODS_ROOT}/Target Support Files/Pods-LoopFollow/Pods-LoopFollow-frameworks-${CONFIGURATION}-output-files.xcfilelist", ); - outputPaths = ( - ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-LoopFollow/Pods-LoopFollow-frameworks.sh\"\n"; @@ -490,7 +494,7 @@ CODE_SIGN_ENTITLEMENTS = LoopFollowLAExtensionExtension.entitlements; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_TEAM = "$(LF_DEVELOPMENT_TEAM)"; + DEVELOPMENT_TEAM = 4MFAGT7CVA; ENABLE_APP_SANDBOX = NO; ENABLE_HARDENED_RUNTIME = NO; ENABLE_USER_SCRIPT_SANDBOXING = YES; @@ -542,7 +546,7 @@ CODE_SIGN_ENTITLEMENTS = LoopFollowLAExtensionExtension.entitlements; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_TEAM = "$(LF_DEVELOPMENT_TEAM)"; + DEVELOPMENT_TEAM = 4MFAGT7CVA; ENABLE_APP_SANDBOX = NO; ENABLE_HARDENED_RUNTIME = NO; ENABLE_USER_SCRIPT_SANDBOXING = YES; @@ -591,7 +595,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_TEAM = "$(LF_DEVELOPMENT_TEAM)"; + DEVELOPMENT_TEAM = 4MFAGT7CVA; ENABLE_USER_SCRIPT_SANDBOXING = YES; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -622,7 +626,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_TEAM = "$(LF_DEVELOPMENT_TEAM)"; + DEVELOPMENT_TEAM = 4MFAGT7CVA; ENABLE_USER_SCRIPT_SANDBOXING = YES; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -772,7 +776,7 @@ CODE_SIGN_ENTITLEMENTS = "LoopFollow/Loop Follow.entitlements"; CODE_SIGN_STYLE = Automatic; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = "$(LF_DEVELOPMENT_TEAM)"; + DEVELOPMENT_TEAM = 4MFAGT7CVA; INFOPLIST_FILE = LoopFollow/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 18.0; LD_RUNPATH_SEARCH_PATHS = ( @@ -797,7 +801,7 @@ CODE_SIGN_ENTITLEMENTS = "LoopFollow/Loop Follow.entitlements"; CODE_SIGN_STYLE = Automatic; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = "$(LF_DEVELOPMENT_TEAM)"; + DEVELOPMENT_TEAM = 4MFAGT7CVA; INFOPLIST_FILE = LoopFollow/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 18.0; LD_RUNPATH_SEARCH_PATHS = ( diff --git a/LoopFollow/Controllers/SpeakBGIntents.swift b/LoopFollow/Controllers/SpeakBGIntents.swift new file mode 100644 index 000000000..575e0323a --- /dev/null +++ b/LoopFollow/Controllers/SpeakBGIntents.swift @@ -0,0 +1,24 @@ +// LoopFollow +// SpeakBGIntents.swift + +import AppIntents + +struct EnableSpeakBGIntent: AppIntent { + static var title: LocalizedStringResource = "Enable BG Speech" + static var description = IntentDescription("Turns on spoken glucose readings in LoopFollow.") + + func perform() async throws -> some IntentResult & ProvidesDialog { + Storage.shared.speakBG.value = true + return .result(dialog: "BG speech enabled.") + } +} + +struct DisableSpeakBGIntent: AppIntent { + static var title: LocalizedStringResource = "Disable BG Speech" + static var description = IntentDescription("Turns off spoken glucose readings in LoopFollow.") + + func perform() async throws -> some IntentResult & ProvidesDialog { + Storage.shared.speakBG.value = false + return .result(dialog: "BG speech disabled.") + } +} diff --git a/LoopFollow/LiveActivity/RestartLiveActivityIntent.swift b/LoopFollow/LiveActivity/RestartLiveActivityIntent.swift index e92ee5778..fb50fee15 100644 --- a/LoopFollow/LiveActivity/RestartLiveActivityIntent.swift +++ b/LoopFollow/LiveActivity/RestartLiveActivityIntent.swift @@ -32,7 +32,7 @@ } } - struct LoopFollowAppShortcuts: AppShortcutsProvider { +struct LoopFollowAppShortcuts: AppShortcutsProvider { static var appShortcuts: [AppShortcut] { AppShortcut( intent: RestartLiveActivityIntent(), @@ -40,6 +40,18 @@ shortTitle: "Restart Live Activity", systemImageName: "dot.radiowaves.left.and.right" ) + AppShortcut( + intent: EnableSpeakBGIntent(), + phrases: ["Enable BG speech in \(.applicationName)"], + shortTitle: "Enable BG Speech", + systemImageName: "speaker.wave.2" + ) + AppShortcut( + intent: DisableSpeakBGIntent(), + phrases: ["Disable BG speech in \(.applicationName)"], + shortTitle: "Disable BG Speech", + systemImageName: "speaker.slash" + ) } } #endif