# 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 class com.glia.** { public *; }

# Retrofit
# https://square.github.io/retrofit
-keepattributes Signature, InnerClasses, EnclosingMethod
-keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations
-keepclassmembers,allowshrinking,allowobfuscation interface * { @retrofit2.http.* <methods>; }
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
-dontwarn javax.annotation.**
-dontwarn kotlin.Unit
-dontwarn retrofit2.KotlinExtensions
-if interface * { @retrofit2.http.* <methods>; }
-keep,allowobfuscation interface <1>

# Okio
# https://github.com/square/okio
-dontwarn org.codehaus.mojo.animal_sniffer.*

# Okhttp
# https://github.com/square/okhttp
-dontwarn javax.annotation.**
-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase
-dontwarn org.codehaus.mojo.animal_sniffer.*
-dontwarn okhttp3.internal.platform.ConscryptPlatform

# Gson
-keepattributes Signature
-keepattributes *Annotation*
-dontwarn sun.misc.**
-keep class com.google.gson.stream.** { *; }
-keep class com.google.gson.examples.android.model.** { *; }
-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer

# Guava
# https://github.com/google/guava/wiki/UsingProGuardWithGuava
-dontwarn javax.lang.model.element.Modifier
-dontnote sun.misc.SharedSecrets
-keep class sun.misc.SharedSecrets {
  *** getJavaLangAccess(...);
}
-dontnote sun.misc.JavaLangAccess
-keep class sun.misc.JavaLangAccess {
  *** getStackTraceElement(...);
  *** getStackTraceDepth(...);
}
-keepnames class com.google.common.base.internal.Finalizer {
  *** startFinalizer(...);
}
-keepclassmembers class com.google.common.base.internal.Finalizer {
  *** startFinalizer(...);
}
-keepnames class com.google.common.base.FinalizableReference {
  void finalizeReferent();
}
-keepclassmembers class com.google.common.base.FinalizableReference {
  void finalizeReferent();
}
-dontwarn sun.misc.Unsafe
-keepclassmembers class com.google.common.cache.Striped64 {
  *** base;
  *** busy;
}
-keepclassmembers class com.google.common.cache.Striped64$Cell {
  <fields>;
}
-dontwarn java.lang.SafeVarargs
-keep class java.lang.Throwable {
  *** addSuppressed(...);
}
-keepclassmembers class com.google.common.util.concurrent.AbstractFuture** {
  *** waiters;
  *** value;
  *** listeners;
  *** thread;
  *** next;
}
-keepclassmembers class com.google.common.util.concurrent.AtomicDouble {
  *** value;
}
-keepclassmembers class com.google.common.util.concurrent.AggregateFutureState {
  *** remaining;
  *** seenExceptions;
}
-keep,allowshrinking,allowobfuscation class com.google.common.util.concurrent.AbstractFuture** {
  <fields>;
}
-dontwarn java.lang.ClassValue
-dontnote com.google.appengine.api.ThreadManager
-keep class com.google.appengine.api.ThreadManager {
  static *** currentRequestThreadFactory(...);
}
-dontnote com.google.apphosting.api.ApiProxy
-keep class com.google.apphosting.api.ApiProxy {
  static *** getCurrentEnvironment (...);
}

# WebRTC
# https://github.com/RWebRTC
-keep class org.webrtc.** { *; }
-dontwarn org.webrtc.**
-keepclasseswithmembernames class * { native <methods>; }

# Twilio Programmable Voice
# https://www.twilio.com/docs/voice/voip-sdk/android#setting-up-proguard-rules
-keep class com.twilio.** { *; }
-keep class tvo.webrtc.** { *; }
-dontwarn tvo.webrtc.**
-keep class com.twilio.voice.** { *; }
-keepattributes InnerClasses

# Generated keep rule for Lifecycle observer adapter.
-if class com.glia.androidsdk.internal.medra.ScreenStream {
    <init>(...);
}
-keep class com.glia.androidsdk.internal.medra.ScreenStream_LifecycleAdapter {
    <init>(...);
}

# Generated keep rule for Lifecycle observer adapter.
-if class com.glia.androidsdk.internal.AppLifecycle {
    <init>(...);
}
-keep class com.glia.androidsdk.internal.AppLifecycle_LifecycleAdapter {
    <init>(...);
}


