# ========================================
# Game SDK ProGuard Rules
# ========================================
# This file contains ProGuard rules for the SDK itself
# Will be automatically applied to apps using this SDK
# ========================================

# Basic configuration
# Increased optimization passes for better obfuscation (matching screw-sdk)
-optimizationpasses 5
-optimizations !code/simplification/cast,!field/*,!class/merging/*
-keepattributes *Annotation*,InnerClasses
# Remove Signature to hide generic type information (including class names in field types)
# This allows BannerAd, InterstitialAd, MaxRewardAd class names to be fully obfuscated
-keepattributes !Signature
# Remove SourceFile to reduce memory usage
-keepattributes Exceptions

# ========================================
# String Encryption Support (StringEncryptor)
# ========================================
# Obfuscate StringEncryptor to protect decryption logic
# Do NOT keep the class - let R8 obfuscate it completely
-keep,allowobfuscation class com.applovia.mediation.gamemoven.utils.StringEncryptor { *; }
# Keep only the decrypt method signature, but allow obfuscation of implementation
-keepclassmembers,allowobfuscation class com.applovia.mediation.gamemoven.utils.StringEncryptor {
    public static java.lang.String decrypt(java.lang.String);
}
# Don't warn about Base64 (Android provides it natively)
-dontwarn java.util.Base64

# ========================================
# SDK Core Classes Keep Rules
# ========================================

# Keep SDK main entry
-keep public class com.applovia.mediation.gamemoven.GameSDK {
    public *;
}

# Keep SDK configuration classes
-keep public class com.applovia.mediation.gamemoven.SDKConfig { *; }
-keep public class com.applovia.mediation.gamemoven.AnalyticsKeysConfig { *; }
# Keep AnalyticsKeysConfig Companion object and its factory methods (critical for wrapper SDKs)
-keep class com.applovia.mediation.gamemoven.AnalyticsKeysConfig$Companion { *; }
-keepclassmembers class com.applovia.mediation.gamemoven.AnalyticsKeysConfig$Companion {
    public static *** createEventNames(...);
    public static *** createParamKeys(...);
    public static *** createAliLogKeys(...);
}

# Keep SDK callback interfaces
-keep public interface com.applovia.mediation.gamemoven.ICocosCallback { *; }
-keep public interface com.applovia.mediation.gamemoven.IUICallback { *; }
-keep public interface com.applovia.mediation.gamemoven.IAliLogParamsBuilder { *; }
-keep public interface com.applovia.mediation.gamemoven.callback.IAlertManager { *; }
-keep public interface com.applovia.mediation.gamemoven.callback.IAdStatusHandler { *; }

# Keep SDK callback default implementations
# Class names must be kept for typealias usage, but allow implementation obfuscation
-keep,allowobfuscation public class com.applovia.mediation.gamemoven.callback.DefaultCocosCallback {
    public <init>(...);
    public <methods>;
}
-keep,allowobfuscation public class com.applovia.mediation.gamemoven.callback.DefaultUICallback {
    public <init>(...);
    public <methods>;
}

# ========================================
# Utility Classes Keep Rules (Precise - Only Keep What Wrapper SDK Needs)
# ========================================
# IMPORTANT: We only keep the minimal set of utility classes that wrapper SDKs actually use.
# All other utils classes (like AliLogUtils, AppUtils, FileUtils, IntentUtils) will be obfuscated.

# VibratorType enum (used by wrapper SDKs via ScrewVibrationUtils)
-keep public enum com.applovia.mediation.gamemoven.utils.VibratorType { *; }

# DeviceUtils - Kotlin object, must keep INSTANCE field and methods
# Kotlin val properties compile to getter methods: getDeviceId(), getStatusBarHeight(), getNavigationBarHeight()
-keep class com.applovia.mediation.gamemoven.utils.DeviceUtils {
    # Kotlin object generates INSTANCE field - must be kept
    public static com.applovia.mediation.gamemoven.utils.DeviceUtils INSTANCE;
    # Public methods used by wrapper SDK
    public static java.lang.String getDeviceId();
    public static int getStatusBarHeight();
    public static int getNavigationBarHeight();
    # Keep all public methods
    public <methods>;
}

# LauncherUtils - Kotlin object, must keep INSTANCE field and methods
-keep class com.applovia.mediation.gamemoven.utils.LauncherUtils {
    # Kotlin object generates INSTANCE field - must be kept
    public static com.applovia.mediation.gamemoven.utils.LauncherUtils INSTANCE;
    # Public methods used by wrapper SDK
    public static void launcher(java.lang.String);
    public static void openSetting();
    # Keep all public methods
    public <methods>;
}

# NetworkUtils - Kotlin object, must keep INSTANCE field and methods
-keep class com.applovia.mediation.gamemoven.utils.NetworkUtils {
    # Kotlin object generates INSTANCE field - must be kept
    public static com.applovia.mediation.gamemoven.utils.NetworkUtils INSTANCE;
    # Public methods used by wrapper SDK
    public static boolean isActuallyOnline();
    # Keep all public methods
    public <methods>;
}

# LocaleUtils - Kotlin object, must keep INSTANCE field and methods
-keep class com.applovia.mediation.gamemoven.utils.LocaleUtils {
    # Kotlin object generates INSTANCE field - must be kept
    public static com.applovia.mediation.gamemoven.utils.LocaleUtils INSTANCE;
    # Public methods used by wrapper SDK
    public static java.util.Locale getLocale();
    # Keep all public methods
    public <methods>;
}

# VibrationUtils - Kotlin object, must keep INSTANCE field and methods
-keep class com.applovia.mediation.gamemoven.utils.VibrationUtils {
    # Kotlin object generates INSTANCE field - must be kept
    public static com.applovia.mediation.gamemoven.utils.VibrationUtils INSTANCE;
    # Public methods used by wrapper SDK
    public static void vibrate(com.applovia.mediation.gamemoven.utils.VibratorType);
    # Keep all public methods
    public <methods>;
}

# CrashReporter - Kotlin object, must keep INSTANCE field and methods
-keep class com.applovia.mediation.gamemoven.utils.CrashReporter {
    # Kotlin object generates INSTANCE field - must be kept
    public static com.applovia.mediation.gamemoven.utils.CrashReporter INSTANCE;
    # Public methods used by wrapper SDK and SDK internal
    public static void recordException(java.lang.Throwable);
    public static void recordCocosException(java.lang.String, java.lang.String, java.lang.String);
    public static void log(java.lang.String);
    # Keep all public methods
    public <methods>;
}

# CocosError - Used for exception handling
-keep class com.applovia.mediation.gamemoven.utils.CocosError { *; }

# Firebase Remote Config Helper - Keep for AB testing functionality
-keep public class com.applovia.mediation.gamemoven.utils.FirebaseRemoteConfigHelper {
    public *;
}

# CacheManager - Used internally by SDK (data persistence)
-keep class com.applovia.mediation.gamemoven.utils.CacheManager {
    public *;
}

# AppUtils - Used by wrapper SDKs (dramaboom-sdk, screw-sdk)
# Keep all public methods and properties
-keep class com.applovia.mediation.gamemoven.utils.AppUtils {
    public static com.applovia.mediation.gamemoven.utils.AppUtils INSTANCE;
    public static java.lang.String md5(java.lang.String);
    public static int sdbHash(java.lang.String);
    public static java.lang.String getInstallTime();
    public static java.lang.String getSignHash();
    public static java.lang.String getInstallSource();
    public <methods>;
}

# FileUtils - Used by wrapper SDKs
-keep class com.applovia.mediation.gamemoven.utils.FileUtils {
    public static com.applovia.mediation.gamemoven.utils.FileUtils INSTANCE;
    public static byte[] fileToByte(java.io.File);
    public static void saveByteByFile(byte[], java.io.File);
    public <methods>;
}

# DeviceInfoCollector - Used by wrapper SDKs
-keep class com.applovia.mediation.gamemoven.utils.DeviceInfoCollector {
    public static com.applovia.mediation.gamemoven.utils.DeviceInfoCollector INSTANCE;
    public static java.util.Map collectAllDeviceInfo();
    public <methods>;
}

# GraphicsInfoUtils - Used by wrapper SDKs
-keep class com.applovia.mediation.gamemoven.utils.GraphicsInfoUtils {
    public static com.applovia.mediation.gamemoven.utils.GraphicsInfoUtils INSTANCE;
    public static java.lang.String getOpenGlInfo();
    public static java.lang.String getGpuInfo();
    public <methods>;
}

# SecurityUtils - Used by wrapper SDKs
-keep class com.applovia.mediation.gamemoven.utils.SecurityUtils {
    public static com.applovia.mediation.gamemoven.utils.SecurityUtils INSTANCE;
    public static java.lang.String getIsJailbroken();
    public static java.lang.String getIsVirtualMachine();
    public static java.lang.String getHookInfo();
    public static java.lang.String getEmulatorInfo();
    public <methods>;
}

# HotUpdateManager - Used by wrapper SDKs
-keep class com.applovia.mediation.gamemoven.utils.hotupdate.HotUpdateManager {
    public <init>(...);
    public void unzipHotUpdate(android.content.Context, kotlin.jvm.functions.Function2);
    public java.lang.String getHotUpdatePath(android.content.Context);
    public <methods>;
}
# Keep HotUpdateManager companion object and instance property
-keep class com.applovia.mediation.gamemoven.utils.hotupdate.HotUpdateManager$Companion {
    public static com.applovia.mediation.gamemoven.utils.hotupdate.HotUpdateManager getInstance();
    public static com.applovia.mediation.gamemoven.utils.hotupdate.HotUpdateManager instance;
    public <methods>;
}

# BaseMaxAd - Keep isLoading property
-keepclassmembers class com.applovia.mediation.gamemoven.ads.max.BaseMaxAd {
    public abstract boolean isLoading();
}

# SDKLog - Used by wrapper SDKs for logging
-keep class com.applovia.mediation.gamemoven.utils.SDKLog {
    public static com.applovia.mediation.gamemoven.utils.SDKLog INSTANCE;
    public static void d(java.lang.String, java.lang.String);
    public static void i(java.lang.String, java.lang.String);
    public static void w(java.lang.String, java.lang.String);
    public static void e(java.lang.String, java.lang.String, java.lang.Throwable);
    public static void e(java.lang.String, java.lang.String);
    public <methods>;
}

# Note: The following utils classes are NOT kept and will be obfuscated:
# - AliLogUtils (not used by wrapper SDK)
# - IntentUtils (internal implementation only)

# ========================================
# Ad Module Keep Rules
# ========================================

# Ad manager
-keep public class com.applovia.mediation.gamemoven.ads.AdManager { *; }
-keep public class com.applovia.mediation.gamemoven.ads.AdType { *; }

# MAX ad adapters - Only keep MaxAdManager and BaseMaxAd (for property types)
# Internal implementation classes (BannerAd, InterstitialAd, etc.) will be obfuscated
# MaxAdManager is a Kotlin object, must keep INSTANCE field and all public methods
-keep public class com.applovia.mediation.gamemoven.ads.max.MaxAdManager {
    # Kotlin object generates INSTANCE field - must be kept
    public static com.applovia.mediation.gamemoven.ads.max.MaxAdManager INSTANCE;
    # Kotlin var properties generate getter methods - must be kept
    # Use BaseMaxAd as return type to allow subclass name obfuscation
    public static com.applovia.mediation.gamemoven.ads.max.BaseMaxAd getInterstitialAd();
    public static com.applovia.mediation.gamemoven.ads.max.BaseMaxAd getRewardItemAd();
    public static com.applovia.mediation.gamemoven.ads.max.BaseMaxAd getRewardCashAd();
    public static com.applovia.mediation.gamemoven.ads.max.BaseMaxAd getBannerAd();
    # Public methods used by wrapper SDK
    public static void loadAdByType(com.applovia.mediation.gamemoven.ads.AdType, android.app.Activity);
    public static void init(android.app.Application);
    public static void tryRequestConsentAndInitSdk(android.app.Activity);
    public static boolean initBanner();
    public static void showBanner(boolean);
    public static void showInterstitialAd();
    public static void showRewardItemAd();
    public static void showRewardCashAd();
    public static java.lang.Double getAdRevenue(com.applovia.mediation.gamemoven.ads.AdType);
    public static void ensureAdObjectCreated(com.applovia.mediation.gamemoven.ads.AdType, android.app.Activity);
    # Keep lifecycle callbacks (implements Application.ActivityLifecycleCallbacks)
    public void onActivityCreated(android.app.Activity, android.os.Bundle);
    public void onActivityStarted(android.app.Activity);
    public void onActivityResumed(android.app.Activity);
    public void onActivityPaused(android.app.Activity);
    public void onActivityStopped(android.app.Activity);
    public void onActivitySaveInstanceState(android.app.Activity, android.os.Bundle);
    public void onActivityDestroyed(android.app.Activity);
    # Keep all public methods
    public <methods>;
}
# Keep MaxAdManager companion/internal classes if needed (Kotlin object)
-keep class com.applovia.mediation.gamemoven.ads.max.MaxAdManager$* {
    <methods>;
}

# Keep BaseMaxAd abstract methods only (for method calls), but allow class name obfuscation
# Wrapper SDK calls isReady() on InterstitialAd/MaxRewardAd instances
# Subclasses (BannerAd, InterstitialAd, MaxRewardAd, etc.) will be fully obfuscated
-keep,allowobfuscation public abstract class com.applovia.mediation.gamemoven.ads.max.BaseMaxAd {
    # Keep abstract method signatures (needed for method calls)
    public abstract boolean isReady();
    public abstract void load();
    public abstract void show();
    public abstract void destroy();
    public abstract com.applovia.mediation.gamemoven.ads.AdType getAdType();
    public abstract java.lang.String getUnitId();
}

# Keep isReady() method in all BaseMaxAd subclasses (MaxRewardAd, MaxRewardCashAd, InterstitialAd, etc.)
# This ensures wrapper SDK can call isReady() on concrete ad instances
-keepclassmembers class * extends com.applovia.mediation.gamemoven.ads.max.BaseMaxAd {
    public boolean isReady();
    public void load();
    public void show();
    public void destroy();
    public com.applovia.mediation.gamemoven.ads.AdType getAdType();
    public java.lang.String getUnitId();
}
# Note: Class names can still be obfuscated, but method signatures are preserved
# Their class names will become a/a/a, b/b/b, etc.
# BaseMaxAd class name will also be obfuscated, but method signatures are kept

# ========================================
# Analytics Module Keep Rules
# ========================================

# Analytics manager and utilities
-keep public class com.applovia.mediation.gamemoven.analytics.AnalyticsManager { *; }
-keep public class com.applovia.mediation.gamemoven.analytics.AnalyticsUtils { *; }
-keep public enum com.applovia.mediation.gamemoven.analytics.AnalyticsType { *; }
-keep public interface com.applovia.mediation.gamemoven.analytics.IAnalyticsStrategy { *; }

# Analytics strategy implementations
# Allow obfuscation of class names, but keep interface methods for type checks
# This allows 'is AdjustStrategy' checks to work while hiding class names
-keep,allowobfuscation public class com.applovia.mediation.gamemoven.analytics.strategy.** implements com.applovia.mediation.gamemoven.analytics.IAnalyticsStrategy {
    <methods>;
}
# Keep class hierarchy info for 'is' type checks, but allow name obfuscation
-keepclassmembers,allowobfuscation class com.applovia.mediation.gamemoven.analytics.strategy.** {
    <init>(...);
}

# Bundle extensions - Allow obfuscation, extensions are inline and don't need class names
-keep,allowobfuscation class com.applovia.mediation.gamemoven.analytics.ext.** {
    <methods>;
}

# ========================================
# Cocos Bridge Module Keep Rules
# ========================================

# Converter manager and base classes
# Class names must be kept for inheritance/usage by wrapper SDKs
# Companion object field must be kept (Kotlin companion object generates Companion field)
-keep public class com.applovia.mediation.gamemoven.bridge.ConverterManager {
    # Keep Companion field (Kotlin companion object)
    public static com.applovia.mediation.gamemoven.bridge.ConverterManager$Companion Companion;
    # Keep getInstance() method (called by wrapper SDKs)
    public static *** getInstance();
    # Keep all public methods
    public <methods>;
}
# Keep Companion class and its methods
-keep public class com.applovia.mediation.gamemoven.bridge.ConverterManager$Companion {
    public static *** getInstance();
    <methods>;
}
# BaseConverter - Class name must be kept for inheritance
# All public methods must be kept (not obfuscated) because they are used by application layer
-keep public abstract class com.applovia.mediation.gamemoven.bridge.BaseConverter {
    public <init>(...);
    # Abstract method - must be kept for subclasses to override
    public abstract void onReceive(com.applovia.mediation.gamemoven.bridge.cocos.CocosNativeParams);
    # Public methods used by application layer - must be kept
    public void registerNetworkReceiverIfNeeded();
    public void unregisterNetworkReceiver();
    public boolean isNetworkReceiverActive();
    public void onResume(android.app.Activity);
    public void onDestroy();
    # Keep all other public methods
    public <methods>;
}
-keep public interface com.applovia.mediation.gamemoven.bridge.IConverterDelegate { *; }
-keep public interface com.applovia.mediation.gamemoven.bridge.ILifecycleAware { *; }
# LifecycleDispatcher - Kotlin object, must keep INSTANCE field and instance methods
-keep public class com.applovia.mediation.gamemoven.bridge.LifecycleDispatcher {
    # Kotlin object generates INSTANCE field - must be kept
    public static com.applovia.mediation.gamemoven.bridge.LifecycleDispatcher INSTANCE;
    # Public instance methods (Kotlin object methods are instance methods, not static)
    # Used by wrapper SDKs via LifecycleDispatcher.INSTANCE.onResume() or LifecycleDispatcher.onResume()
    public void onResume(android.app.Activity);
    public void onDestroy();
    # Keep all public methods
    public <methods>;
}

# Cocos parameter class - Critical class, must not be obfuscated
-keep public class com.applovia.mediation.gamemoven.bridge.cocos.CocosNativeParams {
    public *;
    # Keep all fields and methods as they will be called by Cocos
    private *;
}

# ========================================
# Data Model Keep Rules
# ========================================

# Game state record - Used for data persistence
-keep class com.applovia.mediation.gamemoven.model.GameStateRecord { *; }

# ========================================
# Network Receiver Keep Rules
# ========================================

# Network state receiver - Will be called via reflection by system
-keep public class com.applovia.mediation.gamemoven.receiver.NetworkStateReceiver { *; }

# ========================================
# Serialization and Deserialization
# ========================================

# Keep all classes and members with @Keep annotation
-keep @androidx.annotation.Keep class * { *; }
-keep class * {
    @androidx.annotation.Keep *;
}

# ========================================
# Kotlin Related
# ========================================

# Kotlin metadata
-keep class kotlin.Metadata { *; }

# Kotlin reflection
-keepclassmembers class kotlin.** {
    *;
}

# Kotlin coroutines
-keepnames class kotlinx.coroutines.internal.MainDispatcherFactory {}
-keepnames class kotlinx.coroutines.CoroutineExceptionHandler {}

# ========================================
# General Rules
# ========================================

# Keep all native methods
-keepclasseswithmembernames class * {
    native <methods>;
}

# Keep enum classes
-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

# Keep Parcelable
-keep class * implements android.os.Parcelable {
    public static final android.os.Parcelable$Creator *;
}

# Keep Serializable
-keepclassmembers class * implements java.io.Serializable {
    static final long serialVersionUID;
    private 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();
}

# ========================================
# Custom Obfuscation Dictionary
# ========================================
# Note: Dictionary configuration is removed from this file
# because it's included in consumerProguardFiles and will be used by consumers (e.g., screw-sdk)
# Consumers may not have access to the dictionary file.
# Dictionary is only used in local build via proguard-sdk-local.pro
# If you need dictionary for game-sdk, use proguard-sdk-local.pro in buildTypes.release.proguardFiles


# Cocos Creator Engine ProGuard Rules
# Prevent runtime NoSuchMethodError

# Keep all Cocos related classes
-keep class com.cocos.** { *; }
-keep class org.cocos2dx.** { *; }
-keep class com.cocos.lib.** { *; }
-keep class com.cocos.service.** { *; }

# Specifically keep JS bridge classes (Critical! Prevents runtime errors from obfuscation)
-keepclassmembers class com.cocos.lib.CocosJavascriptJavaBridge {
    public static <methods>;
}

-keepclassmembers class com.cocos.lib.CocosHelper {
    public static <methods>;
}

# Keep native methods
-keepclasseswithmembernames class * {
    native <methods>;
}


# ========================================
# AppLovin MAX SDK ProGuard Rules
# ========================================

# AppLovin core
-keep class com.applovin.** { *; }
-keepclassmembers class com.applovin.** { *; }
-dontwarn com.applovin.**

# AppLovin adapters
-keep class com.applovin.mediation.** { *; }
-keepclassmembers class com.applovin.mediation.** { *; }

# AppLovin ad loaders
-keepclassmembers class * implements com.applovin.mediation.MaxAdListener {
    *;
}
-keepclassmembers class * implements com.applovin.mediation.MaxAdViewAdListener {
    *;
}
-keepclassmembers class * implements com.applovin.mediation.MaxRewardedAdListener {
    *;
}
-keepclassmembers class * implements com.applovin.mediation.MaxAdRevenueListener {
    *;
}

# AppLovin native ads
-keep class com.applovin.mediation.nativeAds.** { *; }

# Google UMP (User Messaging Platform) - Required by AppLovin
-keep class com.google.android.ump.** { *; }
-dontwarn com.google.android.ump.**


## Google Play Services 4.3.23 specific rules ##
## https://developer.android.com/google/play-services/setup.html#Proguard ##

-keep class * extends java.util.ListResourceBundle {
    protected Object[][] getContents();
}

-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
    public static final *** NULL;
}

-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
    @com.google.android.gms.common.annotation.KeepName *;
}

-keepnames class * implements android.os.Parcelable {
    public static final ** CREATOR;
}
## Google AdMob specific rules ##
## https://developers.google.com/admob/android/quick-start ##
 
-keep public class com.google.ads.** {
   public *;
}
## Google Analytics 3.0 specific rules ##

-keep class com.google.analytics.** { *; }

#Adjust
-keep public class com.adjust.sdk.** { *; }
-keep class com.google.android.gms.common.ConnectionResult {
    int SUCCESS;
}
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient {
    com.google.android.gms.ads.identifier.AdvertisingIdClient$Info getAdvertisingIdInfo(android.content.Context);
}
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info {
    java.lang.String getId();
    boolean isLimitAdTrackingEnabled();
}
-keep class dalvik.system.VMRuntime {
    java.lang.String getRuntime();
}
-keep class android.os.Build {
    java.lang.String[] SUPPORTED_ABIS;
    java.lang.String CPU_ABI;
}
-keep class android.content.res.Configuration {
    android.os.LocaleList getLocales();
    java.util.Locale locale;
}
-keep class android.os.LocaledList {
    java.util.Locale get(int);
}
-keep public class com.android.installreferrer.** { *; }
#Google Play Referrer API
-keep public class com.android.installreferrer.** { *; }
# Facebook 3.2

-keep class com.facebook.** { *; }
-dontwarn com.facebook.**
-keepattributes Signature

# Fresco v0.8.1 ProGuard rules.
# https://github.com/facebook/fresco

-keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip

# Do not strip any method/class that is annotated with @DoNotStrip
-keep @com.facebook.common.internal.DoNotStrip class *
-keepclassmembers class * {
    @com.facebook.common.internal.DoNotStrip *;
}

# Keep native methods
-keepclassmembers class * {
    native <methods>;
}

-dontwarn okio.**
-dontwarn javax.annotation.**
-dontwarn com.android.volley.toolbox.**
# ========================================
# Firebase SDK ProGuard Rules
# ========================================

# Firebase core
-keep class com.google.firebase.** { *; }
-dontwarn com.google.firebase.**

# Firebase Analytics
-keep class com.google.android.gms.measurement.** { *; }
-dontwarn com.google.android.gms.measurement.**

# Firebase Crashlytics
-keep class com.google.firebase.crashlytics.** { *; }
-keepattributes SourceFile,LineNumberTable
-keepattributes *Annotation*
-keep public class * extends java.lang.Exception

# Firebase Crashlytics NDK
-keep class com.google.firebase.crashlytics.ndk.** { *; }

# Keep custom exception classes
-keep class com.applovia.mediation.gamemoven.utils.CocosError { *; }

# Firebase Remote Config
-keep class com.google.firebase.remoteconfig.** { *; }
-dontwarn com.google.firebase.remoteconfig.**

# Firebase Dynamic Links
-keep class com.google.firebase.dynamiclinks.** { *; }
-dontwarn com.google.firebase.dynamiclinks.**


# Crashlytics 2.+

-keep class com.crashlytics.** { *; }
-keep class com.crashlytics.android.**
-keepattributes SourceFile, LineNumberTable, *Annotation*

# If you are using custom exceptions, add this line so that custom exception types are skipped during obfuscation:
-keep public class * extends java.lang.Exception

# For Fabric to properly de-obfuscate your crash reports, you need to remove this line from your ProGuard config:
# -printmapping mapping.txt
# ========================================
# Aliyun Log Service (AliLog/SLS) ProGuard Rules
# ========================================
# Important: AliLog uses JNI and reflection, must keep all related classes

# Core Producer classes - Keep completely
-keep class com.aliyun.sls.android.producer.** { *; }
-keepclassmembers class com.aliyun.sls.android.producer.** { *; }

# Keep all interfaces
-keep interface com.aliyun.sls.android.producer.** { *; }

# Keep LogProducerClient and its inner classes
-keep class com.aliyun.sls.android.producer.LogProducerClient { *; }
-keep class com.aliyun.sls.android.producer.LogProducerClient$* { *; }

# Keep LogProducerConfig
-keep class com.aliyun.sls.android.producer.LogProducerConfig { *; }
-keep class com.aliyun.sls.android.producer.LogProducerConfig$* { *; }

# Keep LogProducerCallback
-keep class com.aliyun.sls.android.producer.LogProducerCallback { *; }
-keepclassmembers class * implements com.aliyun.sls.android.producer.LogProducerCallback {
    *;
}

# Keep Log related classes
-keep class com.aliyun.sls.android.producer.Log { *; }
-keep class com.aliyun.sls.android.producer.LogProducerException { *; }
-keep class com.aliyun.sls.android.producer.LogProducerResult { *; }

# Keep all native methods (JNI calls)
-keepclasseswithmembernames class com.aliyun.sls.android.producer.** {
    native <methods>;
}

# Keep enum classes
-keepclassmembers class com.aliyun.sls.android.producer.** extends java.lang.Enum {
    <fields>;
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

# Do not obfuscate class names (Important!)
-keepnames class com.aliyun.sls.android.producer.** { *; }

# Do not warn about missing classes (may be optional dependencies)
-dontwarn com.aliyun.sls.android.producer.**
# ========================================
# MMKV ProGuard Rules
# ========================================

# MMKV core classes
-keep class com.tencent.mmkv.** { *; }
-keepclassmembers class com.tencent.mmkv.** { *; }
-dontwarn com.tencent.mmkv.**

# MMKV JNI
-keep class com.tencent.mmkv.MMKV {
    native <methods>;
    long nativeHandle;
    private static *** onMMKVCRCCheckFail(***);
    private static *** onMMKVFileLengthError(***);
    private static *** mmkvLogImp(...);
    private static *** onContentChangedByOuterProcess(***);
}

# Keep classes used for MMKV serialization
-keep class com.applovia.mediation.gamemoven.model.GameStateRecord { *; }


## GSON 2.2.4 specific rules ##

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

-keepattributes EnclosingMethod

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

# Platform calls Class.forName on types which do not exist on Android to determine platform.
-dontnote retrofit2.Platform
# Platform used when running on RoboVM on iOS. Will not be used at runtime.
-dontnote retrofit2.Platform$IOS$MainThreadExecutor
# 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


# JSR 305 annotations are for embedding nullability information.
-dontwarn javax.annotation.**

# A resource is loaded with a relative path so the package of this class must be preserved.
-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase

# Animal Sniffer compileOnly dependency to ensure APIs are compatible with older versions of Java.
-dontwarn org.codehaus.mojo.animal_sniffer.*

# OkHttp platform used only on JVM and when Conscrypt dependency is available.
-dontwarn okhttp3.internal.platform.ConscryptPlatform

# Animal Sniffer compileOnly dependency to ensure APIs are compatible with older versions of Java.
-dontwarn org.codehaus.mojo.animal_sniffer.*