@@ -59,12 +59,12 @@ public struct LegacyNotificationParserImpl: LegacyNotificationParser {
59
59
}
60
60
61
61
let commandPayload : CommandPayload ? = {
62
- switch input [ " message " ] as? String {
63
- case " request_location_update " , " request_location_updates " :
62
+ switch LegacyNotificationCommandType ( rawValue : input [ " message " ] as? String ?? " " ) {
63
+ case . locationUpdate , . locationUpdates :
64
64
return . init( " request_location_update " )
65
- case " clear_badge " :
65
+ case . clearBadge :
66
66
return . init( isAlert: true , payload: [ " aps " : [ " badge " : 0 ] ] )
67
- case " clear_notification " :
67
+ case . clearNotification :
68
68
var homeassistant = [ String: Any] ( )
69
69
70
70
if let tag = data [ " tag " ] {
@@ -76,8 +76,10 @@ public struct LegacyNotificationParserImpl: LegacyNotificationParser {
76
76
}
77
77
78
78
return . init( " clear_notification " , homeassistant: homeassistant)
79
- case " update_complications " :
79
+ case . updateComplications :
80
80
return . init( " update_complications " )
81
+ case . updateWidgets:
82
+ return . init( " update_widgets " )
81
83
default : return nil
82
84
}
83
85
} ( )
@@ -246,6 +248,15 @@ public struct LegacyNotificationParserImpl: LegacyNotificationParser {
246
248
}
247
249
}
248
250
251
+ enum LegacyNotificationCommandType : String {
252
+ case locationUpdate = " request_location_update "
253
+ case locationUpdates = " request_location_updates "
254
+ case clearBadge = " clear_badge "
255
+ case clearNotification = " clear_notification "
256
+ case updateComplications = " update_complications "
257
+ case updateWidgets = " update_wigets "
258
+ }
259
+
249
260
private extension Dictionary where Value == Any {
250
261
mutating func mutate< SomeValue> (
251
262
_ key: Key ,
0 commit comments