robrix
robrix copied to clipboard
Handle app lifecycle events: `Pause`, `Resume`, etc
Description
Implements handling for app lifecycle events as requested in #458.
Changes
- Added
Event::Pausehandler to save app state and stop sync service - Added
Event::Resume/Event::Foregroundhandler to restore state and restart sync service - Added
Event::Backgroundhandler for fallback state saving - Implemented redundancy tracking to avoid duplicate saves across lifecycle events
Testing
- ✅ Code compiles without errors
- ⚠️ Unable to test on iOS (no device available)
Fixes #458
@kevinaboos Apologies for the delay in responding. Thank you for the detailed review and guidance. Since this is my first time working with app lifecycle events, it took me some time to fully understand your feedback and refactor the code. I've tested this on my Ubuntu 22.04 laptop (window minimize/restore cycles, shutdown/restart) and verified that state persistence works. Unfortunately I don't have access to a suitable mobile device to test the mobile behavior. Please let me know if there's anything else that needs adjustment. Thanks again for the thorough review!