Преглед изворни кода

feat(android) expose channels ids

master
tmoldovan8x8 пре 4 година
родитељ
комит
c7ad5b5b26
No account linked to committer's email address

+ 11
- 0
android/sdk/src/main/java/org/jitsi/meet/sdk/NotificationChannels.java Прегледај датотеку

@@ -0,0 +1,11 @@
1
+package org.jitsi.meet.sdk;
2
+
3
+import java.util.ArrayList;
4
+import java.util.List;
5
+
6
+public class NotificationChannels {
7
+    static final String ONGOING_CONFERENCE_CHANNEL_ID = "JitsiOngoingConferenceChannel";
8
+    static final String ONGOING_CONFERNCE_CHANNEL_NAME = "Ongoing Conference Notifications";
9
+
10
+    public static List<String> allIds = new ArrayList<String>() {{ add(ONGOING_CONFERENCE_CHANNEL_ID); }};
11
+}

+ 6
- 6
android/sdk/src/main/java/org/jitsi/meet/sdk/OngoingNotification.java Прегледај датотеку

@@ -16,6 +16,9 @@
16 16
 
17 17
 package org.jitsi.meet.sdk;
18 18
 
19
+import static org.jitsi.meet.sdk.NotificationChannels.ONGOING_CONFERENCE_CHANNEL_ID;
20
+import static org.jitsi.meet.sdk.NotificationChannels.ONGOING_CONFERNCE_CHANNEL_NAME;
21
+
19 22
 import android.app.Notification;
20 23
 import android.app.NotificationChannel;
21 24
 import android.app.NotificationManager;
@@ -39,9 +42,6 @@ import java.util.Random;
39 42
 class OngoingNotification {
40 43
     private static final String TAG = OngoingNotification.class.getSimpleName();
41 44
 
42
-    private static final String CHANNEL_ID = "JitsiNotificationChannel";
43
-    private static final String CHANNEL_NAME = "Ongoing Conference Notifications";
44
-
45 45
     static final int NOTIFICATION_ID = new Random().nextInt(99999) + 10000;
46 46
     private static long startingTime = 0;
47 47
 
@@ -60,13 +60,13 @@ class OngoingNotification {
60 60
             = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
61 61
 
62 62
         NotificationChannel channel
63
-            = notificationManager.getNotificationChannel(CHANNEL_ID);
63
+            = notificationManager.getNotificationChannel(ONGOING_CONFERENCE_CHANNEL_ID);
64 64
         if (channel != null) {
65 65
             // The channel was already created, no need to do it again.
66 66
             return;
67 67
         }
68 68
 
69
-        channel = new NotificationChannel(CHANNEL_ID, CHANNEL_NAME, NotificationManager.IMPORTANCE_DEFAULT);
69
+        channel = new NotificationChannel(ONGOING_CONFERENCE_CHANNEL_ID, ONGOING_CONFERNCE_CHANNEL_NAME, NotificationManager.IMPORTANCE_DEFAULT);
70 70
         channel.enableLights(false);
71 71
         channel.enableVibration(false);
72 72
         channel.setShowBadge(false);
@@ -84,7 +84,7 @@ class OngoingNotification {
84 84
         Intent notificationIntent = new Intent(context, context.getClass());
85 85
         PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
86 86
 
87
-        NotificationCompat.Builder builder = new NotificationCompat.Builder(context, CHANNEL_ID);
87
+        NotificationCompat.Builder builder = new NotificationCompat.Builder(context, ONGOING_CONFERENCE_CHANNEL_ID);
88 88
 
89 89
         if (startingTime == 0) {
90 90
             startingTime = System.currentTimeMillis();

Loading…
Откажи
Сачувај