From a22fcb92e93eda32bda00f8f2ac161836943d50a Mon Sep 17 00:00:00 2001 From: Den <2119348+dzianisv@users.noreply.github.com> Date: Wed, 3 Jun 2026 03:06:37 -0700 Subject: [PATCH] fix(fdroid): Firebase-free stubs for expo-notifications --- .../notifications/debug/DebugLogging.kt | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 fdroid/expo-notifications-patches/notifications/debug/DebugLogging.kt diff --git a/fdroid/expo-notifications-patches/notifications/debug/DebugLogging.kt b/fdroid/expo-notifications-patches/notifications/debug/DebugLogging.kt new file mode 100644 index 0000000..10d625d --- /dev/null +++ b/fdroid/expo-notifications-patches/notifications/debug/DebugLogging.kt @@ -0,0 +1,65 @@ +package expo.modules.notifications.notifications.debug + +import android.os.Build +import android.os.Bundle +import android.util.Log +import androidx.annotation.RequiresApi +import expo.modules.notifications.BuildConfig +import expo.modules.notifications.notifications.model.Notification +import java.util.function.Consumer + +/** + * Patched version (Firebase-free) for F-Droid builds. + * logRemoteMessage() removed — no Firebase classes referenced. + */ +object DebugLogging { + @JvmStatic + fun logBundle(caller: String, bundleToLog: Bundle) { + if (!BuildConfig.DEBUG) { + return + } + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { + return + } + Log.i("expo-notifications", "$caller:\n${bundleString(caller, bundleToLog, 0)}") + } + + @RequiresApi(Build.VERSION_CODES.N) + private fun bundleString(ignoredCaller: String, bundleToLog: Bundle, indent: Int): String { + return buildString { + bundleToLog.keySet().forEach( + Consumer { key: String -> + val value = bundleToLog[key] + if (value is Bundle) { + append("${" ".repeat(indent)}${key}\n") + append(bundleString(ignoredCaller, value, indent + 2)) + } else { + val stringValue = value?.toString() ?: "(null)" + append("${" ".repeat(indent)}$key: $stringValue\n") + } + } + ) + } + } + + fun logNotification(caller: String, notification: Notification) { + if (!BuildConfig.DEBUG) { + return + } + val logMessage = + """ + $caller: + notification.notificationRequest.content.title: ${notification.notificationRequest.content.title} + notification.notificationRequest.content.subText: ${notification.notificationRequest.content.subText} + notification.notificationRequest.content.text: ${notification.notificationRequest.content.text} + notification.notificationRequest.content.sound: ${notification.notificationRequest.content.soundName} + notification.notificationRequest.content.channelID: ${notification.notificationRequest.trigger.getNotificationChannel()} + notification.notificationRequest.content.body: ${notification.notificationRequest.content.body} + notification.notificationRequest.content.color: ${notification.notificationRequest.content.color} + notification.notificationRequest.content.vibrationPattern: ${notification.notificationRequest.content.vibrationPattern?.contentToString()} + notification.notificationRequest.identifier: ${notification.notificationRequest.identifier} + """.trimIndent() + + Log.i("expo-notifications", logMessage) + } +}