# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/jdeffibaugh/Library/Android/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
#   public *;
#}

## Below are the suggested rules from the developer documentation:
## https://developers.optimizely.com/x/solutions/sdks/reference/index.html?language=android&platform=mobile#installation

# Optimizely
-keep class com.optimizely.ab.config.**
-keepclassmembers class  com.optimizely.ab.config.** {
    *;    
}
# Keep Payload classes that get sent to the ODP server
-keep class com.optimizely.ab.odp.ODPEvent { *; }
# ODP event uses this. R8 complains about it.
-dontwarn java.beans.Transient

# Keep Payload classes that get sent to Optimizely's backend
-keep class com.optimizely.ab.event.internal.payload.** { *; }

# Keep these for logging purposes
-keep class com.optimizely.ab.bucketing.DecisionService { *; }
-keep class com.optimizely.ab.Optimizely { *; }

# Safely ignore warnings about other libraries since we are using Gson
-dontwarn com.fasterxml.jackson.**
-dontwarn org.json.**

# Annotations
-dontwarn javax.annotation.**

# Findbugs
-dontwarn edu.umd.cs.findbugs.annotations.SuppressFBWarnings

# slf4j
-dontwarn org.slf4j.**
-keep class org.slf4j.** {*;}

# Android Logger
-keep class com.noveogroup.android.log.** { *; }

-optimizations !class/unboxing/enum

-dontwarn com.google.gson.**
-dontwarn com.optimizely.ab.config.parser.**

# Gson (https://github.com/google/gson/blob/master/examples/android-proguard-example/proguard.cfg)
##---------------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

# Retain the name used by the Java SDK to determine whether Gson is usable as a config parser.
-keepnames class com.google.gson.Gson
##---------------End: proguard configuration for Gson  ----------

