Skip to content

Commit 42388a8

Browse files
Surjit Kumar SahooSurjit Kumar Sahoo
authored andcommitted
refactor: Migrate JSON serialization from Gson to Moshi, adjust ProGuard rules and domain models, and update application ID.
1 parent 9296632 commit 42388a8

File tree

5 files changed

+30
-16
lines changed

5 files changed

+30
-16
lines changed

app/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ android {
5050
defaultConfig {
5151
val commitHash = gitCommitHash()
5252

53-
applicationId = "org.surjit.kahani"
53+
applicationId = "com.kahani.app"
5454
minSdk = 28
5555
targetSdk = 36
5656
versionCode = project.property("appVersionCode").toString().toInt()

app/proguard-rules.pro

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
1-
# Gson uses generic type information stored in a class file when working with
2-
# fields. Proguard removes such information by default, keep it.
3-
-keepattributes Signature
4-
5-
# This is also needed for R8 in compat mode since multiple
6-
# optimizations will remove the generic signature such as class
7-
# merging and argument removal. See:
8-
# https://r8.googlesource.com/r8/+/refs/heads/main/compatibility-faq.md#troubleshooting-gson-gson
9-
-keep class com.google.gson.reflect.TypeToken { *; }
10-
-keep class * extends com.google.gson.reflect.TypeToken
11-
12-
# Optional. For using GSON @Expose annotation
13-
-keepattributes AnnotationDefault,RuntimeVisibleAnnotations
14-
-keep class com.google.gson.reflect.TypeToken { <fields>; }
15-
-keepclassmembers class **$TypeAdapterFactory { <fields>; }
1+
# Moshi
2+
-keepclassmembers class * {
3+
@com.squareup.moshi.Json <fields>;
4+
}
5+
6+
# Keep the generated JSON adapters.
7+
-keep class *JsonAdapter { *; }
8+
-keep class org.grakovne.lissen.lib.domain.** { *; }
9+
10+
# Keep Moshi's internal classes that use reflection.
11+
-keep class com.squareup.moshi.** { *; }
12+
-keep interface com.squareup.moshi.** { *; }
13+
14+
# Attributes for Moshi's reflection.
15+
-keepattributes Signature, AnnotationDefault, RuntimeVisibleAnnotations, InnerClasses, EnclosingMethod
16+
17+
# Hilt and Dagger rules (usually bundled, but good to ensure)
18+
-keep class dagger.hilt.android.internal.** { *; }
19+
-keep class *__HiltBindingModule { *; }
20+
-keep class org.grakovne.lissen.**_HiltComponents$* { *; }

lib/src/main/kotlin/org/grakovne/lissen/lib/domain/CacheStatus.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package org.grakovne.lissen.lib.domain
22

3+
import androidx.annotation.Keep
4+
5+
@Keep
36
sealed class CacheStatus {
47
data object Idle : CacheStatus()
58

lib/src/main/kotlin/org/grakovne/lissen/lib/domain/LibraryType.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package org.grakovne.lissen.lib.domain
22

3+
import androidx.annotation.Keep
4+
5+
@Keep
36
enum class LibraryType {
47
LIBRARY,
58
PODCAST,

lib/src/main/kotlin/org/grakovne/lissen/lib/domain/NetworkType.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package org.grakovne.lissen.lib.domain
22

3+
import androidx.annotation.Keep
4+
5+
@Keep
36
enum class NetworkType {
47
WIFI,
58
CELLULAR

0 commit comments

Comments
 (0)