iOS Shortcuts (notifications, quiet time, watch prefs, launch app)#119
iOS Shortcuts (notifications, quiet time, watch prefs, launch app)#119sjp4 merged 2 commits intocoredevices:masterfrom
Conversation
| single { CoreConfigHolder(defaultValue = CoreConfig(), get(), get()) } | ||
| single { CoreConfigFlow(get<CoreConfigHolder>().config) } | ||
| singleOf(::ModelManager) | ||
| singleOf(::CactusTranscriptionService) |
There was a problem hiding this comment.
I have to add this because it was crashing the app when installing, maybe its a bug not yet discovered.
There was a problem hiding this comment.
cc @crc-32 - I guess this is in experimentalmodule, but references from common code?
d37f592 to
9372109
Compare
|
cc @sjp4 |
|
really cool! Really useful |
|
Awesome. I was hoping for Shortcuts support at some point! Thanks for adding it! Would it be possible to add a timeline pin from a shortcut? |
9372109 to
1185084
Compare
|
Added timeline shortcuts
|
|
Thanks for adding Timeline support. I can't wait to try this out. A couple more Shortcut ideas:
|
|
@saltedlolly I'm interested to know what you would use these cases in a real-life situation. |
|
@asyba Off the top of my head... For battery life, perhaps you want to chart battery usage over time with a shortcut that runs ever few hours and logs the current battery to a Google Sheet. Useful to keep track of how battery life deteriorates over time. For Motion backlight, you could have a shortcut that disables the motion back light at certain times of day, or over night. Or when battery gets low. (by running a Shortcut ever 6 hours, that checks the battery first, and then performs other actions if the battery is low) Get watch details, could be useful to identify which of your Pebble watches you are currently using, before running the rest of a Shortcut. It would make it possible to run a shortcut on a particular watch only. (if you own more than one Pebble watch) Get screenshot. Perhaps you want to capture regular data from a particular app each day, or create a tiled image of all the watchfaces you have installed, by screenshotting each of them. Set alarm/timer on watch, there are loads of potential use cases, too many to list. I'm sure you can think of some! Get step count. Ideally, you would want to be able to query the total step count for a particular day (e.g. yesterday), as well as the current running count for today, so far. You could use this to log your daily step count to some external source. Perhaps to a spreadsheet or journal app like DayOne. Just some ideas. |
1185084 to
1cf01d6
Compare
1cf01d6 to
a70c101
Compare
|
did some refactor and added: battery, backlight, watch name, screenshot and step count.
|
|
@asyba This is amazing. Thanks for adding it. My only request concerns the health stats. Would it be possible to query the total_steps_yesterday, or better yet include a date input with the query (default to today), to get the step count for a specific day? This way you could run a daily query to log your daily step count to a Google Sheet or something. That would really useful. And perhaps the same for sleep duration, sleep start, and sleep end. Querying the latest values from last night/this morning. Or querying for a specific date? If you want to keep a log of this stuff over time, it would be really useful. |
|
that will be better exposed as a health API, which is in progress |
sjp4
left a comment
There was a problem hiding this comment.
General questions:
- Should these be documented as an "API", or is that not really shortcuts work?
- Should they always be enabled, or would users want to enable/disable access to this stuff?
| } | ||
|
|
||
| @available(iOS 16.0, *) | ||
| struct PebbleShortcutsProvider: AppShortcutsProvider { |
There was a problem hiding this comment.
Does this code need to be in swift, or was it just easier to to write in swift? Our policy is basically that it should be in kotlin unless the only way to do it is in swift (or to put it another way, as much in kotlin as is possible). I don't have much context on how shortcuts work (or the ability to thoroughly review swift code), so any context would be useful
There was a problem hiding this comment.
No, is not possible to do it with kotlin, its specific swift.
I improve it by moving some methods/code to kotlin but this is as much that can be done.
in this section func perform() is wheere each shorcut action calls kotlin code (IOSDelegateShortcuts.shared).
| /** | ||
| * Returns the [RemoteTimelineEmulator] from the LibPebble Koin context. | ||
| */ | ||
| fun getRemoteTimelineEmulator(): RemoteTimelineEmulator = koin.get() |
There was a problem hiding this comment.
RemoteTimelineemulator shouldn't be exposed like this (it's internal to libpebble) - we should add new methods to the libpebble API (probably here) if the ones already exposed don't do the job
There was a problem hiding this comment.
done, found another way. thanks
| * For now these are placeholders (no-op) but provide a clear extension point | ||
| * for future integrations (e.g. Tasker plugin, Android Shortcuts, etc.). | ||
| */ | ||
| class AndroidPebbleAppActions( |
There was a problem hiding this comment.
If we add anything similar on android it will be part of PebbleKit 2.0, so I think it's unlikely we'd re-use this interface directly. That being said, i'm thinking it's probably best to keep it entirely within the iosMain code tree for now (i.e. no androidMain implementations needed)
There was a problem hiding this comment.
okay. I removed the androidMain implementations, there are still commonMain files let me know if those should be move to iosMain tree.
There was a problem hiding this comment.
I think we should move those to iosMain
|
9e46fc9 to
73dda83
Compare
73dda83 to
5ed81f7
Compare
|
@sjp4 ready for re-review |





iOS support for Shortcuts.
Some possible actions that could be used, for example using Focus modes.
I also added some classes but not implement, to support the equivalent in Android in the future using the Tasker plugin or others.