Skip to content

Commit 4981b13

Browse files
feat: Android 5.3.1
1 parent 07d125f commit 4981b13

File tree

3 files changed

+36
-2
lines changed

3 files changed

+36
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Tested with:
1616

1717
The most updated branch is [feat/twilio-android-sdk-5](https://github.com/hoxfon/react-native-twilio-programmable-voice/tree/feat/twilio-android-sdk-5) which is aligned with:
1818

19-
- Android 5.2.0
19+
- Android 5.3.1
2020
- iOS 5.2.0
2121

2222
It contains breaking changes from `react-native-twilio-programmable-voice` v4, and it will be released as v5.

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ dependencies {
5757

5858
implementation fileTree(include: ['*.jar'], dir: 'libs')
5959
implementation 'com.twilio:audioswitch:1.1.2'
60-
implementation 'com.twilio:voice-android:5.2.0'
60+
implementation 'com.twilio:voice-android:5.3.1'
6161
implementation "com.android.support:appcompat-v7:$supportLibVersion"
6262
implementation 'com.facebook.react:react-native:+'
6363
implementation 'com.google.firebase:firebase-messaging:19.0.+'

android/src/main/java/com/hoxfon/react/RNTwilioVoice/TwilioVoiceModule.java

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@
5252
import com.twilio.voice.RegistrationListener;
5353
import com.twilio.voice.Voice;
5454

55+
import java.util.HashSet;
56+
import java.util.Locale;
57+
import java.util.Set;
5558
import java.util.HashMap;
5659
import java.util.Map;
5760
import java.util.List;
@@ -379,6 +382,34 @@ public void onConnectFailure(@NonNull Call call, CallException error) {
379382
toName = "";
380383
activeCallInvite = null;
381384
}
385+
386+
/*
387+
* currentWarnings: existing quality warnings that have not been cleared yet
388+
* previousWarnings: last set of warnings prior to receiving this callback
389+
*
390+
* Example:
391+
* - currentWarnings: { A, B }
392+
* - previousWarnings: { B, C }
393+
*
394+
* Newly raised warnings = currentWarnings - intersection = { A }
395+
* Newly cleared warnings = previousWarnings - intersection = { C }
396+
*/
397+
public void onCallQualityWarningsChanged(@NonNull Call call,
398+
@NonNull Set<Call.CallQualityWarning> currentWarnings,
399+
@NonNull Set<Call.CallQualityWarning> previousWarnings) {
400+
if (previousWarnings.size() > 1) {
401+
Set<Call.CallQualityWarning> intersection = new HashSet<>(currentWarnings);
402+
currentWarnings.removeAll(previousWarnings);
403+
intersection.retainAll(previousWarnings);
404+
previousWarnings.removeAll(intersection);
405+
}
406+
String message = String.format(
407+
Locale.US,
408+
"Newly raised warnings: " + currentWarnings + " Clear warnings " + previousWarnings);
409+
Log.e(TAG, message);
410+
411+
// TODO send event to JS
412+
}
382413
};
383414
}
384415

@@ -522,6 +553,9 @@ private void handleStartActivityIntent(Intent intent) {
522553

523554
case Constants.ACTION_OPEN_CALL_IN_PROGRESS:
524555
// the notification already brings the activity to the top
556+
if (activeCall == null) {
557+
callNotificationManager.removeHangupNotification(getReactApplicationContext());
558+
}
525559
break;
526560

527561
default:

0 commit comments

Comments
 (0)