Feat(backup): implement advanced app state backup (v2) & dynamic locale hot-reload#42
Open
YisusPineapple wants to merge 7 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request elevates Lune's backup utility from a simple playlist exporter to a robust, full-featured Application State Backup & Restore Engine (Backup v2). It ensures complete data preservation (including favorites, custom covers, and listening history), resolves UI configuration/language lifecycle bugs, and delivers native Material 3 Expressive visual feedback.
Key Enhancements
1. Advanced Application State Backup (
Backup v2Schema)song_overridesdatabase entities [MusicDatabase.kt]. Restoring a backup now seamlessly recovers custom metadata (titles, artists, genres), custom local covers, and all liked/favorite statuses (isFavorite = true).SettingsManagerusing a strongly-typed, nested data structure (SettingsBackupData). This avoids generic GSON parsing issues (such as numbers defaulting to doubles) and guarantees exact restoration of audio, theme, and UI preferences.playback_statstable to ensure that home screen recommendation widgets and listening statistics are preserved across devices.v1backup file is uploaded, the parser gracefully defaults to playlist-only restoration without throwing exceptions.2. Runtime Localization & Theming Hot-Reload
SharedPreferencesduring import did not force Android's localization engine to update the active UI layout.AppCompatDelegate.setApplicationLocales(LocaleListCompat.forLanguageTags(code))with the newly restored language code, followed by an immediateactivity.recreate()call. This dynamically re-loads the entire layout tree (applying theme, custom colors, and language) without requiring a manual app restart.3. Material 3 Expressive Loader & Thread Stabilization
AlertDialogduring file I/O operations.CircularWavyProgressIndicatorpowered by a smooth infinite loop transition, making it extremely friendly on modest devices.1200mscoroutine delay. This guarantees SQLite write-ahead logging (WAL) and journal files on disk are fully flushed and synchronized before the Activity context is torn down and recreated.4. Spanish Localization Alignment
values-es/strings.xml):"Cover player"➔"Carátula del reproductor""Control player"➔"Controles del reproductor""Export/Import Playlists"➔"Exportar/Importar copia de seguridad"Technical Details & Architecture
Dispatchers.IOto protectDispatchers.Mainfrom frame drops or UI janks.-keep class com.demonlab.lune.tools.** { *; }).Testing Performed
v2JSON, and verified that playlists, custom colors, equalizer presets, home screen statistics, and song favorite stars restored successfully.v1backup files (containing only playlists) are still parsed and restored successfully.