@infilect-sdk/infiviz-shots-react-sdk 1.2.14
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/README.md +66 -0
- package/android/build.gradle +130 -0
- package/android/gradle.properties +17 -0
- package/android/proguard-rules.pro +146 -0
- package/android/settings.gradle +18 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +24 -0
- package/android/src/main/java/com/infilect/infivizshotsreactsdk/InfivizShotsReactSdkModule.kt +813 -0
- package/android/src/main/java/com/infilect/infivizshotsreactsdk/InfivizShotsReactSdkPackage.kt +19 -0
- package/android/src/main/java/com/infilect/infivizshotsreactsdk/SDKEvent.kt +15 -0
- package/android/src/main/java/com/infilect/infivizshotsreactsdk/SessionStatus.kt +6 -0
- package/ios/InfivizShotSDK.xcframework/Info.plist +44 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/AccuracyCheckViewController.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/ActionProgressSliderView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/ActionableInsightsViewController.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/ActionsHeaderView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/ActionsTableView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/ActionsTableViewCell.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/ActionsView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/Assets.car +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/BBoxImageSliderViewController.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/Base.lproj/FullImageCell.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/CategoryTableViewCell.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/CircleViewWithNumber.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/CollapsibleHeaderView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/CollapsibleTableViewCell.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/DemoImageCollectionViewCell.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/EvidenceCategoryViewController.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/FabBtnView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/Headers/InfivizShotSDK-Swift.h +1203 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/Headers/InfivizShotSDK.h +18 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/ImageOverlayView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/ImageQualityCollectionViewCell.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/ImageQualityView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/ImageSelectionTableViewCell.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/ImageSelectionViewController.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/ImageViewFullScreenView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/InfivizShotSDK +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/Info.plist +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/LoaderViewController.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/Localizable.strings +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/Modules/InfivizShotSDK.swiftmodule/arm64-apple-ios.abi.json +103877 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/Modules/InfivizShotSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- 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/Modules/module.modulemap +11 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/NotificationPermissionOverlayView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/OSAActionTableViewCell.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/PassthroughView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/PhotoSliderView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/ProgressWithActionView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/RealmTimeChartAndGraphViewController.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/RealtimeChartView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/ReasonActionView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/ReasonsActionCellViewTableViewCell.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/ReasonsListView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/ReasonsTableView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/SKUTableViewCell.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/SaveRetakeView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/SelectReasonsTableViewCell.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/SelectReasonsVIew.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/SessionStatusView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/ShelvingActionPopup.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/ShelvingActionsQuestionVIew.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/ShelvingActionsTableViewCell.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/ShelvingActionsView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/ShelvingHeaderView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/ShelvingViewController.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/SpreadSheetXIBView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/StoreKPITableViewCell.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/StoreLevelKPIViewController.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/V1ListTabView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/V1ListTableViewCell.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/V1ListView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/V1ListViewController.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/V1OptionTableViewCell.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/V1OptionsView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/V1ReasonTableViewCell.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/V1ReasonsView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/V1TabView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/V1TableViewCell.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/V1ViewController.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/V3CollectionViewCell.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/V3ViewController.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/ViewOverlay.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/default_english.json +251 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/en.lproj/FullImageCell.strings +1 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/id.lproj/FullImageCell.strings +1 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/infivizshots.momd/InfivizShotSDKDatabase 2.mom +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/infivizshots.momd/InfivizShotSDKDatabase 3.mom +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/infivizshots.momd/InfivizShotSDKDatabase 4.mom +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 6.mom +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/infivizshots.momd/InfivizShotSDKDatabase 7.mom +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/infivizshots.momd/InfivizShotSDKDatabase 7.omo +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/infivizshots.momd/InfivizShotSDKDatabase.mom +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/8Tq-Ro-cFI-view-Hie-zi-eQ4.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/shotsSDK.storyboardc/CameraViewController.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/shotsSDK.storyboardc/Grb-Na-uhe-view-0fF-4V-Sp4.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/shotsSDK.storyboardc/ImagePreviewDetailsViewController.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/shotsSDK.storyboardc/Info.plist +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/shotsSDK.storyboardc/LoaderViewController.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/shotsSDK.storyboardc/SW9-KF-vYy-view-a8B-9e-hfC.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64/InfivizShotSDK.framework/shotsSDK.storyboardc/SessionDetailsViewController.nib +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/AccuracyCheckViewController.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/ActionProgressSliderView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/ActionableInsightsViewController.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/ActionsHeaderView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/ActionsTableView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/ActionsTableViewCell.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/ActionsView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/Assets.car +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/BBoxImageSliderViewController.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/Base.lproj/FullImageCell.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/CategoryTableViewCell.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/CircleViewWithNumber.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/CollapsibleHeaderView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/CollapsibleTableViewCell.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/DemoImageCollectionViewCell.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/EvidenceCategoryViewController.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/FabBtnView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/Headers/InfivizShotSDK-Swift.h +2402 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/Headers/InfivizShotSDK.h +18 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/ImageOverlayView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/ImageQualityCollectionViewCell.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/ImageQualityView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/ImageSelectionTableViewCell.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/ImageSelectionViewController.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/ImageViewFullScreenView.nib +0 -0
- 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/Info.plist +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/LoaderViewController.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/Localizable.strings +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/Modules/InfivizShotSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +103877 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/Modules/InfivizShotSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- 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 +103877 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/Modules/InfivizShotSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- 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/Modules/module.modulemap +11 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/NotificationPermissionOverlayView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/OSAActionTableViewCell.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/PassthroughView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/PhotoSliderView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/ProgressWithActionView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/RealmTimeChartAndGraphViewController.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/RealtimeChartView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/ReasonActionView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/ReasonsActionCellViewTableViewCell.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/ReasonsListView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/ReasonsTableView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/SKUTableViewCell.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/SaveRetakeView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/SelectReasonsTableViewCell.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/SelectReasonsVIew.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/SessionStatusView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/ShelvingActionPopup.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/ShelvingActionsQuestionVIew.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/ShelvingActionsTableViewCell.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/ShelvingActionsView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/ShelvingHeaderView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/ShelvingViewController.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/SpreadSheetXIBView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/StoreKPITableViewCell.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/StoreLevelKPIViewController.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/V1ListTabView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/V1ListTableViewCell.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/V1ListView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/V1ListViewController.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/V1OptionTableViewCell.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/V1OptionsView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/V1ReasonTableViewCell.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/V1ReasonsView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/V1TabView.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/V1TableViewCell.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/V1ViewController.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/V3CollectionViewCell.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/V3ViewController.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/ViewOverlay.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/default_english.json +251 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/en.lproj/FullImageCell.strings +1 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/id.lproj/FullImageCell.strings +1 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/infivizshots.momd/InfivizShotSDKDatabase 2.mom +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/infivizshots.momd/InfivizShotSDKDatabase 3.mom +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/infivizshots.momd/InfivizShotSDKDatabase 4.mom +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 6.mom +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/infivizshots.momd/InfivizShotSDKDatabase 7.mom +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/infivizshots.momd/InfivizShotSDKDatabase 7.omo +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/infivizshots.momd/InfivizShotSDKDatabase.mom +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/8Tq-Ro-cFI-view-Hie-zi-eQ4.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/shotsSDK.storyboardc/CameraViewController.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/shotsSDK.storyboardc/Grb-Na-uhe-view-0fF-4V-Sp4.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/shotsSDK.storyboardc/ImagePreviewDetailsViewController.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/shotsSDK.storyboardc/Info.plist +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/shotsSDK.storyboardc/LoaderViewController.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/shotsSDK.storyboardc/SW9-KF-vYy-view-a8B-9e-hfC.nib +0 -0
- package/ios/InfivizShotSDK.xcframework/ios-arm64_x86_64-simulator/InfivizShotSDK.framework/shotsSDK.storyboardc/SessionDetailsViewController.nib +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.m +145 -0
- package/ios/InfivizShotsReactSdk.swift +913 -0
- package/ios/ModuleProvider.swift +13 -0
- package/ios/nativeModulesIos-Bridging-Header.h +13 -0
- package/lib/module/NativeInfivizShotsReactSdk.js +15 -0
- package/lib/module/NativeInfivizShotsReactSdk.js.map +1 -0
- package/lib/module/index.js +71 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/types/Environment.js +8 -0
- package/lib/module/types/Environment.js.map +1 -0
- package/lib/module/types/ImageMetaData.js +4 -0
- package/lib/module/types/ImageMetaData.js.map +1 -0
- package/lib/module/types/InfiSession.js +4 -0
- package/lib/module/types/InfiSession.js.map +1 -0
- package/lib/module/types/LabelScore.js +2 -0
- package/lib/module/types/LabelScore.js.map +1 -0
- package/lib/module/types/SDKStatus.js +2 -0
- package/lib/module/types/SDKStatus.js.map +1 -0
- package/lib/module/types/SessionStatus.js +2 -0
- package/lib/module/types/SessionStatus.js.map +1 -0
- package/lib/module/types/SessionSyncStateEnum.js +21 -0
- package/lib/module/types/SessionSyncStateEnum.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/NativeInfivizShotsReactSdk.d.ts +28 -0
- package/lib/typescript/src/NativeInfivizShotsReactSdk.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +30 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/types/Environment.d.ts +5 -0
- package/lib/typescript/src/types/Environment.d.ts.map +1 -0
- package/lib/typescript/src/types/ImageMetaData.d.ts +13 -0
- package/lib/typescript/src/types/ImageMetaData.d.ts.map +1 -0
- package/lib/typescript/src/types/InfiSession.d.ts +18 -0
- package/lib/typescript/src/types/InfiSession.d.ts.map +1 -0
- package/lib/typescript/src/types/LabelScore.d.ts +5 -0
- package/lib/typescript/src/types/LabelScore.d.ts.map +1 -0
- package/lib/typescript/src/types/SDKStatus.d.ts +27 -0
- package/lib/typescript/src/types/SDKStatus.d.ts.map +1 -0
- package/lib/typescript/src/types/SessionStatus.d.ts +5 -0
- package/lib/typescript/src/types/SessionStatus.d.ts.map +1 -0
- package/lib/typescript/src/types/SessionSyncStateEnum.d.ts +18 -0
- package/lib/typescript/src/types/SessionSyncStateEnum.d.ts.map +1 -0
- package/package.json +155 -0
- package/react-native-infiviz-shots.podspec +28 -0
- package/react-native.config.js +13 -0
- package/src/NativeInfivizShotsReactSdk.tsx +111 -0
- package/src/index.tsx +121 -0
- package/src/types/Environment.ts +4 -0
- package/src/types/ImageMetaData.ts +13 -0
- package/src/types/InfiSession.ts +18 -0
- package/src/types/LabelScore.ts +4 -0
- package/src/types/SDKStatus.ts +35 -0
- package/src/types/SessionStatus.ts +4 -0
- package/src/types/SessionSyncStateEnum.ts +17 -0
|
@@ -0,0 +1,913 @@
|
|
|
1
|
+
//
|
|
2
|
+
// InfivizShotsReactSdk.swift
|
|
3
|
+
//
|
|
4
|
+
//
|
|
5
|
+
// Created by Aakash Sinha on 10/04/25.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import InfivizShotSDK
|
|
10
|
+
import React
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@objc(InfivizShotsReactSdk)
|
|
14
|
+
class InfivizShotsReactSdk: RCTEventEmitter {
|
|
15
|
+
@objc
|
|
16
|
+
override static func moduleName() -> String! {
|
|
17
|
+
return "InfivizShotsReactSdk"
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@objc
|
|
21
|
+
override static func requiresMainQueueSetup() -> Bool {
|
|
22
|
+
return false
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// MARK: – RCTEventEmitter Boilerplate
|
|
26
|
+
|
|
27
|
+
private var hasListeners = false
|
|
28
|
+
|
|
29
|
+
// 3. List of events that JS can subscribe to:
|
|
30
|
+
override func supportedEvents() -> [String]! {
|
|
31
|
+
return [
|
|
32
|
+
"SyncEvent",
|
|
33
|
+
"ActionsGeneratedEvent",
|
|
34
|
+
"SessionRealTimeResultEvent",
|
|
35
|
+
"IMAGE_SLOW_UPLOAD",
|
|
36
|
+
"SESSION_PROCESSING_SLA_BREACHED",
|
|
37
|
+
"IMAGE_UPLOAD_FAILED",
|
|
38
|
+
"SESSION_UPLOAD_FAILED",
|
|
39
|
+
"HIGH_CPU_USAGE",
|
|
40
|
+
"HIGH_DEVICE_TEMPERATURE",
|
|
41
|
+
"LOW_DEVICE_STORAGE",
|
|
42
|
+
"LOW_BATTERY"
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// 4. Only send events if JS has at least one listener:
|
|
47
|
+
override func startObserving() {
|
|
48
|
+
hasListeners = true
|
|
49
|
+
|
|
50
|
+
NotificationCenter.default.addObserver(self,
|
|
51
|
+
selector: #selector(handleActionsGeneratedEvent(_:)),
|
|
52
|
+
name: NSNotification.Name("ActionsGeneratedEvent"),
|
|
53
|
+
object: nil)
|
|
54
|
+
NotificationCenter.default.addObserver(self,
|
|
55
|
+
selector: #selector(handleSessionRealTimeResultEvent(_:)),
|
|
56
|
+
name: NSNotification.Name("SessionRealTimeResultEvent"),
|
|
57
|
+
object: nil)
|
|
58
|
+
NotificationCenter.default.addObserver(self,
|
|
59
|
+
selector: #selector(handleImageSlowUploadEvent(_:)),
|
|
60
|
+
name: NSNotification.Name("IMAGE_SLOW_UPLOAD"),
|
|
61
|
+
object: nil)
|
|
62
|
+
NotificationCenter.default.addObserver(self,
|
|
63
|
+
selector: #selector(handleSessionProcessingSlaBreachedEvent(_:)),
|
|
64
|
+
name: NSNotification.Name("SESSION_PROCESSING_SLA_BREACHED"),
|
|
65
|
+
object: nil)
|
|
66
|
+
NotificationCenter.default.addObserver(self,
|
|
67
|
+
selector: #selector(handleImageUploadFailedEvent(_:)),
|
|
68
|
+
name: NSNotification.Name("IMAGE_UPLOAD_FAILED"),
|
|
69
|
+
object: nil)
|
|
70
|
+
NotificationCenter.default.addObserver(self,
|
|
71
|
+
selector: #selector(handleSessionUploadFailedEvent(_:)),
|
|
72
|
+
name: NSNotification.Name("SESSION_UPLOAD_FAILED"),
|
|
73
|
+
object: nil)
|
|
74
|
+
|
|
75
|
+
NotificationCenter.default.addObserver(self,
|
|
76
|
+
selector: #selector(handleHighCpuUsageEvent(_:)),
|
|
77
|
+
name: NSNotification.Name("HIGH_CPU_USAGE"),
|
|
78
|
+
object: nil)
|
|
79
|
+
NotificationCenter.default.addObserver(self,
|
|
80
|
+
selector: #selector(handleHighDeviceTemperatureEvent(_:)),
|
|
81
|
+
name: NSNotification.Name("HIGH_DEVICE_TEMPERATURE"),
|
|
82
|
+
object: nil)
|
|
83
|
+
NotificationCenter.default.addObserver(self,
|
|
84
|
+
selector: #selector(handleLowDeviceStorageEvent(_:)),
|
|
85
|
+
name: NSNotification.Name("LOW_DEVICE_STORAGE"),
|
|
86
|
+
object: nil)
|
|
87
|
+
NotificationCenter.default.addObserver(self,
|
|
88
|
+
selector: #selector(handleLowBatteryEvent(_:)),
|
|
89
|
+
name: NSNotification.Name("LOW_BATTERY"),
|
|
90
|
+
object: nil)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
override func stopObserving() {
|
|
94
|
+
hasListeners = false
|
|
95
|
+
NotificationCenter.default.removeObserver(self, name: NSNotification.Name("ActionsGeneratedEvent"), object: nil)
|
|
96
|
+
NotificationCenter.default.removeObserver(self, name: NSNotification.Name("SessionRealTimeResultEvent"), object: nil)
|
|
97
|
+
NotificationCenter.default.removeObserver(self, name: NSNotification.Name("IMAGE_SLOW_UPLOAD"), object: nil)
|
|
98
|
+
NotificationCenter.default.removeObserver(self, name: NSNotification.Name("SESSION_PROCESSING_SLA_BREACHED"), object: nil)
|
|
99
|
+
NotificationCenter.default.removeObserver(self, name: NSNotification.Name("IMAGE_UPLOAD_FAILED"), object: nil)
|
|
100
|
+
NotificationCenter.default.removeObserver(self, name: NSNotification.Name("SESSION_UPLOAD_FAILED"), object: nil)
|
|
101
|
+
NotificationCenter.default.removeObserver(self, name: NSNotification.Name("HIGH_CPU_USAGE"), object: nil)
|
|
102
|
+
NotificationCenter.default.removeObserver(self, name: NSNotification.Name("HIGH_DEVICE_TEMPERATURE"), object: nil)
|
|
103
|
+
NotificationCenter.default.removeObserver(self, name: NSNotification.Name("LOW_DEVICE_STORAGE"), object: nil)
|
|
104
|
+
NotificationCenter.default.removeObserver(self, name: NSNotification.Name("LOW_BATTERY"), object: nil)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// 5. If you have no constants to export, just return empty:
|
|
108
|
+
override func constantsToExport() -> [AnyHashable: Any]! {
|
|
109
|
+
return [:]
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
var activity: InfivizShotsActivity?
|
|
114
|
+
|
|
115
|
+
// MARK: –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
|
|
116
|
+
// MARK: – Helper Methods (not directly exposed to JS)
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
// MARK: - Universal Session ID
|
|
120
|
+
@objc
|
|
121
|
+
func fetchUniversalSessionId(_ tempID: NSString, resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
122
|
+
InfivizShotsSDK.shared.fetchUniversalSessionId(temporarySessionID: tempID as String, completion: { sessionID, error in
|
|
123
|
+
if let id = sessionID {
|
|
124
|
+
resolve(id)
|
|
125
|
+
} else {
|
|
126
|
+
reject("FETCH_SESSION_ID_ERROR", "Session not found", nil)
|
|
127
|
+
}
|
|
128
|
+
})
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
@objc
|
|
132
|
+
func syncSession(_ sessionId: NSString) {
|
|
133
|
+
// Kick off the upload. No resolver/rejecter—just emit events once it’s done.
|
|
134
|
+
InfivizShotsSDK.shared.uploadSession(temporarySessionID: sessionId as String) { result in
|
|
135
|
+
switch result {
|
|
136
|
+
case .success(let response):
|
|
137
|
+
if self.hasListeners {
|
|
138
|
+
let payload: [String: Any] = [
|
|
139
|
+
"status": "200",
|
|
140
|
+
"universalSessionID": response,
|
|
141
|
+
"temporarySessionID": sessionId as String
|
|
142
|
+
]
|
|
143
|
+
self.sendEvent(withName: "SyncEvent", body: payload)
|
|
144
|
+
}
|
|
145
|
+
case .failure(let error):
|
|
146
|
+
if self.hasListeners {
|
|
147
|
+
let payload: [String: Any] = [
|
|
148
|
+
"status": "400",
|
|
149
|
+
"message": error.localizedDescription,
|
|
150
|
+
"temporarySessionID": sessionId as String
|
|
151
|
+
]
|
|
152
|
+
self.sendEvent(withName: "SyncEvent", body: payload)
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// MARK: - Sync Multiple Sessions
|
|
159
|
+
/// Bridge to InfivizShotsSDK.shared.syncSessions(temporarySessionIDs:completionHandler:)
|
|
160
|
+
|
|
161
|
+
@objc
|
|
162
|
+
func uploadSession(temporarySessionIDs: NSArray) {
|
|
163
|
+
var ids: [String] = []
|
|
164
|
+
if let arr = temporarySessionIDs as? [String] {
|
|
165
|
+
ids = arr
|
|
166
|
+
} else if let arr = temporarySessionIDs as? [NSString] {
|
|
167
|
+
ids = arr.map { $0 as String }
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
guard !ids.isEmpty else { return }
|
|
171
|
+
|
|
172
|
+
InfivizShotsSDK.shared.syncSessions(temporarySessionIDs: ids) { sessionId, result in
|
|
173
|
+
switch result {
|
|
174
|
+
case .success(let message):
|
|
175
|
+
if self.hasListeners {
|
|
176
|
+
let payload: [String: Any] = [
|
|
177
|
+
"status": "200",
|
|
178
|
+
"universalSessionID": message,
|
|
179
|
+
"temporarySessionID": sessionId
|
|
180
|
+
]
|
|
181
|
+
self.sendEvent(withName: "SyncEvent", body: payload)
|
|
182
|
+
}
|
|
183
|
+
case .failure(let error):
|
|
184
|
+
if self.hasListeners {
|
|
185
|
+
let payload: [String: Any] = [
|
|
186
|
+
"status": "400",
|
|
187
|
+
"universalSessionID": error,
|
|
188
|
+
"temporarySessionID": sessionId
|
|
189
|
+
]
|
|
190
|
+
self.sendEvent(withName: "SyncEvent", body: payload)
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// MARK: - Get Session Result
|
|
197
|
+
|
|
198
|
+
@objc
|
|
199
|
+
func getSessionStatus(
|
|
200
|
+
_ temporarySessionID: NSString,
|
|
201
|
+
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
202
|
+
rejecter reject: @escaping RCTPromiseRejectBlock
|
|
203
|
+
) {
|
|
204
|
+
InfivizShotsSDK.shared.checkState(sessionID: temporarySessionID as String) { result in
|
|
205
|
+
switch result {
|
|
206
|
+
case .success(let response):
|
|
207
|
+
let json = ["sessionId": temporarySessionID,
|
|
208
|
+
"status": response]
|
|
209
|
+
|
|
210
|
+
if let jsonData = try? JSONSerialization.data(withJSONObject: json, options: []) {
|
|
211
|
+
let jsonString = String(data: jsonData, encoding: .utf8)
|
|
212
|
+
resolve(jsonString)
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
case .failure(let error):
|
|
216
|
+
reject(
|
|
217
|
+
"RESULT_FAILED",
|
|
218
|
+
"Failed to get result for \(temporarySessionID): \(error.localizedDescription)",
|
|
219
|
+
nil
|
|
220
|
+
)
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// MARK: - Sync All Data
|
|
226
|
+
@objc
|
|
227
|
+
func syncAllData(_ resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
228
|
+
InfivizShotsSDK.shared.syncAllData { result in
|
|
229
|
+
switch result {
|
|
230
|
+
case .success(let message):
|
|
231
|
+
resolve(message)
|
|
232
|
+
case .failure(let error):
|
|
233
|
+
reject("SYNC_FAILED", "Sync failed: \(error)", nil)
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// MARK: - Fetch Session Details
|
|
239
|
+
@objc
|
|
240
|
+
func fetchSessionDetails(_ temporarySessionID: NSString, resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
241
|
+
InfivizShotsSDK.shared.fetchSessionDetails(temporarySessionID: temporarySessionID as String) { result in
|
|
242
|
+
switch result {
|
|
243
|
+
case .success(let value):
|
|
244
|
+
// Convert any value to a clean dictionary that handles Optionals properly
|
|
245
|
+
let cleanDict = self.convertToCleanDictionary(value)
|
|
246
|
+
|
|
247
|
+
// Ensure status field is properly handled
|
|
248
|
+
var finalDict = cleanDict
|
|
249
|
+
if let statusValue = cleanDict["status"] {
|
|
250
|
+
// If status is NSNull, try to get a default value
|
|
251
|
+
if statusValue is NSNull {
|
|
252
|
+
finalDict["status"] = InfivizShotSDK.SessionSyncStateEnum.NOT_SYNCED.rawValue // Default fallback
|
|
253
|
+
}
|
|
254
|
+
} else {
|
|
255
|
+
finalDict["status"] = InfivizShotSDK.SessionSyncStateEnum.NOT_SYNCED.rawValue // Default fallback
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// Return the dictionary directly instead of JSON string
|
|
259
|
+
resolve(finalDict)
|
|
260
|
+
case .failure(let error):
|
|
261
|
+
reject("RESULT_FAILED", "Failed to get result: \(error)", nil)
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// MARK: - Convert Any to Clean Dictionary
|
|
267
|
+
private func convertToCleanDictionary(_ value: Any) -> [String: Any] {
|
|
268
|
+
if let dict = value as? [String: Any] {
|
|
269
|
+
return cleanDictionary(dict)
|
|
270
|
+
} else {
|
|
271
|
+
let mirror = Mirror(reflecting: value)
|
|
272
|
+
var result: [String: Any] = [:]
|
|
273
|
+
|
|
274
|
+
for child in mirror.children {
|
|
275
|
+
if let label = child.label {
|
|
276
|
+
result[label] = unwrapOptional(child.value)
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
return result
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// MARK: - Recursively Clean Dictionary
|
|
284
|
+
private func cleanDictionary(_ dict: [String: Any]) -> [String: Any] {
|
|
285
|
+
var cleaned: [String: Any] = [:]
|
|
286
|
+
for (key, value) in dict {
|
|
287
|
+
cleaned[key] = unwrapOptional(value)
|
|
288
|
+
}
|
|
289
|
+
return cleaned
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// MARK: - Unwrap Optionals and Flatten SDK Values
|
|
293
|
+
private func unwrapOptional(_ value: Any) -> Any {
|
|
294
|
+
// 1. Handle Optional
|
|
295
|
+
let mirror = Mirror(reflecting: value)
|
|
296
|
+
if mirror.displayStyle == .optional {
|
|
297
|
+
if let unwrapped = mirror.children.first?.value {
|
|
298
|
+
return unwrapOptional(unwrapped)
|
|
299
|
+
} else {
|
|
300
|
+
return NSNull()
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
// 2. Handle JSONValue directly
|
|
305
|
+
if let jsonValue = value as? InfivizShotSDK.JSONValue {
|
|
306
|
+
switch jsonValue {
|
|
307
|
+
case .string(let str): return str
|
|
308
|
+
case .bool(let b): return b
|
|
309
|
+
case .int(let i): return i
|
|
310
|
+
case .double(let d): return d
|
|
311
|
+
case .dictionary(let dict):
|
|
312
|
+
var cleaned: [String: Any] = [:]
|
|
313
|
+
for (k, v) in dict {
|
|
314
|
+
cleaned[k] = unwrapOptional(v)
|
|
315
|
+
}
|
|
316
|
+
return cleaned
|
|
317
|
+
case .array(let arr):
|
|
318
|
+
return arr.map { unwrapOptional($0) }
|
|
319
|
+
case .null:
|
|
320
|
+
return NSNull()
|
|
321
|
+
@unknown default:
|
|
322
|
+
return NSNull()
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
// 3. Arrays
|
|
327
|
+
if let array = value as? [Any] {
|
|
328
|
+
return array.map { unwrapOptional($0) }
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// 4. Dictionaries
|
|
332
|
+
if let dict = value as? [String: Any] {
|
|
333
|
+
var cleaned: [String: Any] = [:]
|
|
334
|
+
for (k, v) in dict {
|
|
335
|
+
cleaned[k] = unwrapOptional(v)
|
|
336
|
+
}
|
|
337
|
+
return cleaned
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
// 5. Enum like SessionSyncStateEnum
|
|
341
|
+
let typeName = String(describing: type(of: value))
|
|
342
|
+
if typeName.contains("InfivizShotSDK.SessionSyncStateEnum") {
|
|
343
|
+
return String(describing: value)
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
// 5a. Handle SessionSyncStateEnum directly if it's the actual enum type
|
|
347
|
+
if let sessionState = value as? InfivizShotSDK.SessionSyncStateEnum {
|
|
348
|
+
return sessionState.rawValue
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
// 6. Date
|
|
352
|
+
if let date = value as? Date {
|
|
353
|
+
let formatter = DateFormatter()
|
|
354
|
+
formatter.dateFormat = "yyyy-MM-dd HH:mm:ss Z"
|
|
355
|
+
return formatter.string(from: date)
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
// 7. Custom objects
|
|
359
|
+
if !mirror.children.isEmpty {
|
|
360
|
+
var result: [String: Any] = [:]
|
|
361
|
+
for child in mirror.children {
|
|
362
|
+
if let label = child.label {
|
|
363
|
+
result[label] = unwrapOptional(child.value)
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
return result
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
// 8. Primitive
|
|
370
|
+
return value
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
// MARK: - Logout
|
|
374
|
+
@objc
|
|
375
|
+
func logout(_ resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
376
|
+
InfivizShotsSDK.shared.callLogoutAPI { result in
|
|
377
|
+
switch result {
|
|
378
|
+
case .success(let success):
|
|
379
|
+
resolve("From Callback: SDK Logout success")
|
|
380
|
+
case .failure(let error):
|
|
381
|
+
reject("LOGOUT_ERROR", error.localizedDescription, nil)
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
// MARK: - Reprocessing Enable Time
|
|
387
|
+
@objc
|
|
388
|
+
func getReprocessingButtonEnableTime(_ sessionID: NSString, resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
389
|
+
InfivizShotsSDK.shared.getReprocessingButtonEnableTime(sessionID: sessionID as String) { result in
|
|
390
|
+
switch result {
|
|
391
|
+
case .success(let time):
|
|
392
|
+
resolve(time)
|
|
393
|
+
case .failure(let error):
|
|
394
|
+
reject("REPROCESS_TIME_ERROR", "Error fetching reprocessing time: \(error)", nil)
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// MARK: - Start Reprocessing Workflow
|
|
400
|
+
@objc
|
|
401
|
+
func startReprocessingWorkflow(_ sessionID: NSString, resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
402
|
+
InfivizShotsSDK.shared.startReprocessingWorkflow(sessionID: sessionID as String) { result in
|
|
403
|
+
switch result {
|
|
404
|
+
case .success(let time):
|
|
405
|
+
resolve(time)
|
|
406
|
+
case .failure(let error):
|
|
407
|
+
reject("REPROCESS_WORKFLOW_ERROR", "Reprocessing workflow error: \(error)", nil)
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
// MARK: - Start Camera
|
|
413
|
+
@objc(startCamera:storeTitle:storeId:photoType:category:maxPhoto:maxPhotoOneGo:metaData:resolver:rejecter:)
|
|
414
|
+
func startCamera(_ taskName: NSString,
|
|
415
|
+
storeTitle: NSString,
|
|
416
|
+
storeId: NSString,
|
|
417
|
+
photoType: NSString,
|
|
418
|
+
category: NSString,
|
|
419
|
+
maxPhoto: NSNumber,
|
|
420
|
+
maxPhotoOneGo: NSNumber,
|
|
421
|
+
metaData: NSDictionary,
|
|
422
|
+
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
423
|
+
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
424
|
+
|
|
425
|
+
DispatchQueue.main.async {
|
|
426
|
+
// 1️⃣ Build the CameraContext just like before
|
|
427
|
+
let metadataDict: [String: Any]? = metaData as? [String: Any]
|
|
428
|
+
let context = CameraContext(
|
|
429
|
+
taskName: taskName as String,
|
|
430
|
+
storeTitle: storeTitle as String,
|
|
431
|
+
storeId: storeId as String,
|
|
432
|
+
photoType: photoType as String,
|
|
433
|
+
category: category as String,
|
|
434
|
+
maxPhoto: 0,
|
|
435
|
+
maxPhotoOneGo: 0,
|
|
436
|
+
tempSessionId: nil,
|
|
437
|
+
imageURI: nil,
|
|
438
|
+
navigationController: nil,
|
|
439
|
+
retake: false,
|
|
440
|
+
metaData: metadataDict
|
|
441
|
+
)
|
|
442
|
+
|
|
443
|
+
// 2️⃣ Instantiate the SDK activity
|
|
444
|
+
let activity = InfilectSDKCameraActivityForResult(cameraContext: context)
|
|
445
|
+
|
|
446
|
+
// 3️⃣ Call its existing `start(completion:)` which will handle validation,
|
|
447
|
+
activity.start { result in
|
|
448
|
+
switch result {
|
|
449
|
+
case .success(let successRes):
|
|
450
|
+
switch successRes {
|
|
451
|
+
case .cameraStarted(let msg):
|
|
452
|
+
print(msg)
|
|
453
|
+
case .sessionCompleted(let sessionID):
|
|
454
|
+
resolve(sessionID)
|
|
455
|
+
}
|
|
456
|
+
case .failure(let apiError):
|
|
457
|
+
reject("CAMERA_ERROR", apiError.localizedDescription, nil)
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
@objc
|
|
464
|
+
func initialize(_ appID: NSString,
|
|
465
|
+
authSecret: NSString,
|
|
466
|
+
accountKey: NSString,
|
|
467
|
+
userID: NSString,
|
|
468
|
+
clientID: NSString,
|
|
469
|
+
apiToken: NSString,
|
|
470
|
+
env: NSString,
|
|
471
|
+
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
472
|
+
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
473
|
+
|
|
474
|
+
let model = InfivizUserLoginContext(
|
|
475
|
+
appID: appID as String,
|
|
476
|
+
authSecret: authSecret as String,
|
|
477
|
+
accountKey: accountKey as String,
|
|
478
|
+
userID: userID as String,
|
|
479
|
+
clientID: clientID as String,
|
|
480
|
+
apiToken: apiToken as String
|
|
481
|
+
)
|
|
482
|
+
|
|
483
|
+
let environment = APIEnvironment(rawValue: env as String) ?? .production
|
|
484
|
+
InfivizShotsSDK.shared.initializeEnvironent(environment)
|
|
485
|
+
activity = InfivizShotsActivity(model: model)
|
|
486
|
+
activity?.initialize { result in
|
|
487
|
+
switch result {
|
|
488
|
+
case .success(let success):
|
|
489
|
+
resolve("SDK Initialized successfully!!")
|
|
490
|
+
case .failure(let error):
|
|
491
|
+
reject("SDK_INIT_ERROR", "SDK Initialized Failed -> \(error.localizedDescription)", nil)
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
@objc
|
|
497
|
+
func fetchSessionID(_ taskCategory: NSString,
|
|
498
|
+
storeID: NSString,
|
|
499
|
+
taskPhotoType: NSString,
|
|
500
|
+
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
501
|
+
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
502
|
+
|
|
503
|
+
InfivizShotsSDK.shared.fetchSessionID(
|
|
504
|
+
taskCategory: taskCategory as String,
|
|
505
|
+
storeID: storeID as String,
|
|
506
|
+
taskPhotoType: taskPhotoType as String
|
|
507
|
+
) { sessionID, error in
|
|
508
|
+
if let id = sessionID {
|
|
509
|
+
resolve(id)
|
|
510
|
+
} else {
|
|
511
|
+
reject("SESSION_NOT_FOUND", "Session not found", nil)
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
static func topMostViewController() -> UIViewController? {
|
|
517
|
+
guard let keyWindow = UIApplication.shared.connectedScenes
|
|
518
|
+
.compactMap({ $0 as? UIWindowScene })
|
|
519
|
+
.flatMap({ $0.windows })
|
|
520
|
+
.first(where: { $0.isKeyWindow }) else {
|
|
521
|
+
return nil
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
var top = keyWindow.rootViewController
|
|
525
|
+
while let presented = top?.presentedViewController {
|
|
526
|
+
top = presented
|
|
527
|
+
}
|
|
528
|
+
return top
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
// MARK: - View IR Results via bridge
|
|
532
|
+
@objc(viewIRResults:resolver:rejecter:)
|
|
533
|
+
func viewIRResults(_ sessionID: NSString,
|
|
534
|
+
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
535
|
+
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
536
|
+
DispatchQueue.main.async {
|
|
537
|
+
// guard let navigationController = UIApplication.shared.connectedScenes
|
|
538
|
+
// .compactMap({ $0 as? UIWindowScene })
|
|
539
|
+
// .flatMap({ $0.windows })
|
|
540
|
+
// .first(where: { $0.isKeyWindow })?
|
|
541
|
+
// .rootViewController?.navigationController else {
|
|
542
|
+
// reject("NAV_ERROR", "No navigation controller available", nil)
|
|
543
|
+
// return
|
|
544
|
+
// }
|
|
545
|
+
guard let topVC = InfivizShotsReactSdk.topMostViewController() else {
|
|
546
|
+
reject("NAV_ERROR", "No view controller available", nil)
|
|
547
|
+
return
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
// Create a navigation controller for the SDK to use
|
|
551
|
+
let navController: UINavigationController
|
|
552
|
+
|
|
553
|
+
if let existingNav = topVC as? UINavigationController {
|
|
554
|
+
// TopVC is already a navigation controller
|
|
555
|
+
navController = existingNav
|
|
556
|
+
} else if let existingNav = topVC.navigationController {
|
|
557
|
+
// TopVC is inside a navigation controller
|
|
558
|
+
navController = existingNav
|
|
559
|
+
} else {
|
|
560
|
+
// React Native doesn't have a nav controller, create a temporary one
|
|
561
|
+
// We'll pass this to the SDK, and the SDK will handle presenting its views
|
|
562
|
+
navController = UINavigationController()
|
|
563
|
+
navController.setViewControllers([], animated: false)
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
let realTimeView = InfivizRealTimeView(sessionID: sessionID as String,
|
|
567
|
+
navigationController: navController)
|
|
568
|
+
realTimeView.viewIRResults(sessionID: sessionID as String) { result in
|
|
569
|
+
switch result {
|
|
570
|
+
case .success(let value):
|
|
571
|
+
print("View IR Results success: \(value)")
|
|
572
|
+
resolve(value)
|
|
573
|
+
case .failure(let error):
|
|
574
|
+
print("View IR Results error: \(error.localizedDescription)")
|
|
575
|
+
reject("VIEW_IR_FAILED", error.localizedDescription, nil)
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
// MARK: - Start Actions Workflow via bridge
|
|
582
|
+
@objc(startActionsWorkFlow:sessionId:latitude:longitude:dateTimeStamp:resolver:rejecter:)
|
|
583
|
+
func startActionsWorkFlow(_ storeId: NSString,
|
|
584
|
+
sessionId: NSString,
|
|
585
|
+
latitude: NSString,
|
|
586
|
+
longitude: NSString,
|
|
587
|
+
dateTimeStamp: NSString,
|
|
588
|
+
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
589
|
+
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
590
|
+
DispatchQueue.main.async {
|
|
591
|
+
guard let navigationController = UIApplication.shared.connectedScenes
|
|
592
|
+
.compactMap({ $0 as? UIWindowScene })
|
|
593
|
+
.flatMap({ $0.windows })
|
|
594
|
+
.first(where: { $0.isKeyWindow })?
|
|
595
|
+
.rootViewController?.navigationController else {
|
|
596
|
+
reject("NAV_ERROR", "No navigation controller available", nil)
|
|
597
|
+
return
|
|
598
|
+
}
|
|
599
|
+
let realTimeView = InfivizRealTimeView(sessionID: sessionId as String,
|
|
600
|
+
navigationController: navigationController)
|
|
601
|
+
realTimeView.startActionsWorkFlow(storeId: storeId as String,
|
|
602
|
+
sessionId: sessionId as String,
|
|
603
|
+
latitude: latitude as String,
|
|
604
|
+
longitude: longitude as String,
|
|
605
|
+
dateTimeStamp: dateTimeStamp as String) { result in
|
|
606
|
+
switch result {
|
|
607
|
+
case .success(let value): resolve(value)
|
|
608
|
+
case .failure(let error): reject("ACTIONS_WORKFLOW_FAILED", error.localizedDescription, nil)
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
@objc(resumeCamera:metaData:resolver:rejecter:)
|
|
615
|
+
func resumeCamera(
|
|
616
|
+
_ temporarySessionID: NSString,
|
|
617
|
+
metaData: NSDictionary?,
|
|
618
|
+
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
619
|
+
rejecter reject: @escaping RCTPromiseRejectBlock
|
|
620
|
+
) {
|
|
621
|
+
// Build whatever CameraContext your SDK needs. In your original UI code,
|
|
622
|
+
// you were reading from text fields (e.g. shelfTextField.text, traderTextField.text, etc.).
|
|
623
|
+
// In a module method you typically won't have those outlets available, so you'll
|
|
624
|
+
// need to pass any required "taskName", "storeTitle" etc. from JS into this call
|
|
625
|
+
// or hard‐code defaults here. For now, I'll show a minimal example:
|
|
626
|
+
|
|
627
|
+
let context = CameraContext(
|
|
628
|
+
taskName: "", // ← pass in from JS if you really need it
|
|
629
|
+
storeTitle: "",
|
|
630
|
+
storeId: "",
|
|
631
|
+
photoType: "",
|
|
632
|
+
category: "",
|
|
633
|
+
maxPhoto: 0,
|
|
634
|
+
maxPhotoOneGo: 0,
|
|
635
|
+
navigationController: nil // ← no UIKit nav controller in RN module
|
|
636
|
+
)
|
|
637
|
+
|
|
638
|
+
// Instantiate your SDK's camera controller just like before:
|
|
639
|
+
let controller = InfilectSDKCameraActivityForResult(cameraContext: context)
|
|
640
|
+
|
|
641
|
+
// Convert NSDictionary to [String: Any]
|
|
642
|
+
let metadataDict: [String: Any]? = metaData as? [String: Any]
|
|
643
|
+
|
|
644
|
+
// Call the updated `resumeCamera(sessionID:metaData:completion:)` API with metadata
|
|
645
|
+
controller.resumeCamera(sessionID: temporarySessionID as String, metaData: metadataDict) { result in
|
|
646
|
+
switch result {
|
|
647
|
+
case .success(let successRes):
|
|
648
|
+
// fulfill the JS promise with the returned string
|
|
649
|
+
switch successRes {
|
|
650
|
+
case .cameraStarted(let msg):
|
|
651
|
+
resolve(msg)
|
|
652
|
+
case .sessionCompleted(let sessionID):
|
|
653
|
+
print(sessionID)
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
case .failure(let sdkError):
|
|
657
|
+
// reject the JS promise
|
|
658
|
+
let nsError = sdkError as NSError
|
|
659
|
+
reject(
|
|
660
|
+
"ResumeCameraError",
|
|
661
|
+
"Failed to resume camera: \(nsError.localizedDescription)",
|
|
662
|
+
nsError
|
|
663
|
+
)
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
@objc
|
|
669
|
+
func deletePhoto(
|
|
670
|
+
_ imageURI: NSString,
|
|
671
|
+
temporarySessionId: NSString,
|
|
672
|
+
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
673
|
+
rejecter reject: @escaping RCTPromiseRejectBlock
|
|
674
|
+
) {
|
|
675
|
+
let context = CameraContext(
|
|
676
|
+
taskName: "",
|
|
677
|
+
storeTitle: "",
|
|
678
|
+
storeId: "",
|
|
679
|
+
photoType: "",
|
|
680
|
+
|
|
681
|
+
category: "",
|
|
682
|
+
maxPhoto: 0,
|
|
683
|
+
maxPhotoOneGo: 0,
|
|
684
|
+
navigationController: nil
|
|
685
|
+
)
|
|
686
|
+
let controller = InfilectSDKCameraActivityForResult(cameraContext: context)
|
|
687
|
+
controller.deleteImage(imageURL: imageURI as String, sessionID: temporarySessionId as String) { result in
|
|
688
|
+
switch result {
|
|
689
|
+
case .success(let successMessage):
|
|
690
|
+
resolve(successMessage)
|
|
691
|
+
case .failure(let error):
|
|
692
|
+
reject("DELETE_IMAGE_ERROR", "Failed to delete image: \(error.localizedDescription)", error)
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
@objc(retakeImage:imageURL:metaData:resolver:rejecter:)
|
|
698
|
+
func retakeImage(
|
|
699
|
+
_ temporarySessionId: NSString,
|
|
700
|
+
imageURL: String,
|
|
701
|
+
metaData: NSDictionary?,
|
|
702
|
+
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
703
|
+
rejecter reject: @escaping RCTPromiseRejectBlock
|
|
704
|
+
) {
|
|
705
|
+
let context = CameraContext(
|
|
706
|
+
taskName: "",
|
|
707
|
+
storeTitle: "",
|
|
708
|
+
storeId: "",
|
|
709
|
+
photoType: "",
|
|
710
|
+
category: "",
|
|
711
|
+
maxPhoto: 0,
|
|
712
|
+
maxPhotoOneGo: 0,
|
|
713
|
+
navigationController: nil,
|
|
714
|
+
metaData: metaData as? [String: Any]
|
|
715
|
+
)
|
|
716
|
+
|
|
717
|
+
let imageURL = imageURL.components(separatedBy: "/").last ?? ""
|
|
718
|
+
|
|
719
|
+
let controller = InfilectSDKCameraActivityForResult(cameraContext: context)
|
|
720
|
+
controller.retakeImage(
|
|
721
|
+
imageURL: imageURL,
|
|
722
|
+
sessionID: temporarySessionId as String,
|
|
723
|
+
metaData: [:] as? [String: Any]
|
|
724
|
+
) { result in
|
|
725
|
+
switch result {
|
|
726
|
+
case .success(let newImageId):
|
|
727
|
+
resolve(newImageId)
|
|
728
|
+
case .failure(let sdkError):
|
|
729
|
+
reject(
|
|
730
|
+
"RetakeImageError",
|
|
731
|
+
"Failed to retake image: \((sdkError as NSError).localizedDescription)",
|
|
732
|
+
sdkError as NSError
|
|
733
|
+
)
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
// MARK: – React Native Promise Exposures for OutputAPI
|
|
739
|
+
/// Expose `getIRResult(sessionID:completion:)` to JavaScript as:
|
|
740
|
+
/// InfiBridge.getIRResult("session-123").then(...).catch(...)
|
|
741
|
+
@objc
|
|
742
|
+
func getIrResult(
|
|
743
|
+
_ sessionId: NSString,
|
|
744
|
+
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
745
|
+
rejecter reject: @escaping RCTPromiseRejectBlock
|
|
746
|
+
) {
|
|
747
|
+
print("Inside GetIrResult sessionId -> \(sessionId)")
|
|
748
|
+
// Call the Swift helper (which calls outputAPI.getIRResult)
|
|
749
|
+
InfivizShotsSDK.shared.getIrResult(sessionID: sessionId as String) { (dataAny, error) in
|
|
750
|
+
|
|
751
|
+
if let output = dataAny {
|
|
752
|
+
resolve(output)
|
|
753
|
+
} else {
|
|
754
|
+
reject(
|
|
755
|
+
"IR_RESULT_ERROR", // error code (custom identifier)
|
|
756
|
+
error.debugDescription,
|
|
757
|
+
error as? NSError // error message
|
|
758
|
+
)
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
/// Expose `getActionsResult(sessionID:completion:)` to JavaScript as:
|
|
764
|
+
/// InfiBridge.getActionsResult("session-123").then(...).catch(...)
|
|
765
|
+
@objc
|
|
766
|
+
func getActionsResult(
|
|
767
|
+
_ sessionId: NSString,
|
|
768
|
+
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
769
|
+
rejecter reject: @escaping RCTPromiseRejectBlock
|
|
770
|
+
) {
|
|
771
|
+
// Call the Swift helper (which calls outputAPI.getActionsResult)
|
|
772
|
+
InfivizShotsSDK.shared.getActionsResult(sessionID: sessionId as String) { (dataAny, error) in
|
|
773
|
+
if let output = dataAny {
|
|
774
|
+
resolve(output)
|
|
775
|
+
} else {
|
|
776
|
+
reject(
|
|
777
|
+
"ACTIONS_FAILED", // error code (custom identifier)
|
|
778
|
+
error.debugDescription,
|
|
779
|
+
error as? NSError // error message
|
|
780
|
+
)
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
@objc
|
|
786
|
+
private func handleActionsGeneratedEvent(_ notification: Notification) {
|
|
787
|
+
guard hasListeners else { return }
|
|
788
|
+
|
|
789
|
+
let payload = notification.userInfo ?? [:]
|
|
790
|
+
sendEvent(withName: "ActionsGeneratedEvent", body: payload)
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
@objc
|
|
794
|
+
private func handleSessionRealTimeResultEvent(_ notification: Notification) {
|
|
795
|
+
guard hasListeners else { return }
|
|
796
|
+
|
|
797
|
+
let payload = notification.userInfo ?? [:]
|
|
798
|
+
sendEvent(withName: "SessionRealTimeResultEvent", body: payload)
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
@objc
|
|
802
|
+
private func handleSessionProcessingSlaBreachedEvent(_ notification: Notification) {
|
|
803
|
+
guard hasListeners else { return }
|
|
804
|
+
|
|
805
|
+
let payload = notification.userInfo ?? [:]
|
|
806
|
+
sendEvent(withName: "SESSION_PROCESSING_SLA_BREACHED", body: payload)
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
@objc
|
|
810
|
+
private func handleImageSlowUploadEvent(_ notification: Notification) {
|
|
811
|
+
guard hasListeners else { return }
|
|
812
|
+
|
|
813
|
+
let payload = notification.userInfo ?? [:]
|
|
814
|
+
sendEvent(withName: "IMAGE_SLOW_UPLOAD", body: payload)
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
@objc
|
|
818
|
+
private func handleImageUploadFailedEvent(_ notification: Notification) {
|
|
819
|
+
guard hasListeners else { return }
|
|
820
|
+
|
|
821
|
+
let payload = notification.userInfo ?? [:]
|
|
822
|
+
sendEvent(withName: "IMAGE_UPLOAD_FAILED", body: payload)
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
@objc
|
|
826
|
+
private func handleSessionUploadFailedEvent(_ notification: Notification) {
|
|
827
|
+
guard hasListeners else { return }
|
|
828
|
+
|
|
829
|
+
let payload = notification.userInfo ?? [:]
|
|
830
|
+
sendEvent(withName: "SESSION_UPLOAD_FAILED", body: payload)
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
@objc
|
|
834
|
+
private func handleHighCpuUsageEvent(_ notification: Notification) {
|
|
835
|
+
guard hasListeners else { return }
|
|
836
|
+
|
|
837
|
+
let payload = notification.userInfo ?? [:]
|
|
838
|
+
sendEvent(withName: "HIGH_CPU_USAGE", body: payload)
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
@objc
|
|
842
|
+
private func handleHighDeviceTemperatureEvent(_ notification: Notification) {
|
|
843
|
+
guard hasListeners else { return }
|
|
844
|
+
|
|
845
|
+
let payload = notification.userInfo ?? [:]
|
|
846
|
+
sendEvent(withName: "HIGH_DEVICE_TEMPERATURE", body: payload)
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
@objc
|
|
850
|
+
private func handleLowDeviceStorageEvent(_ notification: Notification) {
|
|
851
|
+
guard hasListeners else { return }
|
|
852
|
+
|
|
853
|
+
let payload = notification.userInfo ?? [:]
|
|
854
|
+
sendEvent(withName: "LOW_DEVICE_STORAGE", body: payload)
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
@objc
|
|
858
|
+
private func handleLowBatteryEvent(_ notification: Notification) {
|
|
859
|
+
guard hasListeners else { return }
|
|
860
|
+
|
|
861
|
+
let payload = notification.userInfo ?? [:]
|
|
862
|
+
sendEvent(withName: "LOW_BATTERY", body: payload)
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
@objc(checkTokenValidity:userID:resolver:rejecter:)
|
|
866
|
+
func checkTokenValidity(_ clientID: NSString,
|
|
867
|
+
userID: NSString,
|
|
868
|
+
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
869
|
+
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
870
|
+
InfivizShotsSDK.shared.checkTokenValidity(clientID: clientID as String, userID: userID as String) { result in
|
|
871
|
+
switch result {
|
|
872
|
+
case .success(let isValid):
|
|
873
|
+
resolve(isValid)
|
|
874
|
+
case .failure(let error):
|
|
875
|
+
reject("TOKEN_VALIDITY_ERROR", error.localizedDescription, nil)
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
@objc
|
|
881
|
+
func fetchLatestSdkStatus(_ resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
882
|
+
InfivizShotsSDK.shared.fetchLatestSdkStatus { [weak self] result in
|
|
883
|
+
guard let self = self else {
|
|
884
|
+
reject("FETCH_LATEST_SDK_STATUS_ERROR", "No data found", nil)
|
|
885
|
+
return }
|
|
886
|
+
|
|
887
|
+
if let sdkStatus = result {
|
|
888
|
+
// Convert any value to a clean dictionary that handles Optionals properly
|
|
889
|
+
resolve(sdkStatus.toDictionary())
|
|
890
|
+
}
|
|
891
|
+
else {
|
|
892
|
+
reject("FETCH_LATEST_SDK_STATUS_ERROR", "No data found", nil)
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
@objc(fetchSdkStatusLogs:resolver:rejecter:)
|
|
898
|
+
func fetchSdkStatusLogs(_ days: NSNumber,
|
|
899
|
+
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
900
|
+
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
901
|
+
InfivizShotsSDK.shared.fetchSdkStatusLogs(days: days.intValue) { sdkStatusArray in
|
|
902
|
+
if let statusArray = sdkStatusArray {
|
|
903
|
+
// Convert SDKStatus array to JSON-serializable format using existing method
|
|
904
|
+
let jsonArray = statusArray.map { sdkStatus -> [String: Any] in
|
|
905
|
+
return self.convertToCleanDictionary(sdkStatus)
|
|
906
|
+
}
|
|
907
|
+
resolve(jsonArray)
|
|
908
|
+
} else {
|
|
909
|
+
reject("FETCH_SDK_STATUS_LOGS_ERROR", "Failed to fetch SDK status logs", nil)
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
}
|