Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Fixed loop in action processing

Eric Bariauxe154ef8a6cc7
diff --git a/console/iOS/NotificationExtension/NotificationService.swift b/console/iOS/NotificationExtension/NotificationService.swift
index 5b8507efe..187df7f32 100644
--- a/console/iOS/NotificationExtension/NotificationService.swift
+++ b/console/iOS/NotificationExtension/NotificationService.swift
@@ -70,19 +70,17 @@ class NotificationService: UNNotificationServiceExtension, URLSessionDelegate {
bestAttemptContent.userInfo["alertId"] = detailedJson["id"]
let actions = detailedJson["actions"] as! [[String : Any]]
var notificationActions = [UNNotificationAction]()
- for var i in (0..<actions.count) {
+ for i in (0..<actions.count) {
let actionTitle = actions[i]["title"]! as! String
let actionType = actions[i]["type"]! as! String
switch actionType {
case ActionType.ACTION_ACTUATOR :
bestAttemptContent.userInfo["actions"] = actions[i]
-
notificationActions.append(UNNotificationAction(identifier: actionType, title: actionTitle, options: UNNotificationActionOptions.destructive))
case ActionType.ACTION_DEEP_LINK :
notificationActions.append(UNNotificationAction(identifier: actionType, title: actionTitle, options: UNNotificationActionOptions.foreground))
default : break
}
- i += 1
}
let categoryName = "openremoteNotification"
let category = UNNotificationCategory(identifier: categoryName, actions: notificationActions, intentIdentifiers: [], options: [])