Skip to content

Fix set sleep timer via shortcut/siri when locked - #4812

Open
lparry wants to merge 6 commits into
Automattic:trunkfrom
lparry:codex/fix-siri-sleep-timer-lock
Open

Fix set sleep timer via shortcut/siri when locked#4812
lparry wants to merge 6 commits into
Automattic:trunkfrom
lparry:codex/fix-siri-sleep-timer-lock

Conversation

@lparry

@lparry lparry commented Jul 23, 2026

Copy link
Copy Markdown

Fixes: #32

This PR fixes issue 32: that the set sleep timer shortcut/action cannot succeed when the device is locked.

This is a critical feature for those suffering from insomnia. When waking part way through the night, the last thing anyone wants to do is unlock their phone in order to make sure that the podcasts they need to get to sleep don't continue running unrestricted.

With this shortcut fixed and the correct bluetooth-device triggered automation configured, all one needs to do is reconnect their bluetooth sleep mask and they'll get another interval of podcasts with zero risk of them continuing to play for hours.

I also added the ability for the shortcut to natively configure the length of the sleep timer. I've never really be able to figure exactly where the old value came from, it was all a bit magic for me; so now it's possible for the shortcut to be the source-of-truth for what actually gets set when the shortcut runs.

To test

  1. Configure a shortcut that sets a sleep timer of x minutes when a simple trigger happens (eg. bluetooth device connects, or power is connected)
  2. Lock the phone
  3. Cause the trigger to fire by connecting the bluetooth device/connecting power
  4. Unlock the phone and see that the sleep timer is enabled and configured to the right duration.

Checklist

  • I have considered if this change warrants user-facing release notes and have added them to CHANGELOG.md if necessary.
  • I have considered adding unit tests for my changes.
  • I have updated (or requested that someone edit) the Event Horizon schema to reflect any new or changed analytics.

@lparry
lparry requested a review from a team as a code owner July 23, 2026 10:43
@lparry
lparry requested review from kean and removed request for a team July 23, 2026 10:43
@CLAassistant

CLAassistant commented Jul 23, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@kean

kean commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Hey, @lparry. Thanks for the PR! I will review it as soon as I finish with the current project.

@lparry

lparry commented Jul 28, 2026

Copy link
Copy Markdown
Author

Thank you @kean, I've been running with a build from this git sha the past week, and the sleep timer shortcut has been happily running each time when locked now which has been great for my insomnia.

Please let me know if anything needs to be changed or updated to get this over the line, I'm very keen to help get this into trunk and the official app 馃檹

@kean

kean commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

I did a quick test by setting up an Automation and it worked great. I can see how this makes it much more useful, so thanks for addressing it!

I have a couple of questions/observations about the potential changes to the behavior.

  1. The "Set Sleep Timer" shortcut is not longer present in the app under "Profile / Settings / Siri Shortcuts". My understanding is that this is how you add it to Siri. Was the change intentional? Can we still support it?
Screenshot 2026-07-29 at 3 19 45鈥疨M
  1. When you search for Pocket Casts in "Shortcuts" tab in the "Shortcuts" app, it shows only the new migrated actions first. If you select the app, it actually does surface the rest of the shortcuts. I guess it's acceptable considering this is the only shortcut that was migrated for now.

IMG_7825 IMG_7824

@lparry

lparry commented Jul 31, 2026

Copy link
Copy Markdown
Author

Thanks @kean

re: 1, no, that wasn't intentional. I've found the line responsible and reverted that change, and have verified that it now shows back up within Pocketcasts and that the added Siri shortcut appears to run successfully with a locked device.

Screenshot 2026-07-31 at 23 05 54

re: 2, I think you're right and that once an app exposes one modern AppShortcut, the shortcut app begins hiding legacy INShortcut actions until you tap through and get shown the full list.

I could attempt to migrate a few more in a follow-up so that the single action surfaced at the top level doesn't look so lonely if you like?

@kean

kean commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

shows back up within Pocketcasts and that the added Siri shortcut appears to run successfully

Awesome, thank you!

I could attempt to migrate a few more in a follow-up so that the single action surfaced at the top level doesn't look so lonely if you like?

If you're up for it, that would be ideal. I'd suggest doing it in a separate PR. It looks like we'd need to do it sooner than later anyway. I think it'll also be OK to merge as is once 8.18 release branch is cut and finish the migration during the next iteration.

I wonder if there is a way to connect LocalizedStringResource with https://github.com/Automattic/pocket-casts-ios/blob/trunk/podcasts/Strings%2BL10n.swift, which is used in the app for all localizations.

@lparry

lparry commented Aug 12, 2026

Copy link
Copy Markdown
Author

I wonder if there is a way to connect LocalizedStringResource with https://github.com/Automattic/pocket-casts-ios/blob/trunk/podcasts/Strings%2BL10n.swift, which is used in the app for all localizations.

@kean I've had a crack at getting an agent to do this, and have changed the language on my phone and can confirm that the shortcut will show up in Spanish, but I'm not really sure if this last commit is what you were meaning or not. Happy for it to be discarded if it's no good

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.

Siri: see if it's possible to invoke "Set sleep timer" command without unlocking phone

3 participants