diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 69cef36..928f767 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -19,7 +19,8 @@ android { buildTypes { getByName("release") { isMinifyEnabled = true - proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + isShrinkResources = true + proguardFiles("shrinker-rules.pro") } } diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro deleted file mode 100644 index f1b4245..0000000 --- a/app/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile diff --git a/app/shrinker-rules.pro b/app/shrinker-rules.pro new file mode 100644 index 0000000..5100c88 --- /dev/null +++ b/app/shrinker-rules.pro @@ -0,0 +1,66 @@ +# GENERAL OPTIONS + +# turn on all optimizations except those that are known to cause problems on Android +-optimizations !code/simplification/cast,!field/*,!class/merging/* +-optimizationpasses 6 +-overloadaggressively +-allowaccessmodification +-dontpreverify + +-dontusemixedcaseclassnames +-dontskipnonpubliclibraryclasses +-keepattributes *Annotation* + +# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native +-keepclasseswithmembernames class * { + native ; +} +# keep setters in Views so that animations can still work. +# see http://proguard.sourceforge.net/manual/examples.html#beans +-keepclassmembers public class * extends android.view.View { + void set*(***); + *** get*(); +} +# We want to keep methods in Activity that could be used in the XML attribute onClick +-keepclassmembers class * extends android.app.Activity { + public void *(android.view.View); +} +# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations +-keepclassmembers enum * { + public static **[] values(); + public static ** valueOf(java.lang.String); +} +-keepclassmembers class * implements android.os.Parcelable { + public static final ** CREATOR; +} + +# PIXELCAT SPECIFIC OPTIONS + +# preserve line numbers for crash reporting +-keepattributes SourceFile,LineNumberTable +-renamesourcefileattribute SourceFile + +# remove all logging +-assumenosideeffects public class android.util.Log { + public static *** v(...); + public static *** d(...); + public static *** i(...); + public static *** w(...); + public static *** e(...); + public static *** wtf(...); + public static *** getStackTraceString(...); +} + +-assumenosideeffects class java.lang.String { + public static java.lang.String format(...); +} + +# remove some kotlin overhead +-assumenosideeffects class kotlin.jvm.internal.Intrinsics { + static void checkNotNull(java.lang.Object); + static void checkNotNullParameter(java.lang.Object, java.lang.String); + static void checkParameterIsNotNull(java.lang.Object, java.lang.String); + static void checkExpressionValueIsNotNull(java.lang.Object, java.lang.String); + static void checkNotNullExpressionValue(java.lang.Object, java.lang.String); + static void throwUninitializedPropertyAccessException(java.lang.String); +} diff --git a/app/src/main/kotlin/at/connyduck/pixelcat/model/Attachment.kt b/app/src/main/kotlin/at/connyduck/pixelcat/model/Attachment.kt index ed9398c..fceb778 100644 --- a/app/src/main/kotlin/at/connyduck/pixelcat/model/Attachment.kt +++ b/app/src/main/kotlin/at/connyduck/pixelcat/model/Attachment.kt @@ -32,6 +32,7 @@ data class Attachment( val description: String? ) { + @JsonClass(generateAdapter = false) enum class Type { @Json(name = "image") IMAGE, diff --git a/app/src/main/kotlin/at/connyduck/pixelcat/model/Status.kt b/app/src/main/kotlin/at/connyduck/pixelcat/model/Status.kt index 833fbfc..5e54111 100644 --- a/app/src/main/kotlin/at/connyduck/pixelcat/model/Status.kt +++ b/app/src/main/kotlin/at/connyduck/pixelcat/model/Status.kt @@ -51,6 +51,7 @@ data class Status( val actionableStatus: Status get() = reblog ?: this + @JsonClass(generateAdapter = false) enum class Visibility { UNKNOWN, @Json(name = "public")