nullable strings

pull/340/head
Lucas Nogueira 2 years ago
parent f776c742b4
commit bf6e0b0ca7
No known key found for this signature in database
GPG Key ID: FFEA6C72E73482F1

@ -197,19 +197,19 @@ class Notification {
val notification = Notification()
notification.source = jsonObject.toString()
notification.id = jsonObject.getInteger("id") ?: throw Exception("Missing notification identifier")
notification.body = jsonObject.getString("body")
notification.largeBody = jsonObject.getString("largeBody")
notification.summary = jsonObject.getString("summary")
notification.actionTypeId = jsonObject.getString("actionTypeId")
notification.group = jsonObject.getString("group")
notification.setSound(jsonObject.getString("sound"))
notification.title = jsonObject.getString("title")
notification.setSmallIcon(jsonObject.getString("icon"))
notification.setLargeIcon(jsonObject.getString("largeIcon"))
notification.iconColor = jsonObject.getString("iconColor")
notification.body = jsonObject.getString("body", null)
notification.largeBody = jsonObject.getString("largeBody", null)
notification.summary = jsonObject.getString("summary", null)
notification.actionTypeId = jsonObject.getString("actionTypeId", null)
notification.group = jsonObject.getString("group", null)
notification.setSound(jsonObject.getString("sound", null))
notification.title = jsonObject.getString("title", null)
notification.setSmallIcon(jsonObject.getString("icon", null))
notification.setLargeIcon(jsonObject.getString("largeIcon", null))
notification.iconColor = jsonObject.getString("iconColor", null)
notification.attachments = NotificationAttachment.getAttachments(jsonObject)
notification.isGroupSummary = jsonObject.getBoolean("groupSummary", false)
notification.channelId = jsonObject.getString("channelId")
notification.channelId = jsonObject.getString("channelId", null)
val schedule = jsonObject.getJSObject("schedule")
if (schedule != null) {
notification.schedule = NotificationSchedule(schedule)
@ -260,7 +260,7 @@ class Notification {
val schedule = notification.schedule
if (schedule != null) {
val jsSchedule = JSObject()
jsSchedule.put("kind", schedule.scheduleObj.getString("kind"))
jsSchedule.put("kind", schedule.scheduleObj.getString("kind", null))
jsSchedule.put("data", schedule.scheduleObj.getJSObject("data"))
jsNotification.put("schedule", jsSchedule)
}

@ -231,7 +231,7 @@ class TauriNotificationManager(
) {
return
}
notificationManager.notify(notification.id ?: 0, buildNotification)
notificationManager.notify(notification.id, buildNotification)
}
}

Loading…
Cancel
Save