Эх сурвалжийг харах

add DC_EVENT_CONTACTS_CHANGED to notificationCenter

cyberta 5 жил өмнө
parent
commit
4e7cf7d6f8

+ 13 - 0
deltachat-ios/DC/events.swift

@@ -9,6 +9,7 @@ let dcNotificationConfigureProgress = Notification.Name(rawValue: "MrEventConfig
 let dcNotificationSecureJoinerProgress = Notification.Name(rawValue: "MrEventSecureJoinerProgress")
 let dcNotificationSecureJoinerProgress = Notification.Name(rawValue: "MrEventSecureJoinerProgress")
 let dcNotificationSecureInviterProgress = Notification.Name(rawValue: "MrEventSecureInviterProgress")
 let dcNotificationSecureInviterProgress = Notification.Name(rawValue: "MrEventSecureInviterProgress")
 let dcNotificationViewChat = Notification.Name(rawValue: "MrEventViewChat")
 let dcNotificationViewChat = Notification.Name(rawValue: "MrEventViewChat")
+let dcNotificationContactChanged = Notification.Name(rawValue: "MrEventContactsChanged")
 
 
 @_silgen_name("callbackSwift")
 @_silgen_name("callbackSwift")
 
 
@@ -176,6 +177,18 @@ public func callbackSwift(event: CInt, data1: CUnsignedLong, data2: CUnsignedLon
                 ]
                 ]
             )
             )
         }
         }
+    case DC_EVENT_CONTACTS_CHANGED:
+        logger.info("contact changed: \(data1)")
+        let nc = NotificationCenter.default
+        DispatchQueue.main.async {
+            nc.post(
+                name: dcNotificationContactChanged,
+                object: nil,
+                userInfo: [
+                    "contact_id": Int(data1)
+                ]
+            )
+        }
 
 
     case DC_EVENT_GET_STRING:
     case DC_EVENT_GET_STRING:
         var string = ""
         var string = ""