Skip to content

iOS Shortcuts (notifications, quiet time, watch prefs, launch app)#119

Merged
sjp4 merged 2 commits intocoredevices:masterfrom
asyba:ios-shortcuts-actions
Mar 26, 2026
Merged

iOS Shortcuts (notifications, quiet time, watch prefs, launch app)#119
sjp4 merged 2 commits intocoredevices:masterfrom
asyba:ios-shortcuts-actions

Conversation

@asyba
Copy link
Copy Markdown
Contributor

@asyba asyba commented Feb 15, 2026

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.

IMG_8097 IMG_8097 IMG_8098

single { CoreConfigHolder(defaultValue = CoreConfig(), get(), get()) }
single { CoreConfigFlow(get<CoreConfigHolder>().config) }
singleOf(::ModelManager)
singleOf(::CactusTranscriptionService)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have to add this because it was crashing the app when installing, maybe its a bug not yet discovered.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @crc-32 - I guess this is in experimentalmodule, but references from common code?

@asyba asyba force-pushed the ios-shortcuts-actions branch from d37f592 to 9372109 Compare February 15, 2026 04:30
@asyba
Copy link
Copy Markdown
Contributor Author

asyba commented Feb 15, 2026

cc @sjp4

@ericmigi
Copy link
Copy Markdown
Contributor

really cool! Really useful

@saltedlolly
Copy link
Copy Markdown

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?

@asyba asyba force-pushed the ios-shortcuts-actions branch from 9372109 to 1185084 Compare February 16, 2026 03:23
@asyba
Copy link
Copy Markdown
Contributor Author

asyba commented Feb 16, 2026

Added timeline shortcuts
thanks @saltedlolly good idea.

IMG_8111 IMG_8112

@saltedlolly
Copy link
Copy Markdown

saltedlolly commented Feb 16, 2026

Thanks for adding Timeline support. I can't wait to try this out.

A couple more Shortcut ideas:

  • Get Watch Battery level (%)
  • Set Motion Backlight (enabled/disabled)
  • Get Watch Details (watch model, firmware version, serial number, uptime.
  • Get Watch screenshot
  • Set Watch alarm (not sure if this would be possible)
  • Set Watch timer (also not sure if possible)
  • Get step count

@asyba
Copy link
Copy Markdown
Contributor Author

asyba commented Feb 16, 2026

@saltedlolly I'm interested to know what you would use these cases in a real-life situation.
Battery level, Watch Details, step count. Most of them you can see it in the mobile app.

@saltedlolly
Copy link
Copy Markdown

saltedlolly commented Feb 16, 2026

@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.

@asyba asyba force-pushed the ios-shortcuts-actions branch from 1185084 to 1cf01d6 Compare February 17, 2026 14:05
@asyba asyba force-pushed the ios-shortcuts-actions branch from 1cf01d6 to a70c101 Compare February 17, 2026 14:45
@asyba
Copy link
Copy Markdown
Contributor Author

asyba commented Feb 17, 2026

did some refactor and added: battery, backlight, watch name, screenshot and step count.
For alarm/timer is not possible I think, maybe in the future when more "Index" code is added can be done.
cc @saltedlolly

IMG_8111 IMG_8111 IMG_8111

@saltedlolly
Copy link
Copy Markdown

@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.

Copy link
Copy Markdown
Contributor

that will be better exposed as a health API, which is in progress

Copy link
Copy Markdown
Member

@sjp4 sjp4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay. I removed the androidMain implementations, there are still commonMain files let me know if those should be move to iosMain tree.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should move those to iosMain

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@asyba
Copy link
Copy Markdown
Contributor Author

asyba commented Mar 1, 2026

@sjp4

  • No, they don't need to be documented as APIs. You define (PebbleShortcuts.swift) actions like forms, toggles, etc., and present them in a way that can only be used from the operating system's app shortcuts. You can combine them with other shortcuts from third-party applications or the system itself, and then it offers options to execute them as an icon, share action, automatic trigger, etc. It doesn't let you do anything that isn't documented in that structure.

  • According to the AppIntent documentation, configurations that determine the visibility of an intent are explicitly defined as static var (isDiscoverable).
    Because the Shortcuts app extracts these metadata at install/compile time statically, we cannot dynamically hide or show the intents from preferences.
    However, we could add a toggle in the settings, to prevent the execution of the shortcuts (throwing an error or showing a dialog), but still this intents are show as possible in the apple iOS Shortcuts.

@asyba asyba force-pushed the ios-shortcuts-actions branch 6 times, most recently from 9e46fc9 to 73dda83 Compare March 1, 2026 21:59
@asyba asyba requested a review from sjp4 March 1, 2026 22:10
@asyba asyba force-pushed the ios-shortcuts-actions branch from 73dda83 to 5ed81f7 Compare March 24, 2026 15:22
@asyba
Copy link
Copy Markdown
Contributor Author

asyba commented Mar 24, 2026

@sjp4 ready for re-review

@sjp4 sjp4 merged commit ac55f0b into coredevices:master Mar 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants