Skip to content

Commit

Permalink
feat: Android 5.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriziomoscon committed Aug 2, 2021
1 parent 1678b8d commit fcfb5dd
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Tested with:

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:

- Android 5.2.0
- Android 5.3.1
- iOS 5.2.0

It contains breaking changes from `react-native-twilio-programmable-voice` v4, and it will be released as v5.
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ dependencies {

implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.twilio:audioswitch:1.1.2'
implementation 'com.twilio:voice-android:5.2.0'
implementation 'com.twilio:voice-android:5.3.1'
implementation "com.android.support:appcompat-v7:$supportLibVersion"
implementation 'com.facebook.react:react-native:+'
implementation 'com.google.firebase:firebase-messaging:19.0.+'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
import com.twilio.voice.RegistrationListener;
import com.twilio.voice.Voice;

import java.util.HashSet;
import java.util.Locale;
import java.util.Set;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
Expand Down Expand Up @@ -379,6 +382,34 @@ public void onConnectFailure(@NonNull Call call, CallException error) {
toName = "";
activeCallInvite = null;
}

/*
* currentWarnings: existing quality warnings that have not been cleared yet
* previousWarnings: last set of warnings prior to receiving this callback
*
* Example:
* - currentWarnings: { A, B }
* - previousWarnings: { B, C }
*
* Newly raised warnings = currentWarnings - intersection = { A }
* Newly cleared warnings = previousWarnings - intersection = { C }
*/
public void onCallQualityWarningsChanged(@NonNull Call call,
@NonNull Set<Call.CallQualityWarning> currentWarnings,
@NonNull Set<Call.CallQualityWarning> previousWarnings) {
if (previousWarnings.size() > 1) {
Set<Call.CallQualityWarning> intersection = new HashSet<>(currentWarnings);
currentWarnings.removeAll(previousWarnings);
intersection.retainAll(previousWarnings);
previousWarnings.removeAll(intersection);
}
String message = String.format(
Locale.US,
"Newly raised warnings: " + currentWarnings + " Clear warnings " + previousWarnings);
Log.e(TAG, message);

// TODO send event to JS
}
};
}

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

case Constants.ACTION_OPEN_CALL_IN_PROGRESS:
// the notification already brings the activity to the top
if (activeCall == null) {
callNotificationManager.removeHangupNotification(getReactApplicationContext());
}
break;

default:
Expand Down

0 comments on commit fcfb5dd

Please sign in to comment.