# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/mstipanov/Programs/android-sdk-macosx/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 *;
#}

-printmapping mobile-messaging-out.map
-keepparameternames
-renamesourcefileattribute SourceFile
-keepattributes Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,EnclosingMethod

# Preserve all annotations.

-keepattributes *Annotation*

# Preserve all public classes, and their public and protected fields and
# methods.

-keep public class * {
    public protected *;
}

# Preserve all .class method names.

-keepclassmembernames class * {
    java.lang.Class class$(java.lang.String);
    java.lang.Class class$(java.lang.String, boolean);
}

# Preserve all native method names and the names of their classes.

-keepclasseswithmembernames class * {
    native <methods>;
}

# Preserve the special static methods that are required in all enumeration
# classes.

-keepclassmembers class * extends java.lang.Enum {
    <fields>;
    public static **[] values();
    public static ** valueOf(java.lang.String);
}
-keep public enum org.infobip.mobile.messaging.** { *; }

# 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();
}

# Suppress lombok warnings
-dontwarn lombok.NonNull

# Mobile Messaging API classes
-keep class org.infobip.mobile.messaging.api.** { *; }

# Fix for JobIntentService
-keep class org.infobip.mobile.messaging.platform.JobIntentService$* { *; }

# GSON-related

# Gson specific classes
-keep class sun.misc.Unsafe { *; }
-dontwarn sun.misc.Unsafe
#-keep class com.google.gson.stream.** { *; }

# Application classes that will be serialized/deserialized over Gson
-keep class org.infobip.mobile.messaging.dal.json.** { *; }
-keep class org.infobip.mobile.messaging.Installation { *; }
-keep class org.infobip.mobile.messaging.Message { *; }
-keep class org.infobip.mobile.messaging.User { *; }
-keep class org.infobip.mobile.messaging.CustomAttributeValue { *; }
-keep class org.infobip.mobile.messaging.interactive.NotificationAction { *; }
-keep class org.infobip.mobile.messaging.interactive.NotificationAction$* { *; }
-keep class org.infobip.mobile.messaging.interactive.NotificationCategory { *; }
-keep class org.infobip.mobile.messaging.cloud.firebase.FirebaseMessageMapper { *; }
-keep class org.infobip.mobile.messaging.cloud.firebase.FirebaseMessageMapper$* { *; }
-keep class org.infobip.mobile.messaging.mobile.** { *; }

# 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

# Do not warn us about GCM dependency issues since Firebase is used as a default - listed classes not used
# There should not be warnings if GCM dependency is provided and used
-dontwarn org.xmlpull.v1.**
-dontwarn org.infobip.mobile.messaging.cloud.gcm.MobileMessagingGcmReceiver
-dontwarn org.infobip.mobile.messaging.cloud.gcm.GCMRegistrationTokenHandler
-dontwarn org.infobip.mobile.messaging.cloud.gcm.MobileMessagingInstanceIDListenerService
-dontwarn com.google.android.gms.iid.InstanceIDListenerService
-dontwarn com.google.android.gms.gcm.GcmReceiver