Skip to content

Commit

Permalink
[expo-notifications] Fix test suite (#8413)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukmccall committed May 22, 2020
1 parent 41580b3 commit 5c1a1b2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion apps/test-suite/tests/NewNotifications.js
Expand Up @@ -358,7 +358,7 @@ export async function test(t) {
lightColor: '#FF231F7C',
lockscreenVisibility: Notifications.AndroidNotificationVisibility.SECRET,
showBadge: false,
soundUri: null,
sound: null,
audioAttributes: {
usage: Notifications.AndroidAudioUsage.NOTIFICATION_COMMUNICATION_INSTANT,
contentType: Notifications.AndroidAudioContentType.SONIFICATION,
Expand Down
Expand Up @@ -76,7 +76,11 @@ public static String toString(@Nullable Uri uri) {
return "custom";
}

public static Bundle toBundle(AudioAttributes attributes) {
public static Bundle toBundle(@Nullable AudioAttributes attributes) {
if (attributes == null) {
return null;
}

Bundle result = new Bundle();
result.putInt(AUDIO_ATTRIBUTES_USAGE_KEY, AudioUsage.fromNativeValue(attributes.getUsage()).getEnumValue());
result.putInt(AUDIO_ATTRIBUTES_CONTENT_TYPE_KEY, AudioContentType.fromNativeValue(attributes.getContentType()).getEnumValue());
Expand Down
Expand Up @@ -264,7 +264,7 @@ protected Collection<NotificationRequest> fetchNotifications() {
protected NotificationRequest fetchNotification(String identifier) {
try {
return mStore.getNotificationRequest(identifier);
} catch (IOException | ClassNotFoundException e) {
} catch (IOException | ClassNotFoundException | NullPointerException e) {
return null;
}
}
Expand Down

0 comments on commit 5c1a1b2

Please sign in to comment.