-
-
Notifications
You must be signed in to change notification settings - Fork 316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate Siri shortcuts to enable/disable gps tracking #82
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>INEnums</key> | ||
<array/> | ||
<key>INIntentDefinitionModelVersion</key> | ||
<string>1.2</string> | ||
<key>INIntentDefinitionNamespace</key> | ||
<string>1AigIl</string> | ||
<key>INIntentDefinitionSystemVersion</key> | ||
<string>23F79</string> | ||
<key>INIntentDefinitionToolsBuildVersion</key> | ||
<string>15F31d</string> | ||
<key>INIntentDefinitionToolsVersion</key> | ||
<string>15.4</string> | ||
<key>INIntents</key> | ||
<array> | ||
<dict> | ||
<key>INIntentCategory</key> | ||
<string>generic</string> | ||
<key>INIntentConfigurable</key> | ||
<true/> | ||
<key>INIntentDescription</key> | ||
<string>starts tracking with gps</string> | ||
<key>INIntentDescriptionID</key> | ||
<string>8atNz2</string> | ||
<key>INIntentEligibleForWidgets</key> | ||
<true/> | ||
<key>INIntentManagedParameterCombinations</key> | ||
<dict> | ||
<key></key> | ||
<dict> | ||
<key>INIntentParameterCombinationSupportsBackgroundExecution</key> | ||
<true/> | ||
<key>INIntentParameterCombinationUpdatesLinked</key> | ||
<true/> | ||
</dict> | ||
</dict> | ||
<key>INIntentName</key> | ||
<string>StartTrackingService</string> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this file I only see the start track intent. Where is the stop defined? |
||
<key>INIntentParameterCombinations</key> | ||
<dict> | ||
<key></key> | ||
<dict> | ||
<key>INIntentParameterCombinationIsPrimary</key> | ||
<true/> | ||
<key>INIntentParameterCombinationSupportsBackgroundExecution</key> | ||
<true/> | ||
</dict> | ||
</dict> | ||
<key>INIntentResponse</key> | ||
<dict> | ||
<key>INIntentResponseCodes</key> | ||
<array> | ||
<dict> | ||
<key>INIntentResponseCodeConciseFormatString</key> | ||
<string>yes</string> | ||
<key>INIntentResponseCodeConciseFormatStringID</key> | ||
<string>ZxxgPH</string> | ||
<key>INIntentResponseCodeFormatString</key> | ||
<string>yay</string> | ||
<key>INIntentResponseCodeFormatStringID</key> | ||
<string>5l9bCc</string> | ||
<key>INIntentResponseCodeName</key> | ||
<string>success</string> | ||
<key>INIntentResponseCodeSuccess</key> | ||
<true/> | ||
</dict> | ||
<dict> | ||
<key>INIntentResponseCodeConciseFormatString</key> | ||
<string>no</string> | ||
<key>INIntentResponseCodeConciseFormatStringID</key> | ||
<string>fwaOIl</string> | ||
<key>INIntentResponseCodeFormatString</key> | ||
<string>nay</string> | ||
<key>INIntentResponseCodeFormatStringID</key> | ||
<string>ziguoJ</string> | ||
<key>INIntentResponseCodeName</key> | ||
<string>failure</string> | ||
</dict> | ||
</array> | ||
</dict> | ||
<key>INIntentTitle</key> | ||
<string>Start Tracking Service</string> | ||
<key>INIntentTitleID</key> | ||
<string>kVcJ5o</string> | ||
<key>INIntentType</key> | ||
<string>Custom</string> | ||
<key>INIntentVerb</key> | ||
<string>Do</string> | ||
</dict> | ||
</array> | ||
<key>INTypes</key> | ||
<array/> | ||
</dict> | ||
</plist> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import AppIntents | ||
import SwiftUI | ||
|
||
@available(iOS 16, *) | ||
struct StartTrackingIntent: AppIntent { | ||
|
||
static let title: LocalizedStringResource = "Start Tracking Service" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And this |
||
|
||
func perform() async throws -> some IntentResult & ProvidesDialog { | ||
var trackingController: TrackingController? | ||
let userDefaults = UserDefaults.standard | ||
if !userDefaults.bool(forKey: "service_status_preference") { | ||
userDefaults.setValue(true, forKey: "service_status_preference") | ||
await StatusViewController.addMessage(NSLocalizedString("Tracking Service created", comment: "")) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's reuse existing string |
||
trackingController = TrackingController() | ||
trackingController?.start() | ||
} | ||
return .result(dialog: "Tracking Service Started") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should probably be localized as well. And probably reuse string as well. |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import AppIntents | ||
import SwiftUI | ||
|
||
@available(iOS 16, *) | ||
struct StopTrackingIntent: AppIntent { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same for strings here. |
||
|
||
static let title: LocalizedStringResource = "Stop Tracking Service" | ||
|
||
func perform() async throws -> some IntentResult & ProvidesDialog { | ||
var trackingController: TrackingController? | ||
let userDefaults = UserDefaults.standard | ||
if userDefaults.bool(forKey: "service_status_preference") { | ||
userDefaults.setValue(false, forKey: "service_status_preference") | ||
await StatusViewController.addMessage(NSLocalizedString("Tracking Service destroyed", comment: "")) | ||
trackingController?.stop() | ||
trackingController = nil | ||
} | ||
return .result(dialog: "Tracking Service Stopped") | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>com.apple.developer.siri</key> | ||
<true/> | ||
</dict> | ||
</plist> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is a correct description. It doesn't necessarily use GPS. Also need proper letter cases