#Blesh ---------------------------------------------------------------------------------------------
-verbose
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
-optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/*
-optimizations !method/inlining/*
-optimizationpasses 5

-allowaccessmodification
-repackageclasses 'com.blesh.sdk.core.aa'
-useuniqueclassmembernames

-renamesourcefileattribute SourceFile
-keepattributes InnerClasses, EnclosingMethod, Exceptions, Deprecated, SourceFile, LineNumberTable, Signature, *Annotation*

-dontwarn com.blesh.sdk.core.**
-keep class com.blesh.sdk.core.Blesh { *; }
-keep class com.blesh.sdk.core.service.models.** { *; }
-keep,allowshrinking,allowobfuscation class com.blesh.sdk.core.** { *; }

# Log removal
-assumenosideeffects class android.util.Log {
    public static int v(...);
    public static int w(...);
    public static int d(...);
    public static int e(...);
    public static int wtf(...);
}

#Okhttp --------------------------------------------------------------------------------------------
# Ignore JSR 305 annotations are for embedding nullability information.
-dontwarn javax.annotation.**

# A resource is loaded with a relative path so the package of this class must be preserved.
-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase

# Animal Sniffer compileOnly dependency to ensure APIs are compatible with older versions of Java.
-dontwarn org.codehaus.mojo.animal_sniffer.*

# OkHttp platform used only on JVM and when Conscrypt dependency is available.
-dontwarn okhttp3.internal.platform.*

#Retrofit ------------------------------------------------------------------------------------------
# Retain service method parameters when optimizing.
-keepclassmembers,allowshrinking,allowobfuscation interface * {
    @retrofit2.http.* <methods>;
}

# Ignore annotation used for build tooling.
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement

# Guarded by a NoClassDefFoundError try/catch and only used when on the classpath.
-dontwarn kotlin.Unit

# Top-level functions that can only be used by Kotlin.
-dontwarn retrofit2.-KotlinExtensions

#Glide ---------------------------------------------------------------------------------------------
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public class * extends com.bumptech.glide.module.AppGlideModule
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
  **[] $VALUES;
  public *;
}

#Gson ----------------------------------------------------------------------------------------------
# Gson specific classes
-dontwarn sun.misc.**
#-keep class com.google.gson.stream.** { *; }

# Prevent proguard from stripping interface information from TypeAdapterFactory,
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer

#Kotlin Coroutines ---------------------------------------------------------------------------------
# ServiceLoader support
-keepnames class kotlinx.coroutines.internal.MainDispatcherFactory {}
-keepnames class kotlinx.coroutines.CoroutineExceptionHandler {}

# Most of volatile fields are updated with AFU and should not be mangled
-keepclassmembernames class kotlinx.** {
    volatile <fields>;
}