diff --git a/mobile/src/full/java/org/openhab/habdroid/core/FcmMessageListenerService.kt b/mobile/src/full/java/org/openhab/habdroid/core/FcmMessageListenerService.kt index f24fc5accf..b452de9827 100644 --- a/mobile/src/full/java/org/openhab/habdroid/core/FcmMessageListenerService.kt +++ b/mobile/src/full/java/org/openhab/habdroid/core/FcmMessageListenerService.kt @@ -18,6 +18,7 @@ import com.google.firebase.messaging.FirebaseMessagingService import com.google.firebase.messaging.RemoteMessage import kotlinx.coroutines.runBlocking import org.openhab.habdroid.model.CloudNotification +import org.openhab.habdroid.model.CloudNotificationAction import org.openhab.habdroid.model.CloudNotificationId import org.openhab.habdroid.model.toCloudNotificationAction import org.openhab.habdroid.model.toOH2IconResource @@ -61,7 +62,7 @@ class FcmMessageListenerService : FirebaseMessagingService() { icon = data["icon"].toOH2IconResource(), tag = data["tag"], actions = actions, - onClickAction = data["on-click"].toCloudNotificationAction(), + onClickAction = data["on-click"]?.let { CloudNotificationAction("", it) }, mediaAttachmentUrl = data["media-attachment-url"] ) diff --git a/mobile/src/main/java/org/openhab/habdroid/core/NotificationHandlingReceiver.kt b/mobile/src/main/java/org/openhab/habdroid/core/NotificationHandlingReceiver.kt index 2e08db017f..eae4d20a1a 100644 --- a/mobile/src/main/java/org/openhab/habdroid/core/NotificationHandlingReceiver.kt +++ b/mobile/src/main/java/org/openhab/habdroid/core/NotificationHandlingReceiver.kt @@ -50,6 +50,9 @@ class NotificationHandlingReceiver : BroadcastReceiver() { BackgroundTasksManager.enqueueNotificationAction(context, action) is CloudNotificationAction.Action.UrlAction -> action.url.toUri().openInBrowser(context) + is CloudNotificationAction.Action.NoAction -> { + // no-op + } else -> { throw IllegalArgumentException("Got unexpected action: $action") }