########################################################################
###Beacon specific config

-keepattributes InnerClasses
#keep the R classes so the webview can see R and the res raw dir
-keepclassmembers class **.R$* {public static <fields>;}
-keep class **.R$*

#modules
-keep class com.helpscout.beacon.internal.chat.inject.modules.** { *; }


#keep the models needed for moshi
-keepclassmembers class com.helpscout.beacon.internal.ui.model.** {
  <init>(...);
  <fields>;
}
-keep class com.helpscout.beacon.internal.ui.model.** { *; }
-keepnames @kotlin.Metadata class com.helpscout.beacon.internal.ui.model.**

-keep class com.helpscout.beacon.internal.ui.extensions.* {*;}

-keepclassmembers class com.helpscout.beacon.internal.chat.model.** {
  <init>(...);
  <fields>;
}

-keep class com.helpscout.beacon.internal.chat.model.** { *; }
-keepnames @kotlin.Metadata class com.helpscout.beacon.internal.chat.model.**

-keep class com.helpscout.beacon.internal.chat.extensions.* {*;}


#keep classes causing weirdness with r8 when using AndroidX see ANDSDK-169
-keep class com.helpscout.beacon.internal.common.store.BeaconViewState.* { *; }
-keep class com.helpscout.beacon.internal.common.store.BeaconViewEvent.* { *; }
-keep class com.helpscout.beacon.internal.ui.common.widget.** { *; }


########################################################################
### 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 *;
}

########################################################################
### KOTLIN
-keepattributes *Annotation*
-dontwarn org.jetbrains.annotations.**
-dontwarn kotlin.reflect.jvm.internal.impl.descriptors.CallableDescriptor
-dontwarn kotlin.reflect.jvm.internal.impl.descriptors.ClassDescriptor
-dontwarn kotlin.reflect.jvm.internal.impl.descriptors.ClassifierDescriptorWithTypeParameters
-dontwarn kotlin.reflect.jvm.internal.impl.descriptors.annotations.AnnotationDescriptor
-dontwarn kotlin.reflect.jvm.internal.impl.descriptors.impl.PropertyDescriptorImpl
-dontwarn kotlin.reflect.jvm.internal.impl.load.java.JavaClassFinder
-dontwarn kotlin.reflect.jvm.internal.impl.resolve.OverridingUtil
-dontwarn kotlin.reflect.jvm.internal.impl.types.DescriptorSubstitutor
-dontwarn kotlin.reflect.jvm.internal.impl.types.DescriptorSubstitutor
-dontwarn kotlin.reflect.jvm.internal.impl.types.TypeConstructor
-dontwarn kotlin.reflect.jvm.internal.DefaultConstructorMaker
-dontwarn kotlin.coroutines.experimental.Continuation

-keep class kotlin.Unit { *; }
-keep class kotlin.collections.CollectionsKt { *; }
# The Android pre-handler for exceptions is loaded reflectively (via ServiceLoader).
# https://github.com/Kotlin/kotlinx.coroutines/issues/214
-keep class kotlinx.coroutines.android.AndroidExceptionPreHandler { *; }
-keepnames class kotlinx.coroutines.internal.MainDispatcherFactory {}
-keepnames class kotlinx.coroutines.CoroutineExceptionHandler {}

-keepclassmembernames class kotlinx.** {
    volatile <fields>;
}

########################################################################
### MOSHI
-dontwarn org.jetbrains.annotations.**
-keep class kotlin.Metadata { *; }

-dontwarn okio.**
-dontwarn javax.annotation.**

-keepclasseswithmembers class * {
    @com.squareup.moshi.* <methods>;
}

-keepnames @com.squareup.moshi.JsonClass class *

-keep @com.squareup.moshi.JsonQualifier interface *
-keepclassmembers class kotlin.Metadata {
    public <methods>;
}

# Enum field names are used by the integrated EnumJsonAdapter.
# Annotate enums with @JsonClass(generateAdapter = false) to use them with Moshi.
-keepclassmembers @com.squareup.moshi.JsonClass class * extends java.lang.Enum {
    <fields>;
}

########################################################################
### OKHttp
-dontnote android.net.http.*
-dontnote org.apache.commons.codec.**
-dontnote org.apache.http.**
-dontwarn okhttp3.**
-dontwarn okio.**

########################################################################
### Retrofit

# Platform calls Class.forName on types which do not exist on Android to determine platform.
-dontnote retrofit2.Platform
# Platform used when running on Java 8 VMs. Will not be used at runtime.
-dontwarn retrofit2.Platform$Java8
# Retain generic type information for use by reflection by converters and adapters.
-keepattributes Signature
# Retain declared checked exceptions for use by a Proxy instance.
-keepattributes Exceptions

-keepclasseswithmembers class * {
    @retrofit2.http.* <methods>;
}

########################################################################
###  Stetho 1.1.1
-keep class com.facebook.stetho.** { *; }

########################################################################
### Design Support Lib
 -dontwarn android.support.design.**
 -keep class android.support.design.** { *; }
 -keep interface android.support.design.** { *; }
 -keep public class android.support.design.R$* { *; }

########################################################################
### Support Lib

-keep public class android.support.v7.widget.** { *; }
-keep public class android.support.v7.internal.widget.** { *; }
-keep public class android.support.v7.internal.view.menu.** { *; }

-keep class android.support.v7.widget.SearchView { *; }
-keep class android.support.v4.widget.DrawerLayout { *; }
-keep class android.support.test.espresso.IdlingResource { *; }

-keep public class * extends android.support.v4.view.ActionProvider {
    public <init>(android.content.Context);
}

########################################################################
### Android architecture components: Lifecycle
# LifecycleObserver's empty constructor is considered to be unused by proguard
-keepclassmembers class * implements android.arch.lifecycle.LifecycleObserver {
    <init>(...);
}
# ViewModel's empty constructor is considered to be unused by proguard
-keepclassmembers class * extends android.arch.lifecycle.ViewModel {
    <init>(...);
}
# keep Lifecycle State and Event enums values
-keepclassmembers class android.arch.lifecycle.Lifecycle$State { *; }
-keepclassmembers class android.arch.lifecycle.Lifecycle$Event { *; }
# keep methods annotated with @OnLifecycleEvent even if they seem to be unused
# (Mostly for LiveData.LifecycleBoundObserver.onStateChange(), but who knows)
-keepclassmembers class * {
    @android.arch.lifecycle.OnLifecycleEvent *;
}

-keepclassmembers class * implements android.arch.lifecycle.LifecycleObserver {
    <init>(...);
}

-keep class * implements android.arch.lifecycle.LifecycleObserver {
    <init>(...);
}
-keepclassmembers class android.arch.** { *; }
-keep class android.arch.** { *; }
-dontwarn android.arch.**
