Skip to content

Commit

Permalink
Fix notifications without message
Browse files Browse the repository at this point in the history
I personally use only the title for most notifications, so I discovered
a crash when using the following code to create a notification:

```js
actions.notificationBuilder()
.withTitle("foo")
.send();
```

There's no message passed to `notificationBuilder()`. In this case,
handle it like an empty string as message.

Signed-off-by: mueller-ma <[email protected]>
  • Loading branch information
mueller-ma committed Aug 5, 2024
1 parent 0c10ac0 commit 55a38bf
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ fun JSONObject.toCloudMessage(): CloudMessage? {
CloudMessage.CloudNotification(
id = id,
title = payload?.optString("title").orEmpty(),
message = payload?.getString("message") ?: getString("message"),
message = payload?.optString("message", "") ?: getString("message"),
createdTimestamp = created,
icon = (payload?.optStringOrNull("icon") ?: optStringOrNull("icon")).toIconResource(),
tag = tag,
Expand Down

0 comments on commit 55a38bf

Please sign in to comment.