@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
package/src/types.ts
ADDED
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
import type { EventListener } from './EventManager';
|
|
2
|
+
import type { ManagableTask } from './utils/headlessTask';
|
|
3
|
+
import type { PermissionsResult } from './utils/permissions';
|
|
4
|
+
|
|
5
|
+
export interface ICallingxModule {
|
|
6
|
+
get isNotificationsAllowed(): boolean;
|
|
7
|
+
get isOngoingCallsEnabled(): boolean;
|
|
8
|
+
get isSetup(): boolean;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Setup the module. This method must be called before any other method.
|
|
12
|
+
* For iOS, the module will setup CallKit parameters.
|
|
13
|
+
* See: {@link InternalIOSOptions}
|
|
14
|
+
* For Android, the module will create notification channels.
|
|
15
|
+
* See: {@link InternalAndroidOptions}
|
|
16
|
+
* @param options - The options to setup the callingx module. See {@link CallingExpOptions}
|
|
17
|
+
*/
|
|
18
|
+
setup(options: CallingExpOptions): void;
|
|
19
|
+
/**
|
|
20
|
+
* Set whether to reject calls when the user is busy.
|
|
21
|
+
* The value is used in iOS native module to prevent calls registration in CallKit when the user is busy.
|
|
22
|
+
* @param shouldReject - Whether to reject calls when the user is busy.
|
|
23
|
+
*/
|
|
24
|
+
setShouldRejectCallWhenBusy(shouldReject: boolean): void;
|
|
25
|
+
/**
|
|
26
|
+
* Check the permissions.
|
|
27
|
+
* @returns The permissions result.
|
|
28
|
+
*/
|
|
29
|
+
checkPermissions(): Promise<PermissionsResult>;
|
|
30
|
+
|
|
31
|
+
requestPermissions(): Promise<PermissionsResult>;
|
|
32
|
+
/**
|
|
33
|
+
* Get the initial events. This method is used to get the initial events from the app launch.
|
|
34
|
+
* The events are queued and can be retrieved after the module is setup.
|
|
35
|
+
* IMPORTANT: After the events are retrieved, new events will be sent to the event listeners.
|
|
36
|
+
* @returns The initial events.
|
|
37
|
+
*/
|
|
38
|
+
getInitialEvents(): EventData[];
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Get the initial voip events. This method is used to get the initial voip events from the app launch.
|
|
42
|
+
* The events are queued and can be retrieved after the module is setup.
|
|
43
|
+
* IMPORTANT: After the events are retrieved, new events will be sent to the event listeners.
|
|
44
|
+
* @returns The initial voip events.
|
|
45
|
+
*/
|
|
46
|
+
getInitialVoipEvents(): VoipEventData[];
|
|
47
|
+
|
|
48
|
+
displayIncomingCall(
|
|
49
|
+
callId: string,
|
|
50
|
+
phoneNumber: string,
|
|
51
|
+
callerName: string,
|
|
52
|
+
hasVideo: boolean,
|
|
53
|
+
): Promise<void>;
|
|
54
|
+
answerIncomingCall(callId: string): Promise<void>;
|
|
55
|
+
|
|
56
|
+
startCall(
|
|
57
|
+
callId: string,
|
|
58
|
+
phoneNumber: string,
|
|
59
|
+
callerName: string,
|
|
60
|
+
hasVideo: boolean,
|
|
61
|
+
): Promise<void>;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Set the current call active. This method is used to set the current call active.
|
|
65
|
+
* This method is used to activate the call that was registered with {@link startCall}.
|
|
66
|
+
* @param callId - The call id.
|
|
67
|
+
* @returns The promise.
|
|
68
|
+
*/
|
|
69
|
+
setCurrentCallActive(callId: string): Promise<void>;
|
|
70
|
+
|
|
71
|
+
updateDisplay(
|
|
72
|
+
callId: string,
|
|
73
|
+
phoneNumber: string,
|
|
74
|
+
callerName: string,
|
|
75
|
+
): Promise<void>;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Check if the call is registered in CallKit/Telecom.
|
|
79
|
+
* @param callId - The call id.
|
|
80
|
+
* @returns The boolean value.
|
|
81
|
+
*/
|
|
82
|
+
isCallRegistered(callId: string): boolean;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Check if there is a registered call.
|
|
86
|
+
* @returns The boolean value.
|
|
87
|
+
*/
|
|
88
|
+
hasRegisteredCall(): boolean;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* End the call with a reason. This method is used to end the call with a reason.
|
|
92
|
+
* Note: In general invoking this method will trigger the call end event.
|
|
93
|
+
* But, in case of iOS, when the call is ended with the reason 'local', the call end event will not be triggered.
|
|
94
|
+
* @param callId - The call id.
|
|
95
|
+
* @param reason - The reason.
|
|
96
|
+
* @returns The promise.
|
|
97
|
+
*/
|
|
98
|
+
endCallWithReason(callId: string, reason: EndCallReason): Promise<void>;
|
|
99
|
+
|
|
100
|
+
setMutedCall(callId: string, isMuted: boolean): Promise<void>;
|
|
101
|
+
|
|
102
|
+
setOnHoldCall(callId: string, isOnHold: boolean): Promise<void>;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Register a background task provider. This method only registers the task and does not start it.
|
|
106
|
+
* The task will be automatically started when the service starts (via displayIncomingCall or startCall)
|
|
107
|
+
* if it has been registered.
|
|
108
|
+
* @param taskProvider - The task provider function that will be executed when the background task starts.
|
|
109
|
+
*/
|
|
110
|
+
registerBackgroundTask(taskProvider: ManagableTask): void;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Start the background task. This method will only start the task if:
|
|
114
|
+
* 1. A background task has been registered via registerBackgroundTask
|
|
115
|
+
* 2. The service is currently started
|
|
116
|
+
* @param taskProvider - The task provider function. If not provided, uses the previously registered task.
|
|
117
|
+
* @returns Promise that resolves when the task is started, or rejects if conditions are not met.
|
|
118
|
+
*/
|
|
119
|
+
startBackgroundTask(taskProvider?: ManagableTask): Promise<void>;
|
|
120
|
+
|
|
121
|
+
stopBackgroundTask(taskName: string): Promise<void>;
|
|
122
|
+
|
|
123
|
+
registerVoipToken(): void;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Single entry point for adding event listeners.
|
|
127
|
+
* Automatically routes to the appropriate manager based on event type.
|
|
128
|
+
*
|
|
129
|
+
* @param eventName - The event name (EventName or VoipEventName)
|
|
130
|
+
* @param callback - The callback function that receives the event parameters
|
|
131
|
+
* @returns An object with a remove method to unsubscribe from the event
|
|
132
|
+
*/
|
|
133
|
+
addEventListener<T extends EventName | VoipEventName>(
|
|
134
|
+
eventName: T,
|
|
135
|
+
callback: EventListener<
|
|
136
|
+
T extends EventName
|
|
137
|
+
? EventParams[T]
|
|
138
|
+
: T extends VoipEventName
|
|
139
|
+
? VoipEventParams[T]
|
|
140
|
+
: never
|
|
141
|
+
>,
|
|
142
|
+
): { remove: () => void };
|
|
143
|
+
|
|
144
|
+
log(message: string, level: 'debug' | 'info' | 'warn' | 'error'): void;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export type InternalIOSOptions = {
|
|
148
|
+
supportsVideo?: boolean;
|
|
149
|
+
maximumCallsPerCallGroup?: number;
|
|
150
|
+
maximumCallGroups?: number;
|
|
151
|
+
handleType?: 'generic' | 'number' | 'phone' | 'email';
|
|
152
|
+
/**
|
|
153
|
+
* Sound to play when an incoming call is received. Must be a valid sound resource name in the project.
|
|
154
|
+
* @default '' (no sound)
|
|
155
|
+
*/
|
|
156
|
+
sound?: string;
|
|
157
|
+
/**
|
|
158
|
+
* Image to display when an incoming call is received. Must be a valid image resource name in the project.
|
|
159
|
+
* @default '' (no image)
|
|
160
|
+
*/
|
|
161
|
+
imageName?: string;
|
|
162
|
+
/**
|
|
163
|
+
* Enable calls history. When enabled, the call will be added to the calls history.
|
|
164
|
+
* @default false
|
|
165
|
+
*/
|
|
166
|
+
callsHistory?: boolean;
|
|
167
|
+
/**
|
|
168
|
+
* Timeout to display an incoming call. When the call is displayed for more than the timeout, the call will be rejected.
|
|
169
|
+
* @default 60000 (1 minute)
|
|
170
|
+
*/
|
|
171
|
+
displayCallTimeout?: number;
|
|
172
|
+
};
|
|
173
|
+
type iOSOptions = Omit<
|
|
174
|
+
InternalIOSOptions,
|
|
175
|
+
| 'maximumCallsPerCallGroup'
|
|
176
|
+
| 'maximumCallGroups'
|
|
177
|
+
| 'handleType'
|
|
178
|
+
| 'setupAudioSession'
|
|
179
|
+
>;
|
|
180
|
+
|
|
181
|
+
export type InternalAndroidOptions = {
|
|
182
|
+
/**
|
|
183
|
+
* Incoming channel configuration.
|
|
184
|
+
* @default { id: 'incoming_calls_channel', name: 'Incoming calls', sound: '', vibration: false }
|
|
185
|
+
*/
|
|
186
|
+
incomingChannel?: {
|
|
187
|
+
id?: string;
|
|
188
|
+
name?: string;
|
|
189
|
+
sound?: string;
|
|
190
|
+
vibration?: boolean;
|
|
191
|
+
};
|
|
192
|
+
/**
|
|
193
|
+
* Ongoing channel configuration.
|
|
194
|
+
* @default { id: 'ongoing_calls_channel', name: 'Ongoing calls' }
|
|
195
|
+
*/
|
|
196
|
+
ongoingChannel?: {
|
|
197
|
+
id?: string;
|
|
198
|
+
name?: string;
|
|
199
|
+
};
|
|
200
|
+
};
|
|
201
|
+
type AndroidOptions = InternalAndroidOptions & NotificationTransformers;
|
|
202
|
+
|
|
203
|
+
export type TextTransformer = (text: string, incoming: boolean) => string;
|
|
204
|
+
export type NotificationTransformers = {
|
|
205
|
+
titleTransformer?: TextTransformer;
|
|
206
|
+
subtitleTransformer?: TextTransformer;
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
export type CallingExpOptions = {
|
|
210
|
+
ios?: iOSOptions;
|
|
211
|
+
android?: AndroidOptions;
|
|
212
|
+
/**
|
|
213
|
+
* Whether to enable ongoing calls.
|
|
214
|
+
* @default false
|
|
215
|
+
*/
|
|
216
|
+
enableOngoingCalls?: boolean;
|
|
217
|
+
/**
|
|
218
|
+
* Whether to reject calls when the user is busy.
|
|
219
|
+
* @default false
|
|
220
|
+
*/
|
|
221
|
+
shouldRejectCallWhenBusy?: boolean;
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
export type InfoDisplayOptions = {
|
|
225
|
+
displayTitle?: string;
|
|
226
|
+
displaySubtitle?: string;
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
export type EventData = {
|
|
230
|
+
eventName: EventName;
|
|
231
|
+
params: EventParams[EventName];
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
export type VoipEventData = {
|
|
235
|
+
eventName: VoipEventName;
|
|
236
|
+
params: VoipEventParams[VoipEventName];
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
export type EventName =
|
|
240
|
+
| 'answerCall'
|
|
241
|
+
| 'endCall'
|
|
242
|
+
| 'didDisplayIncomingCall'
|
|
243
|
+
| 'didToggleHoldCallAction'
|
|
244
|
+
| 'didChangeAudioRoute'
|
|
245
|
+
| 'didReceiveStartCallAction'
|
|
246
|
+
| 'didPerformSetMutedCallAction'
|
|
247
|
+
| 'didActivateAudioSession'
|
|
248
|
+
| 'didDeactivateAudioSession';
|
|
249
|
+
|
|
250
|
+
export type EventParams = {
|
|
251
|
+
answerCall: {
|
|
252
|
+
callId: string;
|
|
253
|
+
source: 'app' | 'sys';
|
|
254
|
+
};
|
|
255
|
+
endCall: {
|
|
256
|
+
callId: string;
|
|
257
|
+
cause: string;
|
|
258
|
+
source: 'app' | 'sys';
|
|
259
|
+
};
|
|
260
|
+
didDisplayIncomingCall: {
|
|
261
|
+
callId: string;
|
|
262
|
+
};
|
|
263
|
+
didToggleHoldCallAction: {
|
|
264
|
+
callId: string;
|
|
265
|
+
hold: boolean;
|
|
266
|
+
};
|
|
267
|
+
didPerformSetMutedCallAction: {
|
|
268
|
+
callId: string;
|
|
269
|
+
muted: boolean;
|
|
270
|
+
};
|
|
271
|
+
didChangeAudioRoute: {
|
|
272
|
+
callId: string;
|
|
273
|
+
output: string;
|
|
274
|
+
};
|
|
275
|
+
didReceiveStartCallAction: {
|
|
276
|
+
callId: string;
|
|
277
|
+
};
|
|
278
|
+
didActivateAudioSession: undefined;
|
|
279
|
+
didDeactivateAudioSession: undefined;
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
export type VoipEventName =
|
|
283
|
+
| 'voipNotificationsRegistered'
|
|
284
|
+
| 'voipNotificationReceived';
|
|
285
|
+
|
|
286
|
+
export type VoipEventParams = {
|
|
287
|
+
voipNotificationsRegistered: {
|
|
288
|
+
token: string;
|
|
289
|
+
};
|
|
290
|
+
voipNotificationReceived: {
|
|
291
|
+
aps: {
|
|
292
|
+
'thread-id': string;
|
|
293
|
+
'mutable-content': number;
|
|
294
|
+
alert: {
|
|
295
|
+
title: string;
|
|
296
|
+
};
|
|
297
|
+
category: string;
|
|
298
|
+
sound: string;
|
|
299
|
+
};
|
|
300
|
+
stream: {
|
|
301
|
+
sender: string;
|
|
302
|
+
created_by_id: string;
|
|
303
|
+
body: string;
|
|
304
|
+
title: string;
|
|
305
|
+
call_display_name: string;
|
|
306
|
+
created_by_display_name: string;
|
|
307
|
+
version: string;
|
|
308
|
+
type: string;
|
|
309
|
+
receiver_id: string;
|
|
310
|
+
call_cid: string;
|
|
311
|
+
video: string;
|
|
312
|
+
};
|
|
313
|
+
};
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
export type EndCallReason =
|
|
317
|
+
| 'local' // when call is ended by the user
|
|
318
|
+
| 'remote'
|
|
319
|
+
| 'rejected'
|
|
320
|
+
| 'busy'
|
|
321
|
+
| 'answeredElsewhere'
|
|
322
|
+
| 'missed'
|
|
323
|
+
| 'error';
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
InternalAndroidOptions,
|
|
3
|
+
InternalIOSOptions,
|
|
4
|
+
EndCallReason,
|
|
5
|
+
TextTransformer,
|
|
6
|
+
} from '../types';
|
|
7
|
+
import type { DeepRequired } from './types';
|
|
8
|
+
|
|
9
|
+
export const defaultTextTransformer: TextTransformer = (text: string) => text;
|
|
10
|
+
|
|
11
|
+
export const defaultiOSOptions: Required<InternalIOSOptions> = {
|
|
12
|
+
supportsVideo: true,
|
|
13
|
+
maximumCallsPerCallGroup: 1,
|
|
14
|
+
maximumCallGroups: 1,
|
|
15
|
+
handleType: 'generic',
|
|
16
|
+
sound: '',
|
|
17
|
+
imageName: '',
|
|
18
|
+
callsHistory: false,
|
|
19
|
+
displayCallTimeout: 60000, // 1 minute
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const defaultAndroidOptions: DeepRequired<InternalAndroidOptions> = {
|
|
23
|
+
incomingChannel: {
|
|
24
|
+
id: 'stream_incoming_calls_channel',
|
|
25
|
+
name: 'Incoming calls',
|
|
26
|
+
sound: '',
|
|
27
|
+
vibration: false,
|
|
28
|
+
},
|
|
29
|
+
ongoingChannel: {
|
|
30
|
+
id: 'stream_ongoing_calls_channel',
|
|
31
|
+
name: 'Ongoing calls',
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// See ios/Callingx.mm for native iOS logic and constants mapping.
|
|
36
|
+
export const iosEndCallReasonMap: Record<EndCallReason, number> = {
|
|
37
|
+
local: -1,
|
|
38
|
+
remote: 1,
|
|
39
|
+
rejected: 4,
|
|
40
|
+
busy: 2,
|
|
41
|
+
answeredElsewhere: 3,
|
|
42
|
+
missed: 2,
|
|
43
|
+
error: 0,
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// https://developer.android.com/reference/android/telecom/DisconnectCause
|
|
47
|
+
export const androidEndCallReasonMap: Record<EndCallReason, number> = {
|
|
48
|
+
local: 2,
|
|
49
|
+
remote: 3,
|
|
50
|
+
rejected: 6,
|
|
51
|
+
busy: 7,
|
|
52
|
+
answeredElsewhere: 11,
|
|
53
|
+
missed: 5,
|
|
54
|
+
error: 1,
|
|
55
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { AppRegistry } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export const HEADLESS_TASK_NAME = 'HandleCallBackgroundState';
|
|
4
|
+
|
|
5
|
+
export type ManagableTask = (
|
|
6
|
+
taskData: any,
|
|
7
|
+
stopTask: () => void,
|
|
8
|
+
) => Promise<void>;
|
|
9
|
+
|
|
10
|
+
type HeadlessTask = (taskData: any) => Promise<void>;
|
|
11
|
+
|
|
12
|
+
export const defaultBackgroundTask: ManagableTask = (
|
|
13
|
+
taskData: any,
|
|
14
|
+
stopTask: () => void,
|
|
15
|
+
) => {
|
|
16
|
+
return new Promise<void>((resolve) => {
|
|
17
|
+
console.log('Default background task data', taskData);
|
|
18
|
+
let i = 0;
|
|
19
|
+
const totalIterations = 5;
|
|
20
|
+
|
|
21
|
+
function loop() {
|
|
22
|
+
if (i < totalIterations) {
|
|
23
|
+
setTimeout(() => {
|
|
24
|
+
console.log(`Iteration: ${i + 1}`);
|
|
25
|
+
i++;
|
|
26
|
+
loop();
|
|
27
|
+
}, 1000);
|
|
28
|
+
} else {
|
|
29
|
+
console.log('Default background task finished');
|
|
30
|
+
resolve(undefined);
|
|
31
|
+
stopTask();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
loop();
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
let headlessTask: HeadlessTask = (taskData: any) =>
|
|
40
|
+
defaultBackgroundTask(taskData, () => {
|
|
41
|
+
console.log('Cancel callback called');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
export const setHeadlessTask = (task: HeadlessTask) => {
|
|
45
|
+
headlessTask = task;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const registerHeadlessTask = () => {
|
|
49
|
+
AppRegistry.registerHeadlessTask(HEADLESS_TASK_NAME, () => {
|
|
50
|
+
return headlessTask;
|
|
51
|
+
});
|
|
52
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { Platform, PermissionsAndroid } from 'react-native';
|
|
2
|
+
import type { Permission } from 'react-native';
|
|
3
|
+
|
|
4
|
+
export interface PermissionsResult {
|
|
5
|
+
recordAudio: boolean;
|
|
6
|
+
postNotifications: boolean;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const allowedPostNotifications =
|
|
10
|
+
Platform.OS === 'android' && Platform.Version < 33;
|
|
11
|
+
|
|
12
|
+
export const requestCallPermissions = async (): Promise<PermissionsResult> => {
|
|
13
|
+
if (Platform.OS !== 'android') {
|
|
14
|
+
return { recordAudio: true, postNotifications: true }; // iOS handles permissions differently
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const permissions: string[] = [PermissionsAndroid.PERMISSIONS.RECORD_AUDIO];
|
|
18
|
+
|
|
19
|
+
// Add POST_NOTIFICATIONS for Android 13+
|
|
20
|
+
if (Platform.Version >= 33) {
|
|
21
|
+
permissions.push(PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Add WRITE_CALL_LOG for call history (required for Android 6.0+)
|
|
25
|
+
// Note: PermissionsAndroid doesn't have a constant for this, so we use the string directly
|
|
26
|
+
// permissions.push('android.permission.WRITE_CALL_LOG');
|
|
27
|
+
|
|
28
|
+
try {
|
|
29
|
+
const results = await PermissionsAndroid.requestMultiple(
|
|
30
|
+
permissions as Permission[],
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
// Check if all permissions are granted
|
|
34
|
+
const allGranted = Object.values(results).every(
|
|
35
|
+
(status) => status === PermissionsAndroid.RESULTS.GRANTED,
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
if (!allGranted) {
|
|
39
|
+
const deniedPermissions = Object.entries(results)
|
|
40
|
+
.filter(([, status]) => status !== PermissionsAndroid.RESULTS.GRANTED)
|
|
41
|
+
.map(([permission]) => permission);
|
|
42
|
+
|
|
43
|
+
console.warn('Denied permissions:', deniedPermissions);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
recordAudio:
|
|
48
|
+
results[PermissionsAndroid.PERMISSIONS.RECORD_AUDIO] ===
|
|
49
|
+
PermissionsAndroid.RESULTS.GRANTED,
|
|
50
|
+
postNotifications:
|
|
51
|
+
results[PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS] ===
|
|
52
|
+
PermissionsAndroid.RESULTS.GRANTED || allowedPostNotifications,
|
|
53
|
+
};
|
|
54
|
+
} catch (err) {
|
|
55
|
+
console.warn('Error requesting permissions:', err);
|
|
56
|
+
return { recordAudio: false, postNotifications: false };
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const checkCallPermissions = async (): Promise<PermissionsResult> => {
|
|
61
|
+
if (Platform.OS !== 'android') {
|
|
62
|
+
return { recordAudio: true, postNotifications: true };
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const permissions: string[] = [PermissionsAndroid.PERMISSIONS.RECORD_AUDIO];
|
|
66
|
+
|
|
67
|
+
if (Platform.Version >= 33) {
|
|
68
|
+
permissions.push(PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
try {
|
|
72
|
+
const results = await Promise.all(
|
|
73
|
+
permissions.map(async (permission) => ({
|
|
74
|
+
permission,
|
|
75
|
+
granted: await PermissionsAndroid.check(permission as Permission),
|
|
76
|
+
})),
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
const resultsObject = results.reduce(
|
|
80
|
+
(acc, { permission, granted }) => {
|
|
81
|
+
acc[permission as Permission] = granted;
|
|
82
|
+
return acc;
|
|
83
|
+
},
|
|
84
|
+
{} as { [key in Permission]: boolean },
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
return {
|
|
88
|
+
recordAudio: resultsObject[PermissionsAndroid.PERMISSIONS.RECORD_AUDIO],
|
|
89
|
+
postNotifications:
|
|
90
|
+
resultsObject[PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS] ||
|
|
91
|
+
allowedPostNotifications,
|
|
92
|
+
};
|
|
93
|
+
} catch (err) {
|
|
94
|
+
console.warn('Error checking permissions:', err);
|
|
95
|
+
return { recordAudio: false, postNotifications: false };
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export const requestPostNotificationPermissions =
|
|
100
|
+
async (): Promise<boolean> => {
|
|
101
|
+
if (Platform.OS !== 'android') {
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const results = await PermissionsAndroid.request(
|
|
106
|
+
PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS,
|
|
107
|
+
);
|
|
108
|
+
return (
|
|
109
|
+
results === PermissionsAndroid.RESULTS.GRANTED || allowedPostNotifications
|
|
110
|
+
);
|
|
111
|
+
};
|