# 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.Argyle { *; }
-keep class com.argyle.ArgyleConfig { *; }
-keep class com.argyle.ArgyleConfig$* { *; }
-keep class com.argyle.ArgyleConfig$Builder$* { *; }
-keep class com.argyle.Argyle$Companion { *; }

-keep enum com.argyle.ArgyleErrorType
-keep enum com.argyle.analytics.events.TrackEvents
-keep enum com.argyle.analytics.events.ScreenEvents

-keep interface com.argyle.data.network.services.SegmentService
-keep interface com.argyle.data.network.services.LinkService
-keep interface com.argyle.data.network.services.AppService
-keep interface com.argyle.data.network.SegmentApi
-keep interface com.argyle.data.network.Api
-keep interface com.argyle.Argyle$ArgyleResultListener  { *; }

-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

##---------------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

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

# 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  ----------

##---------------Begin: proguard configuration for OkHttp  ----------

# TODO: These can be removed when we upgrade to Okhttp 5
# OkHttp platform used only on JVM and when Conscrypt and other security providers are available.
-dontwarn okhttp3.internal.platform.**
-dontwarn org.conscrypt.**
-dontwarn org.bouncycastle.**
-dontwarn org.openjsse.**

##---------------End: proguard configuration for OkHttp  ----------