@stream-io/react-native-callingx 0.1.0-beta.0
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/Callingx.podspec +23 -0
- package/LICENSE +219 -0
- package/README.md +392 -0
- package/android/bin/build/generated/source/buildConfig/debug/io/getstream/rn/callingx/BuildConfig.class +0 -0
- package/android/bin/build/generated/source/codegen/java/io/getstream/rn/callingx/NativeCallingxSpec.class +0 -0
- package/android/bin/build/generated/source/codegen/jni/CMakeLists.txt +28 -0
- package/android/bin/build/generated/source/codegen/jni/CallingxSpec-generated.cpp +167 -0
- package/android/bin/build/generated/source/codegen/jni/CallingxSpec.h +31 -0
- package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/CallingxSpecJSI-generated.cpp +196 -0
- package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/CallingxSpecJSI.h +283 -0
- package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/ComponentDescriptors.cpp +22 -0
- package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/ComponentDescriptors.h +24 -0
- package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/EventEmitters.cpp +16 -0
- package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/EventEmitters.h +17 -0
- package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/Props.cpp +19 -0
- package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/Props.h +18 -0
- package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/ShadowNodes.cpp +17 -0
- package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/ShadowNodes.h +23 -0
- package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/States.cpp +16 -0
- package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/States.h +20 -0
- package/android/bin/build/generated/source/codegen/schema.json +1 -0
- package/android/bin/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +33 -0
- package/android/bin/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/output-metadata.json +18 -0
- package/android/bin/build/intermediates/aar_metadata/debug/writeDebugAarMetadata/aar-metadata.properties +6 -0
- package/android/bin/build/intermediates/annotation_processor_list/debug/javaPreCompileDebug/annotationProcessors.json +1 -0
- package/android/bin/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
- package/android/bin/build/intermediates/compile_r_class_jar/debug/generateDebugRFile/R.jar +0 -0
- package/android/bin/build/intermediates/compile_symbol_list/debug/generateDebugRFile/R.txt +3 -0
- package/android/bin/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/drawable_ic_phone_paused_24.xml.flat +0 -0
- package/android/bin/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/drawable_ic_round_call_24.xml.flat +0 -0
- package/android/bin/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/drawable_ic_user.xml.flat +0 -0
- package/android/bin/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +4 -0
- package/android/bin/build/intermediates/incremental/debug/packageDebugResources/merger.xml +2 -0
- package/android/bin/build/intermediates/incremental/mergeDebugAssets/merger.xml +2 -0
- package/android/bin/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +2 -0
- package/android/bin/build/intermediates/incremental/mergeDebugShaders/merger.xml +2 -0
- package/android/bin/build/intermediates/java_res/debug/processDebugJavaRes/out/META-INF/stream-io_react-native-callingx_debug.kotlin_module +0 -0
- package/android/bin/build/intermediates/local_only_symbol_list/debug/parseDebugLocalResources/R-def.txt +5 -0
- package/android/bin/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +60 -0
- package/android/bin/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +33 -0
- package/android/bin/build/intermediates/navigation_json/debug/extractDeepLinksDebug/navigation.json +1 -0
- package/android/bin/build/intermediates/nested_resources_validation_report/debug/generateDebugResources/nestedResourcesValidationReport.txt +1 -0
- package/android/bin/build/intermediates/packaged_res/debug/packageDebugResources/drawable/ic_phone_paused_24.xml +11 -0
- package/android/bin/build/intermediates/packaged_res/debug/packageDebugResources/drawable/ic_round_call_24.xml +11 -0
- package/android/bin/build/intermediates/packaged_res/debug/packageDebugResources/drawable/ic_user.xml +27 -0
- package/android/bin/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/META-INF/stream-io_react-native-callingx_debug.kotlin_module +0 -0
- package/android/bin/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
- package/android/bin/build/intermediates/symbol_list_with_package_name/debug/generateDebugRFile/package-aware-r.txt +4 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.values.at +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.keystream +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.keystream.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.values.at +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab_i +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab_i.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab.keystream +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab.keystream.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab.values.at +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab_i +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab_i.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.s +1 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.values.at +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/counters.tab +2 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.values.at +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.values.at +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i.len +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/classpath-snapshot/shrunk-classpath-snapshot.bin +0 -0
- package/android/bin/build/kotlin/compileDebugKotlin/local-state/build-history.bin +0 -0
- package/android/bin/build/outputs/logs/manifest-merger-debug-report.txt +70 -0
- package/android/bin/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/android/bin/build/tmp/kotlin-classes/debug/META-INF/stream-io_react-native-callingx_debug.kotlin_module +0 -0
- package/android/bin/build.gradle +81 -0
- package/android/bin/gradle.properties +5 -0
- package/android/bin/local.properties +8 -0
- package/android/bin/src/main/AndroidManifest.xml +30 -0
- package/android/bin/src/main/java/io/getstream/rn/callingx/CallService.kt +396 -0
- package/android/bin/src/main/java/io/getstream/rn/callingx/CallingxModule.kt +639 -0
- package/android/bin/src/main/java/io/getstream/rn/callingx/CallingxPackage.kt +16 -0
- package/android/bin/src/main/java/io/getstream/rn/callingx/HeadlessTaskManager.kt +164 -0
- package/android/bin/src/main/java/io/getstream/rn/callingx/ResourceUtils.kt +60 -0
- package/android/bin/src/main/java/io/getstream/rn/callingx/Utils.kt +23 -0
- package/android/bin/src/main/java/io/getstream/rn/callingx/model/Call.kt +57 -0
- package/android/bin/src/main/java/io/getstream/rn/callingx/model/CallAction.kt +36 -0
- package/android/bin/src/main/java/io/getstream/rn/callingx/notifications/CallNotificationManager.kt +215 -0
- package/android/bin/src/main/java/io/getstream/rn/callingx/notifications/NotificationChannelsManager.kt +113 -0
- package/android/bin/src/main/java/io/getstream/rn/callingx/notifications/NotificationIntentFactory.kt +105 -0
- package/android/bin/src/main/java/io/getstream/rn/callingx/notifications/NotificationReceiverActivity.kt +42 -0
- package/android/bin/src/main/java/io/getstream/rn/callingx/notifications/NotificationReceiverService.kt +56 -0
- package/android/bin/src/main/java/io/getstream/rn/callingx/notifications/NotificationsConfig.kt +116 -0
- package/android/bin/src/main/java/io/getstream/rn/callingx/repo/CallRepository.kt +163 -0
- package/android/bin/src/main/java/io/getstream/rn/callingx/repo/LegacyCallRepository.kt +134 -0
- package/android/bin/src/main/java/io/getstream/rn/callingx/repo/TelecomCallRepository.kt +438 -0
- package/android/bin/src/main/res/drawable/ic_phone_paused_24.xml +11 -0
- package/android/bin/src/main/res/drawable/ic_round_call_24.xml +11 -0
- package/android/bin/src/main/res/drawable/ic_user.xml +27 -0
- package/android/build.gradle +81 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +30 -0
- package/android/src/main/java/io/getstream/rn/callingx/CallService.kt +396 -0
- package/android/src/main/java/io/getstream/rn/callingx/CallingxModule.kt +639 -0
- package/android/src/main/java/io/getstream/rn/callingx/CallingxPackage.kt +16 -0
- package/android/src/main/java/io/getstream/rn/callingx/HeadlessTaskManager.kt +164 -0
- package/android/src/main/java/io/getstream/rn/callingx/ResourceUtils.kt +60 -0
- package/android/src/main/java/io/getstream/rn/callingx/Utils.kt +23 -0
- package/android/src/main/java/io/getstream/rn/callingx/model/Call.kt +57 -0
- package/android/src/main/java/io/getstream/rn/callingx/model/CallAction.kt +36 -0
- package/android/src/main/java/io/getstream/rn/callingx/notifications/CallNotificationManager.kt +215 -0
- package/android/src/main/java/io/getstream/rn/callingx/notifications/NotificationChannelsManager.kt +113 -0
- package/android/src/main/java/io/getstream/rn/callingx/notifications/NotificationIntentFactory.kt +105 -0
- package/android/src/main/java/io/getstream/rn/callingx/notifications/NotificationReceiverActivity.kt +42 -0
- package/android/src/main/java/io/getstream/rn/callingx/notifications/NotificationReceiverService.kt +56 -0
- package/android/src/main/java/io/getstream/rn/callingx/notifications/NotificationsConfig.kt +116 -0
- package/android/src/main/java/io/getstream/rn/callingx/repo/CallRepository.kt +163 -0
- package/android/src/main/java/io/getstream/rn/callingx/repo/LegacyCallRepository.kt +134 -0
- package/android/src/main/java/io/getstream/rn/callingx/repo/TelecomCallRepository.kt +438 -0
- package/android/src/main/res/drawable/ic_phone_paused_24.xml +11 -0
- package/android/src/main/res/drawable/ic_round_call_24.xml +11 -0
- package/android/src/main/res/drawable/ic_user.xml +27 -0
- package/dist/module/CallingxModule.js +191 -0
- package/dist/module/CallingxModule.js.map +1 -0
- package/dist/module/EventManager.js +40 -0
- package/dist/module/EventManager.js.map +1 -0
- package/dist/module/index.js +5 -0
- package/dist/module/index.js.map +1 -0
- package/dist/module/package.json +1 -0
- package/dist/module/spec/NativeCallingx.js +8 -0
- package/dist/module/spec/NativeCallingx.js.map +1 -0
- package/dist/module/types.js +4 -0
- package/dist/module/types.js.map +1 -0
- package/dist/module/utils/constants.js +48 -0
- package/dist/module/utils/constants.js.map +1 -0
- package/dist/module/utils/headlessTask.js +37 -0
- package/dist/module/utils/headlessTask.js.map +1 -0
- package/dist/module/utils/permissions.js +86 -0
- package/dist/module/utils/permissions.js.map +1 -0
- package/dist/module/utils/types.js +2 -0
- package/dist/module/utils/types.js.map +1 -0
- package/dist/module/utils/utils.js +6 -0
- package/dist/module/utils/utils.js.map +1 -0
- package/dist/typescript/package.json +1 -0
- package/dist/typescript/src/CallingxModule.d.ts +44 -0
- package/dist/typescript/src/CallingxModule.d.ts.map +1 -0
- package/dist/typescript/src/EventManager.d.ts +11 -0
- package/dist/typescript/src/EventManager.d.ts.map +1 -0
- package/dist/typescript/src/index.d.ts +3 -0
- package/dist/typescript/src/index.d.ts.map +1 -0
- package/dist/typescript/src/spec/NativeCallingx.d.ts +132 -0
- package/dist/typescript/src/spec/NativeCallingx.d.ts.map +1 -0
- package/dist/typescript/src/types.d.ts +249 -0
- package/dist/typescript/src/types.d.ts.map +1 -0
- package/dist/typescript/src/utils/constants.d.ts +8 -0
- package/dist/typescript/src/utils/constants.d.ts.map +1 -0
- package/dist/typescript/src/utils/headlessTask.d.ts +8 -0
- package/dist/typescript/src/utils/headlessTask.d.ts.map +1 -0
- package/dist/typescript/src/utils/permissions.d.ts +8 -0
- package/dist/typescript/src/utils/permissions.d.ts.map +1 -0
- package/dist/typescript/src/utils/types.d.ts +4 -0
- package/dist/typescript/src/utils/types.d.ts.map +1 -0
- package/dist/typescript/src/utils/utils.d.ts +2 -0
- package/dist/typescript/src/utils/utils.d.ts.map +1 -0
- package/ios/AudioSessionManager.swift +46 -0
- package/ios/Callingx.mm +280 -0
- package/ios/CallingxImpl.swift +744 -0
- package/ios/CallingxPublic.h +79 -0
- package/ios/Settings.swift +108 -0
- package/ios/UUIDStorage.swift +124 -0
- package/ios/VoipNotificationsManager.swift +180 -0
- package/package.json +112 -0
- package/react-native.config.js +8 -0
- package/src/CallingxModule.ts +321 -0
- package/src/EventManager.ts +61 -0
- package/src/index.ts +2 -0
- package/src/spec/NativeCallingx.ts +176 -0
- package/src/types.ts +323 -0
- package/src/utils/constants.ts +55 -0
- package/src/utils/headlessTask.ts +52 -0
- package/src/utils/permissions.ts +111 -0
- package/src/utils/types.ts +5 -0
- package/src/utils/utils.ts +6 -0
|
@@ -0,0 +1,744 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import CallKit
|
|
3
|
+
import AVFoundation
|
|
4
|
+
import UIKit
|
|
5
|
+
import stream_react_native_webrtc
|
|
6
|
+
|
|
7
|
+
// MARK: - Event Names
|
|
8
|
+
@objcMembers public class CallingxEvents: NSObject {
|
|
9
|
+
public static let didReceiveStartCallAction = "didReceiveStartCallAction"
|
|
10
|
+
public static let didToggleHoldAction = "didToggleHoldCallAction"
|
|
11
|
+
public static let didPerformSetMutedCallAction = "didPerformSetMutedCallAction"
|
|
12
|
+
public static let didChangeAudioRoute = "didChangeAudioRoute"
|
|
13
|
+
public static let didDisplayIncomingCall = "didDisplayIncomingCall"
|
|
14
|
+
public static let didActivateAudioSession = "didActivateAudioSession"
|
|
15
|
+
public static let didDeactivateAudioSession = "didDeactivateAudioSession"
|
|
16
|
+
public static let performAnswerCallAction = "answerCall"
|
|
17
|
+
public static let performEndCallAction = "endCall"
|
|
18
|
+
public static let performPlayDTMFCallAction = "didPerformDTMFAction"
|
|
19
|
+
public static let providerReset = "providerReset"
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// MARK: - Event Emitter Protocol
|
|
23
|
+
@objc public protocol CallingxEventEmitter {
|
|
24
|
+
func emitEvent(_ dictionary: [String: Any])
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// MARK: - Callingx Implementation
|
|
28
|
+
@objc public class CallingxImpl: NSObject, CXProviderDelegate {
|
|
29
|
+
|
|
30
|
+
// MARK: - Shared State
|
|
31
|
+
@objc public static var sharedProvider: CXProvider?
|
|
32
|
+
@objc public static var uuidStorage: UUIDStorage?
|
|
33
|
+
@objc public static weak var sharedInstance: CallingxImpl?
|
|
34
|
+
|
|
35
|
+
// MARK: - Instance Properties
|
|
36
|
+
@objc public var callKeepCallController: CXCallController?
|
|
37
|
+
@objc public var callKeepProvider: CXProvider?
|
|
38
|
+
@objc public weak var eventEmitter: CallingxEventEmitter?
|
|
39
|
+
|
|
40
|
+
private var canSendEvents: Bool = false
|
|
41
|
+
private var isSetup: Bool = false
|
|
42
|
+
private var isSelfAnswered: Bool = false
|
|
43
|
+
private var isSelfEnded: Bool = false
|
|
44
|
+
private var delayedEvents: [[String: Any]] = []
|
|
45
|
+
|
|
46
|
+
// MARK: - Initialization
|
|
47
|
+
@objc public override init() {
|
|
48
|
+
super.init()
|
|
49
|
+
|
|
50
|
+
isSetup = false
|
|
51
|
+
delayedEvents = []
|
|
52
|
+
canSendEvents = false
|
|
53
|
+
|
|
54
|
+
NotificationCenter.default.addObserver(
|
|
55
|
+
self,
|
|
56
|
+
selector: #selector(onAudioRouteChange(_:)),
|
|
57
|
+
name: AVAudioSession.routeChangeNotification,
|
|
58
|
+
object: nil
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
CallingxImpl.sharedInstance = self
|
|
62
|
+
CallingxImpl.initializeIfNeeded()
|
|
63
|
+
|
|
64
|
+
callKeepProvider = CallingxImpl.sharedProvider
|
|
65
|
+
callKeepProvider?.setDelegate(nil, queue: nil)
|
|
66
|
+
callKeepProvider?.setDelegate(self, queue: nil)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
deinit {
|
|
70
|
+
NotificationCenter.default.removeObserver(self)
|
|
71
|
+
|
|
72
|
+
callKeepProvider?.setDelegate(nil, queue: nil)
|
|
73
|
+
callKeepProvider?.invalidate()
|
|
74
|
+
CallingxImpl.sharedProvider = nil
|
|
75
|
+
canSendEvents = false
|
|
76
|
+
delayedEvents = []
|
|
77
|
+
isSetup = false
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// MARK: - Class Methods
|
|
81
|
+
@objc public static func initializeIfNeeded() {
|
|
82
|
+
if uuidStorage == nil {
|
|
83
|
+
uuidStorage = UUIDStorage()
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if sharedProvider == nil {
|
|
87
|
+
sharedProvider = CXProvider(configuration: Settings.getProviderConfiguration())
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@objc public static func reportNewIncomingCall(
|
|
92
|
+
callId: String,
|
|
93
|
+
handle: String,
|
|
94
|
+
handleType: String,
|
|
95
|
+
hasVideo: Bool,
|
|
96
|
+
localizedCallerName: String?,
|
|
97
|
+
supportsHolding: Bool,
|
|
98
|
+
supportsDTMF: Bool,
|
|
99
|
+
supportsGrouping: Bool,
|
|
100
|
+
supportsUngrouping: Bool,
|
|
101
|
+
fromPushKit: Bool,
|
|
102
|
+
payload: [String: Any]?,
|
|
103
|
+
completion: (() -> Void)?
|
|
104
|
+
) {
|
|
105
|
+
initializeIfNeeded()
|
|
106
|
+
|
|
107
|
+
guard let storage = uuidStorage else { return }
|
|
108
|
+
|
|
109
|
+
if storage.containsCid(callId) {
|
|
110
|
+
#if DEBUG
|
|
111
|
+
print("[Callingx][reportNewIncomingCall] callId already exists")
|
|
112
|
+
#endif
|
|
113
|
+
return
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
let cxHandleType = Settings.getHandleType(handleType)
|
|
117
|
+
let uuid = storage.getOrCreateUUID(forCid: callId)
|
|
118
|
+
let callUpdate = CXCallUpdate()
|
|
119
|
+
callUpdate.remoteHandle = CXHandle(type: cxHandleType, value: handle)
|
|
120
|
+
callUpdate.supportsHolding = supportsHolding
|
|
121
|
+
callUpdate.supportsDTMF = supportsDTMF
|
|
122
|
+
callUpdate.supportsGrouping = supportsGrouping
|
|
123
|
+
callUpdate.supportsUngrouping = supportsUngrouping
|
|
124
|
+
callUpdate.hasVideo = hasVideo
|
|
125
|
+
callUpdate.localizedCallerName = localizedCallerName
|
|
126
|
+
|
|
127
|
+
sharedProvider?.reportNewIncomingCall(with: uuid, update: callUpdate) { error in
|
|
128
|
+
#if DEBUG
|
|
129
|
+
print("[Callingx][reportNewIncomingCall] callId = \(callId), error = \(String(describing: error))")
|
|
130
|
+
#endif
|
|
131
|
+
|
|
132
|
+
let errorCode = error != nil ? CallingxImpl.getIncomingCallErrorCode(error!) : ""
|
|
133
|
+
|
|
134
|
+
let body = [
|
|
135
|
+
"error": error?.localizedDescription ?? "",
|
|
136
|
+
"errorCode": errorCode,
|
|
137
|
+
"callId": callId,
|
|
138
|
+
"handle": handle,
|
|
139
|
+
"localizedCallerName": localizedCallerName ?? "",
|
|
140
|
+
"hasVideo": hasVideo ? "1" : "0",
|
|
141
|
+
"supportsHolding": supportsHolding ? "1" : "0",
|
|
142
|
+
"supportsDTMF": supportsDTMF ? "1" : "0",
|
|
143
|
+
"supportsGrouping": supportsGrouping ? "1" : "0",
|
|
144
|
+
"supportsUngrouping": supportsUngrouping ? "1" : "0",
|
|
145
|
+
"fromPushKit": fromPushKit ? "1" : "0",
|
|
146
|
+
"payload": payload ?? ""
|
|
147
|
+
]
|
|
148
|
+
|
|
149
|
+
sharedInstance?.sendEvent(CallingxEvents.didDisplayIncomingCall, body: body)
|
|
150
|
+
|
|
151
|
+
if error == nil {
|
|
152
|
+
#if DEBUG
|
|
153
|
+
print("[Callingx][reportNewIncomingCall] success callId = \(callId)")
|
|
154
|
+
#endif
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
completion?()
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
@objc public static func canRegisterCall() -> Bool {
|
|
162
|
+
let hasCall = hasRegisteredCall()
|
|
163
|
+
let shouldReject = Settings.getShouldRejectCallWhenBusy()
|
|
164
|
+
return !shouldReject || (shouldReject && !hasCall)
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
@objc public static func hasRegisteredCall() -> Bool {
|
|
168
|
+
guard let storage = uuidStorage else { return false }
|
|
169
|
+
|
|
170
|
+
let appUUIDs = storage.allUUIDs()
|
|
171
|
+
if appUUIDs.isEmpty { return false }
|
|
172
|
+
|
|
173
|
+
let observer = CXCallObserver()
|
|
174
|
+
for call in observer.calls {
|
|
175
|
+
for uuid in appUUIDs {
|
|
176
|
+
if call.uuid == uuid {
|
|
177
|
+
return true
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return false
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
@objc public static func getAudioOutput() -> String? {
|
|
185
|
+
let outputs = AVAudioSession.sharedInstance().currentRoute.outputs
|
|
186
|
+
if !outputs.isEmpty {
|
|
187
|
+
return outputs[0].portType.rawValue
|
|
188
|
+
}
|
|
189
|
+
return nil
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
@objc public static func endCall(_ callId: String, reason: Int) {
|
|
193
|
+
#if DEBUG
|
|
194
|
+
print("[Callingx][endCall] callId = \(callId) reason = \(reason)")
|
|
195
|
+
#endif
|
|
196
|
+
|
|
197
|
+
guard let uuid = uuidStorage?.getUUID(forCid: callId) else {
|
|
198
|
+
#if DEBUG
|
|
199
|
+
print("[Callingx][endCall] callId not found")
|
|
200
|
+
#endif
|
|
201
|
+
return
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
let endedReason: CXCallEndedReason
|
|
205
|
+
switch reason {
|
|
206
|
+
case 1:
|
|
207
|
+
endedReason = .remoteEnded
|
|
208
|
+
case 2:
|
|
209
|
+
endedReason = .unanswered
|
|
210
|
+
case 3:
|
|
211
|
+
endedReason = .answeredElsewhere
|
|
212
|
+
case 4:
|
|
213
|
+
endedReason = .declinedElsewhere
|
|
214
|
+
default:
|
|
215
|
+
endedReason = .failed
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
sharedProvider?.reportCall(with: uuid, endedAt: Date(), reason: endedReason)
|
|
219
|
+
uuidStorage?.removeCid(callId)
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
@objc public static func getIncomingCallErrorCode(_ error: Error) -> String {
|
|
223
|
+
let nsError = error as NSError
|
|
224
|
+
switch nsError.code {
|
|
225
|
+
case CXErrorCodeIncomingCallError.unentitled.rawValue:
|
|
226
|
+
return "Unentitled"
|
|
227
|
+
case CXErrorCodeIncomingCallError.callUUIDAlreadyExists.rawValue:
|
|
228
|
+
return "CallUUIDAlreadyExists"
|
|
229
|
+
case CXErrorCodeIncomingCallError.filteredByDoNotDisturb.rawValue:
|
|
230
|
+
return "FilteredByDoNotDisturb"
|
|
231
|
+
case CXErrorCodeIncomingCallError.filteredByBlockList.rawValue:
|
|
232
|
+
return "FilteredByBlockList"
|
|
233
|
+
default:
|
|
234
|
+
return "Unknown"
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// MARK: - Instance Methods
|
|
239
|
+
@objc public func requestTransaction(_ transaction: CXTransaction) {
|
|
240
|
+
#if DEBUG
|
|
241
|
+
print("[Callingx][requestTransaction] transaction = \(transaction)")
|
|
242
|
+
#endif
|
|
243
|
+
|
|
244
|
+
if callKeepCallController == nil {
|
|
245
|
+
callKeepCallController = CXCallController()
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
callKeepCallController?.request(transaction) { [weak self] error in
|
|
249
|
+
if let error = error {
|
|
250
|
+
#if DEBUG
|
|
251
|
+
print("[Callingx][requestTransaction] Error requesting transaction (\(transaction.actions)): (\(error))")
|
|
252
|
+
#endif
|
|
253
|
+
|
|
254
|
+
self?.isSelfAnswered = false
|
|
255
|
+
self?.isSelfEnded = false
|
|
256
|
+
} else {
|
|
257
|
+
#if DEBUG
|
|
258
|
+
print("[Callingx][requestTransaction] Requested transaction successfully")
|
|
259
|
+
#endif
|
|
260
|
+
|
|
261
|
+
if let startCallAction = transaction.actions.first as? CXStartCallAction {
|
|
262
|
+
let callUpdate = CXCallUpdate()
|
|
263
|
+
callUpdate.remoteHandle = startCallAction.handle
|
|
264
|
+
callUpdate.hasVideo = startCallAction.isVideo
|
|
265
|
+
callUpdate.localizedCallerName = startCallAction.contactIdentifier
|
|
266
|
+
callUpdate.supportsDTMF = false
|
|
267
|
+
callUpdate.supportsHolding = false
|
|
268
|
+
callUpdate.supportsGrouping = false
|
|
269
|
+
callUpdate.supportsUngrouping = false
|
|
270
|
+
|
|
271
|
+
self?.callKeepProvider?.reportCall(with: startCallAction.callUUID, updated: callUpdate)
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
@objc public func sendEvent(_ name: String, body: [String: Any]?) {
|
|
278
|
+
#if DEBUG
|
|
279
|
+
print("[Callingx] sendEventWithNameWrapper: \(name)")
|
|
280
|
+
#endif
|
|
281
|
+
|
|
282
|
+
let sendEventAction = {
|
|
283
|
+
var dictionary: [String: Any] = ["eventName": name]
|
|
284
|
+
if let body = body {
|
|
285
|
+
dictionary["params"] = body
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
if self.canSendEvents {
|
|
289
|
+
self.eventEmitter?.emitEvent(dictionary)
|
|
290
|
+
} else {
|
|
291
|
+
self.delayedEvents.append(dictionary)
|
|
292
|
+
#if DEBUG
|
|
293
|
+
print("[Callingx] delayedEvents: \(self.delayedEvents)")
|
|
294
|
+
#endif
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
if (Thread.isMainThread) {
|
|
299
|
+
sendEventAction()
|
|
300
|
+
} else {
|
|
301
|
+
DispatchQueue.main.async {
|
|
302
|
+
sendEventAction()
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
@objc private func onAudioRouteChange(_ notification: Notification) {
|
|
308
|
+
guard let info = notification.userInfo,
|
|
309
|
+
let reasonValue = info[AVAudioSessionRouteChangeReasonKey] as? UInt,
|
|
310
|
+
let output = CallingxImpl.getAudioOutput() else {
|
|
311
|
+
return
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
let params: [String: Any] = [
|
|
315
|
+
"output": output,
|
|
316
|
+
"reason": reasonValue
|
|
317
|
+
]
|
|
318
|
+
|
|
319
|
+
sendEvent(CallingxEvents.didChangeAudioRoute, body: params)
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// MARK: - Setup Methods
|
|
323
|
+
@objc public func setup(options: [String: Any]) {
|
|
324
|
+
callKeepCallController = CXCallController()
|
|
325
|
+
|
|
326
|
+
Settings.setSettings(options)
|
|
327
|
+
|
|
328
|
+
CallingxImpl.initializeIfNeeded()
|
|
329
|
+
|
|
330
|
+
callKeepProvider = CallingxImpl.sharedProvider
|
|
331
|
+
callKeepProvider?.setDelegate(self, queue: nil)
|
|
332
|
+
|
|
333
|
+
isSetup = true
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
@objc public func getInitialEvents() -> [[String: Any]] {
|
|
337
|
+
var events: [[String: Any]] = []
|
|
338
|
+
let action = {
|
|
339
|
+
#if DEBUG
|
|
340
|
+
print("[Callingx][getInitialEvents] delayedEvents = \(self.delayedEvents)")
|
|
341
|
+
#endif
|
|
342
|
+
|
|
343
|
+
events = self.delayedEvents
|
|
344
|
+
self.delayedEvents = []
|
|
345
|
+
self.canSendEvents = true
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
if (Thread.isMainThread) {
|
|
349
|
+
action()
|
|
350
|
+
} else {
|
|
351
|
+
DispatchQueue.main.sync {
|
|
352
|
+
action()
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
return events
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
// MARK: - Call Management
|
|
360
|
+
@objc public func answerIncomingCall(_ callId: String) -> Bool {
|
|
361
|
+
#if DEBUG
|
|
362
|
+
print("[Callingx][answerIncomingCall] callId = \(callId)")
|
|
363
|
+
#endif
|
|
364
|
+
|
|
365
|
+
guard let uuid = CallingxImpl.uuidStorage?.getUUID(forCid: callId) else {
|
|
366
|
+
#if DEBUG
|
|
367
|
+
print("[Callingx][answerIncomingCall] callId not found")
|
|
368
|
+
#endif
|
|
369
|
+
return false
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
isSelfAnswered = true
|
|
373
|
+
let answerCallAction = CXAnswerCallAction(call: uuid)
|
|
374
|
+
let transaction = CXTransaction()
|
|
375
|
+
transaction.addAction(answerCallAction)
|
|
376
|
+
|
|
377
|
+
requestTransaction(transaction)
|
|
378
|
+
return true
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
@objc public func displayIncomingCall(
|
|
382
|
+
callId: String,
|
|
383
|
+
phoneNumber: String,
|
|
384
|
+
callerName: String,
|
|
385
|
+
hasVideo: Bool
|
|
386
|
+
) -> Bool {
|
|
387
|
+
CallingxImpl.reportNewIncomingCall(
|
|
388
|
+
callId: callId,
|
|
389
|
+
handle: phoneNumber,
|
|
390
|
+
handleType: "generic",
|
|
391
|
+
hasVideo: hasVideo,
|
|
392
|
+
localizedCallerName: callerName,
|
|
393
|
+
supportsHolding: false,
|
|
394
|
+
supportsDTMF: false,
|
|
395
|
+
supportsGrouping: false,
|
|
396
|
+
supportsUngrouping: false,
|
|
397
|
+
fromPushKit: false,
|
|
398
|
+
payload: nil,
|
|
399
|
+
completion: nil
|
|
400
|
+
)
|
|
401
|
+
|
|
402
|
+
let settings = Settings.getSettings()
|
|
403
|
+
if let timeout = settings["displayCallTimeout"] as? Int {
|
|
404
|
+
let popTime = DispatchTime.now() + .milliseconds(timeout)
|
|
405
|
+
DispatchQueue.main.asyncAfter(deadline: popTime) { [weak self] in
|
|
406
|
+
guard let self = self, !self.isSetup else { return }
|
|
407
|
+
#if DEBUG
|
|
408
|
+
print("[Callingx] Displayed a call without a reachable app, ending the call: \(callId)")
|
|
409
|
+
#endif
|
|
410
|
+
CallingxImpl.endCall(callId, reason: CXCallEndedReason.failed.rawValue)
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
return true
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
@objc public func endCall(_ callId: String) -> Bool {
|
|
417
|
+
#if DEBUG
|
|
418
|
+
print("[Callingx][endCall] callId = \(callId)")
|
|
419
|
+
#endif
|
|
420
|
+
|
|
421
|
+
guard let uuid = CallingxImpl.uuidStorage?.getUUID(forCid: callId) else {
|
|
422
|
+
#if DEBUG
|
|
423
|
+
print("[Callingx][endCall] callId not found")
|
|
424
|
+
#endif
|
|
425
|
+
return false
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
isSelfEnded = true
|
|
429
|
+
let endCallAction = CXEndCallAction(call: uuid)
|
|
430
|
+
let transaction = CXTransaction(action: endCallAction)
|
|
431
|
+
|
|
432
|
+
requestTransaction(transaction)
|
|
433
|
+
return true
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
@objc public func isCallRegistered(_ callId: String) -> Bool {
|
|
437
|
+
guard let uuid = CallingxImpl.uuidStorage?.getUUID(forCid: callId) else {
|
|
438
|
+
#if DEBUG
|
|
439
|
+
print("[Callingx][isCallRegistered] callId not found")
|
|
440
|
+
#endif
|
|
441
|
+
return false
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
let observer = CXCallObserver()
|
|
445
|
+
for call in observer.calls {
|
|
446
|
+
if call.uuid == uuid {
|
|
447
|
+
return true
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
return false
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
@objc public func setCurrentCallActive(_ callId: String) -> Bool {
|
|
454
|
+
#if DEBUG
|
|
455
|
+
print("[Callingx][setCurrentCallActive] callId = \(callId)")
|
|
456
|
+
#endif
|
|
457
|
+
|
|
458
|
+
guard let uuid = CallingxImpl.uuidStorage?.getUUID(forCid: callId) else {
|
|
459
|
+
#if DEBUG
|
|
460
|
+
print("[Callingx][setCurrentCallActive] callId not found")
|
|
461
|
+
#endif
|
|
462
|
+
return false
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
//consider to split this into to calls startedConnectingAt with startCall, connectedAt with setCurrentCallActive
|
|
466
|
+
callKeepProvider?.reportOutgoingCall(with: uuid, startedConnectingAt: Date())
|
|
467
|
+
callKeepProvider?.reportOutgoingCall(with: uuid, connectedAt: Date())
|
|
468
|
+
return true
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
@objc public func setMutedCall(_ callId: String, isMuted: Bool) -> Bool {
|
|
472
|
+
#if DEBUG
|
|
473
|
+
print("[Callingx][setMutedCall] muted = \(isMuted)")
|
|
474
|
+
#endif
|
|
475
|
+
|
|
476
|
+
guard let uuid = CallingxImpl.uuidStorage?.getUUID(forCid: callId) else {
|
|
477
|
+
#if DEBUG
|
|
478
|
+
print("[Callingx][setMutedCall] callId not found")
|
|
479
|
+
#endif
|
|
480
|
+
return false
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
let setMutedAction = CXSetMutedCallAction(call: uuid, muted: isMuted)
|
|
484
|
+
let transaction = CXTransaction()
|
|
485
|
+
transaction.addAction(setMutedAction)
|
|
486
|
+
|
|
487
|
+
requestTransaction(transaction)
|
|
488
|
+
return true
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
@objc public func setOnHoldCall(_ callId: String, isOnHold: Bool) -> Bool {
|
|
492
|
+
#if DEBUG
|
|
493
|
+
print("[Callingx][setOnHold] uuidString = \(callId), shouldHold = \(isOnHold)")
|
|
494
|
+
#endif
|
|
495
|
+
|
|
496
|
+
guard let uuid = CallingxImpl.uuidStorage?.getUUID(forCid: callId) else {
|
|
497
|
+
#if DEBUG
|
|
498
|
+
print("[Callingx][setOnHoldCall] callId not found")
|
|
499
|
+
#endif
|
|
500
|
+
return false
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
let setHeldCallAction = CXSetHeldCallAction(call: uuid, onHold: isOnHold)
|
|
504
|
+
let transaction = CXTransaction()
|
|
505
|
+
transaction.addAction(setHeldCallAction)
|
|
506
|
+
|
|
507
|
+
requestTransaction(transaction)
|
|
508
|
+
return true
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
@objc public func startCall(
|
|
512
|
+
callId: String,
|
|
513
|
+
phoneNumber: String,
|
|
514
|
+
callerName: String,
|
|
515
|
+
hasVideo: Bool
|
|
516
|
+
) {
|
|
517
|
+
#if DEBUG
|
|
518
|
+
print("[Callingx][startCall] uuidString = \(callId), phoneNumber = \(phoneNumber)")
|
|
519
|
+
#endif
|
|
520
|
+
|
|
521
|
+
guard let storage = CallingxImpl.uuidStorage else { return }
|
|
522
|
+
|
|
523
|
+
let handleType = Settings.getHandleType("generic")
|
|
524
|
+
let uuid = storage.getOrCreateUUID(forCid: callId)
|
|
525
|
+
let callHandle = CXHandle(type: handleType, value: phoneNumber)
|
|
526
|
+
let startCallAction = CXStartCallAction(call: uuid, handle: callHandle)
|
|
527
|
+
startCallAction.isVideo = hasVideo
|
|
528
|
+
startCallAction.contactIdentifier = callerName
|
|
529
|
+
|
|
530
|
+
let transaction = CXTransaction(action: startCallAction)
|
|
531
|
+
requestTransaction(transaction)
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
@objc public func updateDisplay(
|
|
535
|
+
callId: String,
|
|
536
|
+
phoneNumber: String,
|
|
537
|
+
callerName: String
|
|
538
|
+
) -> Bool {
|
|
539
|
+
#if DEBUG
|
|
540
|
+
print("[Callingx][updateDisplay] uuidString = \(callId) displayName = \(callerName) uri = \(phoneNumber)")
|
|
541
|
+
#endif
|
|
542
|
+
|
|
543
|
+
guard let uuid = CallingxImpl.uuidStorage?.getUUID(forCid: callId) else {
|
|
544
|
+
#if DEBUG
|
|
545
|
+
print("[Callingx][updateDisplay] callId not found")
|
|
546
|
+
#endif
|
|
547
|
+
return false
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
let handleTypeString = Settings.getSettings()["handleType"] as? String
|
|
551
|
+
let handleType = Settings.getHandleType(handleTypeString ?? "generic")
|
|
552
|
+
let callHandle = CXHandle(type: handleType, value: phoneNumber)
|
|
553
|
+
let callUpdate = CXCallUpdate()
|
|
554
|
+
callUpdate.localizedCallerName = callerName
|
|
555
|
+
callUpdate.remoteHandle = callHandle
|
|
556
|
+
|
|
557
|
+
callKeepProvider?.reportCall(with: uuid, updated: callUpdate)
|
|
558
|
+
return true
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
// MARK: - CXProviderDelegate
|
|
562
|
+
public func provider(_ provider: CXProvider, perform action: CXStartCallAction) {
|
|
563
|
+
#if DEBUG
|
|
564
|
+
print("[Callingx][CXProviderDelegate][provider:performStartCallAction]")
|
|
565
|
+
#endif
|
|
566
|
+
|
|
567
|
+
guard let callId = CallingxImpl.uuidStorage?.getCid(forUUID: action.callUUID) else {
|
|
568
|
+
#if DEBUG
|
|
569
|
+
print("[Callingx][CXProviderDelegate][provider:performStartCallAction] callId not found")
|
|
570
|
+
#endif
|
|
571
|
+
action.fail()
|
|
572
|
+
return
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
AudioSessionManager.createAudioSessionIfNeeded()
|
|
576
|
+
|
|
577
|
+
sendEvent(CallingxEvents.didReceiveStartCallAction, body: [
|
|
578
|
+
"callId": callId,
|
|
579
|
+
"handle": action.handle.value
|
|
580
|
+
])
|
|
581
|
+
|
|
582
|
+
action.fulfill()
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
public func provider(_ provider: CXProvider, perform action: CXAnswerCallAction) {
|
|
586
|
+
#if DEBUG
|
|
587
|
+
print("[Callingx][CXProviderDelegate][provider:performAnswerCallAction] isSelfAnswered: \(isSelfAnswered)")
|
|
588
|
+
#endif
|
|
589
|
+
|
|
590
|
+
guard let callId = CallingxImpl.uuidStorage?.getCid(forUUID: action.callUUID) else {
|
|
591
|
+
#if DEBUG
|
|
592
|
+
print("[Callingx][CXProviderDelegate][provider:performAnswerCallAction] callId not found")
|
|
593
|
+
#endif
|
|
594
|
+
action.fail()
|
|
595
|
+
return
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
AudioSessionManager.createAudioSessionIfNeeded()
|
|
599
|
+
|
|
600
|
+
let source = isSelfAnswered ? "app" : "sys"
|
|
601
|
+
sendEvent(CallingxEvents.performAnswerCallAction, body: [
|
|
602
|
+
"callId": callId,
|
|
603
|
+
"source": source
|
|
604
|
+
])
|
|
605
|
+
|
|
606
|
+
isSelfAnswered = false
|
|
607
|
+
action.fulfill()
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
public func provider(_ provider: CXProvider, perform action: CXEndCallAction) {
|
|
611
|
+
#if DEBUG
|
|
612
|
+
print("[Callingx][CXProviderDelegate][provider:performEndCallAction] isSelfEnded: \(isSelfEnded)")
|
|
613
|
+
#endif
|
|
614
|
+
|
|
615
|
+
guard let callId = CallingxImpl.uuidStorage?.getCid(forUUID: action.callUUID) else {
|
|
616
|
+
#if DEBUG
|
|
617
|
+
print("[Callingx][CXProviderDelegate][provider:performEndCallAction] callId not found")
|
|
618
|
+
#endif
|
|
619
|
+
action.fail()
|
|
620
|
+
return
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
let source = isSelfEnded ? "app" : "sys"
|
|
624
|
+
sendEvent(CallingxEvents.performEndCallAction, body: [
|
|
625
|
+
"callId": callId,
|
|
626
|
+
"source": source
|
|
627
|
+
])
|
|
628
|
+
|
|
629
|
+
isSelfEnded = false
|
|
630
|
+
CallingxImpl.uuidStorage?.removeCid(callId)
|
|
631
|
+
|
|
632
|
+
action.fulfill()
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
public func provider(_ provider: CXProvider, perform action: CXSetHeldCallAction) {
|
|
636
|
+
#if DEBUG
|
|
637
|
+
print("[Callingx][CXProviderDelegate][provider:performSetHeldCallAction]")
|
|
638
|
+
#endif
|
|
639
|
+
|
|
640
|
+
guard let callId = CallingxImpl.uuidStorage?.getCid(forUUID: action.callUUID) else {
|
|
641
|
+
#if DEBUG
|
|
642
|
+
print("[Callingx][CXProviderDelegate][provider:performSetHeldCallAction] callId not found")
|
|
643
|
+
#endif
|
|
644
|
+
action.fail()
|
|
645
|
+
return
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
sendEvent(CallingxEvents.didToggleHoldAction, body: [
|
|
649
|
+
"hold": action.isOnHold,
|
|
650
|
+
"callId": callId
|
|
651
|
+
])
|
|
652
|
+
|
|
653
|
+
action.fulfill()
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
public func provider(_ provider: CXProvider, perform action: CXSetMutedCallAction) {
|
|
657
|
+
#if DEBUG
|
|
658
|
+
print("[Callingx][CXProviderDelegate][provider:performSetMutedCallAction] \(action.isMuted)")
|
|
659
|
+
#endif
|
|
660
|
+
|
|
661
|
+
guard let callId = CallingxImpl.uuidStorage?.getCid(forUUID: action.callUUID) else {
|
|
662
|
+
#if DEBUG
|
|
663
|
+
print("[Callingx][CXProviderDelegate][provider:performSetMutedCallAction] callId not found")
|
|
664
|
+
#endif
|
|
665
|
+
action.fail()
|
|
666
|
+
return
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
sendEvent(CallingxEvents.didPerformSetMutedCallAction, body: [
|
|
670
|
+
"muted": action.isMuted,
|
|
671
|
+
"callId": callId
|
|
672
|
+
])
|
|
673
|
+
|
|
674
|
+
action.fulfill()
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
public func provider(_ provider: CXProvider, perform action: CXPlayDTMFCallAction) {
|
|
678
|
+
#if DEBUG
|
|
679
|
+
print("[Callingx][CXProviderDelegate][provider:performPlayDTMFCallAction]")
|
|
680
|
+
#endif
|
|
681
|
+
|
|
682
|
+
guard let callId = CallingxImpl.uuidStorage?.getCid(forUUID: action.callUUID) else {
|
|
683
|
+
#if DEBUG
|
|
684
|
+
print("[Callingx][CXProviderDelegate][provider:performPlayDTMFCallAction] callId not found")
|
|
685
|
+
#endif
|
|
686
|
+
action.fail()
|
|
687
|
+
return
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
sendEvent(CallingxEvents.performPlayDTMFCallAction, body: [
|
|
691
|
+
"digits": action.digits,
|
|
692
|
+
"callId": callId
|
|
693
|
+
])
|
|
694
|
+
|
|
695
|
+
action.fulfill()
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
public func provider(_ provider: CXProvider, didActivate audioSession: AVAudioSession) {
|
|
699
|
+
#if DEBUG
|
|
700
|
+
print("[Callingx][CXProviderDelegate][provider:didActivateAudioSession] category=\(audioSession.category) mode=\(audioSession.mode)")
|
|
701
|
+
#endif
|
|
702
|
+
|
|
703
|
+
// When CallKit activates the AVAudioSession, inform WebRTC as well.
|
|
704
|
+
RTCAudioSession.sharedInstance().audioSessionDidActivate(audioSession)
|
|
705
|
+
|
|
706
|
+
// Enable wake lock to keep the device awake during the call
|
|
707
|
+
DispatchQueue.main.async {
|
|
708
|
+
UIApplication.shared.isIdleTimerDisabled = true
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
sendEvent(CallingxEvents.didActivateAudioSession, body: nil)
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
public func provider(_ provider: CXProvider, didDeactivate audioSession: AVAudioSession) {
|
|
715
|
+
#if DEBUG
|
|
716
|
+
print("[Callingx][CXProviderDelegate][provider:didDeactivateAudioSession] category=\(audioSession.category) mode=\(audioSession.mode)")
|
|
717
|
+
#endif
|
|
718
|
+
|
|
719
|
+
// When CallKit deactivates the AVAudioSession, inform WebRTC as well.
|
|
720
|
+
RTCAudioSession.sharedInstance().audioSessionDidDeactivate(audioSession)
|
|
721
|
+
|
|
722
|
+
// Disable wake lock when the call ends
|
|
723
|
+
DispatchQueue.main.async {
|
|
724
|
+
UIApplication.shared.isIdleTimerDisabled = false
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
sendEvent(CallingxEvents.didDeactivateAudioSession, body: nil)
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
public func provider(_ provider: CXProvider, timedOutPerforming action: CXAction) {
|
|
731
|
+
#if DEBUG
|
|
732
|
+
print("[Callingx][CXProviderDelegate][provider:timedOutPerformingAction]")
|
|
733
|
+
#endif
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
public func providerDidReset(_ provider: CXProvider) {
|
|
737
|
+
#if DEBUG
|
|
738
|
+
print("[Callingx][providerDidReset]")
|
|
739
|
+
#endif
|
|
740
|
+
|
|
741
|
+
sendEvent(CallingxEvents.providerReset, body: nil)
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
|