forked from upstream-mirrors/quik
Use moshi codegen for release, update proguard
This commit is contained in:
+1
-1
@@ -20,7 +20,7 @@ buildscript {
|
||||
ext.lifecycle_version = '2.0.0'
|
||||
ext.material_version = '1.0.0'
|
||||
ext.mockito_version = '2.18.3'
|
||||
ext.moshi_version = '1.6.0'
|
||||
ext.moshi_version = '1.8.0'
|
||||
ext.okhttp3_version = '4.1.0'
|
||||
ext.realm_version = '5.8.0'
|
||||
ext.realm_adapters_version = '3.1.0'
|
||||
|
||||
@@ -22,6 +22,7 @@ import android.content.Context
|
||||
import com.moez.QKSMS.common.util.extensions.versionCode
|
||||
import com.moez.QKSMS.util.Preferences
|
||||
import com.squareup.moshi.Json
|
||||
import com.squareup.moshi.JsonClass
|
||||
import com.squareup.moshi.Moshi
|
||||
import io.reactivex.Single
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
@@ -88,15 +89,18 @@ class ChangelogManagerImpl @Inject constructor(
|
||||
prefs.changelogVersion.set(context.versionCode)
|
||||
}
|
||||
|
||||
private data class ChangelogResponse(
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class ChangelogResponse(
|
||||
@Json(name = "documents") val documents: List<Document>
|
||||
)
|
||||
|
||||
private data class Document(
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class Document(
|
||||
@Json(name = "fields") val fields: Changelog
|
||||
)
|
||||
|
||||
private data class Changelog(
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class Changelog(
|
||||
@Json(name = "added") val added: ArrayField?,
|
||||
@Json(name = "improved") val improved: ArrayField?,
|
||||
@Json(name = "fixed") val fixed: ArrayField?,
|
||||
@@ -104,19 +108,23 @@ class ChangelogManagerImpl @Inject constructor(
|
||||
@Json(name = "versionCode") val versionCode: IntegerField
|
||||
)
|
||||
|
||||
private data class ArrayField(
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class ArrayField(
|
||||
@Json(name = "arrayValue") val value: ArrayValues
|
||||
)
|
||||
|
||||
private data class ArrayValues(
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class ArrayValues(
|
||||
@Json(name = "values") val values: List<StringField>
|
||||
)
|
||||
|
||||
private data class StringField(
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class StringField(
|
||||
@Json(name = "stringValue") val value: String
|
||||
)
|
||||
|
||||
private data class IntegerField(
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class IntegerField(
|
||||
@Json(name = "integerValue") val value: String
|
||||
)
|
||||
|
||||
|
||||
@@ -160,12 +160,16 @@ dependencies {
|
||||
testImplementation "junit:junit:$junit_version"
|
||||
testImplementation "org.mockito:mockito-core:$mockito_version"
|
||||
|
||||
// moshi
|
||||
implementation "com.squareup.moshi:moshi:$moshi_version"
|
||||
debugImplementation "com.squareup.moshi:moshi-kotlin:$moshi_version"
|
||||
kaptRelease "com.squareup.moshi:moshi-kotlin-codegen:$moshi_version"
|
||||
|
||||
implementation "com.android.billingclient:billing:1.0"
|
||||
implementation "com.github.chrisbanes:PhotoView:2.0.0"
|
||||
implementation "com.f2prateek.rx.preferences2:rx-preferences:$rx_preferences_version"
|
||||
implementation "com.google.android:flexbox:0.3.1"
|
||||
implementation "com.jakewharton.timber:timber:$timber_version"
|
||||
implementation "com.squareup.moshi:moshi:$moshi_version"
|
||||
implementation "com.squareup.moshi:moshi-kotlin:$moshi_version"
|
||||
implementation "me.leolin:ShortcutBadger:1.1.21"
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
|
||||
Vendored
+62
@@ -17,6 +17,7 @@
|
||||
# okio
|
||||
-dontwarn okio.**
|
||||
|
||||
# okhttp3
|
||||
# JSR 305 annotations are for embedding nullability information.
|
||||
-dontwarn javax.annotation.**
|
||||
|
||||
@@ -28,3 +29,64 @@
|
||||
|
||||
# OkHttp platform used only on JVM and when Conscrypt dependency is available.
|
||||
-dontwarn okhttp3.internal.platform.ConscryptPlatform
|
||||
|
||||
# moshi
|
||||
# JSR 305 annotations are for embedding nullability information.
|
||||
-dontwarn javax.annotation.**
|
||||
|
||||
-keepclasseswithmembers class * {
|
||||
@com.squareup.moshi.* <methods>;
|
||||
}
|
||||
|
||||
-keep @com.squareup.moshi.JsonQualifier interface *
|
||||
|
||||
# Enum field names are used by the integrated EnumJsonAdapter.
|
||||
# Annotate enums with @JsonClass(generateAdapter = false) to use them with Moshi.
|
||||
-keepclassmembers @com.squareup.moshi.JsonClass class * extends java.lang.Enum {
|
||||
<fields>;
|
||||
}
|
||||
|
||||
# The name of @JsonClass types is used to look up the generated adapter.
|
||||
-keepnames @com.squareup.moshi.JsonClass class *
|
||||
|
||||
# Retain generated target class's synthetic defaults constructor and keep DefaultConstructorMarker's
|
||||
# name. We will look this up reflectively to invoke the type's constructor.
|
||||
#
|
||||
# We can't _just_ keep the defaults constructor because Proguard/R8's spec doesn't allow wildcard
|
||||
# matching preceding parameters.
|
||||
-keepnames class kotlin.jvm.internal.DefaultConstructorMarker
|
||||
-keepclassmembers @com.squareup.moshi.JsonClass class * {
|
||||
<init>(...);
|
||||
}
|
||||
|
||||
# Retain generated JsonAdapters if annotated type is retained.
|
||||
-if @com.squareup.moshi.JsonClass class *
|
||||
-keep class <1>JsonAdapter {
|
||||
<init>(...);
|
||||
<fields>;
|
||||
}
|
||||
-if @com.squareup.moshi.JsonClass class **$*
|
||||
-keep class <1>_<2>JsonAdapter {
|
||||
<init>(...);
|
||||
<fields>;
|
||||
}
|
||||
-if @com.squareup.moshi.JsonClass class **$*$*
|
||||
-keep class <1>_<2>_<3>JsonAdapter {
|
||||
<init>(...);
|
||||
<fields>;
|
||||
}
|
||||
-if @com.squareup.moshi.JsonClass class **$*$*$*
|
||||
-keep class <1>_<2>_<3>_<4>JsonAdapter {
|
||||
<init>(...);
|
||||
<fields>;
|
||||
}
|
||||
-if @com.squareup.moshi.JsonClass class **$*$*$*$*
|
||||
-keep class <1>_<2>_<3>_<4>_<5>JsonAdapter {
|
||||
<init>(...);
|
||||
<fields>;
|
||||
}
|
||||
-if @com.squareup.moshi.JsonClass class **$*$*$*$*$*
|
||||
-keep class <1>_<2>_<3>_<4>_<5>_<6>JsonAdapter {
|
||||
<init>(...);
|
||||
<fields>;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
<uses-permission android:name="android.permission.CALL_PHONE" />
|
||||
<!-- Used for starting foreground service for backup/restore on Android P+ -->
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.READ_CONTACTS" />
|
||||
<uses-permission android:name="android.permission.READ_SMS" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
|
||||
Reference in New Issue
Block a user