# This class defines the rules that are applied to both Glia library build for release as well as it
# is packed inside AAR to be applied to integrator app if he is using ProGuard. This rules here are
# used to prevent ProGuard from obfuscating or removing classes required for Glia library and
# libraries that Glia requires to work

# Glia
# https://www.glia.com
-keep,includecode class com.glia.** { *; }

# Gson
-keepattributes Signature
-keepattributes *Annotation*
-keep class com.google.gson.stream.** { *; }
-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

#RxJava3 Retrofit adapter
-keep class retrofit2.adapter.** { *; }

-keepclassmembers,allowobfuscation class com.glia.** {
    <init>(...);
    @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

# WebRTC
-keep class org.webrtc.** { *; }

# Twilio Programmable Voice
-keep class com.twilio.** { *; }
-keep class tvo.webrtc.** { *; }

# From issue https://glia.atlassian.net/browse/MOB-1233:
-keep class org.json.** { *; }

-keepattributes Signature
-keep,allowobfuscation public class * implements com.glia.androidsdk.internal.Event { *; }

#To not fail release build on client side in case of missing firebase dependency
-dontwarn com.google.android.gms.tasks.OnCompleteListener
-dontwarn com.google.android.gms.tasks.Task
-dontwarn com.google.firebase.messaging.FirebaseMessaging
-dontwarn com.google.firebase.messaging.FirebaseMessagingService
-dontwarn com.google.firebase.messaging.RemoteMessage
