appsflyer-capacitor-plugin 6.17.8-rc1 → 6.17.8-rc2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@ import AppsFlyerLib
5
5
 
6
6
  @objc(AppsFlyerPlugin)
7
7
  public class AppsFlyerPlugin: CAPPlugin {
8
- private let APPSFLYER_PLUGIN_VERSION = "6.17.8-rc1"
8
+ private let APPSFLYER_PLUGIN_VERSION = "6.17.8-rc2"
9
9
  private var conversion = true
10
10
  private var oaoa = true
11
11
  private var udl = false
@@ -811,8 +811,9 @@ public class AppsFlyerPlugin: CAPPlugin {
811
811
  if let nsError = error as NSError? {
812
812
  errorDict["error"] = nsError.localizedDescription
813
813
  errorDict["code"] = nsError.code
814
- errorDict["userInfo"] = nsError.userInfo
815
- errorDict["domain"] = nsError.domain // optional, often useful
814
+ errorDict["domain"] = nsError.domain
815
+ // Convert userInfo to JSON-safe values (userInfo may contain non-serializable objects like NSError)
816
+ errorDict["userInfo"] = nsError.userInfo.jsonSafeRepresentation()
816
817
  }
817
818
  call.reject("Validation failed", errorDict.jsonStringRepresentation ?? "")
818
819
  }
@@ -42,6 +42,35 @@ extension Dictionary {
42
42
  }
43
43
  }
44
44
 
45
+ extension Dictionary where Key == String, Value == Any {
46
+ /// Converts dictionary values to JSON-safe types.
47
+ /// Non-serializable objects (like NSError) are converted to their string description.
48
+ func jsonSafeRepresentation() -> [String: Any] {
49
+ var result: [String: Any] = [:]
50
+ for (key, value) in self {
51
+ if let dict = value as? [String: Any] {
52
+ result[key] = dict.jsonSafeRepresentation()
53
+ } else if let array = value as? [Any] {
54
+ result[key] = array.map { item -> Any in
55
+ if let dict = item as? [String: Any] {
56
+ return dict.jsonSafeRepresentation()
57
+ } else if JSONSerialization.isValidJSONObject([item]) {
58
+ return item
59
+ } else {
60
+ return "\(item)"
61
+ }
62
+ }
63
+ } else if JSONSerialization.isValidJSONObject([value]) {
64
+ result[key] = value
65
+ } else {
66
+ // Convert non-serializable objects (NSError, etc.) to string
67
+ result[key] = "\(value)"
68
+ }
69
+ }
70
+ return result
71
+ }
72
+ }
73
+
45
74
  extension Notification.Name{
46
75
  public static let appsflyerBridge = Notification.Name(AppsFlyerConstants.AF_BRIDGE_SET)
47
76
 
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "appsflyer-capacitor-plugin",
3
- "version": "6.17.8-rc1",
3
+ "version": "6.17.8-rc2",
4
4
  "iosSdkVersion": "6.17.8",
5
5
  "androidSdkVersion": "6.17.5",
6
- "buildNumber": "124",
6
+ "buildNumber": "125",
7
7
  "description": "AppsFlyer SDK plugin for Capacitor",
8
8
  "main": "dist/plugin.cjs.js",
9
9
  "module": "dist/esm/index.js",