Skip to content

Commit

Permalink
Fix: Fixed the backup System.
Browse files Browse the repository at this point in the history
  • Loading branch information
HeCodes2Much committed Dec 4, 2024
1 parent 01efdd4 commit d023d03
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ android {
applicationId = "app.easy.launcher"
minSdk = 24
targetSdk = 35
versionCode = 33
versionName = "0.3.3"
versionCode = 32
versionName = "0.3.2"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
manifestPlaceholders["internetPermission"] = "android.permission.INTERNET"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,11 +397,17 @@ class AppHelper @Inject constructor() {
// Deserialize the JSON into a List<AppInfo>
val appInfoList: List<AppInfo> = 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) {
Expand Down

0 comments on commit d023d03

Please sign in to comment.