@infilectorg/infiviz-shots-react-sdk 1.2.3 → 1.2.5

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.
Files changed (24) hide show
  1. package/android/build.gradle +1 -1
  2. package/ios/InfivizShotSDK.xcframework/Info.plist +5 -5
  3. package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/Assets.car +0 -0
  4. package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/Headers/InfivizShotSDK-Swift.h +18 -17
  5. package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/InfivizShotSDK +0 -0
  6. package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/Modules/InfivizShotSDK.swiftmodule/arm64-apple-ios.abi.json +28548 -28441
  7. package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/Modules/InfivizShotSDK.swiftmodule/arm64-apple-ios.swiftmodule +0 -0
  8. package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/infivizshots.momd/InfivizShotSDKDatabase 5.mom +0 -0
  9. package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/infivizshots.momd/InfivizShotSDKDatabase 5.omo +0 -0
  10. package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/infivizshots.momd/VersionInfo.plist +0 -0
  11. package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/shotsSDK.storyboardc/xUL-ol-gRQ-view-6A8-mO-Rhi.nib +0 -0
  12. package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/Headers/InfivizShotSDK-Swift.h +36 -34
  13. package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/InfivizShotSDK +0 -0
  14. package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/Modules/InfivizShotSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +28548 -28441
  15. package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/Modules/InfivizShotSDK.swiftmodule/arm64-apple-ios-simulator.swiftmodule +0 -0
  16. package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/Modules/InfivizShotSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +28548 -28441
  17. package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/Modules/InfivizShotSDK.swiftmodule/x86_64-apple-ios-simulator.swiftmodule +0 -0
  18. package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/infivizshots.momd/InfivizShotSDKDatabase 5.mom +0 -0
  19. package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/infivizshots.momd/InfivizShotSDKDatabase 5.omo +0 -0
  20. package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/infivizshots.momd/VersionInfo.plist +0 -0
  21. package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/shotsSDK.storyboardc/xUL-ol-gRQ-view-6A8-mO-Rhi.nib +0 -0
  22. package/ios/InfivizShotsReactSdk.swift +49 -46
  23. package/package.json +1 -1
  24. package/react-native-infiviz-shots.podspec +1 -1
@@ -194,6 +194,7 @@ class InfivizShotsReactSdk: RCTEventEmitter {
194
194
  case .success(let value):
195
195
  // Convert any value to a clean dictionary that handles Optionals properly
196
196
  let cleanDict = self.convertToCleanDictionary(value)
197
+ print(value)
197
198
  // Return the dictionary directly instead of JSON string
198
199
  resolve(cleanDict)
199
200
  case .failure(let error):
@@ -202,21 +203,14 @@ class InfivizShotsReactSdk: RCTEventEmitter {
202
203
  }
203
204
  }
204
205
 
205
- // Helper method to convert any value to a clean dictionary that handles Optionals
206
- // MARK: - Convert Any Value to Clean Dictionary
206
+ // MARK: - Convert Any to Clean Dictionary
207
207
  private func convertToCleanDictionary(_ value: Any) -> [String: Any] {
208
208
  if let dict = value as? [String: Any] {
209
209
  return cleanDictionary(dict)
210
- } else if let dict = value as? [AnyHashable: Any] {
211
- var result: [String: Any] = [:]
212
- for (k, v) in dict {
213
- result[String(describing: k)] = unwrapOptional(v)
214
- }
215
- return result
216
210
  } else {
217
- // Try to convert to dictionary using Mirror reflection
218
211
  let mirror = Mirror(reflecting: value)
219
212
  var result: [String: Any] = [:]
213
+
220
214
  for child in mirror.children {
221
215
  if let label = child.label {
222
216
  result[label] = unwrapOptional(child.value)
@@ -225,7 +219,7 @@ class InfivizShotsReactSdk: RCTEventEmitter {
225
219
  return result
226
220
  }
227
221
  }
228
-
222
+
229
223
  // MARK: - Recursively Clean Dictionary
230
224
  private func cleanDictionary(_ dict: [String: Any]) -> [String: Any] {
231
225
  var cleaned: [String: Any] = [:]
@@ -234,74 +228,83 @@ class InfivizShotsReactSdk: RCTEventEmitter {
234
228
  }
235
229
  return cleaned
236
230
  }
237
-
238
- // MARK: - Unwrap Optionals and Clean Nested Structures
231
+
232
+ // MARK: - Unwrap Optionals and Flatten SDK Values
239
233
  private func unwrapOptional(_ value: Any) -> Any {
240
- let mirror = Mirror(reflecting: value)
241
-
242
234
  // 1. Handle Optional
243
- let typeName = String(describing: type(of: value))
244
- if typeName.hasPrefix("Optional<") {
235
+ let mirror = Mirror(reflecting: value)
236
+ if mirror.displayStyle == .optional {
245
237
  if let unwrapped = mirror.children.first?.value {
246
238
  return unwrapOptional(unwrapped)
247
239
  } else {
248
240
  return NSNull()
249
241
  }
250
242
  }
251
-
252
- // 2. Strings cleanup
253
- if let str = value as? String {
254
- return str.replacingOccurrences(of: "Optional\\(|\\)",
255
- with: "",
256
- options: .regularExpression)
243
+
244
+ // 2. Handle JSONValue directly
245
+ if let jsonValue = value as? InfivizShotSDK.JSONValue {
246
+ switch jsonValue {
247
+ case .string(let str): return str
248
+ case .bool(let b): return b
249
+ case .int(let i): return i
250
+ case .double(let d): return d
251
+ case .dictionary(let dict):
252
+ var cleaned: [String: Any] = [:]
253
+ for (k, v) in dict {
254
+ cleaned[k] = unwrapOptional(v)
255
+ }
256
+ return cleaned
257
+ case .array(let arr):
258
+ return arr.map { unwrapOptional($0) }
259
+ case .null:
260
+ return NSNull()
261
+ @unknown default:
262
+ return NSNull()
263
+ }
257
264
  }
258
-
265
+
259
266
  // 3. Arrays
260
267
  if let array = value as? [Any] {
261
268
  return array.map { unwrapOptional($0) }
262
269
  }
263
-
270
+
264
271
  // 4. Dictionaries
265
272
  if let dict = value as? [String: Any] {
266
- // 👇 Detect special case: metadata dictionaries
267
- if dict.keys.count == 1, let firstKey = dict.keys.first {
268
- if ["string", "bool", "int", "double", "float"].contains(firstKey.lowercased()) {
269
- return unwrapOptional(dict[firstKey]!)
270
- }
271
- }
272
- return cleanDictionary(dict)
273
- } else if let dict = value as? [AnyHashable: Any] {
274
- var result: [String: Any] = [:]
273
+ var cleaned: [String: Any] = [:]
275
274
  for (k, v) in dict {
276
- result[String(describing: k)] = unwrapOptional(v)
275
+ cleaned[k] = unwrapOptional(v)
277
276
  }
278
- return result
277
+ return cleaned
279
278
  }
280
-
281
- // 5. Dates
279
+
280
+ // 5. Enum like SessionSyncStateEnum
281
+ let typeName = String(describing: type(of: value))
282
+ if typeName.contains("InfivizShotSDK.SessionSyncStateEnum") {
283
+ return String(describing: value)
284
+ }
285
+
286
+ // 6. Date
282
287
  if let date = value as? Date {
283
288
  let formatter = DateFormatter()
284
289
  formatter.dateFormat = "yyyy-MM-dd HH:mm:ss Z"
285
290
  return formatter.string(from: date)
286
291
  }
287
-
288
- // 6. Custom objects
289
- let objectMirror = Mirror(reflecting: value)
290
- if !objectMirror.children.isEmpty {
292
+
293
+ // 7. Custom objects
294
+ if !mirror.children.isEmpty {
291
295
  var result: [String: Any] = [:]
292
- for child in objectMirror.children {
296
+ for child in mirror.children {
293
297
  if let label = child.label {
294
298
  result[label] = unwrapOptional(child.value)
295
299
  }
296
300
  }
297
301
  return result
298
302
  }
299
-
300
- // 7. Primitives
303
+
304
+ // 8. Primitive
301
305
  return value
302
306
  }
303
307
 
304
-
305
308
  // MARK: - Logout
306
309
  @objc
307
310
  func logout(_ resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
@@ -602,7 +605,7 @@ class InfivizShotsReactSdk: RCTEventEmitter {
602
605
  controller.retakeImage(
603
606
  imageURL: imageURL,
604
607
  sessionID: temporarySessionId as String,
605
- metaData: metaData as? [String: Any]
608
+ metaData: [:] as? [String: Any]
606
609
  ) { result in
607
610
  switch result {
608
611
  case .success(let newImageId):
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infilectorg/infiviz-shots-react-sdk",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
4
4
  "description": "React Native package for native libraries",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/module/index.js",
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = 'react-native-infiviz-shots'
3
- s.version = '1.2.3'
3
+ s.version = '1.1.5'
4
4
  s.summary = 'InfivizShots React Native SDK'
5
5
  s.homepage = 'https://your-repo-link.com' # ← replace with your real URL
6
6
  s.license = { :type => 'MIT' }