Fix some UP crashes

Change-Id: I16f47f86a58c23210cc99c85081da1703bbda5ac
This commit is contained in:
SpiritCroc 2021-08-11 22:06:18 +02:00 committed by S1m
parent ff0c98e8fa
commit 3a1cb53c98
1 changed files with 3 additions and 2 deletions

View File

@ -51,6 +51,7 @@ import org.unifiedpush.android.connector.MessagingReceiver
import org.unifiedpush.android.connector.MessagingReceiverHandler
import timber.log.Timber
@JsonClass(generateAdapter = true)
data class UnifiedPushMessage(
val notification: Notification
)
@ -117,10 +118,10 @@ val upHandler = object: MessagingReceiverHandler {
if (UPHelper.isEmbeddedDistributor(context)) {
notification = moshi.adapter(Notification::class.java)
.fromJson(message)!!
.fromJson(message) ?: return
} else {
val data = moshi.adapter(UnifiedPushMessage::class.java)
.fromJson(message)!!
.fromJson(message) ?: return
notification = data.notification
notification.unread = notification.counts.unread
}