@capgo/capacitor-twilio-voice 7.2.4 → 7.2.7

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.
@@ -13,11 +13,12 @@
13
13
  <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" />
14
14
 
15
15
  <application>
16
- <!-- Firebase Messaging Service for Twilio Voice -->
16
+ <!-- Firebase Messaging Service for Twilio Voice - HIGHEST PRIORITY -->
17
17
  <service
18
18
  android:name="ee.forgr.capacitor_twilio_voice.VoiceFirebaseMessagingService"
19
- android:exported="false">
20
- <intent-filter>
19
+ android:exported="false"
20
+ android:stopWithTask="false">
21
+ <intent-filter android:priority="1000">
21
22
  <action android:name="com.google.firebase.MESSAGING_EVENT" />
22
23
  </intent-filter>
23
24
  </service>
@@ -30,16 +30,29 @@ public class VoiceFirebaseMessagingService extends FirebaseMessagingService impl
30
30
 
31
31
  @Override
32
32
  public void onMessageReceived(@NonNull RemoteMessage remoteMessage) {
33
- super.onMessageReceived(remoteMessage);
34
33
  Log.d(
35
34
  TAG,
36
- String.format("Received Firebase message\n\tmessage data: %s\n\tfrom: %s", remoteMessage.getData(), remoteMessage.getFrom())
35
+ String.format(
36
+ "HIGHEST PRIORITY: Received Firebase message\n\tmessage data: %s\n\tfrom: %s",
37
+ remoteMessage.getData(),
38
+ remoteMessage.getFrom()
39
+ )
37
40
  );
38
41
 
39
42
  // Check if message contains a data payload and handle with Twilio Voice SDK
40
- if (!remoteMessage.getData().isEmpty() && !Voice.handleMessage(this, remoteMessage.getData(), this)) {
41
- Log.w(TAG, String.format("Received message was not a valid Twilio Voice SDK payload: %s", remoteMessage.getData()));
43
+ if (!remoteMessage.getData().isEmpty()) {
44
+ boolean isHandled = Voice.handleMessage(this, remoteMessage.getData(), this);
45
+ if (isHandled) {
46
+ Log.d(TAG, "Successfully handled Twilio Voice message - NOT calling super() to prevent other FCM services from processing");
47
+ // DO NOT call super.onMessageReceived() for Twilio messages to prevent other services from handling them
48
+ return;
49
+ } else {
50
+ Log.w(TAG, String.format("Received message was not a valid Twilio Voice SDK payload: %s", remoteMessage.getData()));
51
+ }
42
52
  }
53
+
54
+ // Only call super for non-Twilio messages
55
+ super.onMessageReceived(remoteMessage);
43
56
  }
44
57
 
45
58
  // MessageListener implementation
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-twilio-voice",
3
- "version": "7.2.4",
3
+ "version": "7.2.7",
4
4
  "description": "Integrates the Twilio Voice SDK into Capacitor",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",