From 9fd1aea9e233840430ffbff35158644d37f0fb60 Mon Sep 17 00:00:00 2001 From: HeCodes2Much Date: Wed, 4 Dec 2024 18:43:06 +0000 Subject: [PATCH] Fix: Fixed the backup System. --- CHANGELOG.md | 8 ++------ .../github/droidworksstudio/launcher/helper/AppHelper.kt | 8 +++++++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 092c18b..428673e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,12 +4,6 @@ All notable changes to this project will be documented in this file. See [conven ## [Coming Soon](https://github.com/DroidWorksStudio/EasyLauncher/tree/HEAD) -### Releases: - -- Prepare for version 0.3.3 - ([c82c05e](https://github.com/DroidWorksStudio/EasyLauncher/commit/c82c05e1c6b33f5936a442f0764482d4cd2d9221)) - -## [0.3.2](https://github.com/DroidWorksStudio/EasyLauncher/tree/0.3.2) - (04, December 2024) - ### Implemented Enhancements: - Added the ability for restore to also run a clear list before restoring. - ([ac4456d](https://github.com/DroidWorksStudio/EasyLauncher/commit/ac4456dac42445d7cee3c51b549a7c4542268367)) @@ -17,6 +11,7 @@ All notable changes to this project will be documented in this file. See [conven ### Bug Fixes: +- Fixed the backup System. - ([d023d03](https://github.com/DroidWorksStudio/EasyLauncher/commit/d023d03428ba2ccb5b3ba637e7c8a794a7641f2c)) - Fixed a few issues with app draw including icons as well as work profile stuff. - ([66065b7](https://github.com/DroidWorksStudio/EasyLauncher/commit/66065b76f8b5dc3673af349570287816ed057fb1)) - First start with filter when filterStrength is set to 0 - ([ff7ecb1](https://github.com/DroidWorksStudio/EasyLauncher/commit/ff7ecb149186645d1990da863afee80b596428f0)) - Fixed the search feature to only show items not hidden. - ([846ba48](https://github.com/DroidWorksStudio/EasyLauncher/commit/846ba486374b988c7f7f6cfd636f3aede8f24701)) @@ -38,6 +33,7 @@ All notable changes to this project will be documented in this file. See [conven ### Releases: +- Prepare for version 0.3.3 - ([c82c05e](https://github.com/DroidWorksStudio/EasyLauncher/commit/c82c05e1c6b33f5936a442f0764482d4cd2d9221)) - Prepare for version 0.3.2 - ([8aebf00](https://github.com/DroidWorksStudio/EasyLauncher/commit/8aebf00cdf14026abc25793ba9f303fce09fe1c2)) ## [0.3.1](https://github.com/DroidWorksStudio/EasyLauncher/tree/0.3.1) - (01, December 2024) diff --git a/app/src/main/java/com/github/droidworksstudio/launcher/helper/AppHelper.kt b/app/src/main/java/com/github/droidworksstudio/launcher/helper/AppHelper.kt index 2b24d46..e97098c 100644 --- a/app/src/main/java/com/github/droidworksstudio/launcher/helper/AppHelper.kt +++ b/app/src/main/java/com/github/droidworksstudio/launcher/helper/AppHelper.kt @@ -397,11 +397,17 @@ class AppHelper @Inject constructor() { // Deserialize the JSON into a List val appInfoList: List = gson.fromJson(jsonReader, type) + // Modify the list to reset IDs (ignore the original ID) + val resetAppInfoList = appInfoList.mapIndexed { index, appInfo -> + appInfo.copy(id = index) // Assign a new sequential ID starting from 0 + } + // Clear all apps first resetDatabase(dao) // Reinsert data into the database - dao.restoreAll(appInfoList) // Execute the method + Thread.sleep(500) + dao.restoreAll(resetAppInfoList) // Execute the method } ?: throw Exception("Failed to open input stream from URI") } catch (e: JsonSyntaxException) {