-
Notifications
You must be signed in to change notification settings - Fork 301
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
Siri Integration #492
Siri Integration #492
Conversation
Nice work @gshaviv Have you considered also adding an You can add one in just a few lines of code, see for example https://github.com/open-gluck/opengluck-swift-app/blob/799196c0d11f13fe66102880b4c0c008b3a687e5/OpenGluck/AppIntents/AppsShortcuts.swift#L6 |
To use AppShortcutsProvider the phrase needs to include the app name which in case of xdrip4iO5 is not very practical. Also tried this with some other app and there seems to be a bug in iOS 16 and Siri and it doesn't pick it up automatically as advertised.
|
I feel your pain @gshaviv, I've been struggling with
While this is true, did you know you can have up to three synonyms, that would allow the user to use a more friendlier name? Just include a For this project maybe we could use something like to add xDrip and Drip (along with a pronunciation hint, because Siri is notoriously bad as understanding uncommon name, and has a strong bias towards the words it already knows make sense somehow): <key>INAlternativeAppNames</key>
<array>
<dict>
<key>INAlternativeAppName</key>
<string>xDrip</string>
<key>INAlternativeAppNamePronunciationHint</key>
<string>ex drip</string>
</dict>
<dict>
<key>INAlternativeAppName</key>
<string>Drip</string>
<key>INAlternativeAppNamePronunciationHint</key>
<string>drip</string>
</dict>
</array> Second, and not least, supporting App Shortcuts is important not only as a way to donate the phrase to Siri (which as you pointed out might not always be practical because of the app name) but also because it integrates within iOS far beyond just Siri. For example, searching for the App Name in Spotlight will also show up your App Shortcuts, allowing the user to learn there is something to be done. You could even push integration deeper, and donate the intent to the system when the current glucose view becomes visible. This would allow iOS to learn how the user interacts with this screen, and say, provide a suggestion to add an automation if, for example, the AI on device learns that this is something does often on the first pickup in the morning. In short, providing an
There are unfortunately a lot of caveats, some I have found is:
With XCode 15, you have also an invaluable tool as the Have a look at this section for screenshots and additional details: https://github.com/open-gluck/opengluck-swift-app#siri-phrases-dont-work |
In the past my attempts to use app synonyms didn't work either, Siri just ignored them. Let me try again and see... |
The App Shortcuts Preview tool, new in XCode and Flexible shortcuts in iOS 17, is an invaluable tool to help you with debugging these issues. If you haven't given it a try yet, it really helps. Also make sure about how you structure the dict, and check the build log for potential errors or warnings. |
Nice work @gshaviv ! This looks very interesting. We'll look at getting some of the pending PRs checked and merged in shortly |
This makes the (already untidy) Settings menu even more untidy I think. Maybe we could look at simply adding a "Siri Integration" menu row (or maybe a whole new section with just one row for now) and when providing the explanation in an alert when the user clicks the row... It would just maybe fit in better with the already crowded UI of the current UIKit Settings menu |
It's not a setting, it's a section footer as it's just a note with no user action needed.but let me know if you want still to add it as a separate section and I will |
Actually not sure it's even possible, cause it will be a section with a title and a footer and no rows (no content) in between. I think the built in UI logic might just not show a section with zero rows, no? |
The section footers with explainer text are a great idea, but if we added just one it would look strange and out of context. Don't worry, if we merge it, we can then change it to a row with actions to show the alert. It's fine. |
It would need a view model to be created, but this is easy to do later, don't worry |
@gshaviv I've been able to use a (heavily) modified and abstracted version of your SwiftUI chart to produce real-time charts in the new live updates and widgets. My previous method of creating UIIMages from a UIView of the chart and save them through the shared-app-group worked perfectly to create the images, but live activities was very unreliable in consistently rendering them during the runtime available... Using your SwiftUI chart idea works perfectly well. We'll definitely get this PR merged in shortly, but just wanted to give you a heads-up that your work has helped a lot! |
Great, glad to hear. Doing a widget was next on my todo, you beat me to it. |
@gshaviv , we'll start looking to merge this in after 5.1.0 is released. As part of 5.1.0 I already wrote a very similar SwiftUI Glucose Chart which has many more options to make it extensible to all possible uses (widgets, complications, Watch app) so it would make sense to use this new one in your PR. I'll pull your PR into a feature branch and we can get it all integrated before merging in. |
from JohanDegraeve#492 Glucose intent play with response graph scale app shortcuts add alternate app pronounciations Add mention in settings for shortcuts donate intent on move to foreground add trend to siri response fix trend calculation for Siri Co-Authored-By: Guy Shaviv <guy@shaviv.org>
Hi @gshaviv , I finally got around to merging this in and rebased it on all of the latest commits in the staging-5.2 branch: https://github.com/JohanDegraeve/xdripswift/tree/staging-5.2-siri-integration Let's carry on with any new commits to that new branch. |
from #492 Glucose intent play with response graph scale app shortcuts add alternate app pronounciations Add mention in settings for shortcuts donate intent on move to foreground add trend to siri response fix trend calculation for Siri Co-Authored-By: Guy Shaviv <guy@shaviv.org>
from JohanDegraeve#492 Glucose intent play with response graph scale app shortcuts add alternate app pronounciations Add mention in settings for shortcuts donate intent on move to foreground add trend to siri response fix trend calculation for Siri Co-Authored-By: Guy Shaviv <guy@shaviv.org>
This PR adds an AppIntent (iOS 16) that enables you to ask Siri "what is my glucose level" and Siri will reply with your glucose level and show a quick snippet chart of your recent glucose. As demonstrated in this video:
What-is.mp4
To add the behavior to Siri, go to the shortcuts app, tap the + button, than the add action, select in apps the xdrip app and there you'll see the "what's my glucose" action.. You can then rename it to respond to any sentence you'd like. You can repeat this setting each time a slightly different sentence to have Siri respond to several options (Siri is a bit stupid in this respect).
The PR adds a GlucoseIntent struct which conforms to AppIntent and does all the work. It also adds a GlucoseIntentResponseView which is a swiftUI view showing the response (since AppIntents require swiftUI).