# THIS ARE pesdk-backend-core RULES

# Keep names for event class, otherwise the processor can't referance the classes.
-keepclasseswithmembers,allowshrinking class * { @ly.img.sdk.android.annotations.StateEvents *; }

# Keep names for event methods, otherwise the processor can't referance the methods.
-keepclassmembers class * { ly.img.android.pesdk.annotations.OnEvent <methods>; }

# Keep Annotaion, because of an issue with multiple processor rounds.
-keep class ly.img.android.pesdk.annotations.OnEvent { *; }

# Keep classes instantiated by reflactions using Class.forName(classNameString).
-keep public class * extends ly.img.android.pesdk.backend.operator.preview.GlOperation
-keep public class * extends ly.img.android.pesdk.backend.operator.rox.RoxOperation
-keep public class * extends ly.img.android.pesdk.backend.model.state.manager.StateObservable
-keep class ly.img.android.events.**

# Keep decoder classes instantiated by reflection.
-keep class ly.img.android.pesdk.backend.decoder.** { *; }

# Keep ThreadUtils class because of some wrong proaguard optimisations.
-keep class ly.img.android.pesdk.utils.ThreadUtils { *; }

# Keep annotaions accessed by reflections.
-keep class ly.img.android.pesdk.backend.model.constant.RevertStrategy { *; }

-keep class ly.img.android.PESDKInit { *; }

 # ----------------------------------------------------------------------------- #
# --- We need these rules to work around a memory issue in the support library. --- #
 # ----------------------------------------------------------------------------- #
-keep class androidx.vectordrawable.graphics.drawable.VectorDrawableCompat {
    private androidx.vectordrawable.graphics.drawable.VectorDrawableCompat$VectorDrawableCompatState mVectorState;
}
-keep class androidx.vectordrawable.graphics.drawable.VectorDrawableCompat$VectorDrawableCompatState {
    android.graphics.Bitmap mCachedBitmap;
}

-keepclassmembers public class * extends ly.img.android.pesdk.backend.decoder.vector.CanvasDecoderDrawable {
   public *;
}

# Keep EventDispatcher classes. We need this because of multiple processor rounds.
# Otherwise proguard may optimize it to early, results in events not firing, which can lead to strange behavior.
-keep @ly.img.android.pesdk.annotations.EventDispatcher public class *
-keepnames @ly.img.android.pesdk.annotations.EventDispatcher public class *
-keepclassmembers @ly.img.android.pesdk.annotations.EventDispatcher public class * {
    public *;
}

-keepclassmembers class * implements android.os.Parcelable {
    static ** CREATOR;
}

#-printconfiguration "build/outputs/mapping/configuration.txt"

# Understand the @Keep annotation.
-keep class androidx.annotation.Keep
-keep @androidx.annotation.Keep class * {*;}
-keepclasseswithmembers class * {
    @androidx.annotation.Keep <methods>;
}
-keepclasseswithmembers class * {
    @androidx.annotation.Keep <fields>;
}
-keepclasseswithmembers class * {
    @androidx.annotation.Keep <init>(...);
}
