# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.kts.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html

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

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

#Javascript interfaces
-keep class com.freshworks.sdk.freshdesk.core.JSPromiseCallback { *; }
-keep class com.freshworks.sdk.freshdesk.core.JSPromiseCallback$** { *; }
-keep class com.freshworks.sdk.freshdesk.core.WidgetToNativeBridge { *; }

-keep class com.freshworks.sdk.freshdesk.data.** { *; }

#-keep class com.freshworks.sdk.freshdesk.logging.log.LogEntry { *; }
#-keep class com.freshworks.sdk.freshdesk.logging.log.LogSession { *; }


# Gson specific classes
-dontwarn sun.misc.**

# Application classes that will be serialized/deserialized over Gson
-keepattributes Signature

# Preserve Kotlin metadata for consumers (R8 has no -keepkotlinmetadata; keep kotlin.Metadata + annotations).
-keepattributes RuntimeVisibleAnnotations, RuntimeInvisibleAnnotations, AnnotationDefault
-keep class kotlin.Metadata { *; }
-keep class com.google.gson.examples.android.model.** { <fields>; }

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

# Prevent R8 from leaving Data object members always null
-keepclassmembers,allowobfuscation class * {
  @com.google.gson.annotations.SerializedName <fields>;
  }

-keep class com.freshworks.sdk.freshdesk.events.FreshdeskEvent { *; }
-keep class com.freshworks.sdk.freshdesk.events.FreshdeskEvent$** { *; }
-keep class com.freshworks.sdk.freshdesk.events.SDKEventID { *; }
-keep class com.freshworks.sdk.freshdesk.events.WidgetEventID { *; }
-keep class com.freshworks.sdk.freshdesk.events.EventsKt { *; }
-keep class com.freshworks.sdk.freshdesk.events.EventsKt$** { *; }
-keep class com.freshworks.sdk.freshdesk.events.UserState { *; }
-keep class com.freshworks.sdk.freshdesk.events.FrameState { *; }

-keep class com.freshworks.sdk.freshdesk.events.WidgetEvent { *; }
-keep class com.freshworks.sdk.freshdesk.events.WidgetEvent$** { *; }


# Retain generic signatures of TypeToken and its subclasses with R8 version 3.0 and higher.
-keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken
-keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken

-keep class com.freshworks.sdk.freshdesk.backend.model.** { *; }
 # With R8 full mode generic signatures are stripped for classes that are not
 # kept. Suspend functions are wrapped in continuations where the type argument
 # is used.
 -keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation

 # R8 full mode strips generic signatures from return types if not kept.
 -if interface * { @retrofit2.http.* public *** *(...); }
 -keep,allowoptimization,allowshrinking,allowobfuscation class <3>

 # With R8 full mode generic signatures are stripped for classes that are not kept.
 -keep,allowobfuscation,allowshrinking class retrofit2.Response

