digidem / mapeo-core-next

The upcoming version of Mapeo Core
MIT License
7 stars 1 forks source link

feat: add "on backgrounded" function #611

Closed EvanHahn closed 1 month ago

EvanHahn commented 2 months ago

MapeoManager#onBackgrounded() should be called when the app goes into the background. It will do its best to gracefully shut down sync.

Closes #576.

EvanHahn commented 2 months ago

Simplified this a bunch (I think).

When the app is in the background and sync is complete, cores will be un-replicated. There is no longer an auto-stop timeout, but it should be easy to add in the future.

There are now two booleans: wantsToSyncData and isBackgrounded.

After these operations and when the state is updated, #updateState() is called. This figures out the desired SyncEnabledState and applies it.

EvanHahn commented 2 months ago

Thanks for all the review here. Hopefully this is the last round!