@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,438 @@
|
|
|
1
|
+
package io.getstream.rn.callingx.repo
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import android.net.Uri
|
|
5
|
+
import android.os.Build
|
|
6
|
+
import android.os.Bundle
|
|
7
|
+
import android.telecom.DisconnectCause
|
|
8
|
+
import android.util.Log
|
|
9
|
+
import androidx.annotation.RequiresApi
|
|
10
|
+
import androidx.core.telecom.CallAttributesCompat
|
|
11
|
+
import androidx.core.telecom.CallControlResult
|
|
12
|
+
import androidx.core.telecom.CallControlScope
|
|
13
|
+
import androidx.core.telecom.CallsManager
|
|
14
|
+
import io.getstream.rn.callingx.debugLog
|
|
15
|
+
import io.getstream.rn.callingx.model.Call
|
|
16
|
+
import io.getstream.rn.callingx.model.CallAction
|
|
17
|
+
import kotlinx.coroutines.Job
|
|
18
|
+
import kotlinx.coroutines.cancel
|
|
19
|
+
import kotlinx.coroutines.channels.Channel
|
|
20
|
+
import kotlinx.coroutines.flow.Flow
|
|
21
|
+
import kotlinx.coroutines.flow.consumeAsFlow
|
|
22
|
+
import kotlinx.coroutines.flow.launchIn
|
|
23
|
+
import kotlinx.coroutines.flow.onEach
|
|
24
|
+
import kotlinx.coroutines.flow.scan
|
|
25
|
+
import kotlinx.coroutines.launch
|
|
26
|
+
import kotlinx.coroutines.sync.withLock
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The central repository that keeps track of the current call and allows to register new calls.
|
|
30
|
+
*
|
|
31
|
+
* This class contains the main logic to integrate with Telecom SDK.
|
|
32
|
+
*
|
|
33
|
+
* @see registerCall
|
|
34
|
+
*/
|
|
35
|
+
@RequiresApi(Build.VERSION_CODES.O)
|
|
36
|
+
class TelecomCallRepository(context: Context) : CallRepository(context) {
|
|
37
|
+
|
|
38
|
+
companion object {
|
|
39
|
+
private const val TAG = "[Callingx] TelecomCallRepository"
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
private var observeCallStateJob: Job? = null
|
|
43
|
+
|
|
44
|
+
private val callsManager: CallsManager
|
|
45
|
+
private var isSelfAnswered = false
|
|
46
|
+
private var isSelfDisconnected = false
|
|
47
|
+
|
|
48
|
+
init {
|
|
49
|
+
val capabilities =
|
|
50
|
+
CallsManager.CAPABILITY_SUPPORTS_CALL_STREAMING or
|
|
51
|
+
CallsManager.CAPABILITY_SUPPORTS_VIDEO_CALLING
|
|
52
|
+
callsManager =
|
|
53
|
+
CallsManager(context.applicationContext).apply {
|
|
54
|
+
registerAppWithTelecom(capabilities)
|
|
55
|
+
}
|
|
56
|
+
debugLog(TAG, "[repository] init: CallsManager created and registered")
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
override fun getTag(): String = TAG
|
|
60
|
+
|
|
61
|
+
override fun setListener(listener: Listener?) {
|
|
62
|
+
this._listener = listener
|
|
63
|
+
|
|
64
|
+
observeCallStateJob?.cancel()
|
|
65
|
+
observeCallStateJob = observeCallState()
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
override fun release() {
|
|
69
|
+
val currentCall = currentCall.value
|
|
70
|
+
if (currentCall is Call.Registered) {
|
|
71
|
+
currentCall.processAction(CallAction.Disconnect(DisconnectCause(DisconnectCause.LOCAL)))
|
|
72
|
+
}
|
|
73
|
+
_currentCall.value = Call.None
|
|
74
|
+
|
|
75
|
+
observeCallStateJob?.cancel()
|
|
76
|
+
observeCallStateJob = null
|
|
77
|
+
_listener = null
|
|
78
|
+
|
|
79
|
+
scope.cancel()
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Register a new call with the provided attributes. Use the [currentCall] StateFlow to receive
|
|
84
|
+
* status updates and process call related actions.
|
|
85
|
+
*/
|
|
86
|
+
override suspend fun registerCall(
|
|
87
|
+
callId: String,
|
|
88
|
+
displayName: String,
|
|
89
|
+
address: Uri,
|
|
90
|
+
isIncoming: Boolean,
|
|
91
|
+
isVideo: Boolean,
|
|
92
|
+
displayOptions: Bundle?,
|
|
93
|
+
) {
|
|
94
|
+
debugLog(
|
|
95
|
+
TAG,
|
|
96
|
+
"[repository] registerCall: Starting registration - Name: $displayName, Address: $address, Incoming: $isIncoming"
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
registrationMutex.withLock {
|
|
100
|
+
// For simplicity we don't support multiple calls
|
|
101
|
+
if (_currentCall.value is Call.Registered) {
|
|
102
|
+
Log.w(
|
|
103
|
+
TAG,
|
|
104
|
+
"[repository] registerCall: Call already registered, ignoring new call request"
|
|
105
|
+
)
|
|
106
|
+
return@withLock
|
|
107
|
+
}
|
|
108
|
+
debugLog(
|
|
109
|
+
TAG,
|
|
110
|
+
"[repository] registerCall: No existing call found, proceeding with registration"
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
val attributes = createCallAttributes(displayName, address, isIncoming, isVideo)
|
|
114
|
+
val actionSource = Channel<CallAction>()
|
|
115
|
+
|
|
116
|
+
// Register the call and handle actions in the scope
|
|
117
|
+
try {
|
|
118
|
+
callsManager.addCall(
|
|
119
|
+
attributes,
|
|
120
|
+
onIsCallAnswered, // Watch needs to know if it can answer the call
|
|
121
|
+
onIsCallDisconnected,
|
|
122
|
+
onIsCallActive,
|
|
123
|
+
onIsCallInactive
|
|
124
|
+
) {
|
|
125
|
+
debugLog(
|
|
126
|
+
TAG,
|
|
127
|
+
"[repository] registerCall: Inside call scope, setting up call handlers"
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
// Consume the actions to interact with the call inside the scope
|
|
131
|
+
launch { processCallActions(actionSource.consumeAsFlow()) }
|
|
132
|
+
|
|
133
|
+
// Update the state to registered with default values while waiting for Telecom
|
|
134
|
+
// updates
|
|
135
|
+
debugLog(
|
|
136
|
+
TAG,
|
|
137
|
+
"[repository] registerCall: Creating Registered call state with ID: $callId"
|
|
138
|
+
)
|
|
139
|
+
_currentCall.value =
|
|
140
|
+
Call.Registered(
|
|
141
|
+
id = callId,
|
|
142
|
+
isActive = false, // can we just register the call as active?
|
|
143
|
+
isOnHold = false,
|
|
144
|
+
callAttributes = attributes,
|
|
145
|
+
displayOptions = displayOptions,
|
|
146
|
+
isMuted = false,
|
|
147
|
+
errorCode = null,
|
|
148
|
+
currentCallEndpoint = null,
|
|
149
|
+
availableCallEndpoints = emptyList(),
|
|
150
|
+
actionSource = actionSource,
|
|
151
|
+
)
|
|
152
|
+
debugLog(TAG, "[repository] registerCall: Call state updated to Registered")
|
|
153
|
+
|
|
154
|
+
launch {
|
|
155
|
+
currentCallEndpoint.collect {
|
|
156
|
+
updateCurrentCall { copy(currentCallEndpoint = it) }
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
launch {
|
|
160
|
+
availableEndpoints.collect {
|
|
161
|
+
updateCurrentCall { copy(availableCallEndpoints = it) }
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
launch { isMuted.collect { updateCurrentCall { copy(isMuted = it) } } }
|
|
165
|
+
}
|
|
166
|
+
debugLog(
|
|
167
|
+
TAG,
|
|
168
|
+
"[repository] registerCall: Call successfully registered with Telecom SDK"
|
|
169
|
+
)
|
|
170
|
+
} catch (e: Exception) {
|
|
171
|
+
Log.e(TAG, "[repository] registerCall: Error registering call", e)
|
|
172
|
+
throw e
|
|
173
|
+
} finally {
|
|
174
|
+
debugLog(TAG, "[repository] registerCall: Call scope ended, setting state to None")
|
|
175
|
+
_currentCall.value = Call.None
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
override fun updateCall(
|
|
181
|
+
callId: String,
|
|
182
|
+
displayName: String,
|
|
183
|
+
address: Uri,
|
|
184
|
+
isVideo: Boolean,
|
|
185
|
+
displayOptions: Bundle?,
|
|
186
|
+
) {
|
|
187
|
+
debugLog(
|
|
188
|
+
TAG,
|
|
189
|
+
"[repository] updateCall: Starting update - Name: $displayName, Address: $address, IsVideo: $isVideo"
|
|
190
|
+
)
|
|
191
|
+
super.updateCall(callId, displayName, address, isVideo, displayOptions)
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
private fun observeCallState(): Job {
|
|
195
|
+
return currentCall
|
|
196
|
+
.scan(Pair<Call?, Call>(null, currentCall.value)) { (_, prev), next ->
|
|
197
|
+
Pair(prev, next)
|
|
198
|
+
}
|
|
199
|
+
.onEach { (previous, current) ->
|
|
200
|
+
when {
|
|
201
|
+
previous is Call.None && current is Call.Registered -> {
|
|
202
|
+
if (!current.isIncoming()) {
|
|
203
|
+
_listener?.onCallRegistered(current.id)
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
previous is Call.Registered && current is Call.Registered -> {
|
|
207
|
+
if (previous.isMuted != current.isMuted) {
|
|
208
|
+
debugLog(
|
|
209
|
+
TAG,
|
|
210
|
+
"[repository] observeCallState: Mute changed: ${current.isMuted}"
|
|
211
|
+
)
|
|
212
|
+
_listener?.onMuteCallChanged(current.id, current.isMuted)
|
|
213
|
+
}
|
|
214
|
+
if (previous.currentCallEndpoint != current.currentCallEndpoint) {
|
|
215
|
+
current.currentCallEndpoint?.let {
|
|
216
|
+
_listener?.onCallEndpointChanged(current.id, it.name.toString())
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
_listener?.onCallStateChanged(current)
|
|
222
|
+
}
|
|
223
|
+
.launchIn(scope)
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/** Collect the action source to handle client actions inside the call scope */
|
|
227
|
+
private suspend fun CallControlScope.processCallActions(actionSource: Flow<CallAction>) {
|
|
228
|
+
actionSource.collect { action ->
|
|
229
|
+
debugLog(TAG, "[repository] processCallActions: action: ${action::class.simpleName}")
|
|
230
|
+
when (action) {
|
|
231
|
+
is CallAction.Answer -> {
|
|
232
|
+
doAnswer(action.isAudioCall)
|
|
233
|
+
}
|
|
234
|
+
is CallAction.Disconnect -> {
|
|
235
|
+
doDisconnect(action)
|
|
236
|
+
}
|
|
237
|
+
is CallAction.SwitchAudioEndpoint -> {
|
|
238
|
+
doSwitchEndpoint(action)
|
|
239
|
+
}
|
|
240
|
+
is CallAction.TransferCall -> {
|
|
241
|
+
debugLog(
|
|
242
|
+
TAG,
|
|
243
|
+
"[repository] processCallActions: Transfer to endpoint: ${action.endpointId}"
|
|
244
|
+
)
|
|
245
|
+
val call = _currentCall.value as? Call.Registered
|
|
246
|
+
val endpoints =
|
|
247
|
+
call?.availableCallEndpoints?.firstOrNull {
|
|
248
|
+
it.identifier == action.endpointId
|
|
249
|
+
}
|
|
250
|
+
if (endpoints != null) {
|
|
251
|
+
requestEndpointChange(
|
|
252
|
+
endpoint = endpoints,
|
|
253
|
+
)
|
|
254
|
+
} else {
|
|
255
|
+
Log.w(
|
|
256
|
+
TAG,
|
|
257
|
+
"[repository] processCallActions: Endpoint not found for transfer, ignoring"
|
|
258
|
+
)
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
CallAction.Hold -> {
|
|
262
|
+
when (val result = setInactive()) {
|
|
263
|
+
is CallControlResult.Success -> {
|
|
264
|
+
onIsCallInactive()
|
|
265
|
+
}
|
|
266
|
+
is CallControlResult.Error -> {
|
|
267
|
+
Log.e(
|
|
268
|
+
TAG,
|
|
269
|
+
"[repository] processCallActions: Hold action failed with error code: ${result.errorCode}"
|
|
270
|
+
)
|
|
271
|
+
updateCurrentCall { copy(errorCode = result.errorCode) }
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
CallAction.Activate -> {
|
|
276
|
+
when (val result = setActive()) {
|
|
277
|
+
is CallControlResult.Success -> {
|
|
278
|
+
onIsCallActive()
|
|
279
|
+
}
|
|
280
|
+
is CallControlResult.Error -> {
|
|
281
|
+
Log.e(
|
|
282
|
+
TAG,
|
|
283
|
+
"[repository] processCallActions: Activate action failed with error code: ${result.errorCode}"
|
|
284
|
+
)
|
|
285
|
+
updateCurrentCall { copy(errorCode = result.errorCode) }
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
is CallAction.ToggleMute -> {
|
|
290
|
+
// We cannot programmatically mute the telecom stack. Instead we just update
|
|
291
|
+
// the state of the call and this will start/stop audio capturing.
|
|
292
|
+
debugLog(TAG, "[repository] processCallActions: Toggling mute: ${action.isMute}")
|
|
293
|
+
updateCurrentCall {
|
|
294
|
+
val newMutedState = action.isMute
|
|
295
|
+
copy(isMuted = newMutedState)
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
debugLog(TAG, "[repository] processCallActions: Action collection ended")
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
private suspend fun CallControlScope.doSwitchEndpoint(action: CallAction.SwitchAudioEndpoint) {
|
|
305
|
+
debugLog(TAG, "[repository] doSwitchEndpoint: Switching to endpoint: ${action.endpointId}")
|
|
306
|
+
if (_currentCall.value !is Call.Registered) {
|
|
307
|
+
Log.w(TAG, "[repository] doSwitchEndpoint: Call not registered, ignoring")
|
|
308
|
+
return
|
|
309
|
+
}
|
|
310
|
+
// TODO once availableCallEndpoints is a state flow we can just get the value
|
|
311
|
+
val endpoints = (_currentCall.value as Call.Registered).availableCallEndpoints
|
|
312
|
+
// Switch to the given endpoint or fallback to the best possible one.
|
|
313
|
+
val newEndpoint = endpoints.firstOrNull { it.identifier == action.endpointId }
|
|
314
|
+
|
|
315
|
+
if (newEndpoint != null) {
|
|
316
|
+
debugLog(
|
|
317
|
+
TAG,
|
|
318
|
+
"[repository] doSwitchEndpoint: Found endpoint: ${newEndpoint.name}, requesting change"
|
|
319
|
+
)
|
|
320
|
+
requestEndpointChange(newEndpoint).also {
|
|
321
|
+
debugLog(TAG, "[repository] doSwitchEndpoint: Endpoint change result: $it")
|
|
322
|
+
}
|
|
323
|
+
} else {
|
|
324
|
+
Log.w(TAG, "[repository] doSwitchEndpoint: Endpoint not found in available endpoints")
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
private suspend fun CallControlScope.doDisconnect(action: CallAction.Disconnect) {
|
|
329
|
+
isSelfDisconnected = true
|
|
330
|
+
debugLog(TAG, "[repository] doDisconnect: Disconnecting call with cause: ${action.cause}")
|
|
331
|
+
disconnect(action.cause)
|
|
332
|
+
debugLog(TAG, "[repository] doDisconnect: Disconnect called, triggering onIsCallDisconnected")
|
|
333
|
+
onIsCallDisconnected(action.cause)
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
private suspend fun CallControlScope.doAnswer(isAudioCall: Boolean) {
|
|
337
|
+
isSelfAnswered = true
|
|
338
|
+
val callType =
|
|
339
|
+
if (isAudioCall) CallAttributesCompat.CALL_TYPE_AUDIO_CALL
|
|
340
|
+
else CallAttributesCompat.CALL_TYPE_VIDEO_CALL
|
|
341
|
+
|
|
342
|
+
when (val result = answer(callType)) {
|
|
343
|
+
is CallControlResult.Success -> {
|
|
344
|
+
onIsCallAnswered(callType)
|
|
345
|
+
}
|
|
346
|
+
is CallControlResult.Error -> {
|
|
347
|
+
Log.e(
|
|
348
|
+
TAG,
|
|
349
|
+
"[repository] doAnswer: Answer failed with error code: ${result.errorCode}"
|
|
350
|
+
)
|
|
351
|
+
isSelfAnswered = false
|
|
352
|
+
updateCurrentCall {
|
|
353
|
+
Call.Unregistered(
|
|
354
|
+
id = id,
|
|
355
|
+
callAttributes = callAttributes,
|
|
356
|
+
disconnectCause = DisconnectCause(DisconnectCause.BUSY),
|
|
357
|
+
)
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* Can the call be successfully answered?? TIP: We would check the connection/call state to see
|
|
365
|
+
* if we can answer a call Example you may need to wait for another call to hold.
|
|
366
|
+
*/
|
|
367
|
+
val onIsCallAnswered: suspend (type: Int) -> Unit = {
|
|
368
|
+
debugLog(
|
|
369
|
+
TAG,
|
|
370
|
+
"[repository] onIsCallAnswered: Call answered, type: $it, isSelfAnswered: $isSelfAnswered"
|
|
371
|
+
)
|
|
372
|
+
updateCurrentCall { copy(isActive = true, isOnHold = false) }
|
|
373
|
+
|
|
374
|
+
val call = _currentCall.value
|
|
375
|
+
val source =
|
|
376
|
+
if (isSelfAnswered) EventSource.APP
|
|
377
|
+
else EventSource.SYS
|
|
378
|
+
if (call is Call.Registered) {
|
|
379
|
+
_listener?.onIsCallAnswered(call.id, source)
|
|
380
|
+
}
|
|
381
|
+
isSelfAnswered = false
|
|
382
|
+
debugLog(TAG, "[repository] onIsCallAnswered: Call state updated to active")
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
/** Can the call perform a disconnect */
|
|
386
|
+
val onIsCallDisconnected: suspend (cause: DisconnectCause) -> Unit = {
|
|
387
|
+
debugLog(
|
|
388
|
+
TAG,
|
|
389
|
+
"[repository] onIsCallDisconnected: Call disconnected, cause: ${it.reason}, description: ${it.description}"
|
|
390
|
+
)
|
|
391
|
+
val source =
|
|
392
|
+
if (isSelfDisconnected) EventSource.APP
|
|
393
|
+
else EventSource.SYS
|
|
394
|
+
var callId: String? = null
|
|
395
|
+
if (_currentCall.value is Call.Registered) {
|
|
396
|
+
callId = (_currentCall.value as Call.Registered).id
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
updateCurrentCall { Call.Unregistered(id, callAttributes, it) }
|
|
400
|
+
_listener?.onIsCallDisconnected(callId, it, source)
|
|
401
|
+
isSelfDisconnected = false
|
|
402
|
+
debugLog(TAG, "[repository] onIsCallDisconnected: Call state updated to Unregistered")
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* Check is see if we can make the call active. Other calls and state might stop us from
|
|
407
|
+
* activating the call
|
|
408
|
+
*/
|
|
409
|
+
val onIsCallActive: suspend () -> Unit = {
|
|
410
|
+
debugLog(TAG, "[repository] onIsCallActive: Call became active")
|
|
411
|
+
updateCurrentCall {
|
|
412
|
+
copy(
|
|
413
|
+
errorCode = null,
|
|
414
|
+
isActive = true,
|
|
415
|
+
isOnHold = false,
|
|
416
|
+
)
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
val call = _currentCall.value
|
|
420
|
+
if (call is Call.Registered) {
|
|
421
|
+
_listener?.onIsCallActive(call.id)
|
|
422
|
+
}
|
|
423
|
+
debugLog(TAG, "[repository] onIsCallActive: Call state updated")
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
/** Check to see if we can make the call inactivate */
|
|
427
|
+
val onIsCallInactive: suspend () -> Unit = {
|
|
428
|
+
debugLog(TAG, "[repository] onIsCallInactive: Call became inactive (on hold)")
|
|
429
|
+
updateCurrentCall { copy(errorCode = null, isOnHold = true) }
|
|
430
|
+
|
|
431
|
+
val call = _currentCall.value
|
|
432
|
+
if (call is Call.Registered) {
|
|
433
|
+
_listener?.onIsCallInactive(call.id)
|
|
434
|
+
}
|
|
435
|
+
debugLog(TAG, "[repository] onIsCallInactive: Call state updated to on hold")
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
2
|
+
android:width="24dp"
|
|
3
|
+
android:height="24dp"
|
|
4
|
+
android:autoMirrored="true"
|
|
5
|
+
android:tint="#000000"
|
|
6
|
+
android:viewportWidth="24"
|
|
7
|
+
android:viewportHeight="24">
|
|
8
|
+
<path
|
|
9
|
+
android:fillColor="@android:color/white"
|
|
10
|
+
android:pathData="M16,3c-0.55,0 -1,0.45 -1,1v5c0,0.55 0.45,1 1,1s1,-0.45 1,-1L17,4c0,-0.55 -0.45,-1 -1,-1zM19,4v5c0,0.55 0.45,1 1,1s1,-0.45 1,-1L21,4c0,-0.55 -0.45,-1 -1,-1s-1,0.45 -1,1zM19.23,15.26l-2.54,-0.29c-0.61,-0.07 -1.21,0.14 -1.64,0.57l-1.84,1.84c-2.83,-1.44 -5.15,-3.75 -6.59,-6.59l1.85,-1.85c0.43,-0.43 0.64,-1.03 0.57,-1.64l-0.29,-2.52c-0.12,-1.01 -0.97,-1.77 -1.99,-1.77L5.03,3.01c-1.13,0 -2.07,0.94 -2,2.07 0.53,8.54 7.36,15.36 15.89,15.89 1.13,0.07 2.07,-0.87 2.07,-2v-1.73c0.01,-1.01 -0.75,-1.86 -1.76,-1.98z" />
|
|
11
|
+
</vector>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
2
|
+
android:width="24dp"
|
|
3
|
+
android:height="24dp"
|
|
4
|
+
android:autoMirrored="true"
|
|
5
|
+
android:tint="#000000"
|
|
6
|
+
android:viewportWidth="24"
|
|
7
|
+
android:viewportHeight="24">
|
|
8
|
+
<path
|
|
9
|
+
android:fillColor="@android:color/white"
|
|
10
|
+
android:pathData="M19.23,15.26l-2.54,-0.29c-0.61,-0.07 -1.21,0.14 -1.64,0.57l-1.84,1.84c-2.83,-1.44 -5.15,-3.75 -6.59,-6.59l1.85,-1.85c0.43,-0.43 0.64,-1.03 0.57,-1.64l-0.29,-2.52c-0.12,-1.01 -0.97,-1.77 -1.99,-1.77H5.03c-1.13,0 -2.07,0.94 -2,2.07 0.53,8.54 7.36,15.36 15.89,15.89 1.13,0.07 2.07,-0.87 2.07,-2v-1.73c0.01,-1.01 -0.75,-1.86 -1.76,-1.98z" />
|
|
11
|
+
</vector>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?><!--
|
|
2
|
+
Copyright (c) 2024 Stream.io Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
Licensed under the Stream License;
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
https://github.com/GetStream/stream-video-android/blob/main/LICENSE
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
-->
|
|
16
|
+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
17
|
+
android:width="24dp"
|
|
18
|
+
android:height="24dp"
|
|
19
|
+
android:viewportWidth="960"
|
|
20
|
+
android:viewportHeight="960">
|
|
21
|
+
<path
|
|
22
|
+
android:fillColor="#CCC"
|
|
23
|
+
android:pathData="M480,0a480,480 0 1,0 0,960a480,480 0 1,0 0,-960" />
|
|
24
|
+
<path
|
|
25
|
+
android:fillColor="#434343"
|
|
26
|
+
android:pathData="M480,480q-66,0 -113,-47t-47,-113q0,-66 47,-113t113,-47q66,0 113,47t47,113q0,66 -47,113t-113,47ZM160,720v-32q0,-34 17.5,-62.5T224,582q62,-31 126,-46.5T480,520q66,0 130,15.5T736,582q29,15 46.5,43.5T800,688v32q0,33 -23.5,56.5T720,800L240,800q-33,0 -56.5,-23.5T160,720Z" />
|
|
27
|
+
</vector>
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { Platform } from 'react-native';
|
|
4
|
+
import NativeCallingModule from "./spec/NativeCallingx.js";
|
|
5
|
+
import { checkCallPermissions, requestCallPermissions } from "./utils/permissions.js";
|
|
6
|
+
import { HEADLESS_TASK_NAME, registerHeadlessTask, setHeadlessTask } from "./utils/headlessTask.js";
|
|
7
|
+
import { EventManager } from "./EventManager.js";
|
|
8
|
+
import { androidEndCallReasonMap, defaultAndroidOptions, defaultiOSOptions, defaultTextTransformer, iosEndCallReasonMap } from "./utils/constants.js";
|
|
9
|
+
import { isVoipEvent } from "./utils/utils.js";
|
|
10
|
+
class CallingxModule {
|
|
11
|
+
_isNotificationsAllowed = false;
|
|
12
|
+
_isSetup = false;
|
|
13
|
+
_isOngoingCallsEnabled = false;
|
|
14
|
+
_isHeadlessTaskRegistered = false;
|
|
15
|
+
titleTransformer = text => text;
|
|
16
|
+
subtitleTransformer = undefined;
|
|
17
|
+
eventManager = new EventManager();
|
|
18
|
+
voipEventManager = new EventManager();
|
|
19
|
+
get isNotificationsAllowed() {
|
|
20
|
+
if (Platform.OS !== 'android') {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
return this._isNotificationsAllowed && NativeCallingModule.canPostNotifications();
|
|
24
|
+
}
|
|
25
|
+
get isOngoingCallsEnabled() {
|
|
26
|
+
return this._isOngoingCallsEnabled;
|
|
27
|
+
}
|
|
28
|
+
get isSetup() {
|
|
29
|
+
return this._isSetup;
|
|
30
|
+
}
|
|
31
|
+
setup(options) {
|
|
32
|
+
if (this._isSetup) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
this._isOngoingCallsEnabled = options.enableOngoingCalls ?? false;
|
|
36
|
+
this.setShouldRejectCallWhenBusy(options.shouldRejectCallWhenBusy ?? false);
|
|
37
|
+
if (Platform.OS === 'ios') {
|
|
38
|
+
NativeCallingModule.setupiOS({
|
|
39
|
+
...defaultiOSOptions,
|
|
40
|
+
...options.ios
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
if (Platform.OS === 'android') {
|
|
44
|
+
const {
|
|
45
|
+
titleTransformer,
|
|
46
|
+
subtitleTransformer,
|
|
47
|
+
incomingChannel,
|
|
48
|
+
ongoingChannel
|
|
49
|
+
} = options.android ?? {};
|
|
50
|
+
this.titleTransformer = titleTransformer ?? defaultTextTransformer;
|
|
51
|
+
this.subtitleTransformer = subtitleTransformer;
|
|
52
|
+
const notificationsConfig = {
|
|
53
|
+
incomingChannel: {
|
|
54
|
+
...defaultAndroidOptions.incomingChannel,
|
|
55
|
+
...(incomingChannel ?? {})
|
|
56
|
+
},
|
|
57
|
+
ongoingChannel: {
|
|
58
|
+
...defaultAndroidOptions.ongoingChannel,
|
|
59
|
+
...(ongoingChannel ?? {})
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
if (notificationsConfig.incomingChannel.id === notificationsConfig.ongoingChannel.id) {
|
|
63
|
+
throw new Error('Incoming and outgoing channel IDs cannot be the same');
|
|
64
|
+
}
|
|
65
|
+
NativeCallingModule.setupAndroid(notificationsConfig);
|
|
66
|
+
registerHeadlessTask();
|
|
67
|
+
}
|
|
68
|
+
this._isSetup = true;
|
|
69
|
+
}
|
|
70
|
+
setShouldRejectCallWhenBusy(shouldReject) {
|
|
71
|
+
NativeCallingModule.setShouldRejectCallWhenBusy(shouldReject);
|
|
72
|
+
}
|
|
73
|
+
async requestPermissions() {
|
|
74
|
+
const result = await requestCallPermissions();
|
|
75
|
+
this._isNotificationsAllowed = result.postNotifications;
|
|
76
|
+
return result;
|
|
77
|
+
}
|
|
78
|
+
async checkPermissions() {
|
|
79
|
+
const result = await checkCallPermissions();
|
|
80
|
+
this._isNotificationsAllowed = result.postNotifications;
|
|
81
|
+
return result;
|
|
82
|
+
}
|
|
83
|
+
getInitialEvents() {
|
|
84
|
+
return NativeCallingModule.getInitialEvents();
|
|
85
|
+
}
|
|
86
|
+
getInitialVoipEvents() {
|
|
87
|
+
return NativeCallingModule.getInitialVoipEvents();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
//activates call that was registered with the telecom stack
|
|
91
|
+
setCurrentCallActive(callId) {
|
|
92
|
+
return NativeCallingModule.setCurrentCallActive(callId);
|
|
93
|
+
}
|
|
94
|
+
displayIncomingCall(callId, phoneNumber, callerName, hasVideo) {
|
|
95
|
+
const displayOptions = {
|
|
96
|
+
displayTitle: this.titleTransformer(callerName, true),
|
|
97
|
+
displaySubtitle: this.subtitleTransformer?.(phoneNumber, true)
|
|
98
|
+
};
|
|
99
|
+
return NativeCallingModule.displayIncomingCall(callId, phoneNumber, callerName, hasVideo, displayOptions);
|
|
100
|
+
}
|
|
101
|
+
answerIncomingCall(callId) {
|
|
102
|
+
return NativeCallingModule.answerIncomingCall(callId);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
//registers call with the telecom stack
|
|
106
|
+
startCall(callId, phoneNumber, callerName, hasVideo) {
|
|
107
|
+
const displayOptions = {
|
|
108
|
+
displayTitle: this.titleTransformer(callerName, false),
|
|
109
|
+
displaySubtitle: this.subtitleTransformer?.(phoneNumber, false)
|
|
110
|
+
};
|
|
111
|
+
return NativeCallingModule.startCall(callId, phoneNumber, callerName, hasVideo, displayOptions);
|
|
112
|
+
}
|
|
113
|
+
updateDisplay(callId, phoneNumber, callerName) {
|
|
114
|
+
const displayOptions = {
|
|
115
|
+
displayTitle: this.titleTransformer(callerName, false),
|
|
116
|
+
//adjust incoming or outgoing call
|
|
117
|
+
displaySubtitle: this.subtitleTransformer?.(phoneNumber, false) //adjust incoming or outgoing call
|
|
118
|
+
};
|
|
119
|
+
return NativeCallingModule.updateDisplay(callId, phoneNumber, callerName, displayOptions);
|
|
120
|
+
}
|
|
121
|
+
endCallWithReason(callId, reason) {
|
|
122
|
+
const reasons = Platform.OS === 'ios' ? iosEndCallReasonMap : androidEndCallReasonMap;
|
|
123
|
+
if (Platform.OS === 'ios' && reason === 'local') {
|
|
124
|
+
return NativeCallingModule.endCall(callId);
|
|
125
|
+
}
|
|
126
|
+
return NativeCallingModule.endCallWithReason(callId, reasons[reason]);
|
|
127
|
+
}
|
|
128
|
+
isCallRegistered(callId) {
|
|
129
|
+
return NativeCallingModule.isCallRegistered(callId);
|
|
130
|
+
}
|
|
131
|
+
hasRegisteredCall() {
|
|
132
|
+
return NativeCallingModule.hasRegisteredCall();
|
|
133
|
+
}
|
|
134
|
+
setMutedCall(callId, isMuted) {
|
|
135
|
+
return NativeCallingModule.setMutedCall(callId, isMuted);
|
|
136
|
+
}
|
|
137
|
+
setOnHoldCall(callId, isOnHold) {
|
|
138
|
+
return NativeCallingModule.setOnHoldCall(callId, isOnHold);
|
|
139
|
+
}
|
|
140
|
+
registerBackgroundTask(taskProvider) {
|
|
141
|
+
const stopTask = () => {
|
|
142
|
+
this._isHeadlessTaskRegistered = false;
|
|
143
|
+
NativeCallingModule.stopBackgroundTask(HEADLESS_TASK_NAME);
|
|
144
|
+
};
|
|
145
|
+
setHeadlessTask(taskData => taskProvider(taskData, stopTask));
|
|
146
|
+
this._isHeadlessTaskRegistered = true;
|
|
147
|
+
NativeCallingModule.registerBackgroundTaskAvailable();
|
|
148
|
+
}
|
|
149
|
+
async startBackgroundTask(taskProvider) {
|
|
150
|
+
// If taskProvider is provided, register it first
|
|
151
|
+
if (taskProvider) {
|
|
152
|
+
this.registerBackgroundTask(taskProvider);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// Check if task is registered
|
|
156
|
+
if (!this._isHeadlessTaskRegistered) {
|
|
157
|
+
throw new Error('Background task not registered. Call registerBackgroundTask first.');
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// Check if service is started (Android only)
|
|
161
|
+
if (Platform.OS === 'android') {
|
|
162
|
+
const isServiceStarted = await NativeCallingModule.isServiceStarted();
|
|
163
|
+
if (!isServiceStarted) {
|
|
164
|
+
throw new Error('Service is not started. Call displayIncomingCall or startCall first.');
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return NativeCallingModule.startBackgroundTask(HEADLESS_TASK_NAME, 0);
|
|
168
|
+
}
|
|
169
|
+
stopBackgroundTask() {
|
|
170
|
+
this._isHeadlessTaskRegistered = false;
|
|
171
|
+
return NativeCallingModule.stopBackgroundTask(HEADLESS_TASK_NAME);
|
|
172
|
+
}
|
|
173
|
+
registerVoipToken() {
|
|
174
|
+
NativeCallingModule.registerVoipToken();
|
|
175
|
+
}
|
|
176
|
+
addEventListener(eventName, callback) {
|
|
177
|
+
const manager = isVoipEvent(eventName) ? this.voipEventManager : this.eventManager;
|
|
178
|
+
manager.addListener(eventName, callback);
|
|
179
|
+
return {
|
|
180
|
+
remove: () => {
|
|
181
|
+
manager.removeListener(eventName, callback);
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
log(message, level) {
|
|
186
|
+
NativeCallingModule.log(message, level);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
const module = new CallingxModule();
|
|
190
|
+
export default module;
|
|
191
|
+
//# sourceMappingURL=CallingxModule.js.map
|