Skip to content

Fix stale iOS Live Activities after app exit - #1265

Draft
Explainfuture wants to merge 1 commit into
lollipopkit:mainfrom
Explainfuture:codex/fix-ios-live-activity-cleanup
Draft

Fix stale iOS Live Activities after app exit#1265
Explainfuture wants to merge 1 commit into
lollipopkit:mainfrom
Explainfuture:codex/fix-ios-live-activity-cleanup

Conversation

@Explainfuture

Copy link
Copy Markdown

Summary

  • end terminal Live Activities when a UIScene session is discarded from the app switcher
  • recover and end every ActivityKit activity instead of relying on an in-memory reference
  • clear orphaned activities before new terminal sessions are registered after launch
  • route bulk server deletion through ServersNotifier so connection sessions and Live Activities are cleaned up

Root cause

The iOS implementation kept only LiveActivityManager.current. That reference is lost when the process exits even though ActivityKit intentionally keeps the Live Activity alive. A later stop request therefore had no activity to end and updates could create duplicates.

The project also uses the UIScene lifecycle, where applicationWillTerminate is not a reliable callback for a user closing the app from the app switcher. In addition, the settings bulk-delete path removed storage entries directly and bypassed the session cleanup performed by ServersNotifier.delServer.

Impact

Closing ServerBox from the iOS app switcher or deleting the connected server no longer leaves a stale "Connected" Live Activity in the Dynamic Island. Interrupted prior runs are reconciled on the next launch.

Validation

  • flutter analyze lib test
  • flutter test (462 tests passed)
  • git diff --check

An iOS/Xcode build was not available on the Windows development host.

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d613beac-c6a1-48f4-93ad-81e72481c5f1

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant