Kaynağa Gözat

add DCContext initial implementation for secure join

cyberta 6 yıl önce
ebeveyn
işleme
3048fbe0e3
1 değiştirilmiş dosya ile 24 ekleme ve 0 silme
  1. 24 0
      deltachat-ios/DC/Wrapper.swift

+ 24 - 0
deltachat-ios/DC/Wrapper.swift

@@ -93,6 +93,30 @@ class DCContact {
     }
 }
 
+class DCContext {
+	let contextPointer: OpaquePointer
+
+	init() {
+		contextPointer = dc_context_new(callback_ios, nil, "iOS")
+	}
+
+	deinit {
+		dc_context_unref(contextPointer)
+	}
+
+
+	func getSecurejoinQr (chatId: Int) -> String? {
+		if let cString = dc_get_securejoin_qr(self.contextPointer,  UInt32(chatId)) {
+			return String(cString: cString)
+		}
+		return nil
+	}
+
+	func joinSecurejoin (qrCode: String) {
+		dc_join_securejoin(contextPointer, qrCode)
+	}
+}
+
 class DCMessage: MessageType {
     private var messagePointer: OpaquePointer