From 5e9610e49c511b21a02a8baa21a547051e1371bf Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Wed, 22 Apr 2026 14:59:15 +0300 Subject: [PATCH] Revert "add android MessagingStyle for chat notifications" This reverts commit 0cbbc62d24daf08c63470702dbee445ce27f0515. --- ...ons+0.32.16+002+chat-messaging-style.patch | 87 ------------------- 1 file changed, 87 deletions(-) delete mode 100644 patches/expo-notifications+0.32.16+002+chat-messaging-style.patch diff --git a/patches/expo-notifications+0.32.16+002+chat-messaging-style.patch b/patches/expo-notifications+0.32.16+002+chat-messaging-style.patch deleted file mode 100644 index 3e11522d09..0000000000 --- a/patches/expo-notifications+0.32.16+002+chat-messaging-style.patch +++ /dev/null @@ -1,87 +0,0 @@ -diff --git a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/service/delegates/ExpoPresentationDelegate.kt b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/service/delegates/ExpoPresentationDelegate.kt -index 38f6fba..c0406c6 100644 ---- a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/service/delegates/ExpoPresentationDelegate.kt -+++ b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/service/delegates/ExpoPresentationDelegate.kt -@@ -2,6 +2,7 @@ package expo.modules.notifications.service.delegates - - import android.app.NotificationManager - import android.content.Context -+import android.graphics.BitmapFactory - import android.media.RingtoneManager - import android.net.Uri - import android.os.Build -@@ -13,6 +14,8 @@ import android.util.Log - import android.util.Pair - import androidx.core.app.NotificationCompat - import androidx.core.app.NotificationManagerCompat -+import androidx.core.app.Person -+import androidx.core.graphics.drawable.IconCompat - import expo.modules.notifications.notifications.SoundResolver - import expo.modules.notifications.notifications.enums.NotificationPriority - import expo.modules.notifications.notifications.model.NotificationBehaviorRecord -@@ -26,6 +29,7 @@ import kotlinx.coroutines.Dispatchers - import kotlinx.coroutines.launch - import org.json.JSONException - import org.json.JSONObject -+import java.net.URL - import java.util.Date - - open class ExpoPresentationDelegate( -@@ -156,11 +160,55 @@ open class ExpoPresentationDelegate( - - override fun dismissAllNotifications() = NotificationManagerCompat.from(context).cancelAll() - -- protected open suspend fun createNotification(notification: Notification, notificationBehavior: NotificationBehaviorRecord?): android.app.Notification = -- ExpoNotificationBuilder(context, notification, SharedPreferencesNotificationCategoriesStore(context)).apply { -+ protected open suspend fun createNotification(notification: Notification, notificationBehavior: NotificationBehaviorRecord?): android.app.Notification { -+ val baseNotification = ExpoNotificationBuilder(context, notification, SharedPreferencesNotificationCategoriesStore(context)).apply { - setAllowedBehavior(notificationBehavior) - }.build() - -+ val body = notification.notificationRequest.content.body -+ val reason = body?.optString("reason") -+ if (reason == "chat-message" || reason == "chat-reaction") { -+ return buildChatNotification(baseNotification, body) ?: baseNotification -+ } -+ return baseNotification -+ } -+ -+ private fun buildChatNotification(baseNotification: android.app.Notification, body: JSONObject): android.app.Notification? { -+ try { -+ val senderName = body.optString("senderDisplayName").ifEmpty { null } ?: return null -+ val messageText = NotificationCompat.getContentText(baseNotification)?.toString() ?: "" -+ val avatarUrl = body.optString("senderAvatarUrl").ifEmpty { null } -+ -+ val personBuilder = Person.Builder().setName(senderName) -+ if (avatarUrl != null) { -+ try { -+ val thumbnailUrl = avatarUrl.replace("/img/avatar/", "/img/avatar_thumbnail/") -+ val conn = URL(thumbnailUrl).openConnection() -+ conn.connectTimeout = 5000 -+ conn.readTimeout = 5000 -+ val bitmap = BitmapFactory.decodeStream(conn.getInputStream()) -+ if (bitmap != null) { -+ personBuilder.setIcon(IconCompat.createWithBitmap(bitmap)) -+ } -+ } catch (e: Exception) { -+ // Avatar download failed, continue without icon -+ } -+ } -+ val person = personBuilder.build() -+ -+ val style = NotificationCompat.MessagingStyle(person) -+ .addMessage(messageText, System.currentTimeMillis(), person) -+ -+ val builder = NotificationCompat.Builder(context, baseNotification) -+ .setStyle(style) -+ -+ return builder.build() -+ } catch (e: Exception) { -+ Log.e("expo-notifications", "Failed to build chat notification", e) -+ return null -+ } -+ } -+ - protected open fun getNotification(statusBarNotification: StatusBarNotification): Notification? { - val notification = statusBarNotification.notification - notification.extras.getByteArray(ExpoNotificationBuilder.EXTRAS_MARSHALLED_NOTIFICATION_REQUEST_KEY)?.let {