# Keeps the packages structure and does not flatten it.
# This prevents issues like "Duplicate class a.a found in modules..."
-keeppackagenames
-keepparameternames
-renamesourcefileattribute SourceFile
-keepattributes Exceptions,InnerClasses,Deprecated,SourceFile,LineNumberTable,EnclosingMethod

-keep class com.argyle.AccountData { *; }
-keep class com.argyle.ArgyleLink { *; }
-keep class com.argyle.ArgyleLink$* { *; }
-keep class com.argyle.FormData { *; }
-keep class com.argyle.LinkConfig { *; }
-keep class com.argyle.LinkConfig$* { *; }
-keep class com.argyle.LinkError { *; }
-keep class com.argyle.LinkError$* { *; }
-keep class com.argyle.LinkError$Type$* { *; }
-keep class com.argyle.UIEvent { *; }

-keep class * extends androidx.fragment.app.Fragment{}

-keepclassmembers enum * { *; }

# Preserve default implementations for interfaces
-keep class **$DefaultImpls { *; }

# Preserve all .class method names.
-keepclassmembernames class * {
    java.lang.Class class$(java.lang.String);
    java.lang.Class class$(java.lang.String, boolean);
}

# Preserve all native method names and the names of their classes.
-keepclasseswithmembernames class * { native <methods>; }

# Preserve the special static methods that are required in all enumeration
# classes.
-keepclassmembers class * extends java.lang.Enum {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

-optimizations !class/unboxing/enum
-ignorewarnings

##---------------Begin: proguard configuration for Gson  ----------

# Gson uses generic type information stored in a class file when working with fields. Proguard
# removes such information by default, so configure it to keep all of it.
-keepattributes Signature

# For using GSON @Expose annotation
-keepattributes *Annotation*

# Gson specific classes
-dontwarn sun.misc.**

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

-keep class com.google.gson.internal.LinkedTreeMap { *; }

# Prevent R8 from leaving Data object members always null
-keepclasseswithmembers,allowobfuscation,allowoptimization class * {
  @com.google.gson.annotations.SerializedName <fields>;
}
-keep,allowobfuscation,allowoptimization @com.google.gson.annotations.JsonAdapter class *

# Retain generic signatures of TypeToken and its subclasses with R8 version 3.0 and higher.
-keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken
-keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken

##---------------End: proguard configuration for Gson  ----------

# Remove these rules with new Retrofit version https://github.com/square/retrofit/issues/3751#issuecomment-1192043644
-keep,allowobfuscation,allowshrinking interface retrofit2.Call
-keep,allowobfuscation,allowshrinking class retrofit2.Response
-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation