From 821cc1136408c0fe6aee5a6bd3c0ba30da1a2d06 Mon Sep 17 00:00:00 2001 From: Calin-Teodor Date: Tue, 21 Nov 2023 15:09:55 +0200 Subject: [PATCH] sdk(react-native-sdk/android): replaced activityContext with currentActivity --- .../org/jitsi/meet/sdk/JMOngoingConferenceModule.java | 6 +++--- .../meet/sdk/JitsiMeetOngoingConferenceService.java | 5 +++-- .../java/org/jitsi/meet/sdk/RNOngoingNotification.java | 9 +++++---- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/react-native-sdk/android/src/main/java/org/jitsi/meet/sdk/JMOngoingConferenceModule.java b/react-native-sdk/android/src/main/java/org/jitsi/meet/sdk/JMOngoingConferenceModule.java index ca3b22ebe7..f817318a4a 100644 --- a/react-native-sdk/android/src/main/java/org/jitsi/meet/sdk/JMOngoingConferenceModule.java +++ b/react-native-sdk/android/src/main/java/org/jitsi/meet/sdk/JMOngoingConferenceModule.java @@ -1,6 +1,6 @@ package org.jitsi.meet.sdk; -import android.app.Notification; +import android.app.Activity; import android.content.Context; import androidx.annotation.NonNull; @@ -24,9 +24,9 @@ class JMOngoingConferenceModule @ReactMethod public void launch() { Context context = getReactApplicationContext(); - Context activityContext = context.getCurrentActivity(); + Activity currentActivity = getCurrentActivity(); - JitsiMeetOngoingConferenceService.launch(context, activityContext); + JitsiMeetOngoingConferenceService.launch(context, currentActivity); } @ReactMethod diff --git a/react-native-sdk/android/src/main/java/org/jitsi/meet/sdk/JitsiMeetOngoingConferenceService.java b/react-native-sdk/android/src/main/java/org/jitsi/meet/sdk/JitsiMeetOngoingConferenceService.java index 0d760e123f..20900c3cea 100644 --- a/react-native-sdk/android/src/main/java/org/jitsi/meet/sdk/JitsiMeetOngoingConferenceService.java +++ b/react-native-sdk/android/src/main/java/org/jitsi/meet/sdk/JitsiMeetOngoingConferenceService.java @@ -16,6 +16,7 @@ package org.jitsi.meet.sdk; +import android.app.Activity; import android.app.Notification; import android.app.NotificationManager; import android.app.Service; @@ -41,9 +42,9 @@ import java.util.HashMap; public class JitsiMeetOngoingConferenceService extends Service { private static final String TAG = JitsiMeetOngoingConferenceService.class.getSimpleName(); - public static void launch(Context context, Context activityContext) { + public static void launch(Context context, Activity currentActivity) { - RNOngoingNotification.createOngoingConferenceNotificationChannel(activityContext); + RNOngoingNotification.createOngoingConferenceNotificationChannel(currentActivity); Intent intent = new Intent(context, JitsiMeetOngoingConferenceService.class); diff --git a/react-native-sdk/android/src/main/java/org/jitsi/meet/sdk/RNOngoingNotification.java b/react-native-sdk/android/src/main/java/org/jitsi/meet/sdk/RNOngoingNotification.java index 688d57b1e0..868c81a852 100644 --- a/react-native-sdk/android/src/main/java/org/jitsi/meet/sdk/RNOngoingNotification.java +++ b/react-native-sdk/android/src/main/java/org/jitsi/meet/sdk/RNOngoingNotification.java @@ -16,6 +16,7 @@ package org.jitsi.meet.sdk; +import android.app.Activity; import android.app.Notification; import android.app.NotificationChannel; import android.app.NotificationManager; @@ -41,19 +42,19 @@ class RNOngoingNotification { static final int NOTIFICATION_ID = new Random().nextInt(99999) + 10000; - static void createOngoingConferenceNotificationChannel(Context activityContext) { + static void createOngoingConferenceNotificationChannel(Activity currentActivity) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) { return; } - if (activityContext == null) { + if (currentActivity == null) { JitsiMeetLogger.w(TAG + " Cannot create notification channel: no current context"); return; } NotificationManager notificationManager - = (NotificationManager) activityContext.getSystemService(Context.NOTIFICATION_SERVICE); + = (NotificationManager) currentActivity.getSystemService(Context.NOTIFICATION_SERVICE); NotificationChannel channel = notificationManager.getNotificationChannel("JitsiOngoingConferenceChannel"); @@ -62,7 +63,7 @@ class RNOngoingNotification { return; } - channel = new NotificationChannel("JitsiOngoingConferenceChannel", activityContext.getString(R.string.ongoing_notification_channel_name), NotificationManager.IMPORTANCE_DEFAULT); + channel = new NotificationChannel("JitsiOngoingConferenceChannel", currentActivity.getString(R.string.ongoing_notification_channel_name), NotificationManager.IMPORTANCE_DEFAULT); channel.enableLights(false); channel.enableVibration(false); channel.setShowBadge(false);