jkuester / unlauncher

Android minimalistic launcher
https://jkuester.github.io/unlauncher/
MIT License
319 stars 47 forks source link

Fix quick button preferences to not break when app is updated #142

Closed jkuester closed 1 year ago

jkuester commented 1 year ago

The Quick Button preferences were storing the Resource Id of the icon that should be shown. Unfortunately, Android Resource Ids are not consistent between different versions of an app. So, upgrading the app changes all the Resource Ids (and the stored preference values no longer mapped to actual resources).

I have updated the value stored for the preference to just be an arbitrary Int value that I have manually mapped to the various Icon resources. This seems best because I can reuse the same proto data structure to store the preference, but it will also remain consistent between different versions of the app.

I have added a new migration for the Quick Button preferences that will set the default icon pref values for any of the quick buttons that is not currently associated with a valid icon. This does two things. For anyone upgrading from 1.3.0, this migration will reset their Quick Button preferences to the default values (unfortunately their custom Quick Button settings will not be recoverable). This will prevent the app from crashing if someone upgrades after updating their Quick Buttons in 1.3.0. The second thing the migration does is simply provide default values for a new installation.

Closes https://github.com/jkuester/unlauncher/issues/129