react-native-zolozkit 0.1.2

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 wangshi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,93 @@
1
+ # react-native-zolozkit
2
+
3
+ ZOLOZ provides an SDK and APIs for you to implement integration with your native mobile application. This article provides you an overview of the app SDK-mode integration by React Native.
4
+
5
+ For more information about the ZOLOZ SDK, see: [App SDK-mode integration](https://docs.zoloz.com/zoloz/saas/integration/neug2p)
6
+
7
+ ## Installation
8
+
9
+ ```sh
10
+ npm install react-native-zolozkit
11
+ ```
12
+
13
+ ### Add zolozkit for iOS
14
+
15
+ You should add the SDK dependency in Podfile(*usually ios/Podfile*).
16
+
17
+ ```pod
18
+ pod 'zolozkit', :source => 'https://github.com/zoloz-pte-ltd/zoloz-demo-ios'
19
+ ```
20
+
21
+ ### Add other dependencies for android
22
+
23
+ If your project support for AndroidX, you need add the `localbroadcastmanager` dependencies in 'android/app/build.gradle' file.
24
+
25
+ ```gradle
26
+ implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
27
+ ```
28
+
29
+ ## Usage
30
+
31
+ ### 1. import `ZolozKit` in React Native
32
+
33
+ ```js
34
+ import { NativeModules} from "react-native";
35
+ const { ZolozKit } = NativeModules;
36
+ ```
37
+
38
+ ### 2. Get meta information
39
+
40
+ Use the ZolozKit and its method getMetaInfo to get the meta information about the ZOLOZ SDK and the user's device. The meta information is used to initialize a transaction later.
41
+
42
+ ```js
43
+ ZolozKit.getMetaInfo((metainfo) => {
44
+ console.log(metainfo)
45
+ });
46
+ ```
47
+
48
+ ### 3. Initialize a transaction
49
+
50
+ Send a request that contains the meta information to your (merchant) server to initialize a transaction. Then your (merchant) server needs to call the initialize API to obtain the client configuration and return it to your (merchant) application.
51
+
52
+ ### 4. Start the transaction flow
53
+
54
+ Start the transaction flow by calling the start method with the `clientcfg` that is from Step 3. You also need to override the callback functions to handle the transaction result.
55
+
56
+ ```js
57
+ const { ZLZ_LOCAL_KEY, ZLZ_CHAMELEON_KEY, ZLZ_PUB_KEY } = ZolozKit.getConstants();
58
+ clientCfg = "the clientcfg from the third step"
59
+ ZolozKit.start(clientCfg, {
60
+ // add some biz params for zoloz sdk , like local.
61
+ // [ZLZ_LOCAL_KEY]: "zh-CN"
62
+ }, (result) => {
63
+ alert(result, [{text: 'OK', onPress: () => console.log('OK Pressed!')},])
64
+ console.log(result);
65
+ })
66
+ ```
67
+
68
+ The transaction result contains a result code that indicates the transaction flow status. If the end user has completed the flow, the result value is true.
69
+
70
+ ## License
71
+
72
+
73
+ MIT License
74
+
75
+ Copyright (c) 2020 ZOLOZ-PTE-LTD
76
+
77
+ Permission is hereby granted, free of charge, to any person obtaining a copy
78
+ of this software and associated documentation files (the "Software"), to deal
79
+ in the Software without restriction, including without limitation the rights
80
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
81
+ copies of the Software, and to permit persons to whom the Software is
82
+ furnished to do so, subject to the following conditions:
83
+
84
+ The above copyright notice and this permission notice shall be included in all
85
+ copies or substantial portions of the Software.
86
+
87
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
88
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
89
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
90
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
91
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
92
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
93
+ SOFTWARE.
@@ -0,0 +1,63 @@
1
+ buildscript {
2
+ if (project == rootProject) {
3
+ repositories {
4
+ google()
5
+ mavenCentral()
6
+ jcenter()
7
+ }
8
+
9
+ dependencies {
10
+ classpath 'com.android.tools.build:gradle:3.5.3'
11
+ }
12
+ }
13
+ }
14
+
15
+ apply plugin: 'com.android.library'
16
+
17
+ def safeExtGet(prop, fallback) {
18
+ rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
19
+ }
20
+
21
+ android {
22
+ compileSdkVersion safeExtGet('Zolozkit_compileSdkVersion', 29)
23
+ defaultConfig {
24
+ minSdkVersion safeExtGet('Zolozkit_minSdkVersion', 16)
25
+ targetSdkVersion safeExtGet('Zolozkit_targetSdkVersion', 29)
26
+ versionCode 1
27
+ versionName "1.0"
28
+
29
+ }
30
+
31
+ buildTypes {
32
+ release {
33
+ minifyEnabled false
34
+ }
35
+ }
36
+ lintOptions {
37
+ disable 'GradleCompatible'
38
+ }
39
+ compileOptions {
40
+ sourceCompatibility JavaVersion.VERSION_1_8
41
+ targetCompatibility JavaVersion.VERSION_1_8
42
+ }
43
+ }
44
+
45
+ repositories {
46
+ mavenLocal()
47
+ maven {
48
+ // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
49
+ url("$rootDir/../node_modules/react-native/android")
50
+ }
51
+ google()
52
+ mavenCentral()
53
+ jcenter()
54
+ }
55
+
56
+ dependencies {
57
+ //noinspection GradleDynamicVersion
58
+ implementation "com.facebook.react:react-native:+" // From node_modules
59
+ // zoloz library
60
+ implementation 'com.zoloz.android.build:zolozkit:1.2.0'
61
+ implementation "com.squareup.okio:okio:1.7.0@jar"
62
+ implementation "com.alibaba:fastjson:1.1.68.android"
63
+ }
@@ -0,0 +1,3 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
+ package="com.zoloz.react">
3
+ </manifest>
@@ -0,0 +1,69 @@
1
+ package com.zoloz.react;
2
+
3
+ import androidx.annotation.NonNull;
4
+ import androidx.annotation.Nullable;
5
+
6
+ import com.ap.zoloz.hummer.api.IZLZCallback;
7
+ import com.ap.zoloz.hummer.api.ZLZConstants;
8
+ import com.ap.zoloz.hummer.api.ZLZFacade;
9
+ import com.ap.zoloz.hummer.api.ZLZRequest;
10
+ import com.ap.zoloz.hummer.api.ZLZResponse;
11
+ import com.facebook.react.bridge.Callback;
12
+ import com.facebook.react.bridge.ReactApplicationContext;
13
+ import com.facebook.react.bridge.ReactContextBaseJavaModule;
14
+ import com.facebook.react.bridge.ReactMethod;
15
+ import com.facebook.react.bridge.ReadableMap;
16
+ import com.facebook.react.module.annotations.ReactModule;
17
+
18
+ import java.util.HashMap;
19
+ import java.util.Map;
20
+
21
+ @ReactModule(name = ZolozkitModule.NAME)
22
+ public class ZolozkitModule extends ReactContextBaseJavaModule {
23
+ public static final String NAME = "ZolozKit";
24
+
25
+ public ZolozkitModule(ReactApplicationContext reactContext) {
26
+ super(reactContext);
27
+ }
28
+
29
+ @NonNull
30
+ @Override
31
+ public String getName() {
32
+ return NAME;
33
+ }
34
+
35
+ @ReactMethod
36
+ public void start(String clientCfg, ReadableMap bizConfig, Callback callback) {
37
+ ZLZRequest request = new ZLZRequest();
38
+ request.bizConfig = new HashMap<>();
39
+ request.bizConfig.put(ZLZConstants.CONTEXT, getCurrentActivity());
40
+ request.bizConfig.putAll(bizConfig.toHashMap());
41
+ request.zlzConfig = clientCfg;
42
+ ZLZFacade.getInstance().start(request, new IZLZCallback() {
43
+ @Override
44
+ public void onCompleted(ZLZResponse zlzResponse) {
45
+ callback.invoke(true);
46
+ }
47
+
48
+ @Override
49
+ public void onInterrupted(ZLZResponse zlzResponse) {
50
+ callback.invoke(false);
51
+ }
52
+ });
53
+ }
54
+
55
+ @ReactMethod
56
+ public void getMetaInfo(Callback callback) {
57
+ callback.invoke(ZLZFacade.getMetaInfo(getCurrentActivity()));
58
+ }
59
+
60
+ @Nullable
61
+ @Override
62
+ public Map<String, Object> getConstants() {
63
+ Map<String, Object> constants = new HashMap<>();
64
+ constants.put("ZLZ_LOCAL_KEY", ZLZConstants.LOCALE);
65
+ constants.put("ZLZ_CHAMELEON_KEY", ZLZConstants.CHAMELEON_CONFIG_PATH);
66
+ constants.put("ZLZ_PUB_KEY", ZLZConstants.PUBLIC_KEY);
67
+ return constants;
68
+ }
69
+ }
@@ -0,0 +1,29 @@
1
+ package com.zoloz.react;
2
+
3
+
4
+ import androidx.annotation.NonNull;
5
+
6
+ import com.facebook.react.ReactPackage;
7
+ import com.facebook.react.bridge.NativeModule;
8
+ import com.facebook.react.bridge.ReactApplicationContext;
9
+ import com.facebook.react.uimanager.ViewManager;
10
+
11
+ import java.util.ArrayList;
12
+ import java.util.Collections;
13
+ import java.util.List;
14
+
15
+ public class ZolozkitPackage implements ReactPackage {
16
+ @NonNull
17
+ @Override
18
+ public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext) {
19
+ List<NativeModule> modules = new ArrayList<>();
20
+ modules.add(new ZolozkitModule(reactContext));
21
+ return modules;
22
+ }
23
+
24
+ @NonNull
25
+ @Override
26
+ public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) {
27
+ return Collections.emptyList();
28
+ }
29
+ }
@@ -0,0 +1,5 @@
1
+ #import <React/RCTBridgeModule.h>
2
+
3
+ @interface ZolozKitModule : NSObject <RCTBridgeModule>
4
+ @end
5
+
@@ -0,0 +1,109 @@
1
+ #import "ZolozKitModule.h"
2
+ #import <hummer/ZLZFacade.h>
3
+ #import <hummer/ZLZRequest.h>
4
+ #import <hummer/ZLZResponse.h>
5
+ #import <hummer/ZLZHummerFacade.h>
6
+
7
+ @protocol ZolozkitForPluginViewControllerDelegate
8
+ - (void)onResult:(BOOL)isSuccess withResponse:(ZLZResponse *)response;
9
+ @end
10
+
11
+ @interface ZolozkitForPluginViewController : UIViewController
12
+ @property(nonatomic, strong) NSString *clientCfg;
13
+ @property(nonatomic, strong) NSDictionary *bizCfg;
14
+ @property(nullable, nonatomic, weak) id <ZolozkitForPluginViewControllerDelegate> delegate;
15
+ @end
16
+
17
+ @implementation ZolozkitForPluginViewController
18
+ - (void)viewWillAppear:(BOOL)animated {
19
+ [super viewWillAppear:animated];
20
+ }
21
+
22
+
23
+ - (void)viewDidLoad {
24
+ [super viewDidLoad];
25
+ self.view.backgroundColor = [UIColor clearColor];
26
+ [self.navigationController.navigationBar setBackgroundImage:[[UIImage alloc] init] forBarMetrics:UIBarMetricsDefault];
27
+ self.navigationController.navigationBar.shadowImage = [[UIImage alloc] init];
28
+ self.navigationController.navigationBar.translucent = YES;
29
+ self.navigationController.view.backgroundColor = [UIColor clearColor];
30
+ [self startZoloz];
31
+ }
32
+
33
+ - (void)startZoloz {
34
+ NSString *clientCfg = self.clientCfg;
35
+ if (!self.bizCfg) {
36
+ self.bizCfg = @{};
37
+ }
38
+ NSDictionary *bizCfg = self.bizCfg;
39
+ NSMutableDictionary *bizConfig = [[NSMutableDictionary alloc] initWithDictionary:bizCfg];
40
+ [bizConfig setObject:self forKey:kZLZCurrentViewControllerKey];
41
+ ZLZRequest *request = [[ZLZRequest alloc] initWithzlzConfig:clientCfg bizConfig:bizConfig];
42
+ __weak typeof(self) weakSelf = self;
43
+ [[ZLZFacade sharedInstance]
44
+ startWithRequest:request
45
+ completeCallback:^(ZLZResponse *response) {
46
+ dispatch_async(dispatch_get_main_queue(), ^{
47
+ [weakSelf dismissViewControllerAnimated:NO completion:^{
48
+ [weakSelf onResult:YES withResponse:response];
49
+ }];
50
+ });
51
+ }
52
+ interruptCallback:^(ZLZResponse *response) {
53
+ dispatch_async(dispatch_get_main_queue(), ^{
54
+ [weakSelf dismissViewControllerAnimated:NO completion:^{
55
+ [weakSelf onResult:NO withResponse:response];
56
+ }];
57
+ });
58
+ }];
59
+ }
60
+
61
+ - (void)onResult:(BOOL)isSuccess withResponse:(ZLZResponse *)response {
62
+ NSLog(@"onResult called");
63
+ [self.delegate onResult:isSuccess withResponse:response];
64
+ }
65
+
66
+ @end
67
+
68
+ @interface ZolozKitModule()<ZolozkitForPluginViewControllerDelegate>
69
+ @property(nonatomic, strong) RCTResponseSenderBlock callback;
70
+ @end
71
+
72
+ @implementation ZolozKitModule
73
+ RCT_EXPORT_MODULE(ZolozKit);
74
+ RCT_EXPORT_METHOD(start:(NSString *)clientCfg bizConfig:(NSDictionary *)bizCfg callback:(RCTResponseSenderBlock)cb)
75
+ {
76
+ self.callback = cb;
77
+ dispatch_async(dispatch_get_main_queue(), ^{
78
+ UIViewController *rootViewController = [[[UIApplication sharedApplication] keyWindow] rootViewController];
79
+ ZolozkitForPluginViewController *viewController = [[ZolozkitForPluginViewController alloc] init];
80
+ viewController.clientCfg = clientCfg;
81
+ viewController.bizCfg = bizCfg;
82
+ viewController.delegate = self;
83
+ UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
84
+ navigationController.modalPresentationStyle = UIModalPresentationOverFullScreen;
85
+ [rootViewController presentViewController:navigationController animated:NO completion:nil];
86
+ });
87
+
88
+ }
89
+
90
+ RCT_EXPORT_METHOD(getMetaInfo:(RCTResponseSenderBlock)cb) {
91
+ cb(@[[ZLZFacade getMetaInfo]]);
92
+ }
93
+
94
+ - (void)onResult:(BOOL)isSuccess withResponse:(ZLZResponse *)response {
95
+ self.callback(@[@(isSuccess)]);
96
+ self.callback = nil;
97
+ }
98
+
99
+
100
+ - (NSDictionary *)constantsToExport {
101
+ return @{@"ZLZ_LOCAL_KEY": kZLZLocaleKey,
102
+ @"ZLZ_CHAMELEON_KEY": kZLZChameleonConfigKey,
103
+ @"ZLZ_PUB_KEY": kZLZPubkey
104
+ };
105
+ }
106
+ +(BOOL) requiresMainQueueSetup {
107
+ return YES;
108
+ }
109
+ @end
@@ -0,0 +1,267 @@
1
+ // !$*UTF8*$!
2
+ {
3
+ archiveVersion = 1;
4
+ classes = {
5
+ };
6
+ objectVersion = 46;
7
+ objects = {
8
+
9
+ /* Begin PBXCopyFilesBuildPhase section */
10
+ 58B511D91A9E6C8500147676 /* CopyFiles */ = {
11
+ isa = PBXCopyFilesBuildPhase;
12
+ buildActionMask = 2147483647;
13
+ dstPath = "include/$(PRODUCT_NAME)";
14
+ dstSubfolderSpec = 16;
15
+ files = (
16
+ );
17
+ runOnlyForDeploymentPostprocessing = 0;
18
+ };
19
+ /* End PBXCopyFilesBuildPhase section */
20
+
21
+ /* Begin PBXFileReference section */
22
+ 134814201AA4EA6300B7C361 /* libZolozkit.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libZolozkit.a; sourceTree = BUILT_PRODUCTS_DIR; };
23
+ B3E7B5881CC2AC0600A0062D /* ZolozKitModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZolozKitModule.h; sourceTree = "<group>"; };
24
+ B3E7B5891CC2AC0600A0062D /* ZolozKitModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZolozKitModule.m; sourceTree = "<group>"; };
25
+ /* End PBXFileReference section */
26
+
27
+ /* Begin PBXFrameworksBuildPhase section */
28
+ 58B511D81A9E6C8500147676 /* Frameworks */ = {
29
+ isa = PBXFrameworksBuildPhase;
30
+ buildActionMask = 2147483647;
31
+ files = (
32
+ );
33
+ runOnlyForDeploymentPostprocessing = 0;
34
+ };
35
+ /* End PBXFrameworksBuildPhase section */
36
+
37
+ /* Begin PBXGroup section */
38
+ 134814211AA4EA7D00B7C361 /* Products */ = {
39
+ isa = PBXGroup;
40
+ children = (
41
+ 134814201AA4EA6300B7C361 /* libZolozkit.a */,
42
+ );
43
+ name = Products;
44
+ sourceTree = "<group>";
45
+ };
46
+ 58B511D21A9E6C8500147676 = {
47
+ isa = PBXGroup;
48
+ children = (
49
+ B3E7B5881CC2AC0600A0062D /* ZolozKitModule.h */,
50
+ B3E7B5891CC2AC0600A0062D /* ZolozKitModule.m */,
51
+ 134814211AA4EA7D00B7C361 /* Products */,
52
+ );
53
+ sourceTree = "<group>";
54
+ };
55
+ /* End PBXGroup section */
56
+
57
+ /* Begin PBXNativeTarget section */
58
+ 58B511DA1A9E6C8500147676 /* Zolozkit */ = {
59
+ isa = PBXNativeTarget;
60
+ buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "Zolozkit" */;
61
+ buildPhases = (
62
+ 58B511D71A9E6C8500147676 /* Sources */,
63
+ 58B511D81A9E6C8500147676 /* Frameworks */,
64
+ 58B511D91A9E6C8500147676 /* CopyFiles */,
65
+ );
66
+ buildRules = (
67
+ );
68
+ dependencies = (
69
+ );
70
+ name = Zolozkit;
71
+ productName = RCTDataManager;
72
+ productReference = 134814201AA4EA6300B7C361 /* libZolozkit.a */;
73
+ productType = "com.apple.product-type.library.static";
74
+ };
75
+ /* End PBXNativeTarget section */
76
+
77
+ /* Begin PBXProject section */
78
+ 58B511D31A9E6C8500147676 /* Project object */ = {
79
+ isa = PBXProject;
80
+ attributes = {
81
+ LastUpgradeCheck = 0920;
82
+ ORGANIZATIONNAME = Facebook;
83
+ TargetAttributes = {
84
+ 58B511DA1A9E6C8500147676 = {
85
+ CreatedOnToolsVersion = 6.1.1;
86
+ };
87
+ };
88
+ };
89
+ buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "Zolozkit" */;
90
+ compatibilityVersion = "Xcode 3.2";
91
+ developmentRegion = English;
92
+ hasScannedForEncodings = 0;
93
+ knownRegions = (
94
+ English,
95
+ en,
96
+ );
97
+ mainGroup = 58B511D21A9E6C8500147676;
98
+ productRefGroup = 58B511D21A9E6C8500147676;
99
+ projectDirPath = "";
100
+ projectRoot = "";
101
+ targets = (
102
+ 58B511DA1A9E6C8500147676 /* Zolozkit */,
103
+ );
104
+ };
105
+ /* End PBXProject section */
106
+
107
+ /* Begin PBXSourcesBuildPhase section */
108
+ 58B511D71A9E6C8500147676 /* Sources */ = {
109
+ isa = PBXSourcesBuildPhase;
110
+ buildActionMask = 2147483647;
111
+ files = (
112
+ );
113
+ runOnlyForDeploymentPostprocessing = 0;
114
+ };
115
+ /* End PBXSourcesBuildPhase section */
116
+
117
+ /* Begin XCBuildConfiguration section */
118
+ 58B511ED1A9E6C8500147676 /* Debug */ = {
119
+ isa = XCBuildConfiguration;
120
+ buildSettings = {
121
+ ALWAYS_SEARCH_USER_PATHS = NO;
122
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
123
+ CLANG_CXX_LIBRARY = "libc++";
124
+ CLANG_ENABLE_MODULES = YES;
125
+ CLANG_ENABLE_OBJC_ARC = YES;
126
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
127
+ CLANG_WARN_BOOL_CONVERSION = YES;
128
+ CLANG_WARN_COMMA = YES;
129
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
130
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
131
+ CLANG_WARN_EMPTY_BODY = YES;
132
+ CLANG_WARN_ENUM_CONVERSION = YES;
133
+ CLANG_WARN_INFINITE_RECURSION = YES;
134
+ CLANG_WARN_INT_CONVERSION = YES;
135
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
136
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
137
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
138
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
139
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
140
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
141
+ CLANG_WARN_UNREACHABLE_CODE = YES;
142
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
143
+ COPY_PHASE_STRIP = NO;
144
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
145
+ ENABLE_TESTABILITY = YES;
146
+ GCC_C_LANGUAGE_STANDARD = gnu99;
147
+ GCC_DYNAMIC_NO_PIC = NO;
148
+ GCC_NO_COMMON_BLOCKS = YES;
149
+ GCC_OPTIMIZATION_LEVEL = 0;
150
+ GCC_PREPROCESSOR_DEFINITIONS = (
151
+ "DEBUG=1",
152
+ "$(inherited)",
153
+ );
154
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
155
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
156
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
157
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
158
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
159
+ GCC_WARN_UNUSED_FUNCTION = YES;
160
+ GCC_WARN_UNUSED_VARIABLE = YES;
161
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
162
+ MTL_ENABLE_DEBUG_INFO = YES;
163
+ ONLY_ACTIVE_ARCH = YES;
164
+ SDKROOT = iphoneos;
165
+ };
166
+ name = Debug;
167
+ };
168
+ 58B511EE1A9E6C8500147676 /* Release */ = {
169
+ isa = XCBuildConfiguration;
170
+ buildSettings = {
171
+ ALWAYS_SEARCH_USER_PATHS = NO;
172
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
173
+ CLANG_CXX_LIBRARY = "libc++";
174
+ CLANG_ENABLE_MODULES = YES;
175
+ CLANG_ENABLE_OBJC_ARC = YES;
176
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
177
+ CLANG_WARN_BOOL_CONVERSION = YES;
178
+ CLANG_WARN_COMMA = YES;
179
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
180
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
181
+ CLANG_WARN_EMPTY_BODY = YES;
182
+ CLANG_WARN_ENUM_CONVERSION = YES;
183
+ CLANG_WARN_INFINITE_RECURSION = YES;
184
+ CLANG_WARN_INT_CONVERSION = YES;
185
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
186
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
187
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
188
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
189
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
190
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
191
+ CLANG_WARN_UNREACHABLE_CODE = YES;
192
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
193
+ COPY_PHASE_STRIP = YES;
194
+ ENABLE_NS_ASSERTIONS = NO;
195
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
196
+ GCC_C_LANGUAGE_STANDARD = gnu99;
197
+ GCC_NO_COMMON_BLOCKS = YES;
198
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
199
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
200
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
201
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
202
+ GCC_WARN_UNUSED_FUNCTION = YES;
203
+ GCC_WARN_UNUSED_VARIABLE = YES;
204
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
205
+ MTL_ENABLE_DEBUG_INFO = NO;
206
+ SDKROOT = iphoneos;
207
+ VALIDATE_PRODUCT = YES;
208
+ };
209
+ name = Release;
210
+ };
211
+ 58B511F01A9E6C8500147676 /* Debug */ = {
212
+ isa = XCBuildConfiguration;
213
+ buildSettings = {
214
+ HEADER_SEARCH_PATHS = (
215
+ "$(inherited)",
216
+ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
217
+ "$(SRCROOT)/../../../React/**",
218
+ "$(SRCROOT)/../../react-native/React/**",
219
+ );
220
+ LIBRARY_SEARCH_PATHS = "$(inherited)";
221
+ OTHER_LDFLAGS = "-ObjC";
222
+ PRODUCT_NAME = Zolozkit;
223
+ SKIP_INSTALL = YES;
224
+ };
225
+ name = Debug;
226
+ };
227
+ 58B511F11A9E6C8500147676 /* Release */ = {
228
+ isa = XCBuildConfiguration;
229
+ buildSettings = {
230
+ HEADER_SEARCH_PATHS = (
231
+ "$(inherited)",
232
+ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
233
+ "$(SRCROOT)/../../../React/**",
234
+ "$(SRCROOT)/../../react-native/React/**",
235
+ );
236
+ LIBRARY_SEARCH_PATHS = "$(inherited)";
237
+ OTHER_LDFLAGS = "-ObjC";
238
+ PRODUCT_NAME = Zolozkit;
239
+ SKIP_INSTALL = YES;
240
+ };
241
+ name = Release;
242
+ };
243
+ /* End XCBuildConfiguration section */
244
+
245
+ /* Begin XCConfigurationList section */
246
+ 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "Zolozkit" */ = {
247
+ isa = XCConfigurationList;
248
+ buildConfigurations = (
249
+ 58B511ED1A9E6C8500147676 /* Debug */,
250
+ 58B511EE1A9E6C8500147676 /* Release */,
251
+ );
252
+ defaultConfigurationIsVisible = 0;
253
+ defaultConfigurationName = Release;
254
+ };
255
+ 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "Zolozkit" */ = {
256
+ isa = XCConfigurationList;
257
+ buildConfigurations = (
258
+ 58B511F01A9E6C8500147676 /* Debug */,
259
+ 58B511F11A9E6C8500147676 /* Release */,
260
+ );
261
+ defaultConfigurationIsVisible = 0;
262
+ defaultConfigurationName = Release;
263
+ };
264
+ /* End XCConfigurationList section */
265
+ };
266
+ rootObject = 58B511D31A9E6C8500147676 /* Project object */;
267
+ }
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Workspace
3
+ version = "1.0">
4
+ </Workspace>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>IDEDidComputeMac32BitWarning</key>
6
+ <true/>
7
+ </dict>
8
+ </plist>
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>SchemeUserState</key>
6
+ <dict>
7
+ <key>Zolozkit.xcscheme_^#shared#^_</key>
8
+ <dict>
9
+ <key>orderHint</key>
10
+ <integer>0</integer>
11
+ </dict>
12
+ </dict>
13
+ </dict>
14
+ </plist>
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.multiply = multiply;
7
+
8
+ var _reactNative = require("react-native");
9
+
10
+ const LINKING_ERROR = `The package 'react-native-zolozkit' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
11
+ ios: "- You have run 'pod install'\n",
12
+ default: ''
13
+ }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo managed workflow\n';
14
+ const Zolozkit = _reactNative.NativeModules.Zolozkit ? _reactNative.NativeModules.Zolozkit : new Proxy({}, {
15
+ get() {
16
+ throw new Error(LINKING_ERROR);
17
+ }
18
+
19
+ });
20
+
21
+ function multiply(a, b) {
22
+ return Zolozkit.multiply(a, b);
23
+ }
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.tsx"],"names":["LINKING_ERROR","Platform","select","ios","default","Zolozkit","NativeModules","Proxy","get","Error","multiply","a","b"],"mappings":";;;;;;;AAAA;;AAEA,MAAMA,aAAa,GAChB,gFAAD,GACAC,sBAASC,MAAT,CAAgB;AAAEC,EAAAA,GAAG,EAAE,gCAAP;AAAyCC,EAAAA,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJF;AAMA,MAAMC,QAAQ,GAAGC,2BAAcD,QAAd,GACbC,2BAAcD,QADD,GAEb,IAAIE,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUT,aAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;;AAWO,SAASU,QAAT,CAAkBC,CAAlB,EAA6BC,CAA7B,EAAyD;AAC9D,SAAOP,QAAQ,CAACK,QAAT,CAAkBC,CAAlB,EAAqBC,CAArB,CAAP;AACD","sourcesContent":["import { NativeModules, Platform } from 'react-native';\n\nconst LINKING_ERROR =\n `The package 'react-native-zolozkit' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst Zolozkit = NativeModules.Zolozkit\n ? NativeModules.Zolozkit\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nexport function multiply(a: number, b: number): Promise<number> {\n return Zolozkit.multiply(a, b);\n}\n"]}
@@ -0,0 +1,15 @@
1
+ import { NativeModules, Platform } from 'react-native';
2
+ const LINKING_ERROR = `The package 'react-native-zolozkit' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
3
+ ios: "- You have run 'pod install'\n",
4
+ default: ''
5
+ }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo managed workflow\n';
6
+ const Zolozkit = NativeModules.Zolozkit ? NativeModules.Zolozkit : new Proxy({}, {
7
+ get() {
8
+ throw new Error(LINKING_ERROR);
9
+ }
10
+
11
+ });
12
+ export function multiply(a, b) {
13
+ return Zolozkit.multiply(a, b);
14
+ }
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.tsx"],"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","Zolozkit","Proxy","get","Error","multiply","a","b"],"mappings":"AAAA,SAASA,aAAT,EAAwBC,QAAxB,QAAwC,cAAxC;AAEA,MAAMC,aAAa,GAChB,gFAAD,GACAD,QAAQ,CAACE,MAAT,CAAgB;AAAEC,EAAAA,GAAG,EAAE,gCAAP;AAAyCC,EAAAA,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJF;AAMA,MAAMC,QAAQ,GAAGN,aAAa,CAACM,QAAd,GACbN,aAAa,CAACM,QADD,GAEb,IAAIC,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUP,aAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;AAWA,OAAO,SAASQ,QAAT,CAAkBC,CAAlB,EAA6BC,CAA7B,EAAyD;AAC9D,SAAON,QAAQ,CAACI,QAAT,CAAkBC,CAAlB,EAAqBC,CAArB,CAAP;AACD","sourcesContent":["import { NativeModules, Platform } from 'react-native';\n\nconst LINKING_ERROR =\n `The package 'react-native-zolozkit' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst Zolozkit = NativeModules.Zolozkit\n ? NativeModules.Zolozkit\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nexport function multiply(a: number, b: number): Promise<number> {\n return Zolozkit.multiply(a, b);\n}\n"]}
@@ -0,0 +1 @@
1
+ export declare function multiply(a: number, b: number): Promise<number>;
package/package.json ADDED
@@ -0,0 +1,147 @@
1
+ {
2
+ "name": "react-native-zolozkit",
3
+ "version": "0.1.2",
4
+ "description": "zolozkit for react native",
5
+ "main": "lib/commonjs/index",
6
+ "module": "lib/module/index",
7
+ "types": "lib/typescript/index.d.ts",
8
+ "react-native": "src/index",
9
+ "source": "src/index",
10
+ "files": [
11
+ "src",
12
+ "lib",
13
+ "android",
14
+ "ios",
15
+ "cpp",
16
+ "react-native-zolozkit.podspec",
17
+ "!lib/typescript/example",
18
+ "!android/build",
19
+ "!ios/build",
20
+ "!**/__tests__",
21
+ "!**/__fixtures__",
22
+ "!**/__mocks__"
23
+ ],
24
+ "scripts": {
25
+ "test": "jest",
26
+ "typescript": "tsc --noEmit",
27
+ "lint": "eslint \"**/*.{js,ts,tsx}\"",
28
+ "prepare": "bob build",
29
+ "release": "release-it",
30
+ "example": "yarn --cwd example",
31
+ "pods": "cd example && pod-install --quiet",
32
+ "bootstrap": "yarn example && yarn && yarn pods"
33
+ },
34
+ "keywords": [
35
+ "react-native",
36
+ "ios",
37
+ "android"
38
+ ],
39
+ "repository": "https://www.zoloz.com",
40
+ "author": "zoloz",
41
+ "license": "MIT",
42
+ "bugs": {
43
+ "url": "https://www.zoloz.com/"
44
+ },
45
+ "homepage": "https://www.zoloz.com",
46
+ "publishConfig": {
47
+ "registry": "https://registry.npmjs.org/"
48
+ },
49
+ "devDependencies": {
50
+ "@commitlint/config-conventional": "^11.0.0",
51
+ "@react-native-community/eslint-config": "^2.0.0",
52
+ "@release-it/conventional-changelog": "^2.0.0",
53
+ "@types/jest": "^26.0.0",
54
+ "@types/react": "^16.9.19",
55
+ "@types/react-native": "0.62.13",
56
+ "commitlint": "^11.0.0",
57
+ "eslint": "^7.2.0",
58
+ "eslint-config-prettier": "^7.0.0",
59
+ "eslint-plugin-prettier": "^3.1.3",
60
+ "husky": "^6.0.0",
61
+ "jest": "^26.0.1",
62
+ "pod-install": "^0.1.0",
63
+ "prettier": "^2.0.5",
64
+ "react": "16.13.1",
65
+ "react-native": "0.63.4",
66
+ "react-native-builder-bob": "^0.18.0",
67
+ "release-it": "^14.2.2",
68
+ "typescript": "^4.1.3"
69
+ },
70
+ "peerDependencies": {
71
+ "react": "*",
72
+ "react-native": "*"
73
+ },
74
+ "jest": {
75
+ "preset": "react-native",
76
+ "modulePathIgnorePatterns": [
77
+ "<rootDir>/example/node_modules",
78
+ "<rootDir>/lib/"
79
+ ]
80
+ },
81
+ "commitlint": {
82
+ "extends": [
83
+ "@commitlint/config-conventional"
84
+ ]
85
+ },
86
+ "release-it": {
87
+ "git": {
88
+ "commitMessage": "chore: release ${version}",
89
+ "tagName": "v${version}"
90
+ },
91
+ "npm": {
92
+ "publish": true
93
+ },
94
+ "github": {
95
+ "release": true
96
+ },
97
+ "plugins": {
98
+ "@release-it/conventional-changelog": {
99
+ "preset": "angular"
100
+ }
101
+ }
102
+ },
103
+ "eslintConfig": {
104
+ "root": true,
105
+ "extends": [
106
+ "@react-native-community",
107
+ "prettier"
108
+ ],
109
+ "rules": {
110
+ "prettier/prettier": [
111
+ "error",
112
+ {
113
+ "quoteProps": "consistent",
114
+ "singleQuote": true,
115
+ "tabWidth": 2,
116
+ "trailingComma": "es5",
117
+ "useTabs": false
118
+ }
119
+ ]
120
+ }
121
+ },
122
+ "eslintIgnore": [
123
+ "node_modules/",
124
+ "lib/"
125
+ ],
126
+ "prettier": {
127
+ "quoteProps": "consistent",
128
+ "singleQuote": true,
129
+ "tabWidth": 2,
130
+ "trailingComma": "es5",
131
+ "useTabs": false
132
+ },
133
+ "react-native-builder-bob": {
134
+ "source": "src",
135
+ "output": "lib",
136
+ "targets": [
137
+ "commonjs",
138
+ "module",
139
+ [
140
+ "typescript",
141
+ {
142
+ "project": "tsconfig.build.json"
143
+ }
144
+ ]
145
+ ]
146
+ }
147
+ }
@@ -0,0 +1,20 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = "react-native-zolozkit"
7
+ s.version = package["version"]
8
+ s.summary = package["description"]
9
+ s.homepage = package["homepage"]
10
+ s.license = package["license"]
11
+ s.authors = package["author"]
12
+
13
+ s.platforms = { :ios => "10.0" }
14
+ s.source = { :git => "https://github.com/zoloz-pte-ltd/zoloz-demo-ios.git"}
15
+
16
+ s.source_files = "ios/**/*.{h,m,mm}"
17
+
18
+ s.dependency "zolozkit", "~>1.2"
19
+ s.dependency "React-Core"
20
+ end
package/src/index.tsx ADDED
@@ -0,0 +1,22 @@
1
+ import { NativeModules, Platform } from 'react-native';
2
+
3
+ const LINKING_ERROR =
4
+ `The package 'react-native-zolozkit' doesn't seem to be linked. Make sure: \n\n` +
5
+ Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
6
+ '- You rebuilt the app after installing the package\n' +
7
+ '- You are not using Expo managed workflow\n';
8
+
9
+ const Zolozkit = NativeModules.Zolozkit
10
+ ? NativeModules.Zolozkit
11
+ : new Proxy(
12
+ {},
13
+ {
14
+ get() {
15
+ throw new Error(LINKING_ERROR);
16
+ },
17
+ }
18
+ );
19
+
20
+ export function multiply(a: number, b: number): Promise<number> {
21
+ return Zolozkit.multiply(a, b);
22
+ }