From ef943174d6e40c94c5c6b02fd0e6be06081ab429 Mon Sep 17 00:00:00 2001 From: Santhosh Vaiyapuri Date: Wed, 19 Feb 2025 23:04:09 +0100 Subject: [PATCH] fix: add smallIcon to android push config for expo naming support --- .../src/hooks/useAndroidKeepCallAliveEffect.ts | 4 +++- packages/react-native-sdk/src/utils/StreamVideoRN/types.ts | 6 ++++++ packages/react-native-sdk/src/utils/push/android.ts | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/react-native-sdk/src/hooks/useAndroidKeepCallAliveEffect.ts b/packages/react-native-sdk/src/hooks/useAndroidKeepCallAliveEffect.ts index 9fe7f33b5c..608284b039 100644 --- a/packages/react-native-sdk/src/hooks/useAndroidKeepCallAliveEffect.ts +++ b/packages/react-native-sdk/src/hooks/useAndroidKeepCallAliveEffect.ts @@ -38,7 +38,8 @@ function setForegroundService() { } async function startForegroundService(call_cid: string) { - const foregroundServiceConfig = StreamVideoRN.getConfig().foregroundService; + const videoConfig = StreamVideoRN.getConfig(); + const foregroundServiceConfig = videoConfig.foregroundService; const { title, body } = foregroundServiceConfig.android.notificationTexts; // check for notification permission and then start the foreground service @@ -79,6 +80,7 @@ async function startForegroundService(call_cid: string) { body, android: { channelId, + smallIcon: videoConfig.push?.android.smallIcon, foregroundServiceTypes, asForegroundService: true, ongoing: true, // user cannot dismiss the notification diff --git a/packages/react-native-sdk/src/utils/StreamVideoRN/types.ts b/packages/react-native-sdk/src/utils/StreamVideoRN/types.ts index a25a254532..1ceb2d9b4a 100644 --- a/packages/react-native-sdk/src/utils/StreamVideoRN/types.ts +++ b/packages/react-native-sdk/src/utils/StreamVideoRN/types.ts @@ -32,6 +32,12 @@ export type StreamVideoConfig = { pushProviderName?: string; }; android: { + /** + * The small icon to be used for push notifications for Android + * Reference the name created (Optional, defaults to 'ic_launcher') + * @example "smallIcon: 'ic_small_icon'" or "smallIcon: 'ic_notification'" + */ + smallIcon?: string; /** * The name for the alias of push provider used for Android * Pass undefined if you will not be using stream's push notifications but still want to use the functionality of the SDK diff --git a/packages/react-native-sdk/src/utils/push/android.ts b/packages/react-native-sdk/src/utils/push/android.ts index bfc77d0144..67fab36504 100644 --- a/packages/react-native-sdk/src/utils/push/android.ts +++ b/packages/react-native-sdk/src/utils/push/android.ts @@ -279,6 +279,7 @@ export const firebaseDataHandler = async ( data, android: { channelId, + smallIcon: pushConfig.android.smallIcon, importance: 4, // high importance foregroundServiceTypes: getIncomingCallForegroundServiceTypes(), asForegroundService, @@ -365,6 +366,7 @@ export const firebaseDataHandler = async ( data, android: { sound: callChannel.sound, + smallIcon: pushConfig.android.smallIcon, vibrationPattern: callChannel.vibrationPattern, channelId, importance: 4, // high importance