Skip to content

Commit

Permalink
remove 'description' parameter from webxdc's sendUpdate()
Browse files Browse the repository at this point in the history
  • Loading branch information
r10s committed Nov 24, 2024
1 parent 1b1f2d5 commit f691947
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
17 changes: 5 additions & 12 deletions deltachat-ios/Controller/WebxdcViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,8 @@ class WebxdcViewController: WebViewViewController {
return Promise.resolve([]);
},
sendUpdate: (payload, descr) => {
// only one parameter is allowed, we we create a new parameter object here
var parameter = {
payload: payload,
descr: descr
};
webkit.messageHandlers.sendStatusUpdate.postMessage(parameter);
sendUpdate: (payload) => {
webkit.messageHandlers.sendStatusUpdate.postMessage(payload);
},
sendToChat: async (message) => {
Expand Down Expand Up @@ -481,15 +476,13 @@ extension WebxdcViewController: WKScriptMessageHandler {
logger.info("webxdc log msg: " + msg)

case .sendStatusUpdate:
guard let dict = message.body as? [String: AnyObject],
let payloadDict = dict["payload"] as? [String: AnyObject],
guard let payloadDict = message.body as? [String: AnyObject],
let payloadJson = try? JSONSerialization.data(withJSONObject: payloadDict, options: []),
let payloadString = String(data: payloadJson, encoding: .utf8),
let description = dict["descr"] as? String else {
let payloadString = String(data: payloadJson, encoding: .utf8) else {
logger.error("Failed to parse status update parameters \(message.body)")
return
}
_ = dcContext.sendWebxdcStatusUpdate(msgId: messageId, payload: payloadString, description: description)
_ = dcContext.sendWebxdcStatusUpdate(msgId: messageId, payload: payloadString)

case .sendToChat:
if let dict = message.body as? [String: AnyObject] {
Expand Down
4 changes: 2 additions & 2 deletions deltachat-ios/DC/DcContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ public class DcContext {
dc_download_full_msg(contextPointer, Int32(id))
}

public func sendWebxdcStatusUpdate(msgId: Int, payload: String, description: String) -> Bool {
return dc_send_webxdc_status_update(contextPointer, UInt32(msgId), payload, description) == 1
public func sendWebxdcStatusUpdate(msgId: Int, payload: String) -> Bool {
return dc_send_webxdc_status_update(contextPointer, UInt32(msgId), payload, nil) == 1
}

public func getWebxdcStatusUpdates(msgId: Int, lastKnownSerial: Int) -> String {
Expand Down

0 comments on commit f691947

Please sign in to comment.