Skip to content

[Bug] Draft content lost when Android kills the app while composing #4424

@chibenwa

Description

@chibenwa

Problem

While composing a new email on Android, if you switch to another app (e.g. to reply to a notification or browse the web), Android can silently kill the Twake Mail process in the background to free up
memory. When you tap the Twake Mail icon again, the app restarts from scratch and the email you were writing is gone.

Root cause

The composer has no automatic draft saving on mobile. Content only survives if the user explicitly taps "Save draft" or closes the composer and confirms the save dialog. There is no AppLifecycleState
listener in the composer — so when Android terminates the process, the in-memory draft is lost with no recovery. (The web version already handles this via session storage on browser unload, but nothing
equivalent exists for Android/iOS.)

Fix

Add an AppLifecycleListener in ComposerController that triggers an automatic draft save when the app transitions to paused state. This ensures the draft is persisted to the server before the process is
potentially killed, and the user can resume from the Drafts folder.

Metadata

Metadata

Assignees

No one assigned

    Labels

    CriticalbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions