@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.
- package/android/build.gradle +1 -1
- package/ios/InfivizShotSDK.xcframework/Info.plist +5 -5
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/Assets.car +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/Headers/InfivizShotSDK-Swift.h +18 -17
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/InfivizShotSDK +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/Modules/InfivizShotSDK.swiftmodule/arm64-apple-ios.abi.json +28548 -28441
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/Modules/InfivizShotSDK.swiftmodule/arm64-apple-ios.swiftmodule +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/infivizshots.momd/InfivizShotSDKDatabase 5.mom +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/infivizshots.momd/InfivizShotSDKDatabase 5.omo +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/infivizshots.momd/VersionInfo.plist +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/shotsSDK.storyboardc/xUL-ol-gRQ-view-6A8-mO-Rhi.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/Headers/InfivizShotSDK-Swift.h +36 -34
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/InfivizShotSDK +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/Modules/InfivizShotSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +28548 -28441
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/Modules/InfivizShotSDK.swiftmodule/arm64-apple-ios-simulator.swiftmodule +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/Modules/InfivizShotSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +28548 -28441
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/Modules/InfivizShotSDK.swiftmodule/x86_64-apple-ios-simulator.swiftmodule +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/infivizshots.momd/InfivizShotSDKDatabase 5.mom +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/infivizshots.momd/InfivizShotSDKDatabase 5.omo +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/infivizshots.momd/VersionInfo.plist +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/shotsSDK.storyboardc/xUL-ol-gRQ-view-6A8-mO-Rhi.nib +0 -0
- package/ios/InfivizShotsReactSdk.swift +49 -46
- package/package.json +1 -1
- package/react-native-infiviz-shots.podspec +1 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -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
|
-
//
|
|
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
|
|
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
|
|
244
|
-
if
|
|
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.
|
|
253
|
-
if let
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
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
|
-
|
|
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
|
-
|
|
275
|
+
cleaned[k] = unwrapOptional(v)
|
|
277
276
|
}
|
|
278
|
-
return
|
|
277
|
+
return cleaned
|
|
279
278
|
}
|
|
280
|
-
|
|
281
|
-
// 5.
|
|
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
|
-
//
|
|
289
|
-
|
|
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
|
|
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
|
-
//
|
|
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:
|
|
608
|
+
metaData: [:] as? [String: Any]
|
|
606
609
|
) { result in
|
|
607
610
|
switch result {
|
|
608
611
|
case .success(let newImageId):
|
package/package.json
CHANGED