Skip to content
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

Save the settings in more cases to avoid losing setting changes #14266

Merged
merged 6 commits into from Jan 23, 2024

Conversation

grorp
Copy link
Member

@grorp grorp commented Jan 17, 2024

Fixes #14229.

On Android, closing the app via the "Recents screen" won't result in a clean shutdown, discarding any setting changes made by the user.

To avoid that, this PR writes the settings file in some more cases on all platforms, and in even more cases on Android (see the diff). My changes were originally limited to the Android version to avoid problems with multiple instances of Minetest running at the same time, but sfan5 said that doesn't matter.

Note that there are probably still some cases where you can lose setting changes because this is just a workaround. While this is still a workaround, it should be 99.99% reliable now.

An alternative approach would be to ensure a clean shutdown when closing the app from the "Recents screen", but that's much more complicated (as far as I can tell) and I'd like to fix this bug sooner rather than later.

To do

This PR is a Ready for Review.

How to test

Close Minetest on Android from the "Recents screen". Verify that any setting changes you've made are persisted.

builtin/mainmenu/misc.lua Outdated Show resolved Hide resolved
builtin/mainmenu/settings/dlg_settings.lua Outdated Show resolved Hide resolved
@grorp grorp changed the title Android: Fix settings not saving when closing app via "Recents" screen Save the settings in more cases to avoid losing setting changes Jan 18, 2024
@grorp
Copy link
Member Author

grorp commented Jan 19, 2024

I plan to make this even more reliable by saving settings in activity onStop.

@grorp grorp marked this pull request as draft January 19, 2024 17:24
@grorp
Copy link
Member Author

grorp commented Jan 22, 2024

This is still a workaround, but with the onStop callback, it should be 99.99% reliable now.

@grorp grorp marked this pull request as ready for review January 22, 2024 14:54
@grorp grorp merged commit a29d3cf into minetest:master Jan 23, 2024
15 checks passed
@grorp
Copy link
Member Author

grorp commented Jan 23, 2024

@grorp grorp deleted the android-save-settings branch January 23, 2024 20:33
grorp added a commit to grorp/minetest that referenced this pull request Apr 15, 2024
grorp added a commit to grorp/minetest that referenced this pull request Apr 15, 2024
grorp added a commit to grorp/minetest that referenced this pull request Apr 21, 2024
grorp added a commit that referenced this pull request May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

settings don't save on android when closing app via "Recents" screen
2 participants