partner_react_native_sdk 0.1.6 → 0.1.8

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.
@@ -14,7 +14,8 @@ Pod::Spec.new do |s|
14
14
  s.source = { :git => "https://github.com/spense-fintech/partner-react-native-library.git.git", :tag => "#{s.version}" }
15
15
 
16
16
  s.source_files = "ios/**/*.{h,m,mm,cpp}"
17
- s.private_header_files = "ios/**/*.h"
17
+ # s.private_header_files = "ios/**/*.h"
18
+ s.exclude_files = "ios/generated/**"
18
19
 
19
20
  # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
20
21
  # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
@@ -22,5 +23,9 @@ if respond_to?(:install_modules_dependencies, true)
22
23
  install_modules_dependencies(s)
23
24
  else
24
25
  s.dependency "React-Core"
26
+ s.dependency "React-Codegen"
27
+ s.dependency "RCTRequired"
28
+ s.dependency "RCTTypeSafety"
29
+ s.dependency "ReactCommon/turbomodule/core"
25
30
  end
26
31
  end
@@ -1,18 +1,29 @@
1
- #import "PartnerReactNativeSdk.h"
1
+ // ios/PartnerReactNativeSdk.mm
2
+ #import <React/RCTBridgeModule.h>
3
+ #import <React/RCTEventEmitter.h>
4
+
5
+ @interface PartnerReactNativeSdk : RCTEventEmitter <RCTBridgeModule>
6
+ @end
2
7
 
3
8
  @implementation PartnerReactNativeSdk
4
- RCT_EXPORT_MODULE()
5
9
 
6
- - (NSNumber *)multiply:(double)a b:(double)b {
7
- NSNumber *result = @(a * b);
10
+ RCT_EXPORT_MODULE();
11
+
12
+ + (BOOL)requiresMainQueueSetup { return YES; }
13
+
14
+ - (NSArray<NSString *> *)supportedEvents {
15
+ return @[@"PartnerSdkEvent", @"PartnerSdkError"];
16
+ }
8
17
 
9
- return result;
18
+ // Use these whenever you need to notify JS:
19
+ // [self emitPartnerEvent:@{@"status": @"ok"}];
20
+ - (void)emitPartnerEvent:(NSDictionary *)payload {
21
+ [self sendEventWithName:@"PartnerSdkEvent" body:payload ?: @{}];
10
22
  }
11
23
 
12
- - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
13
- (const facebook::react::ObjCTurboModule::InitParams &)params
14
- {
15
- return std::make_shared<facebook::react::NativePartnerReactNativeSdkSpecJSI>(params);
24
+ - (void)emitPartnerError:(NSString *)message code:(NSNumber *)code {
25
+ [self sendEventWithName:@"PartnerSdkError"
26
+ body:@{ @"message": message ?: @"", @"code": code ?: @0 }];
16
27
  }
17
28
 
18
29
  @end
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Sample React Native App
3
+ * https://github.com/facebook/react-native
4
+ *
5
+ * @format
6
+ */
7
+ import React from 'react';
8
+ declare function App(): React.JSX.Element;
9
+ export default App;
10
+ //# sourceMappingURL=App.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../rn78test/App.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAiD1B,iBAAS,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,OAAO,CAqDhC;AAqBD,eAAe,GAAG,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "partner_react_native_sdk",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "React Native package for Fintech Partner",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/module/index.js",
@@ -29,7 +29,9 @@
29
29
  "!**/__tests__",
30
30
  "!**/__fixtures__",
31
31
  "!**/__mocks__",
32
- "!**/.*"
32
+ "!**/.*",
33
+ "!ios/generated/**",
34
+ "!android/generated/**"
33
35
  ],
34
36
  "scripts": {
35
37
  "example": "yarn workspace partner_react_native_sdk-example",
@@ -146,7 +148,6 @@
146
148
  "source": "src",
147
149
  "output": "lib",
148
150
  "targets": [
149
- "codegen",
150
151
  [
151
152
  "module",
152
153
  {
@@ -172,7 +173,7 @@
172
173
  "android": {
173
174
  "javaPackageName": "com.partnerreactnativesdk"
174
175
  },
175
- "includesGeneratedCode": true
176
+ "includesGeneratedCode": false
176
177
  },
177
178
  "create-react-native-library": {
178
179
  "type": "turbo-module",
@@ -1,37 +0,0 @@
1
-
2
- /**
3
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
- *
5
- * Do not edit this file as changes may cause incorrect behavior and will be lost
6
- * once the code is regenerated.
7
- *
8
- * @generated by codegen project: GenerateModuleJavaSpec.js
9
- *
10
- * @nolint
11
- */
12
-
13
- package com.partnerreactnativesdk;
14
-
15
- import com.facebook.proguard.annotations.DoNotStrip;
16
- import com.facebook.react.bridge.ReactApplicationContext;
17
- import com.facebook.react.bridge.ReactContextBaseJavaModule;
18
- import com.facebook.react.bridge.ReactMethod;
19
- import com.facebook.react.turbomodule.core.interfaces.TurboModule;
20
- import javax.annotation.Nonnull;
21
-
22
- public abstract class NativePartnerReactNativeSdkSpec extends ReactContextBaseJavaModule implements TurboModule {
23
- public static final String NAME = "PartnerReactNativeSdk";
24
-
25
- public NativePartnerReactNativeSdkSpec(ReactApplicationContext reactContext) {
26
- super(reactContext);
27
- }
28
-
29
- @Override
30
- public @Nonnull String getName() {
31
- return NAME;
32
- }
33
-
34
- @ReactMethod(isBlockingSynchronousMethod = true)
35
- @DoNotStrip
36
- public abstract double multiply(double a, double b);
37
- }
@@ -1,36 +0,0 @@
1
- # Copyright (c) Meta Platforms, Inc. and affiliates.
2
- #
3
- # This source code is licensed under the MIT license found in the
4
- # LICENSE file in the root directory of this source tree.
5
-
6
- cmake_minimum_required(VERSION 3.13)
7
- set(CMAKE_VERBOSE_MAKEFILE on)
8
-
9
- file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/RNPartnerReactNativeSdkSpec/*.cpp)
10
-
11
- add_library(
12
- react_codegen_RNPartnerReactNativeSdkSpec
13
- OBJECT
14
- ${react_codegen_SRCS}
15
- )
16
-
17
- target_include_directories(react_codegen_RNPartnerReactNativeSdkSpec PUBLIC . react/renderer/components/RNPartnerReactNativeSdkSpec)
18
-
19
- target_link_libraries(
20
- react_codegen_RNPartnerReactNativeSdkSpec
21
- fbjni
22
- jsi
23
- # We need to link different libraries based on whether we are building rncore or not, that's necessary
24
- # because we want to break a circular dependency between react_codegen_rncore and reactnative
25
- reactnative
26
- )
27
-
28
- target_compile_options(
29
- react_codegen_RNPartnerReactNativeSdkSpec
30
- PRIVATE
31
- -DLOG_TAG=\"ReactNative\"
32
- -fexceptions
33
- -frtti
34
- -std=c++20
35
- -Wall
36
- )
@@ -1,32 +0,0 @@
1
-
2
- /**
3
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
- *
5
- * Do not edit this file as changes may cause incorrect behavior and will be lost
6
- * once the code is regenerated.
7
- *
8
- * @generated by codegen project: GenerateModuleJniCpp.js
9
- */
10
-
11
- #include "RNPartnerReactNativeSdkSpec.h"
12
-
13
- namespace facebook::react {
14
-
15
- static facebook::jsi::Value __hostFunction_NativePartnerReactNativeSdkSpecJSI_multiply(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
16
- static jmethodID cachedMethodId = nullptr;
17
- return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, NumberKind, "multiply", "(DD)D", args, count, cachedMethodId);
18
- }
19
-
20
- NativePartnerReactNativeSdkSpecJSI::NativePartnerReactNativeSdkSpecJSI(const JavaTurboModule::InitParams &params)
21
- : JavaTurboModule(params) {
22
- methodMap_["multiply"] = MethodMetadata {2, __hostFunction_NativePartnerReactNativeSdkSpecJSI_multiply};
23
- }
24
-
25
- std::shared_ptr<TurboModule> RNPartnerReactNativeSdkSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params) {
26
- if (moduleName == "PartnerReactNativeSdk") {
27
- return std::make_shared<NativePartnerReactNativeSdkSpecJSI>(params);
28
- }
29
- return nullptr;
30
- }
31
-
32
- } // namespace facebook::react
@@ -1,31 +0,0 @@
1
-
2
- /**
3
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
- *
5
- * Do not edit this file as changes may cause incorrect behavior and will be lost
6
- * once the code is regenerated.
7
- *
8
- * @generated by codegen project: GenerateModuleJniH.js
9
- */
10
-
11
- #pragma once
12
-
13
- #include <ReactCommon/JavaTurboModule.h>
14
- #include <ReactCommon/TurboModule.h>
15
- #include <jsi/jsi.h>
16
-
17
- namespace facebook::react {
18
-
19
- /**
20
- * JNI C++ class for module 'NativePartnerReactNativeSdk'
21
- */
22
- class JSI_EXPORT NativePartnerReactNativeSdkSpecJSI : public JavaTurboModule {
23
- public:
24
- NativePartnerReactNativeSdkSpecJSI(const JavaTurboModule::InitParams &params);
25
- };
26
-
27
-
28
- JSI_EXPORT
29
- std::shared_ptr<TurboModule> RNPartnerReactNativeSdkSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params);
30
-
31
- } // namespace facebook::react
@@ -1,28 +0,0 @@
1
- /**
2
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
- *
4
- * Do not edit this file as changes may cause incorrect behavior and will be lost
5
- * once the code is regenerated.
6
- *
7
- * @generated by codegen project: GenerateModuleCpp.js
8
- */
9
-
10
- #include "RNPartnerReactNativeSdkSpecJSI.h"
11
-
12
- namespace facebook::react {
13
-
14
- static jsi::Value __hostFunction_NativePartnerReactNativeSdkCxxSpecJSI_multiply(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
15
- return static_cast<NativePartnerReactNativeSdkCxxSpecJSI *>(&turboModule)->multiply(
16
- rt,
17
- count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asNumber(),
18
- count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asNumber()
19
- );
20
- }
21
-
22
- NativePartnerReactNativeSdkCxxSpecJSI::NativePartnerReactNativeSdkCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
23
- : TurboModule("PartnerReactNativeSdk", jsInvoker) {
24
- methodMap_["multiply"] = MethodMetadata {2, __hostFunction_NativePartnerReactNativeSdkCxxSpecJSI_multiply};
25
- }
26
-
27
-
28
- } // namespace facebook::react
@@ -1,71 +0,0 @@
1
- /**
2
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
- *
4
- * Do not edit this file as changes may cause incorrect behavior and will be lost
5
- * once the code is regenerated.
6
- *
7
- * @generated by codegen project: GenerateModuleH.js
8
- */
9
-
10
- #pragma once
11
-
12
- #include <ReactCommon/TurboModule.h>
13
- #include <react/bridging/Bridging.h>
14
-
15
- namespace facebook::react {
16
-
17
-
18
- class JSI_EXPORT NativePartnerReactNativeSdkCxxSpecJSI : public TurboModule {
19
- protected:
20
- NativePartnerReactNativeSdkCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
21
-
22
- public:
23
- virtual double multiply(jsi::Runtime &rt, double a, double b) = 0;
24
-
25
- };
26
-
27
- template <typename T>
28
- class JSI_EXPORT NativePartnerReactNativeSdkCxxSpec : public TurboModule {
29
- public:
30
- jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
31
- return delegate_.create(rt, propName);
32
- }
33
-
34
- std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
35
- return delegate_.getPropertyNames(runtime);
36
- }
37
-
38
- static constexpr std::string_view kModuleName = "PartnerReactNativeSdk";
39
-
40
- protected:
41
- NativePartnerReactNativeSdkCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
42
- : TurboModule(std::string{NativePartnerReactNativeSdkCxxSpec::kModuleName}, jsInvoker),
43
- delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
44
-
45
-
46
- private:
47
- class Delegate : public NativePartnerReactNativeSdkCxxSpecJSI {
48
- public:
49
- Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
50
- NativePartnerReactNativeSdkCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
51
-
52
- }
53
-
54
- double multiply(jsi::Runtime &rt, double a, double b) override {
55
- static_assert(
56
- bridging::getParameterCount(&T::multiply) == 3,
57
- "Expected multiply(...) to have 3 parameters");
58
-
59
- return bridging::callFromJs<double>(
60
- rt, &T::multiply, jsInvoker_, instance_, std::move(a), std::move(b));
61
- }
62
-
63
- private:
64
- friend class NativePartnerReactNativeSdkCxxSpec;
65
- T *instance_;
66
- };
67
-
68
- Delegate delegate_;
69
- };
70
-
71
- } // namespace facebook::react
@@ -1,39 +0,0 @@
1
- /**
2
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
- *
4
- * Do not edit this file as changes may cause incorrect behavior and will be lost
5
- * once the code is regenerated.
6
- *
7
- * @generated by codegen project: GenerateModuleObjCpp
8
- *
9
- * We create an umbrella header (and corresponding implementation) here since
10
- * Cxx compilation in BUCK has a limitation: source-code producing genrule()s
11
- * must have a single output. More files => more genrule()s => slower builds.
12
- */
13
-
14
- #import "RNPartnerReactNativeSdkSpec.h"
15
-
16
-
17
- @implementation NativePartnerReactNativeSdkSpecBase
18
-
19
-
20
- - (void)setEventEmitterCallback:(EventEmitterCallbackWrapper *)eventEmitterCallbackWrapper
21
- {
22
- _eventEmitterCallback = std::move(eventEmitterCallbackWrapper->_eventEmitterCallback);
23
- }
24
- @end
25
-
26
-
27
- namespace facebook::react {
28
-
29
- static facebook::jsi::Value __hostFunction_NativePartnerReactNativeSdkSpecJSI_multiply(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
30
- return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, NumberKind, "multiply", @selector(multiply:b:), args, count);
31
- }
32
-
33
- NativePartnerReactNativeSdkSpecJSI::NativePartnerReactNativeSdkSpecJSI(const ObjCTurboModule::InitParams &params)
34
- : ObjCTurboModule(params) {
35
-
36
- methodMap_["multiply"] = MethodMetadata {2, __hostFunction_NativePartnerReactNativeSdkSpecJSI_multiply};
37
-
38
- }
39
- } // namespace facebook::react
@@ -1,63 +0,0 @@
1
- /**
2
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
- *
4
- * Do not edit this file as changes may cause incorrect behavior and will be lost
5
- * once the code is regenerated.
6
- *
7
- * @generated by codegen project: GenerateModuleObjCpp
8
- *
9
- * We create an umbrella header (and corresponding implementation) here since
10
- * Cxx compilation in BUCK has a limitation: source-code producing genrule()s
11
- * must have a single output. More files => more genrule()s => slower builds.
12
- */
13
-
14
- #ifndef __cplusplus
15
- #error This file must be compiled as Obj-C++. If you are importing it, you must change your file extension to .mm.
16
- #endif
17
-
18
- // Avoid multiple includes of RNPartnerReactNativeSdkSpec symbols
19
- #ifndef RNPartnerReactNativeSdkSpec_H
20
- #define RNPartnerReactNativeSdkSpec_H
21
-
22
- #import <Foundation/Foundation.h>
23
- #import <RCTRequired/RCTRequired.h>
24
- #import <RCTTypeSafety/RCTConvertHelpers.h>
25
- #import <RCTTypeSafety/RCTTypedModuleConstants.h>
26
- #import <React/RCTBridgeModule.h>
27
- #import <React/RCTCxxConvert.h>
28
- #import <React/RCTManagedPointer.h>
29
- #import <ReactCommon/RCTTurboModule.h>
30
- #import <optional>
31
- #import <vector>
32
-
33
-
34
- NS_ASSUME_NONNULL_BEGIN
35
-
36
- @protocol NativePartnerReactNativeSdkSpec <RCTBridgeModule, RCTTurboModule>
37
-
38
- - (NSNumber *)multiply:(double)a
39
- b:(double)b;
40
-
41
- @end
42
-
43
- @interface NativePartnerReactNativeSdkSpecBase : NSObject {
44
- @protected
45
- facebook::react::EventEmitterCallback _eventEmitterCallback;
46
- }
47
- - (void)setEventEmitterCallback:(EventEmitterCallbackWrapper *)eventEmitterCallbackWrapper;
48
-
49
-
50
- @end
51
-
52
- namespace facebook::react {
53
- /**
54
- * ObjC++ class for module 'NativePartnerReactNativeSdk'
55
- */
56
- class JSI_EXPORT NativePartnerReactNativeSdkSpecJSI : public ObjCTurboModule {
57
- public:
58
- NativePartnerReactNativeSdkSpecJSI(const ObjCTurboModule::InitParams &params);
59
- };
60
- } // namespace facebook::react
61
-
62
- NS_ASSUME_NONNULL_END
63
- #endif // RNPartnerReactNativeSdkSpec_H
@@ -1,28 +0,0 @@
1
- /**
2
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
- *
4
- * Do not edit this file as changes may cause incorrect behavior and will be lost
5
- * once the code is regenerated.
6
- *
7
- * @generated by codegen project: GenerateModuleCpp.js
8
- */
9
-
10
- #include "RNPartnerReactNativeSdkSpecJSI.h"
11
-
12
- namespace facebook::react {
13
-
14
- static jsi::Value __hostFunction_NativePartnerReactNativeSdkCxxSpecJSI_multiply(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
15
- return static_cast<NativePartnerReactNativeSdkCxxSpecJSI *>(&turboModule)->multiply(
16
- rt,
17
- count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asNumber(),
18
- count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asNumber()
19
- );
20
- }
21
-
22
- NativePartnerReactNativeSdkCxxSpecJSI::NativePartnerReactNativeSdkCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
23
- : TurboModule("PartnerReactNativeSdk", jsInvoker) {
24
- methodMap_["multiply"] = MethodMetadata {2, __hostFunction_NativePartnerReactNativeSdkCxxSpecJSI_multiply};
25
- }
26
-
27
-
28
- } // namespace facebook::react
@@ -1,71 +0,0 @@
1
- /**
2
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
- *
4
- * Do not edit this file as changes may cause incorrect behavior and will be lost
5
- * once the code is regenerated.
6
- *
7
- * @generated by codegen project: GenerateModuleH.js
8
- */
9
-
10
- #pragma once
11
-
12
- #include <ReactCommon/TurboModule.h>
13
- #include <react/bridging/Bridging.h>
14
-
15
- namespace facebook::react {
16
-
17
-
18
- class JSI_EXPORT NativePartnerReactNativeSdkCxxSpecJSI : public TurboModule {
19
- protected:
20
- NativePartnerReactNativeSdkCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
21
-
22
- public:
23
- virtual double multiply(jsi::Runtime &rt, double a, double b) = 0;
24
-
25
- };
26
-
27
- template <typename T>
28
- class JSI_EXPORT NativePartnerReactNativeSdkCxxSpec : public TurboModule {
29
- public:
30
- jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
31
- return delegate_.create(rt, propName);
32
- }
33
-
34
- std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
35
- return delegate_.getPropertyNames(runtime);
36
- }
37
-
38
- static constexpr std::string_view kModuleName = "PartnerReactNativeSdk";
39
-
40
- protected:
41
- NativePartnerReactNativeSdkCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
42
- : TurboModule(std::string{NativePartnerReactNativeSdkCxxSpec::kModuleName}, jsInvoker),
43
- delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
44
-
45
-
46
- private:
47
- class Delegate : public NativePartnerReactNativeSdkCxxSpecJSI {
48
- public:
49
- Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
50
- NativePartnerReactNativeSdkCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
51
-
52
- }
53
-
54
- double multiply(jsi::Runtime &rt, double a, double b) override {
55
- static_assert(
56
- bridging::getParameterCount(&T::multiply) == 3,
57
- "Expected multiply(...) to have 3 parameters");
58
-
59
- return bridging::callFromJs<double>(
60
- rt, &T::multiply, jsInvoker_, instance_, std::move(a), std::move(b));
61
- }
62
-
63
- private:
64
- friend class NativePartnerReactNativeSdkCxxSpec;
65
- T *instance_;
66
- };
67
-
68
- Delegate delegate_;
69
- };
70
-
71
- } // namespace facebook::react