feat(ios): add background and long-running sync Shortcuts - #370
Draft
devnoname120 wants to merge 2 commits into
Draft
devnoname120 wants to merge 2 commits into
devnoname120 wants to merge 2 commits into
Conversation
Route Sync Data through a shared headless-capable Flutter engine and the existing band ownership and commit-before-ACK persistence path. Add opt-in connectivity-error suppression, an interactive foreground fallback, and Dart/native/system-invocation regression tests.
Expose Sync Data (Long Running) on iOS 27 with extended execution, system-managed progress, and cancellation through the shared sync bridge. Keep the ordinary action and deployment target unchanged, and cover the additional intent with native and system-invocation tests.
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Reviewer's GuideAdds iOS Shortcuts support for bounded synchronization on iOS 16+ and an iOS 27 long-running variant, backed by a shared readiness-aware Flutter bridge, serialized BLE ownership, commit-before-ACK persistence, truthful result/progress reporting, and extensive native, Dart, and system-invocation coverage. Sequence diagram for an iOS Shortcut band syncsequenceDiagram
actor User
participant Shortcuts
participant SyncDataIntent
participant ShortcutSyncBridge
participant Flutter
participant BleEngine
participant BandHost
participant Band
User->>Shortcuts: Run Sync Data
Shortcuts->>SyncDataIntent: perform()
SyncDataIntent->>ShortcutSyncBridge: sync()
ShortcutSyncBridge->>Flutter: run(id, budgetMs)
Flutter-->>ShortcutSyncBridge: ready
Flutter->>BleEngine: runSync(timeout)
BleEngine->>Band: Synchronize history
BleEngine->>BandHost: commitNativeBatch(...)
BandHost-->>BleEngine: Data committed
BleEngine-->>Flutter: complete or partial result
Flutter-->>ShortcutSyncBridge: Correlated reply
ShortcutSyncBridge-->>SyncDataIntent: ShortcutSyncReply
SyncDataIntent-->>Shortcuts: Result message
State diagram for Shortcut sync outcomesstateDiagram-v2
[*] --> WaitingForDart
WaitingForDart --> Running: ready
WaitingForDart --> TimedOut: deadline reached
Running --> Connecting: paired and Bluetooth available
Running --> AlreadyRunning: BLE ownership unavailable
Running --> Skipped: bluetoothUnavailable or bandUnreachable
Running --> Failed: pairing, permission, setup, storage, or startup error
Connecting --> Syncing: band reachable
Connecting --> Skipped: bandUnreachable and ignore enabled
Connecting --> Failed: connection failure
Syncing --> Partial: deadline, cancellation, or early transfer end
Syncing --> Persisting: batch received
Persisting --> Syncing: commitNativeBatch succeeds
Persisting --> Failed: persistence failure
Syncing --> Completed: transfer finished and backlog drained
Completed --> [*]
Partial --> [*]
AlreadyRunning --> [*]
Skipped --> [*]
Failed --> [*]
TimedOut --> [*]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Expose explicit band-sync actions for Shortcuts and personal automations without requiring the Edge interface to open. These provide additional synchronization opportunities; they do not guarantee that iOS will run or finish every scheduled invocation.
Changes
Skipped:result only for Bluetooth unavailable or the paired band being unreachable. Missing pairing, denied permission, unfinished accessory setup, storage, startup, and other failures still produce errors. This option does not suppress independent iOS/Shortcuts notifications or system progress UI.LongRunningIntentandCancellableIntenton iOS 27 with Xcode 27 or later. It reports saved-batch progress without inventing a percentage and has an application-imposed ten-minute ceiling, not a guaranteed runtime grant. The ordinary action supports iOS 16 and later; the application deployment target is unchanged.ShortcutIntentssystem-invocation test scheme, andguides/IOS_SHORTCUTS.md.Results distinguish completed transfer, partial progress, an existing request, and skipped connectivity failures. Starting asynchronous work is not reported as completed synchronization.
Separate commits
Long-running support is deliberately isolated so it can be moved to a separate stacked PR. It depends on the shared infrastructure in the first commit.
Recorded validation
System-invocation tests cover background execution, relaunch after termination without opening a window, the foreground fallback, and long-running invocation. Clean-simulator integration tests reach the real Flutter bridge and expect a missing-pairing error; they do not establish successful Bluetooth transfer.
Physical-device installation used ignored local identity overrides to keep the existing installation and App Group separate. Those overrides are not included in these commits.
Remaining device validation
Keeping this PR in draft until real-band and unattended-automation testing is complete:
The device installation check did not pair a band or invoke synchronization.
Summary by Sourcery
Expose reliable, bounded iOS Shortcut synchronization for paired bands, including optional long-running execution on iOS 27, while preserving truthful results and shared BLE ownership.
New Features:
Bug Fixes:
Enhancements:
Build:
Documentation:
Tests: