From 6f9a0ef5ac46794c521e784e24edfd3bed66ce43 Mon Sep 17 00:00:00 2001 From: skydoves Date: Fri, 31 May 2024 13:06:03 +0900 Subject: [PATCH 1/3] Add proguard / R8 integration for the default rule configuration --- .../META-INF/proguards/stream-chat.pro | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 stream-chat-android-client/src/main/resources/META-INF/proguards/stream-chat.pro diff --git a/stream-chat-android-client/src/main/resources/META-INF/proguards/stream-chat.pro b/stream-chat-android-client/src/main/resources/META-INF/proguards/stream-chat.pro new file mode 100644 index 00000000000..4a40c98caeb --- /dev/null +++ b/stream-chat-android-client/src/main/resources/META-INF/proguards/stream-chat.pro @@ -0,0 +1,26 @@ +## Stream Chat Android Client Proguard Rules + +# Classes that are using with QuerySort can't be minified, because QuerySort uses reflection. If the +# name of the fields of the classes being used by QuerySort, change, the sort won't work as expected. +-keep class io.getstream.chat.android.models.** { *; } +-keep class io.getstream.chat.android.client.api2.model.** { *; } + +# ExtraDataDto can't be minified because we check for extraData using reflection in +# io.getstream.chat.android.client.parser2.adapters.CustomObjectDtoAdapter. If the name of extraData +# is changed, we will have problem with serialization. +-keep class * extends io.getstream.chat.android.client.api2.model.dto.ExtraDataDto { + public kotlin.collections.Map extraData; + } + +# Rules necessary for R8 full mode +-keep class io.getstream.chat.android.client.api2.endpoint.** { *; } +-keep class io.getstream.chat.android.client.call.RetrofitCall { *; } +-keep class com.squareup.moshi.JsonReader +-keep class com.squareup.moshi.JsonAdapter +-keep class kotlin.reflect.jvm.internal.* { *; } + +# Rules to improve the logs by keeping the names of the classes +-keep class * extends io.getstream.chat.android.client.clientstate.UserState + +# Classes that are used by reflection. +-keep class io.getstream.chat.android.client.notifications.ChatPushDelegate { *; } From 16f3ab0ae24d1761806f0232640a7b366250cdd9 Mon Sep 17 00:00:00 2001 From: skydoves Date: Fri, 31 May 2024 13:07:44 +0900 Subject: [PATCH 2/3] Add proguard rules for the common-ui module via meta info --- .../src/main/resources/META-INF/proguards/stream-chat.pro | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 stream-chat-android-ui-common/src/main/resources/META-INF/proguards/stream-chat.pro diff --git a/stream-chat-android-ui-common/src/main/resources/META-INF/proguards/stream-chat.pro b/stream-chat-android-ui-common/src/main/resources/META-INF/proguards/stream-chat.pro new file mode 100644 index 00000000000..b7ab72378fa --- /dev/null +++ b/stream-chat-android-ui-common/src/main/resources/META-INF/proguards/stream-chat.pro @@ -0,0 +1,5 @@ +## Stream Chat Android UI Common Proguard Rules + +# Classes that are used by reflection. +-keep class io.getstream.chat.android.ui.common.notifications.StreamCoilUserIconBuilder { *; } +-keep class io.getstream.android.push.permissions.snackbar.SnackbarNotificationPermissionHandler { *; } \ No newline at end of file From 390fef040dfb2028b32efe803a72762ad265b49e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jc=20Mi=C3=B1arro?= Date: Fri, 31 May 2024 11:00:58 +0200 Subject: [PATCH 3/3] Rename proguards files --- .../proguards/{stream-chat.pro => stream-chat-android-client.pro} | 0 .../{stream-chat.pro => stream-chat-android-ui-common.pro} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename stream-chat-android-client/src/main/resources/META-INF/proguards/{stream-chat.pro => stream-chat-android-client.pro} (100%) rename stream-chat-android-ui-common/src/main/resources/META-INF/proguards/{stream-chat.pro => stream-chat-android-ui-common.pro} (100%) diff --git a/stream-chat-android-client/src/main/resources/META-INF/proguards/stream-chat.pro b/stream-chat-android-client/src/main/resources/META-INF/proguards/stream-chat-android-client.pro similarity index 100% rename from stream-chat-android-client/src/main/resources/META-INF/proguards/stream-chat.pro rename to stream-chat-android-client/src/main/resources/META-INF/proguards/stream-chat-android-client.pro diff --git a/stream-chat-android-ui-common/src/main/resources/META-INF/proguards/stream-chat.pro b/stream-chat-android-ui-common/src/main/resources/META-INF/proguards/stream-chat-android-ui-common.pro similarity index 100% rename from stream-chat-android-ui-common/src/main/resources/META-INF/proguards/stream-chat.pro rename to stream-chat-android-ui-common/src/main/resources/META-INF/proguards/stream-chat-android-ui-common.pro