voice-react-native-sdk 1.6.2-fork.24-hack → 1.6.2-fork.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +1 -1
- package/android/src/main/AndroidManifest.xml +2 -1
- package/android/src/main/java/com/twiliovoicereactnative/CallListenerProxy.java +1 -5
- package/android/src/main/java/com/twiliovoicereactnative/NotificationUtility.java +25 -13
- package/android/src/main/java/com/twiliovoicereactnative/TwilioVoiceReactNativeModule.java +0 -3
- package/android/src/main/java/com/twiliovoicereactnative/VoiceService.java +2 -1
- package/android/src/main/res/values/config.xml +2 -2
- package/package.json +1 -1
package/android/build.gradle
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
<uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>
|
|
5
5
|
<uses-permission android:name="android.permission.INTERNET" />
|
|
6
6
|
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
|
7
|
+
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
|
|
7
8
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
|
8
9
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
|
9
10
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE"/>
|
|
@@ -15,7 +16,7 @@
|
|
|
15
16
|
<service
|
|
16
17
|
android:name=".VoiceFirebaseMessagingService"
|
|
17
18
|
android:stopWithTask="false"
|
|
18
|
-
android:exported="
|
|
19
|
+
android:exported="true"
|
|
19
20
|
android:enabled="@bool/twiliovoicereactnative_firebasemessagingservice_enabled">
|
|
20
21
|
<intent-filter>
|
|
21
22
|
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
|
@@ -57,11 +57,7 @@ class CallListenerProxy implements Call.Listener {
|
|
|
57
57
|
getAudioSwitchManager().getAudioSwitch().deactivate();
|
|
58
58
|
|
|
59
59
|
// find call record & remove
|
|
60
|
-
|
|
61
|
-
CallRecord callRecord = getCallRecordDatabase().remove(new CallRecord(uuid));
|
|
62
|
-
if (callRecord == null) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
60
|
+
CallRecord callRecord = Objects.requireNonNull(getCallRecordDatabase().remove(new CallRecord(uuid)));
|
|
65
61
|
|
|
66
62
|
// take down notification
|
|
67
63
|
getVoiceServiceApi().cancelActiveCallNotification(callRecord);
|
|
@@ -24,6 +24,7 @@ import androidx.core.app.Person;
|
|
|
24
24
|
|
|
25
25
|
import com.twilio.voice.CallInvite;
|
|
26
26
|
|
|
27
|
+
import static com.twiliovoicereactnative.ConfigurationProperties.isFullScreenNotificationEnabled;
|
|
27
28
|
import static com.twiliovoicereactnative.Constants.VOICE_CHANNEL_DEFAULT_IMPORTANCE;
|
|
28
29
|
import static com.twiliovoicereactnative.Constants.VOICE_CHANNEL_HIGH_IMPORTANCE;
|
|
29
30
|
import static com.twiliovoicereactnative.Constants.VOICE_CHANNEL_LOW_IMPORTANCE;
|
|
@@ -165,16 +166,18 @@ class NotificationUtility {
|
|
|
165
166
|
callRecord.getUuid());
|
|
166
167
|
PendingIntent piAcceptIntent = constructPendingIntentForActivity(context, acceptIntent);
|
|
167
168
|
|
|
168
|
-
|
|
169
|
+
NotificationCompat.Builder builder = constructNotificationBuilder(context, channelImportance)
|
|
169
170
|
.setSmallIcon(notificationResource.getSmallIconId())
|
|
170
171
|
.setCategory(Notification.CATEGORY_CALL)
|
|
171
172
|
.setAutoCancel(true)
|
|
172
173
|
.setContentIntent(piForegroundIntent)
|
|
173
|
-
.setFullScreenIntent(piForegroundIntent, true)
|
|
174
174
|
.addPerson(incomingCaller)
|
|
175
175
|
.setStyle(NotificationCompat.CallStyle.forIncomingCall(
|
|
176
|
-
incomingCaller, piRejectIntent, piAcceptIntent))
|
|
177
|
-
|
|
176
|
+
incomingCaller, piRejectIntent, piAcceptIntent));
|
|
177
|
+
if (isFullscreenIntentEnabled(context)) {
|
|
178
|
+
builder.setFullScreenIntent(piForegroundIntent, true);
|
|
179
|
+
}
|
|
180
|
+
return builder.build();
|
|
178
181
|
}
|
|
179
182
|
|
|
180
183
|
public static Notification createCallAnsweredNotificationWithLowImportance(@NonNull Context context,
|
|
@@ -202,16 +205,18 @@ class NotificationUtility {
|
|
|
202
205
|
callRecord.getUuid());
|
|
203
206
|
PendingIntent piEndCallIntent = constructPendingIntentForService(context, endCallIntent);
|
|
204
207
|
|
|
205
|
-
|
|
208
|
+
NotificationCompat.Builder builder = constructNotificationBuilder(context, Constants.VOICE_CHANNEL_LOW_IMPORTANCE)
|
|
206
209
|
.setSmallIcon(notificationResource.getSmallIconId())
|
|
207
210
|
.setCategory(Notification.CATEGORY_CALL)
|
|
208
211
|
.setAutoCancel(false)
|
|
209
212
|
.setContentIntent(piForegroundIntent)
|
|
210
|
-
.setFullScreenIntent(piForegroundIntent, true)
|
|
211
213
|
.setOngoing(true)
|
|
212
214
|
.addPerson(activeCaller)
|
|
213
|
-
.setStyle(NotificationCompat.CallStyle.forOngoingCall(activeCaller, piEndCallIntent))
|
|
214
|
-
|
|
215
|
+
.setStyle(NotificationCompat.CallStyle.forOngoingCall(activeCaller, piEndCallIntent));
|
|
216
|
+
if (isFullscreenIntentEnabled(context)) {
|
|
217
|
+
builder.setFullScreenIntent(piForegroundIntent, true);
|
|
218
|
+
}
|
|
219
|
+
return builder.build();
|
|
215
220
|
}
|
|
216
221
|
|
|
217
222
|
public static Notification createOutgoingCallNotificationWithLowImportance(@NonNull Context context,
|
|
@@ -239,16 +244,18 @@ class NotificationUtility {
|
|
|
239
244
|
callRecord.getUuid());
|
|
240
245
|
PendingIntent piEndCallIntent = constructPendingIntentForService(context, endCallIntent);
|
|
241
246
|
|
|
242
|
-
|
|
247
|
+
NotificationCompat.Builder builder = constructNotificationBuilder(context, Constants.VOICE_CHANNEL_LOW_IMPORTANCE)
|
|
243
248
|
.setSmallIcon(notificationResource.getSmallIconId())
|
|
244
249
|
.setCategory(Notification.CATEGORY_CALL)
|
|
245
250
|
.setAutoCancel(false)
|
|
246
251
|
.setContentIntent(piForegroundIntent)
|
|
247
|
-
.setFullScreenIntent(piForegroundIntent, true)
|
|
248
252
|
.setOngoing(true)
|
|
249
253
|
.addPerson(activeCaller)
|
|
250
|
-
.setStyle(NotificationCompat.CallStyle.forOngoingCall(activeCaller, piEndCallIntent))
|
|
251
|
-
|
|
254
|
+
.setStyle(NotificationCompat.CallStyle.forOngoingCall(activeCaller, piEndCallIntent));
|
|
255
|
+
if (isFullscreenIntentEnabled(context)) {
|
|
256
|
+
builder.setFullScreenIntent(piForegroundIntent, true);
|
|
257
|
+
}
|
|
258
|
+
return builder.build();
|
|
252
259
|
}
|
|
253
260
|
|
|
254
261
|
public static void createNotificationChannels(@NonNull Context context) {
|
|
@@ -272,6 +279,11 @@ class NotificationUtility {
|
|
|
272
279
|
notificationManager.deleteNotificationChannelGroup(Constants.VOICE_CHANNEL_GROUP);
|
|
273
280
|
}
|
|
274
281
|
|
|
282
|
+
public static boolean isFullscreenIntentEnabled(Context context) {
|
|
283
|
+
return isFullScreenNotificationEnabled(context) &&
|
|
284
|
+
NotificationManagerCompat.from(context).canUseFullScreenIntent();
|
|
285
|
+
}
|
|
286
|
+
|
|
275
287
|
private static NotificationChannelCompat createNotificationChannel(@NonNull Context context,
|
|
276
288
|
@NonNull final String voiceChannelId) {
|
|
277
289
|
final int notificationImportance = getChannelImportance(voiceChannelId);
|
|
@@ -348,4 +360,4 @@ class NotificationUtility {
|
|
|
348
360
|
.appendPath(String.valueOf(id))
|
|
349
361
|
).build();
|
|
350
362
|
}
|
|
351
|
-
}
|
|
363
|
+
}
|
|
@@ -646,8 +646,6 @@ public class TwilioVoiceReactNativeModule extends ReactContextBaseJavaModule {
|
|
|
646
646
|
|
|
647
647
|
@ReactMethod
|
|
648
648
|
public void system_requestFullScreenNotificationPermission(Promise promise) {
|
|
649
|
-
promise.resolve(null);
|
|
650
|
-
/*
|
|
651
649
|
final boolean shouldStartActivity =
|
|
652
650
|
Build.VERSION.SDK_INT > Build.VERSION_CODES.TIRAMISU &&
|
|
653
651
|
isFullScreenNotificationEnabled(reactContext);
|
|
@@ -665,7 +663,6 @@ public class TwilioVoiceReactNativeModule extends ReactContextBaseJavaModule {
|
|
|
665
663
|
}
|
|
666
664
|
|
|
667
665
|
promise.resolve(null);
|
|
668
|
-
*/
|
|
669
666
|
}
|
|
670
667
|
|
|
671
668
|
@Override
|
|
@@ -329,7 +329,8 @@ public class VoiceService extends Service {
|
|
|
329
329
|
createOrReplaceNotification(callRecord.getNotificationId(), notification);
|
|
330
330
|
|
|
331
331
|
// stop active sound (if any)
|
|
332
|
-
|
|
332
|
+
// 11-14-25: We can keep the sound playing to indicate that the call is still pending pickup.
|
|
333
|
+
//VoiceApplicationProxy.getMediaPlayerManager().stop();
|
|
333
334
|
|
|
334
335
|
// notify JS layer
|
|
335
336
|
sendJSEvent(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="utf-8"?>
|
|
2
2
|
<resources>
|
|
3
|
-
<bool name="twiliovoicereactnative_firebasemessagingservice_enabled">
|
|
4
|
-
<bool name="twiliovoicereactnative_fullscreennotification_enabled">
|
|
3
|
+
<bool name="twiliovoicereactnative_firebasemessagingservice_enabled">true</bool>
|
|
4
|
+
<bool name="twiliovoicereactnative_fullscreennotification_enabled">true</bool>
|
|
5
5
|
</resources>
|