Skip to content

Commit f2d45ce

Browse files
committed
Fix import/export json data casting for folders
1 parent 8e6e008 commit f2d45ce

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

.idea/deviceManager.xml

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ android {
1616
minSdk = libs.versions.minSdk.get().toInt()
1717
targetSdk = libs.versions.targetSdk.get().toInt()
1818
multiDexEnabled = true
19-
versionCode = 30
20-
versionName = "1.6.2"
19+
versionCode = 31
20+
versionName = "1.6.3"
2121
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
2222

2323
ksp {

app/src/main/java/com/amrdeveloper/linkhub/data/DataPackage.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package com.amrdeveloper.linkhub.data
22

3+
import androidx.annotation.Keep
34
import com.google.gson.annotations.SerializedName
45

6+
@Keep
57
data class DataPackage(
68

79
@SerializedName("folders")

app/src/main/java/com/amrdeveloper/linkhub/data/parser/JsonImportExportFileParser.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,16 @@ class JsonImportExportFileParser : ImportExportFileParser {
2121

2222
val folders = dataPackage.folders
2323
// This code should be removed after found why it not serialized on some devices (see Issue #23)
24-
// folderColor field is declared as non nullable type but in this case GSON will break the null safty feature
24+
// folderColor field is declared as non nullable type but in this case GSON will break the null safety feature
2525
folders.forEach { if (it.folderColor == null) it.folderColor = FolderColor.BLUE }
2626
folderRepository.insertFolders(folders)
2727

2828
linkRepository.insertLinks(dataPackage.links)
2929
return Result.success(dataPackage)
3030
} catch (e: JsonSyntaxException) {
3131
return Result.failure(e)
32+
} catch (e: Exception) {
33+
return Result.failure(e)
3234
}
3335
}
3436

0 commit comments

Comments
 (0)