iOS: Siri and Shortcuts, and a widget (#427, #428)

Siri: App Intents with phrases that need no setup: Resume, Pause,
Skip forward, Skip back, Set a sleep timer, How many unread. The
playback ones are AudioPlaybackIntents, run in the app and allowed to
start audio from the background. Playback is now one shared instance
(Playback.shared) so Siri and the widget reach it with no page loaded.
It remembers the last episode and its place (LastPlayed), so Resume
works with the app closed; the page, opened afterwards, does not know
about an episode started that way.

Widget: small and medium on the home screen, circular and rectangular
on the lock screen. It shows the unread count and the last episode,
with a Resume or Pause button (PlayPauseIntent, shared with Siri). It
draws what the app writes to the App Group group.net.sdf1.ipx. The app
asks for a redraw on play, pause, a new episode or a new count, not on
every position, since iOS rations redraws. Shared/ builds into both
targets, with WIDGET set in the widget's, where the player does not
exist.

ipx's push now carries content-available, which wakes the closed app
for a moment to give the widget the count the icon just got (#433).

Tested: unit tests for the snapshot and the remembered place, 19 in
all; in the simulator, playing an episode wrote the snapshot to the
App Group. Not testable there: Siri, and the widget drawn.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ray Slakinski
2026-11-08 19:32:43 -05:00
parent 8f888ae10e
commit f844cf349a
17 changed files with 503 additions and 13 deletions

View File

@@ -19,16 +19,19 @@ targets:
platform: iOS
sources:
- Sources
- Shared
- Resources/Assets.xcassets
dependencies:
- target: iPXWidgets
info:
path: Resources/Info.plist
properties:
CFBundleDisplayName: iPX
CFBundleShortVersionString: $(MARKETING_VERSION)
CFBundleVersion: "11"
CFBundleVersion: "12"
# Playing on with the screen locked. A plist key, not a signed entitlement, so it works on
# a free personal team; CarPlay's own dashboard app is an entitlement Apple has to grant.
UIBackgroundModes: [audio, fetch]
UIBackgroundModes: [audio, fetch, remote-notification]
# The unread badge's refresh while the app is closed (#421).
BGTaskSchedulerPermittedIdentifiers: [net.sdf1.ipx.refresh]
# HTTPS only, so TestFlight need not ask the export-compliance question on every build.
@@ -61,6 +64,8 @@ targets:
path: Resources/iPX.entitlements
properties:
aps-environment: development
# Shared with the widget (#428), which reads what the app last knew from it.
com.apple.security.application-groups: [group.net.sdf1.ipx]
settings:
base:
PRODUCT_BUNDLE_IDENTIFIER: net.sdf1.ipx
@@ -79,6 +84,34 @@ targets:
/usr/libexec/PlistBuddy -c "Add :WKAppBoundDomains: string localhost" "$TARGET_BUILD_DIR/$INFOPLIST_PATH"
fi
# The widget (#428): the unread count and the last episode, from what the app writes to the App
# Group. Its build number has to match the app's, or App Store Connect refuses the upload.
iPXWidgets:
type: app-extension
platform: iOS
sources:
- Widgets
- Shared
info:
path: Widgets/Info.plist
properties:
CFBundleDisplayName: iPX
CFBundleShortVersionString: $(MARKETING_VERSION)
CFBundleVersion: "12"
NSExtension:
NSExtensionPointIdentifier: com.apple.widgetkit-extension
entitlements:
path: Widgets/iPXWidgets.entitlements
properties:
com.apple.security.application-groups: [group.net.sdf1.ipx]
settings:
base:
PRODUCT_BUNDLE_IDENTIFIER: net.sdf1.ipx.widgets
MARKETING_VERSION: "0.1.0"
DEVELOPMENT_TEAM: 8743L8D729
# Shared/ is built here too, where the app's player does not exist.
SWIFT_ACTIVE_COMPILATION_CONDITIONS: $(inherited) WIDGET
iPXTests:
type: bundle.unit-test
platform: iOS