Skip to content

Commit

Permalink
fix(iOS): skip Swift type coercion on Cordova plugin calls (#4048)
Browse files Browse the repository at this point in the history
  • Loading branch information
ikeith authored Jan 12, 2021
1 parent 98374fd commit 7bb9e0f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion ios/Capacitor/Capacitor/CapacitorBridge.swift
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,9 @@ internal class CapacitorBridge: NSObject, CAPBridgeProtocol {
dispatchQueue.async { [weak self] in
//let startTime = CFAbsoluteTimeGetCurrent()

let pluginCall = CAPPluginCall(callbackId: call.callbackId, options: call.options, success: {(result: CAPPluginCallResult?, pluginCall: CAPPluginCall?) -> Void in
let pluginCall = CAPPluginCall(callbackId: call.callbackId,
options: JSTypes.coerceDictionaryToJSObject(call.options) ?? [:],
success: {(result: CAPPluginCallResult?, pluginCall: CAPPluginCall?) -> Void in
if result != nil {
self?.toJs(result: JSResult(call: call, result: result!.data), save: pluginCall?.isSaved ?? false)
} else {
Expand Down
4 changes: 2 additions & 2 deletions ios/Capacitor/Capacitor/JS.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ public class JSDate {
* A call originating from JavaScript land
*/
public class JSCall {
public var options: JSObject = [:]
public var options: [String: Any] = [:]
public var pluginId: String = ""
public var method: String = ""
public var callbackId: String = ""

public init(options: [String: Any], pluginId: String, method: String, callbackId: String) {
self.options = JSTypes.coerceDictionaryToJSObject(options) ?? [:]
self.options = options
self.pluginId = pluginId
self.method = method
self.callbackId = callbackId
Expand Down

0 comments on commit 7bb9e0f

Please sign in to comment.