@kaleem766/react-native-incoming-call 0.1.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/IncomingCall.podspec +29 -0
- package/LICENSE +20 -0
- package/README.md +280 -0
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +118 -0
- package/android/src/main/AndroidManifest.xml +35 -0
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/margelo/nitro/incomingcall/IncomingCall.kt +219 -0
- package/android/src/main/java/com/margelo/nitro/incomingcall/IncomingCallActivity.kt +314 -0
- package/android/src/main/java/com/margelo/nitro/incomingcall/IncomingCallModule.kt +152 -0
- package/android/src/main/java/com/margelo/nitro/incomingcall/IncomingCallPackage.kt +31 -0
- package/android/src/main/java/com/margelo/nitro/incomingcall/IncomingCallService.kt +109 -0
- package/ios/IncomingCall.swift +28 -0
- package/lib/module/IncomingCall.nitro.js +4 -0
- package/lib/module/IncomingCall.nitro.js.map +1 -0
- package/lib/module/index.js +137 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/IncomingCall.nitro.d.ts +21 -0
- package/lib/typescript/src/IncomingCall.nitro.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +43 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/nitro.json +17 -0
- package/nitrogen/generated/android/c++/JHybridIncomingCallSpec.cpp +101 -0
- package/nitrogen/generated/android/c++/JHybridIncomingCallSpec.hpp +73 -0
- package/nitrogen/generated/android/c++/views/JHybridIncomingCallStateUpdater.cpp +72 -0
- package/nitrogen/generated/android/c++/views/JHybridIncomingCallStateUpdater.hpp +49 -0
- package/nitrogen/generated/android/incomingcall+autolinking.cmake +83 -0
- package/nitrogen/generated/android/incomingcall+autolinking.gradle +27 -0
- package/nitrogen/generated/android/incomingcallOnLoad.cpp +56 -0
- package/nitrogen/generated/android/incomingcallOnLoad.hpp +34 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/incomingcall/HybridIncomingCallSpec.kt +87 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/incomingcall/incomingcallOnLoad.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/incomingcall/views/HybridIncomingCallManager.kt +70 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/incomingcall/views/HybridIncomingCallStateUpdater.kt +23 -0
- package/nitrogen/generated/ios/IncomingCall+autolinking.rb +60 -0
- package/nitrogen/generated/ios/IncomingCall-Swift-Cxx-Bridge.cpp +33 -0
- package/nitrogen/generated/ios/IncomingCall-Swift-Cxx-Bridge.hpp +83 -0
- package/nitrogen/generated/ios/IncomingCall-Swift-Cxx-Umbrella.hpp +45 -0
- package/nitrogen/generated/ios/IncomingCallAutolinking.mm +33 -0
- package/nitrogen/generated/ios/IncomingCallAutolinking.swift +26 -0
- package/nitrogen/generated/ios/c++/HybridIncomingCallSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridIncomingCallSpecSwift.hpp +121 -0
- package/nitrogen/generated/ios/c++/views/HybridIncomingCallComponent.mm +127 -0
- package/nitrogen/generated/ios/swift/HybridIncomingCallSpec.swift +60 -0
- package/nitrogen/generated/ios/swift/HybridIncomingCallSpec_cxx.swift +270 -0
- package/nitrogen/generated/shared/c++/HybridIncomingCallSpec.cpp +32 -0
- package/nitrogen/generated/shared/c++/HybridIncomingCallSpec.hpp +73 -0
- package/nitrogen/generated/shared/c++/views/HybridIncomingCallComponent.cpp +127 -0
- package/nitrogen/generated/shared/c++/views/HybridIncomingCallComponent.hpp +115 -0
- package/nitrogen/generated/shared/json/IncomingCallConfig.json +14 -0
- package/package.json +180 -0
- package/src/IncomingCall.nitro.ts +27 -0
- package/src/index.tsx +173 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JHybridIncomingCallStateUpdater.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "JHybridIncomingCallStateUpdater.hpp"
|
|
9
|
+
#include "views/HybridIncomingCallComponent.hpp"
|
|
10
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
11
|
+
#include <react/fabric/StateWrapperImpl.h>
|
|
12
|
+
|
|
13
|
+
namespace margelo::nitro::incomingcall::views {
|
|
14
|
+
|
|
15
|
+
using namespace facebook;
|
|
16
|
+
using ConcreteStateData = react::ConcreteState<HybridIncomingCallState>;
|
|
17
|
+
|
|
18
|
+
void JHybridIncomingCallStateUpdater::updateViewProps(jni::alias_ref<jni::JClass> /* class */,
|
|
19
|
+
jni::alias_ref<JHybridIncomingCallSpec::JavaPart> javaView,
|
|
20
|
+
jni::alias_ref<JStateWrapper::javaobject> stateWrapperInterface) {
|
|
21
|
+
std::shared_ptr<JHybridIncomingCallSpec> hybridView = javaView->getJHybridIncomingCallSpec();
|
|
22
|
+
|
|
23
|
+
// Get concrete StateWrapperImpl from passed StateWrapper interface object
|
|
24
|
+
jobject rawStateWrapper = stateWrapperInterface.get();
|
|
25
|
+
if (!stateWrapperInterface->isInstanceOf(react::StateWrapperImpl::javaClassStatic())) [[unlikely]] {
|
|
26
|
+
throw std::runtime_error("StateWrapper is not a StateWrapperImpl");
|
|
27
|
+
}
|
|
28
|
+
auto stateWrapper = jni::alias_ref<react::StateWrapperImpl::javaobject>{
|
|
29
|
+
static_cast<react::StateWrapperImpl::javaobject>(rawStateWrapper)};
|
|
30
|
+
std::shared_ptr<const react::State> state = stateWrapper->cthis()->getState();
|
|
31
|
+
auto concreteState = std::static_pointer_cast<const ConcreteStateData>(state);
|
|
32
|
+
const HybridIncomingCallState& data = concreteState->getData();
|
|
33
|
+
const std::shared_ptr<HybridIncomingCallProps>& props = data.getProps();
|
|
34
|
+
if (props == nullptr) [[unlikely]] {
|
|
35
|
+
// Props aren't set yet!
|
|
36
|
+
throw std::runtime_error("HybridIncomingCallState's data doesn't contain any props!");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Update all props if they are dirty
|
|
40
|
+
if (props->color.isDirty) {
|
|
41
|
+
hybridView->setColor(props->color.value);
|
|
42
|
+
props->color.isDirty = false;
|
|
43
|
+
}
|
|
44
|
+
if (props->callerName.isDirty) {
|
|
45
|
+
hybridView->setCallerName(props->callerName.value);
|
|
46
|
+
props->callerName.isDirty = false;
|
|
47
|
+
}
|
|
48
|
+
if (props->avatar.isDirty) {
|
|
49
|
+
hybridView->setAvatar(props->avatar.value);
|
|
50
|
+
props->avatar.isDirty = false;
|
|
51
|
+
}
|
|
52
|
+
if (props->callType.isDirty) {
|
|
53
|
+
hybridView->setCallType(props->callType.value);
|
|
54
|
+
props->callType.isDirty = false;
|
|
55
|
+
}
|
|
56
|
+
if (props->timeout.isDirty) {
|
|
57
|
+
hybridView->setTimeout(props->timeout.value);
|
|
58
|
+
props->timeout.isDirty = false;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Update hybridRef if it changed
|
|
62
|
+
if (props->hybridRef.isDirty) {
|
|
63
|
+
// hybridRef changed - call it with new this
|
|
64
|
+
const auto& maybeFunc = props->hybridRef.value;
|
|
65
|
+
if (maybeFunc.has_value()) {
|
|
66
|
+
maybeFunc.value()(hybridView);
|
|
67
|
+
}
|
|
68
|
+
props->hybridRef.isDirty = false;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
} // namespace margelo::nitro::incomingcall::views
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JHybridIncomingCallStateUpdater.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#ifndef RN_SERIALIZABLE_STATE
|
|
11
|
+
#error incomingcall was compiled without the 'RN_SERIALIZABLE_STATE' flag. This flag is required for Nitro Views - set it in your CMakeLists!
|
|
12
|
+
#endif
|
|
13
|
+
|
|
14
|
+
#include <fbjni/fbjni.h>
|
|
15
|
+
#include <react/fabric/CoreComponentsRegistry.h>
|
|
16
|
+
#include <react/fabric/StateWrapperImpl.h>
|
|
17
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
18
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
19
|
+
#include <NitroModules/JStateWrapper.hpp>
|
|
20
|
+
#include "JHybridIncomingCallSpec.hpp"
|
|
21
|
+
#include "views/HybridIncomingCallComponent.hpp"
|
|
22
|
+
|
|
23
|
+
namespace margelo::nitro::incomingcall::views {
|
|
24
|
+
|
|
25
|
+
using namespace facebook;
|
|
26
|
+
|
|
27
|
+
class JHybridIncomingCallStateUpdater final: public jni::JavaClass<JHybridIncomingCallStateUpdater> {
|
|
28
|
+
public:
|
|
29
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/incomingcall/views/HybridIncomingCallStateUpdater;";
|
|
30
|
+
|
|
31
|
+
public:
|
|
32
|
+
static void updateViewProps(jni::alias_ref<jni::JClass> /* class */,
|
|
33
|
+
jni::alias_ref<JHybridIncomingCallSpec::JavaPart> view,
|
|
34
|
+
jni::alias_ref<JStateWrapper::javaobject> stateWrapperInterface);
|
|
35
|
+
|
|
36
|
+
public:
|
|
37
|
+
static void registerNatives() {
|
|
38
|
+
// Register JNI calls
|
|
39
|
+
javaClassStatic()->registerNatives({
|
|
40
|
+
makeNativeMethod("updateViewProps", JHybridIncomingCallStateUpdater::updateViewProps),
|
|
41
|
+
});
|
|
42
|
+
// Register React Native view component descriptor
|
|
43
|
+
auto provider = react::concreteComponentDescriptorProvider<HybridIncomingCallComponentDescriptor>();
|
|
44
|
+
auto providerRegistry = react::CoreComponentsRegistry::sharedProviderRegistry();
|
|
45
|
+
providerRegistry->add(provider);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
} // namespace margelo::nitro::incomingcall::views
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
#
|
|
2
|
+
# incomingcall+autolinking.cmake
|
|
3
|
+
# This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
# https://github.com/mrousavy/nitro
|
|
5
|
+
# Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
#
|
|
7
|
+
|
|
8
|
+
# This is a CMake file that adds all files generated by Nitrogen
|
|
9
|
+
# to the current CMake project.
|
|
10
|
+
#
|
|
11
|
+
# To use it, add this to your CMakeLists.txt:
|
|
12
|
+
# ```cmake
|
|
13
|
+
# include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/incomingcall+autolinking.cmake)
|
|
14
|
+
# ```
|
|
15
|
+
|
|
16
|
+
# Define a flag to check if we are building properly
|
|
17
|
+
add_definitions(-DBUILDING_INCOMINGCALL_WITH_GENERATED_CMAKE_PROJECT)
|
|
18
|
+
|
|
19
|
+
# Enable Raw Props parsing in react-native (for Nitro Views)
|
|
20
|
+
add_definitions(-DRN_SERIALIZABLE_STATE)
|
|
21
|
+
|
|
22
|
+
# Add all headers that were generated by Nitrogen
|
|
23
|
+
include_directories(
|
|
24
|
+
"../nitrogen/generated/shared/c++"
|
|
25
|
+
"../nitrogen/generated/android/c++"
|
|
26
|
+
"../nitrogen/generated/android/"
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
# Add all .cpp sources that were generated by Nitrogen
|
|
30
|
+
target_sources(
|
|
31
|
+
# CMake project name (Android C++ library name)
|
|
32
|
+
incomingcall PRIVATE
|
|
33
|
+
# Autolinking Setup
|
|
34
|
+
../nitrogen/generated/android/incomingcallOnLoad.cpp
|
|
35
|
+
# Shared Nitrogen C++ sources
|
|
36
|
+
../nitrogen/generated/shared/c++/HybridIncomingCallSpec.cpp
|
|
37
|
+
../nitrogen/generated/shared/c++/views/HybridIncomingCallComponent.cpp
|
|
38
|
+
# Android-specific Nitrogen C++ sources
|
|
39
|
+
../nitrogen/generated/android/c++/JHybridIncomingCallSpec.cpp
|
|
40
|
+
../nitrogen/generated/android/c++/views/JHybridIncomingCallStateUpdater.cpp
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
# From node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake
|
|
44
|
+
# Used in node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake
|
|
45
|
+
target_compile_definitions(
|
|
46
|
+
incomingcall PRIVATE
|
|
47
|
+
-DFOLLY_NO_CONFIG=1
|
|
48
|
+
-DFOLLY_HAVE_CLOCK_GETTIME=1
|
|
49
|
+
-DFOLLY_USE_LIBCPP=1
|
|
50
|
+
-DFOLLY_CFG_NO_COROUTINES=1
|
|
51
|
+
-DFOLLY_MOBILE=1
|
|
52
|
+
-DFOLLY_HAVE_RECVMMSG=1
|
|
53
|
+
-DFOLLY_HAVE_PTHREAD=1
|
|
54
|
+
# Once we target android-23 above, we can comment
|
|
55
|
+
# the following line. NDK uses GNU style stderror_r() after API 23.
|
|
56
|
+
-DFOLLY_HAVE_XSI_STRERROR_R=1
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
# Add all libraries required by the generated specs
|
|
60
|
+
find_package(fbjni REQUIRED) # <-- Used for communication between Java <-> C++
|
|
61
|
+
find_package(ReactAndroid REQUIRED) # <-- Used to set up React Native bindings (e.g. CallInvoker/TurboModule)
|
|
62
|
+
find_package(react-native-nitro-modules REQUIRED) # <-- Used to create all HybridObjects and use the Nitro core library
|
|
63
|
+
|
|
64
|
+
# Link all libraries together
|
|
65
|
+
target_link_libraries(
|
|
66
|
+
incomingcall
|
|
67
|
+
fbjni::fbjni # <-- Facebook C++ JNI helpers
|
|
68
|
+
ReactAndroid::jsi # <-- RN: JSI
|
|
69
|
+
react-native-nitro-modules::NitroModules # <-- NitroModules Core :)
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
# Link react-native (different prefab between RN 0.75 and RN 0.76)
|
|
73
|
+
if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
|
|
74
|
+
target_link_libraries(
|
|
75
|
+
incomingcall
|
|
76
|
+
ReactAndroid::reactnative # <-- RN: Native Modules umbrella prefab
|
|
77
|
+
)
|
|
78
|
+
else()
|
|
79
|
+
target_link_libraries(
|
|
80
|
+
incomingcall
|
|
81
|
+
ReactAndroid::react_nativemodule_core # <-- RN: TurboModules Core
|
|
82
|
+
)
|
|
83
|
+
endif()
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// incomingcall+autolinking.gradle
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
/// This is a Gradle file that adds all files generated by Nitrogen
|
|
9
|
+
/// to the current Gradle project.
|
|
10
|
+
///
|
|
11
|
+
/// To use it, add this to your build.gradle:
|
|
12
|
+
/// ```gradle
|
|
13
|
+
/// apply from: '../nitrogen/generated/android/incomingcall+autolinking.gradle'
|
|
14
|
+
/// ```
|
|
15
|
+
|
|
16
|
+
logger.warn("[NitroModules] 🔥 incomingcall is boosted by nitro!")
|
|
17
|
+
|
|
18
|
+
android {
|
|
19
|
+
sourceSets {
|
|
20
|
+
main {
|
|
21
|
+
java.srcDirs += [
|
|
22
|
+
// Nitrogen files
|
|
23
|
+
"${project.projectDir}/../nitrogen/generated/android/kotlin"
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// incomingcallOnLoad.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#ifndef BUILDING_INCOMINGCALL_WITH_GENERATED_CMAKE_PROJECT
|
|
9
|
+
#error incomingcallOnLoad.cpp is not being built with the autogenerated CMakeLists.txt project. Is a different CMakeLists.txt building this?
|
|
10
|
+
#endif
|
|
11
|
+
|
|
12
|
+
#include "incomingcallOnLoad.hpp"
|
|
13
|
+
|
|
14
|
+
#include <jni.h>
|
|
15
|
+
#include <fbjni/fbjni.h>
|
|
16
|
+
#include <NitroModules/HybridObjectRegistry.hpp>
|
|
17
|
+
|
|
18
|
+
#include "JHybridIncomingCallSpec.hpp"
|
|
19
|
+
#include "views/JHybridIncomingCallStateUpdater.hpp"
|
|
20
|
+
#include <NitroModules/DefaultConstructableObject.hpp>
|
|
21
|
+
|
|
22
|
+
namespace margelo::nitro::incomingcall {
|
|
23
|
+
|
|
24
|
+
int initialize(JavaVM* vm) {
|
|
25
|
+
return facebook::jni::initialize(vm, []() {
|
|
26
|
+
::margelo::nitro::incomingcall::registerAllNatives();
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
struct JHybridIncomingCallSpecImpl: public jni::JavaClass<JHybridIncomingCallSpecImpl, JHybridIncomingCallSpec::JavaPart> {
|
|
31
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/incomingcall/HybridIncomingCall;";
|
|
32
|
+
static std::shared_ptr<JHybridIncomingCallSpec> create() {
|
|
33
|
+
static auto constructorFn = javaClassStatic()->getConstructor<JHybridIncomingCallSpecImpl::javaobject()>();
|
|
34
|
+
jni::local_ref<JHybridIncomingCallSpec::JavaPart> javaPart = javaClassStatic()->newObject(constructorFn);
|
|
35
|
+
return javaPart->getJHybridIncomingCallSpec();
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
void registerAllNatives() {
|
|
40
|
+
using namespace margelo::nitro;
|
|
41
|
+
using namespace margelo::nitro::incomingcall;
|
|
42
|
+
|
|
43
|
+
// Register native JNI methods
|
|
44
|
+
margelo::nitro::incomingcall::JHybridIncomingCallSpec::CxxPart::registerNatives();
|
|
45
|
+
margelo::nitro::incomingcall::views::JHybridIncomingCallStateUpdater::registerNatives();
|
|
46
|
+
|
|
47
|
+
// Register Nitro Hybrid Objects
|
|
48
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
49
|
+
"IncomingCall",
|
|
50
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
51
|
+
return JHybridIncomingCallSpecImpl::create();
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
} // namespace margelo::nitro::incomingcall
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// incomingcallOnLoad.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include <jni.h>
|
|
9
|
+
#include <functional>
|
|
10
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
11
|
+
|
|
12
|
+
namespace margelo::nitro::incomingcall {
|
|
13
|
+
|
|
14
|
+
[[deprecated("Use registerNatives() instead.")]]
|
|
15
|
+
int initialize(JavaVM* vm);
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Register the native (C++) part of incomingcall, and autolinks all Hybrid Objects.
|
|
19
|
+
* Call this in your `JNI_OnLoad` function (probably inside `cpp-adapter.cpp`),
|
|
20
|
+
* inside a `facebook::jni::initialize(vm, ...)` call.
|
|
21
|
+
* Example:
|
|
22
|
+
* ```cpp (cpp-adapter.cpp)
|
|
23
|
+
* JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
|
|
24
|
+
* return facebook::jni::initialize(vm, []() {
|
|
25
|
+
* // register all incomingcall HybridObjects
|
|
26
|
+
* margelo::nitro::incomingcall::registerNatives();
|
|
27
|
+
* // any other custom registrations go here.
|
|
28
|
+
* });
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
void registerAllNatives();
|
|
33
|
+
|
|
34
|
+
} // namespace margelo::nitro::incomingcall
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/incomingcall/HybridIncomingCallSpec.kt
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridIncomingCallSpec.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.incomingcall
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import com.margelo.nitro.core.HybridObject
|
|
14
|
+
import com.margelo.nitro.views.HybridView
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* A Kotlin class representing the IncomingCall HybridObject.
|
|
18
|
+
* Implement this abstract class to create Kotlin-based instances of IncomingCall.
|
|
19
|
+
*/
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
@Suppress(
|
|
23
|
+
"KotlinJniMissingFunction", "unused",
|
|
24
|
+
"RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
|
|
25
|
+
"LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
|
|
26
|
+
)
|
|
27
|
+
abstract class HybridIncomingCallSpec: HybridView() {
|
|
28
|
+
// Properties
|
|
29
|
+
@get:DoNotStrip
|
|
30
|
+
@get:Keep
|
|
31
|
+
@set:DoNotStrip
|
|
32
|
+
@set:Keep
|
|
33
|
+
abstract var color: String
|
|
34
|
+
|
|
35
|
+
@get:DoNotStrip
|
|
36
|
+
@get:Keep
|
|
37
|
+
@set:DoNotStrip
|
|
38
|
+
@set:Keep
|
|
39
|
+
abstract var callerName: String?
|
|
40
|
+
|
|
41
|
+
@get:DoNotStrip
|
|
42
|
+
@get:Keep
|
|
43
|
+
@set:DoNotStrip
|
|
44
|
+
@set:Keep
|
|
45
|
+
abstract var avatar: String?
|
|
46
|
+
|
|
47
|
+
@get:DoNotStrip
|
|
48
|
+
@get:Keep
|
|
49
|
+
@set:DoNotStrip
|
|
50
|
+
@set:Keep
|
|
51
|
+
abstract var callType: String?
|
|
52
|
+
|
|
53
|
+
@get:DoNotStrip
|
|
54
|
+
@get:Keep
|
|
55
|
+
@set:DoNotStrip
|
|
56
|
+
@set:Keep
|
|
57
|
+
abstract var timeout: Double?
|
|
58
|
+
|
|
59
|
+
// Methods
|
|
60
|
+
@DoNotStrip
|
|
61
|
+
@Keep
|
|
62
|
+
abstract fun answerCall(): Unit
|
|
63
|
+
|
|
64
|
+
@DoNotStrip
|
|
65
|
+
@Keep
|
|
66
|
+
abstract fun rejectCall(): Unit
|
|
67
|
+
|
|
68
|
+
// Default implementation of `HybridObject.toString()`
|
|
69
|
+
override fun toString(): String {
|
|
70
|
+
return "[HybridObject IncomingCall]"
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// C++ backing class
|
|
74
|
+
@DoNotStrip
|
|
75
|
+
@Keep
|
|
76
|
+
protected open class CxxPart(javaPart: HybridIncomingCallSpec): HybridObject.CxxPart(javaPart) {
|
|
77
|
+
// C++ JHybridIncomingCallSpec::CxxPart::initHybrid(...)
|
|
78
|
+
external override fun initHybrid(): HybridData
|
|
79
|
+
}
|
|
80
|
+
override fun createCxxPart(): CxxPart {
|
|
81
|
+
return CxxPart(this)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
companion object {
|
|
85
|
+
protected const val TAG = "HybridIncomingCallSpec"
|
|
86
|
+
}
|
|
87
|
+
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/incomingcall/incomingcallOnLoad.kt
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// incomingcallOnLoad.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.incomingcall
|
|
9
|
+
|
|
10
|
+
import android.util.Log
|
|
11
|
+
|
|
12
|
+
internal class incomingcallOnLoad {
|
|
13
|
+
companion object {
|
|
14
|
+
private const val TAG = "incomingcallOnLoad"
|
|
15
|
+
private var didLoad = false
|
|
16
|
+
/**
|
|
17
|
+
* Initializes the native part of "incomingcall".
|
|
18
|
+
* This method is idempotent and can be called more than once.
|
|
19
|
+
*/
|
|
20
|
+
@JvmStatic
|
|
21
|
+
fun initializeNative() {
|
|
22
|
+
if (didLoad) return
|
|
23
|
+
try {
|
|
24
|
+
Log.i(TAG, "Loading incomingcall C++ library...")
|
|
25
|
+
System.loadLibrary("incomingcall")
|
|
26
|
+
Log.i(TAG, "Successfully loaded incomingcall C++ library!")
|
|
27
|
+
didLoad = true
|
|
28
|
+
} catch (e: Error) {
|
|
29
|
+
Log.e(TAG, "Failed to load incomingcall C++ library! Is it properly installed and linked? " +
|
|
30
|
+
"Is the name correct? (see `CMakeLists.txt`, at `add_library(...)`)", e)
|
|
31
|
+
throw e
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridIncomingCallManager.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.incomingcall.views
|
|
9
|
+
|
|
10
|
+
import android.view.View
|
|
11
|
+
import com.facebook.react.uimanager.ReactStylesDiffMap
|
|
12
|
+
import com.facebook.react.uimanager.SimpleViewManager
|
|
13
|
+
import com.facebook.react.uimanager.StateWrapper
|
|
14
|
+
import com.facebook.react.uimanager.ThemedReactContext
|
|
15
|
+
import com.margelo.nitro.R.id.associated_hybrid_view_tag
|
|
16
|
+
import com.margelo.nitro.views.RecyclableView
|
|
17
|
+
import com.margelo.nitro.incomingcall.*
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Represents the React Native `ViewManager` for the "IncomingCall" Nitro HybridView.
|
|
21
|
+
*/
|
|
22
|
+
public class HybridIncomingCallManager: SimpleViewManager<View>() {
|
|
23
|
+
init {
|
|
24
|
+
if (RecyclableView::class.java.isAssignableFrom(HybridIncomingCall::class.java)) {
|
|
25
|
+
// Enable view recycling
|
|
26
|
+
super.setupViewRecycling()
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
override fun getName(): String {
|
|
31
|
+
return "IncomingCall"
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
override fun createViewInstance(reactContext: ThemedReactContext): View {
|
|
35
|
+
val hybridView = HybridIncomingCall(reactContext)
|
|
36
|
+
val view = hybridView.view
|
|
37
|
+
view.setTag(associated_hybrid_view_tag, hybridView)
|
|
38
|
+
return view
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
override fun updateState(view: View, props: ReactStylesDiffMap, stateWrapper: StateWrapper): Any? {
|
|
42
|
+
val hybridView = view.getTag(associated_hybrid_view_tag) as? HybridIncomingCall
|
|
43
|
+
?: throw Error("Couldn't find view $view in local views table!")
|
|
44
|
+
|
|
45
|
+
// 1. Update each prop individually
|
|
46
|
+
hybridView.beforeUpdate()
|
|
47
|
+
HybridIncomingCallStateUpdater.updateViewProps(hybridView, stateWrapper)
|
|
48
|
+
hybridView.afterUpdate()
|
|
49
|
+
|
|
50
|
+
// 2. Continue in base View props
|
|
51
|
+
return super.updateState(view, props, stateWrapper)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
protected override fun prepareToRecycleView(reactContext: ThemedReactContext, view: View): View? {
|
|
55
|
+
super.prepareToRecycleView(reactContext, view)
|
|
56
|
+
val hybridView = view.getTag(associated_hybrid_view_tag) as? HybridIncomingCall
|
|
57
|
+
?: return null
|
|
58
|
+
|
|
59
|
+
@Suppress("USELESS_IS_CHECK")
|
|
60
|
+
if (hybridView is RecyclableView) {
|
|
61
|
+
// Recycle in it's implementation
|
|
62
|
+
hybridView.prepareForRecycle()
|
|
63
|
+
|
|
64
|
+
// Maybe update the view if it changed
|
|
65
|
+
return hybridView.view
|
|
66
|
+
} else {
|
|
67
|
+
return null
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridIncomingCallStateUpdater.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.incomingcall.views
|
|
9
|
+
|
|
10
|
+
import com.facebook.react.uimanager.StateWrapper
|
|
11
|
+
import com.margelo.nitro.incomingcall.*
|
|
12
|
+
|
|
13
|
+
internal class HybridIncomingCallStateUpdater {
|
|
14
|
+
companion object {
|
|
15
|
+
/**
|
|
16
|
+
* Updates the props for [view] through C++.
|
|
17
|
+
* The [state] prop is expected to contain [view]'s props as wrapped Fabric state.
|
|
18
|
+
*/
|
|
19
|
+
@Suppress("KotlinJniMissingFunction")
|
|
20
|
+
@JvmStatic
|
|
21
|
+
external fun updateViewProps(view: HybridIncomingCallSpec, state: StateWrapper)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
#
|
|
2
|
+
# IncomingCall+autolinking.rb
|
|
3
|
+
# This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
# https://github.com/mrousavy/nitro
|
|
5
|
+
# Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
#
|
|
7
|
+
|
|
8
|
+
# This is a Ruby script that adds all files generated by Nitrogen
|
|
9
|
+
# to the given podspec.
|
|
10
|
+
#
|
|
11
|
+
# To use it, add this to your .podspec:
|
|
12
|
+
# ```ruby
|
|
13
|
+
# Pod::Spec.new do |spec|
|
|
14
|
+
# # ...
|
|
15
|
+
#
|
|
16
|
+
# # Add all files generated by Nitrogen
|
|
17
|
+
# load 'nitrogen/generated/ios/IncomingCall+autolinking.rb'
|
|
18
|
+
# add_nitrogen_files(spec)
|
|
19
|
+
# end
|
|
20
|
+
# ```
|
|
21
|
+
|
|
22
|
+
def add_nitrogen_files(spec)
|
|
23
|
+
Pod::UI.puts "[NitroModules] 🔥 IncomingCall is boosted by nitro!"
|
|
24
|
+
|
|
25
|
+
spec.dependency "NitroModules"
|
|
26
|
+
|
|
27
|
+
current_source_files = Array(spec.attributes_hash['source_files'])
|
|
28
|
+
spec.source_files = current_source_files + [
|
|
29
|
+
# Generated cross-platform specs
|
|
30
|
+
"nitrogen/generated/shared/**/*.{h,hpp,c,cpp,swift}",
|
|
31
|
+
# Generated bridges for the cross-platform specs
|
|
32
|
+
"nitrogen/generated/ios/**/*.{h,hpp,c,cpp,mm,swift}",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
current_public_header_files = Array(spec.attributes_hash['public_header_files'])
|
|
36
|
+
spec.public_header_files = current_public_header_files + [
|
|
37
|
+
# Generated specs
|
|
38
|
+
"nitrogen/generated/shared/**/*.{h,hpp}",
|
|
39
|
+
# Swift to C++ bridging helpers
|
|
40
|
+
"nitrogen/generated/ios/IncomingCall-Swift-Cxx-Bridge.hpp"
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
current_private_header_files = Array(spec.attributes_hash['private_header_files'])
|
|
44
|
+
spec.private_header_files = current_private_header_files + [
|
|
45
|
+
# iOS specific specs
|
|
46
|
+
"nitrogen/generated/ios/c++/**/*.{h,hpp}",
|
|
47
|
+
# Views are framework-specific and should be private
|
|
48
|
+
"nitrogen/generated/shared/**/views/**/*"
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
current_pod_target_xcconfig = spec.attributes_hash['pod_target_xcconfig'] || {}
|
|
52
|
+
spec.pod_target_xcconfig = current_pod_target_xcconfig.merge({
|
|
53
|
+
# Use C++ 20
|
|
54
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
|
|
55
|
+
# Enables C++ <-> Swift interop (by default it's only ObjC)
|
|
56
|
+
"SWIFT_OBJC_INTEROP_MODE" => "objcxx",
|
|
57
|
+
# Enables stricter modular headers
|
|
58
|
+
"DEFINES_MODULE" => "YES",
|
|
59
|
+
})
|
|
60
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// IncomingCall-Swift-Cxx-Bridge.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "IncomingCall-Swift-Cxx-Bridge.hpp"
|
|
9
|
+
|
|
10
|
+
// Include C++ implementation defined types
|
|
11
|
+
#include "HybridIncomingCallSpecSwift.hpp"
|
|
12
|
+
#include "IncomingCall-Swift-Cxx-Umbrella.hpp"
|
|
13
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::incomingcall::bridge::swift {
|
|
16
|
+
|
|
17
|
+
// pragma MARK: std::shared_ptr<HybridIncomingCallSpec>
|
|
18
|
+
std::shared_ptr<HybridIncomingCallSpec> create_std__shared_ptr_HybridIncomingCallSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
19
|
+
IncomingCall::HybridIncomingCallSpec_cxx swiftPart = IncomingCall::HybridIncomingCallSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
20
|
+
return std::make_shared<margelo::nitro::incomingcall::HybridIncomingCallSpecSwift>(swiftPart);
|
|
21
|
+
}
|
|
22
|
+
void* NON_NULL get_std__shared_ptr_HybridIncomingCallSpec_(std__shared_ptr_HybridIncomingCallSpec_ cppType) {
|
|
23
|
+
std::shared_ptr<margelo::nitro::incomingcall::HybridIncomingCallSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::incomingcall::HybridIncomingCallSpecSwift>(cppType);
|
|
24
|
+
#ifdef NITRO_DEBUG
|
|
25
|
+
if (swiftWrapper == nullptr) [[unlikely]] {
|
|
26
|
+
throw std::runtime_error("Class \"HybridIncomingCallSpec\" is not implemented in Swift!");
|
|
27
|
+
}
|
|
28
|
+
#endif
|
|
29
|
+
IncomingCall::HybridIncomingCallSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
|
30
|
+
return swiftPart.toUnsafe();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
} // namespace margelo::nitro::incomingcall::bridge::swift
|