############################# Rules for Android Library ############################################
# Save the obfuscation mapping to a file, so we can de-obfuscate any stack
# traces later on. Keep a fixed source file attribute and all line number
# tables to get line numbers in the stack traces.
# You can comment this out if you're not interested in stack traces.
-keepparameternames
-renamesourcefileattribute SourceFile
-keepattributes Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,EnclosingMethod

# Specifies not to generate mixed-case class names while obfuscating.
# By default, obfuscated class names can contain a mix of upper-case characters and lower-case characters.
# This creates perfectly acceptable and usable jars.
# Only if a jar is unpacked on a platform with a case-insensitive filing system (say, Windows), the unpacking tool may let similarly named class files overwrite each other.
# Code that self-destructs when it's unpacked! Developers who really want to unpack their jars on Windows can use this option to switch off this behavior.
# Obfuscated jars will become slightly larger as a result. Only applicable when obfuscating.
-dontusemixedcaseclassnames
# Specifies not to ignore non-public library classes. As of version 4.5, this is the default setting.
-dontskipnonpubliclibraryclasses
# Specifies not to preverify the processed class files.
# By default, class files are preverified if they are targeted at Java Micro Edition or at Java 6 or higher.
# For Java Micro Edition, preverification is required, so you will need to run an external preverifier on the processed code if you specify this option.
# For Java 6, preverification is optional, but as of Java 7, it is required.
# Only when eventually targeting Android, it is not necessary, so you can then switch it off to reduce the processing time a bit.
-dontpreverify

# Preserve all annotations.
-keepattributes *Annotation*

# Preserve all classes in PayPalCheckout SDK, their public, protected and private fields and methods
-keep class com.paypal.pyplcheckout.** {*;}
-keep class com.paypal.checkout.** {*;}
# Preserve names of all classes in PayPalCheckout SDK, their public, protected and private fields and methods
-keepnames class com.paypal.pyplcheckout.** {*;}

# Preserve all .class method names in PayPalCheckout SDK
-keepclassmembernames class com.paypal.pyplcheckout.** {
    java.lang.Class class$(java.lang.String);
    java.lang.Class class$(java.lang.String, boolean);
}

# Preserve all interfaces and it's methods in PayPalCheckout SDK
-keep interface com.paypal.pyplcheckout.** {
    <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);
}

# Explicitly preserve all serialization members. The Serializable interface
# is only a marker interface, so it wouldn't save them.
# You can comment this out if your library doesn't use serialization.
# If your code contains serializable classes that have to be backward
# compatible, please refer to the manual.

-keepclassmembers class * implements java.io.Serializable {
    static final long serialVersionUID;
    static final java.io.ObjectStreamField[] serialPersistentFields;
    private void writeObject(java.io.ObjectOutputStream);
    private void readObject(java.io.ObjectInputStream);
    java.lang.Object writeReplace();
    java.lang.Object readResolve();
}

##################################### 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
-keep class sun.misc.Unsafe { *; }
-keep class com.google.gson.stream.** { *; }

# Prevent proguard from stripping interface information from TypeAdapterFactory,
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer

##################################### NXO ##########################################################
# Keep all the pojo's
# Because GSON relies on these POJOs for the JSON to GSON conversions, make sure to add any POJO you're
# adding to the project which doesn't live in one of these packages down below. If you don't do that,
# GSON won't be able to convert the POJOs
-keep class com.paypal.pyplcheckout.pojo.** { <fields>; }
-keep class com.paypal.pyplcheckout.instrumentation.** { <fields>; }

# Keep our enum classes
-keepclassmembers enum * { *; }
