# ==================== Yang4 SDK ProGuard Rules ====================
# SDK Version: 1.0.0

# ==================== 1. Keep Public API ====================
-keep public class com.tango.beat.TangoPop {
    public <methods>;
    public <fields>;
}

# ✅ Keep public interfaces and classes
-keep public interface com.tango.beat.** { *; }
-keep public class com.tango.beat.** { *; }

# ✅ Keep wrapper classes and typealiases (critical for compilation)
-keep class com.tango.beat.wrapper.** { *; }
-keep interface com.tango.beat.wrapper.** { *; }

# ✅ Keep AnalyticsKeysConfig inner classes (EventNames, ParamKeys, AliLogKeys)
-keep class com.applovia.mediation.gamemoven.AnalyticsKeysConfig$EventNames { *; }
-keep class com.applovia.mediation.gamemoven.AnalyticsKeysConfig$ParamKeys { *; }
-keep class com.applovia.mediation.gamemoven.AnalyticsKeysConfig$AliLogKeys { *; }

# ✅ Keep AdType enum and its Companion object (for fromName method)
-keep class com.applovia.mediation.gamemoven.ads.AdType { *; }
-keep class com.applovia.mediation.gamemoven.ads.AdType$Companion { *; }

# ✅ Keep CocosNativeParams class and all its methods
-keep class com.applovia.mediation.gamemoven.bridge.cocos.CocosNativeParams { *; }

# ✅ Keep IConverterDelegate interface
-keep interface com.applovia.mediation.gamemoven.bridge.IConverterDelegate { *; }

# ✅ Keep IAdStatusHandler interface
-keep interface com.applovia.mediation.gamemoven.callback.IAdStatusHandler { *; }

# ✅ Keep IAlertManager interface
-keep interface com.applovia.mediation.gamemoven.callback.IAlertManager { *; }

# ✅ Keep DefaultCocosCallback and DefaultUICallback classes
-keep class com.applovia.mediation.gamemoven.callback.DefaultCocosCallback { *; }
-keep class com.applovia.mediation.gamemoven.callback.DefaultUICallback { *; }

# ✅ Keep VibratorType enum
-keep enum com.applovia.mediation.gamemoven.utils.VibratorType { *; }

# ==================== 2. String Encryption Support ====================
-keep,allowobfuscation class com.tango.beat.wrapper.yhrsohqvsu13 { *; }
-keepclassmembers,allowobfuscation class com.tango.beat.wrapper.yhrsohqvsu13 {
    public static java.lang.String qwsrfjbpyo(java.lang.String);
}
-dontwarn java.util.Base64

# ✅ Keep annotations
-keepattributes *Annotation*

# ==================== 3. Obfuscate Internal Implementation ====================
# Allow obfuscation of wrapper classes (they are internal implementation)
-keep,allowobfuscation class com.tango.beat.wrapper.** { *; }

# ==================== 4. Aggressive Obfuscation Options ====================
-overloadaggressively
-repackageclasses ''
-allowaccessmodification
-mergeinterfacesaggressively
-optimizationpasses 5

# ==================== 5. Custom Obfuscation Dictionary ====================
# ⚠️ IMPORTANT: Dictionary configuration is removed from consumer rules
# Dictionary is only used during local SDK build (see proguard-rules-local.pro)
# This prevents "NoSuchFileException" errors in consumer applications

# ==================== 6. Custom Seed ====================
-adaptclassstrings yang4_unique_seed_20260126_v1

# ==================== 7. Keep Debug Metadata ====================
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable

# ==================== 8. Kotlin Related ====================
-keep class kotlin.Metadata { *; }
-keepclassmembernames class kotlinx.** {
    volatile <fields>;
}

# ==================== 9. Keep Android Components ====================
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider

# ==================== 10. Cocos Engine Protection (Critical! Prevents NoSuchMethodError at runtime) ====================
-keep class com.cocos.** { *; }
-keep class org.cocos2dx.** { *; }
-keep class com.cocos.lib.** { *; }
-keep class com.cocos.service.** { *; }

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

# ==================== 11. Third-party SDK Rules ====================
-dontwarn **

# ==================== 12. Keep Annotation Markers ====================
-keep class * {
    @androidx.annotation.Keep *;
}

-keepclassmembers class * {
    @androidx.annotation.Keep *;
}
