Browse Source

sdk(react-native-sdk/android): replaced activityContext with currentActivity

factor2
Calin-Teodor 1 year ago
parent
commit
821cc11364

+ 3
- 3
react-native-sdk/android/src/main/java/org/jitsi/meet/sdk/JMOngoingConferenceModule.java View File

@@ -1,6 +1,6 @@
1 1
 package org.jitsi.meet.sdk;
2 2
 
3
-import android.app.Notification;
3
+import android.app.Activity;
4 4
 import android.content.Context;
5 5
 
6 6
 import androidx.annotation.NonNull;
@@ -24,9 +24,9 @@ class JMOngoingConferenceModule
24 24
     @ReactMethod
25 25
     public void launch() {
26 26
         Context context = getReactApplicationContext();
27
-        Context activityContext = context.getCurrentActivity();
27
+        Activity currentActivity = getCurrentActivity();
28 28
 
29
-        JitsiMeetOngoingConferenceService.launch(context, activityContext);
29
+        JitsiMeetOngoingConferenceService.launch(context, currentActivity);
30 30
     }
31 31
 
32 32
     @ReactMethod

+ 3
- 2
react-native-sdk/android/src/main/java/org/jitsi/meet/sdk/JitsiMeetOngoingConferenceService.java View File

@@ -16,6 +16,7 @@
16 16
 
17 17
 package org.jitsi.meet.sdk;
18 18
 
19
+import android.app.Activity;
19 20
 import android.app.Notification;
20 21
 import android.app.NotificationManager;
21 22
 import android.app.Service;
@@ -41,9 +42,9 @@ import java.util.HashMap;
41 42
 public class JitsiMeetOngoingConferenceService extends Service {
42 43
     private static final String TAG = JitsiMeetOngoingConferenceService.class.getSimpleName();
43 44
 
44
-    public static void launch(Context context, Context activityContext) {
45
+    public static void launch(Context context, Activity currentActivity) {
45 46
 
46
-        RNOngoingNotification.createOngoingConferenceNotificationChannel(activityContext);
47
+        RNOngoingNotification.createOngoingConferenceNotificationChannel(currentActivity);
47 48
 
48 49
         Intent intent = new Intent(context, JitsiMeetOngoingConferenceService.class);
49 50
 

+ 5
- 4
react-native-sdk/android/src/main/java/org/jitsi/meet/sdk/RNOngoingNotification.java View File

@@ -16,6 +16,7 @@
16 16
 
17 17
 package org.jitsi.meet.sdk;
18 18
 
19
+import android.app.Activity;
19 20
 import android.app.Notification;
20 21
 import android.app.NotificationChannel;
21 22
 import android.app.NotificationManager;
@@ -41,19 +42,19 @@ class RNOngoingNotification {
41 42
 
42 43
     static final int NOTIFICATION_ID = new Random().nextInt(99999) + 10000;
43 44
 
44
-    static void createOngoingConferenceNotificationChannel(Context activityContext) {
45
+    static void createOngoingConferenceNotificationChannel(Activity currentActivity) {
45 46
 
46 47
         if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
47 48
             return;
48 49
         }
49 50
 
50
-        if (activityContext == null) {
51
+        if (currentActivity == null) {
51 52
             JitsiMeetLogger.w(TAG + " Cannot create notification channel: no current context");
52 53
             return;
53 54
         }
54 55
 
55 56
         NotificationManager notificationManager
56
-            = (NotificationManager) activityContext.getSystemService(Context.NOTIFICATION_SERVICE);
57
+            = (NotificationManager) currentActivity.getSystemService(Context.NOTIFICATION_SERVICE);
57 58
 
58 59
         NotificationChannel channel
59 60
             = notificationManager.getNotificationChannel("JitsiOngoingConferenceChannel");
@@ -62,7 +63,7 @@ class RNOngoingNotification {
62 63
             return;
63 64
         }
64 65
 
65
-        channel = new NotificationChannel("JitsiOngoingConferenceChannel", activityContext.getString(R.string.ongoing_notification_channel_name), NotificationManager.IMPORTANCE_DEFAULT);
66
+        channel = new NotificationChannel("JitsiOngoingConferenceChannel", currentActivity.getString(R.string.ongoing_notification_channel_name), NotificationManager.IMPORTANCE_DEFAULT);
66 67
         channel.enableLights(false);
67 68
         channel.enableVibration(false);
68 69
         channel.setShowBadge(false);

Loading…
Cancel
Save