From a2404abc130d3e8935efe381ad0d104dbe5c8e53 Mon Sep 17 00:00:00 2001 From: Priyonto M Rahman Date: Tue, 2 Jul 2024 20:15:56 +0200 Subject: [PATCH] fix: Support plain text push notifications #2070 (#2071) --- .../Sources/NotificationService.swift | 9 +++++++-- station.localization | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Apps/RuuviStation/NotificationService/Sources/NotificationService.swift b/Apps/RuuviStation/NotificationService/Sources/NotificationService.swift index 6426f9ce6..2e7992d9f 100644 --- a/Apps/RuuviStation/NotificationService/Sources/NotificationService.swift +++ b/Apps/RuuviStation/NotificationService/Sources/NotificationService.swift @@ -45,8 +45,13 @@ class NotificationService: UNNotificationServiceExtension { let bestAttemptContent { // If this value is not available on data, show formatted message. // Otherwise don't do anything. - let showLocallyFormattedMessage = userInfo["showLocallyFormatted"] as? Bool ?? true - if showLocallyFormattedMessage { + var showLocallyFormatted: Bool = true + // Its a shame that properties from userInfo are always string somehow. + // So, cast it as string and compare with 'false' value. + if let showLocallyFormattedMessage = userInfo["showLocallyFormatted"] as? String { + showLocallyFormatted = showLocallyFormattedMessage != "false" + } + if showLocallyFormatted { if let sensorName = userInfo["name"] as? String, let alertType = userInfo["alertType"] as? String, let triggerType = userInfo["triggerType"] as? String, diff --git a/station.localization b/station.localization index b327dc453..95f714700 160000 --- a/station.localization +++ b/station.localization @@ -1 +1 @@ -Subproject commit b327dc453988680b7fe42788d5ddee67d35ef89a +Subproject commit 95f71470080fb2b0a0a996dccc13e8335850f9c3