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.
@@ -3,7 +3,7 @@ buildscript {
3
3
  'java' : JavaVersion.VERSION_11,
4
4
  'androidGradlePlugin': '7.4.2',
5
5
  'googleServices' : '4.3.10',
6
- 'voiceAndroid' : '6.9.0',
6
+ 'voiceAndroid' : '6.7.1',
7
7
  'androidxCore' : '1.12.0',
8
8
  'androidxLifecycle' : '2.2.0',
9
9
  'audioSwitch' : '1.2.2',
@@ -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="false"
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
- //CallRecord callRecord = Objects.requireNonNull(getCallRecordDatabase().remove(new CallRecord(uuid)));
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
- return constructNotificationBuilder(context, channelImportance)
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
- .build();
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
- return constructNotificationBuilder(context, Constants.VOICE_CHANNEL_LOW_IMPORTANCE)
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
- .build();
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
- return constructNotificationBuilder(context, Constants.VOICE_CHANNEL_LOW_IMPORTANCE)
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
- .build();
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
- VoiceApplicationProxy.getMediaPlayerManager().stop();
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">false</bool>
4
- <bool name="twiliovoicereactnative_fullscreennotification_enabled">false</bool>
3
+ <bool name="twiliovoicereactnative_firebasemessagingservice_enabled">true</bool>
4
+ <bool name="twiliovoicereactnative_fullscreennotification_enabled">true</bool>
5
5
  </resources>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "voice-react-native-sdk",
3
- "version": "1.6.2-fork.24-hack",
3
+ "version": "1.6.2-fork.30",
4
4
  "description": "Twilio Voice React Native SDK",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",