Update RNFirebaseNotificationManager.java

Retrieve vibration array as IntegerArray and check for null in case of improper usage.
This commit is contained in:
Tal Davidi 2018-03-26 12:06:22 -04:00 committed by GitHub
parent 4874bd32d0
commit b02258b444
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 5 deletions

View File

@ -352,13 +352,15 @@ public class RNFirebaseNotificationManager {
nb = nb.setUsesChronometer(android.getBoolean("usesChronometer")); nb = nb.setUsesChronometer(android.getBoolean("usesChronometer"));
} }
if (android.containsKey("vibrate")) { if (android.containsKey("vibrate")) {
double[] vibrate = android.getDoubleArray("vibrate"); ArrayList<Integer> vibrate = android.getIntegerArrayList("vibrate");
long[] vibrateArray = new long[vibrate.length]; if(vibrate != null) {
for (int i = 0; i < vibrate.length; i++) { long[] vibrateArray = new long[vibrate.size()];
vibrateArray[i] = ((Double)vibrate[i]).longValue(); for (int i = 0; i < vibrate.size(); i++) {
vibrateArray[i] = (vibrate.get(i).longValue();
} }
nb = nb.setVibrate(vibrateArray); nb = nb.setVibrate(vibrateArray);
} }
}
if (android.containsKey("visibility")) { if (android.containsKey("visibility")) {
Double visibility = android.getDouble("visibility"); Double visibility = android.getDouble("visibility");
nb = nb.setVisibility(visibility.intValue()); nb = nb.setVisibility(visibility.intValue());