-
Notifications
You must be signed in to change notification settings - Fork 1
iOS: stop presenting a suspended app's last reading as current (#147) #253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -75,6 +75,23 @@ final class KilnConnection { | |
| connectionState = .disconnected | ||
| } | ||
|
|
||
| /// Re-establishes the live feed after the app has been suspended (#147). | ||
| /// | ||
| /// iOS tears the WebSocket down within seconds of backgrounding, and the app | ||
| /// declares no background modes, so on return the socket is dead while | ||
| /// `connectionState` still reads `.connected` and the UI presents whatever | ||
| /// reading it had when the phone went in a pocket. Nothing noticed until the | ||
| /// user pulled to refresh. | ||
| /// | ||
| /// Only meaningful when a connection was already established: a foreground | ||
| /// event must not start dialling a kiln the user never connected to, or | ||
| /// overwrite an `.error` they still need to read. | ||
| func resumeIfConnected() { | ||
| guard case .connected = connectionState, !host.isEmpty else { return } | ||
| webSocket.disconnect() | ||
| webSocket.connect(host: host, port: port, apiToken: apiToken) | ||
|
Comment on lines
+91
to
+92
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Whenever Useful? React with 👍 / 👎. |
||
| } | ||
|
|
||
| /// Returns false if the token could not be persisted, so the caller can say | ||
| /// so rather than letting the user discover it as a lockout on next launch | ||
| /// (#151). The in-memory token is still adopted either way — the current | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the app remains suspended beyond 90 seconds,
staleDateonly causes ActivityKit to setActivityViewContext.isStale; it does not replace the displayed state automatically. The lock-screen and Dynamic Island views still rendercurrentTemp, status, and remaining time identically and never inspectcontext.isStale, so the old temperature continues to look current indefinitely despite this timestamp. Update both Live Activity presentations to visibly label or hide stale readings.Useful? React with 👍 / 👎.