react-native-smallcase-gateway 0.7.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/CHANGELOG.md +130 -0
- package/LICENSE +21 -0
- package/README.md +147 -0
- package/android/README.md +14 -0
- package/android/build.gradle +161 -0
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/java/com/smallcase/gateway/reactnative/SmallcaseGatewayModule.kt +260 -0
- package/android/src/main/java/com/smallcase/gateway/reactnative/SmallcaseGatewayPackage.kt +18 -0
- package/index.js +4 -0
- package/ios/SmallcaseGateway.h +5 -0
- package/ios/SmallcaseGateway.m +287 -0
- package/ios/SmallcaseGateway.xcodeproj/project.pbxproj +290 -0
- package/ios/SmallcaseGateway.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/SmallcaseGateway.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/package.json +62 -0
- package/react-native-smallcase-gateway.podspec +28 -0
- package/src/SmallcaseGateway.js +169 -0
- package/src/constants.js +33 -0
- package/src/util.js +11 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
|
+
|
|
5
|
+
## [0.7.0](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/compare/v0.6.0...v0.7.0) (2021-09-20)
|
|
6
|
+
|
|
7
|
+
## [0.6.0](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/compare/v0.5.0...v0.6.0) (2021-08-17)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* added broker name to transaction responses ([c486fc0](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/commit/c486fc0e5d2093b1345ff5c750e94a913579ea9b))
|
|
13
|
+
|
|
14
|
+
## [0.5.0](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/compare/v0.4.0...v0.5.0) (2021-08-10)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* ios deployment target reduced to 11.0 ([a02955c](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/commit/a02955c6cff9314b9a0dff17a6b7194b32232dce))
|
|
20
|
+
|
|
21
|
+
## [0.4.0](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/compare/v0.3.0...v0.4.0) (2021-05-31)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Features
|
|
25
|
+
|
|
26
|
+
* added archiveSmallcase functionality and utm params in triggerLeadGen ([314f7d1](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/commit/314f7d10417031cdef7eaa3360fa87cbce826b5e))
|
|
27
|
+
|
|
28
|
+
## [0.3.0](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/compare/v0.3.0-alpha.2...v0.3.0) (2021-02-24)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Bug Fixes
|
|
32
|
+
|
|
33
|
+
* add "no_order" error code to handle invalid pending-action orders ([89d19e4](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/commit/89d19e44f2cc8758c6a38715837d1a6ea595e041))
|
|
34
|
+
|
|
35
|
+
## [0.3.0-alpha.2](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/compare/v0.3.0-alpha.1...v0.3.0-alpha.2) (2021-02-15)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
### Features
|
|
39
|
+
|
|
40
|
+
* add optional list of brokers to show in trigger-transaction (ios) ([f1f0eba](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/commit/f1f0ebaa98ceffbac55df2a791de9bc199fc4597))
|
|
41
|
+
|
|
42
|
+
## [0.3.0-alpha.1](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/compare/v0.3.0-alpha.0...v0.3.0-alpha.1) (2021-02-10)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
### Bug Fixes
|
|
46
|
+
|
|
47
|
+
* add null safety to trigger-transaction ([d42d1ba](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/commit/d42d1ba8d6c7ef80d6c7b115e0f4d55de0cb20f8))
|
|
48
|
+
|
|
49
|
+
## [0.3.0-alpha.0](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/compare/v0.2.0...v0.3.0-alpha.0) (2021-02-10)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
### Features
|
|
53
|
+
|
|
54
|
+
* add optional list of brokers to show in trigger-transaction ([d0c0036](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/commit/d0c003600766991a8df7e8a87cc4f46c75878b2c))
|
|
55
|
+
|
|
56
|
+
## [0.2.0](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/compare/v0.1.1-alpha.0...v0.2.0) (2021-01-05)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
### Features
|
|
60
|
+
|
|
61
|
+
* add logout user and signup key in ios ([8cb5b74](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/commit/8cb5b74e2b402253c4e2bfff2886c7e669df8f3b))
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
### Bug Fixes
|
|
65
|
+
|
|
66
|
+
* remove json handling in ios, and pass the response as it is ([67ed038](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/commit/67ed038bf873180fc7ca394a4fba514e83bee66c))
|
|
67
|
+
|
|
68
|
+
### [0.1.1-alpha.0](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/compare/v0.1.0...v0.1.1-alpha.0) (2020-12-30)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
### Features
|
|
72
|
+
|
|
73
|
+
* add logout user ([e7ac74f](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/commit/e7ac74fddc2dfe808d8403621fc9a65cc22b8e49))
|
|
74
|
+
|
|
75
|
+
## [0.1.0](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/compare/v0.0.29...v0.1.0) (2020-12-09)
|
|
76
|
+
|
|
77
|
+
### [0.0.29](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/compare/v0.0.28...v0.0.29) (2020-12-04)
|
|
78
|
+
|
|
79
|
+
### [0.0.28](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/compare/v0.0.27...v0.0.28) (2020-12-04)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
### Bug Fixes
|
|
83
|
+
|
|
84
|
+
* fix null being taken as object ([2aaefed](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/commit/2aaefedaf79c52532219dbd8a25726a888b9d280))
|
|
85
|
+
|
|
86
|
+
### [0.0.27](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/compare/v0.0.26...v0.0.27) (2020-11-23)
|
|
87
|
+
|
|
88
|
+
### [0.0.26](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/compare/v0.0.25...v0.0.26) (2020-11-19)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
### Bug Fixes
|
|
92
|
+
|
|
93
|
+
* ignore postinstall error ([f4918db](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/commit/f4918db3c12db65a3d4942644e6e1b627a4a2b4d))
|
|
94
|
+
|
|
95
|
+
### [0.0.25](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/compare/v0.0.24...v0.0.25) (2020-11-19)
|
|
96
|
+
|
|
97
|
+
### [0.0.24](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/compare/v0.0.23...v0.0.24) (2020-11-19)
|
|
98
|
+
|
|
99
|
+
### [0.0.23](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/compare/v0.0.22...v0.0.23) (2020-11-19)
|
|
100
|
+
|
|
101
|
+
### [0.0.22](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/compare/v0.0.21...v0.0.22) (2020-11-13)
|
|
102
|
+
|
|
103
|
+
### Features
|
|
104
|
+
|
|
105
|
+
- hardcode public maven creds for smallcase repo ([572433d](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/commit/572433deed0ded099dfe5f5096f1feb2720eaf27))
|
|
106
|
+
|
|
107
|
+
### Bug Fixes
|
|
108
|
+
|
|
109
|
+
- add missing "order_pending" error msg ([c547f12](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/commit/c547f126677bdf3c28c8fa155bf5655f42f9aae7))
|
|
110
|
+
- make default min sdk version 21 ([baae752](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/commit/baae75233426dfbcd6a8aa7b4c621f31ffcc37bd))
|
|
111
|
+
|
|
112
|
+
### [0.0.21](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/compare/v0.0.20...v0.0.21) (2020-11-11)
|
|
113
|
+
|
|
114
|
+
### Features
|
|
115
|
+
|
|
116
|
+
- add test framework (jest) ([3e7ed08](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/commit/3e7ed08d0aa1e2d92224eff346016fe352aa644b))
|
|
117
|
+
|
|
118
|
+
### Bug Fixes
|
|
119
|
+
|
|
120
|
+
- add constants.js in npm files ([09cdca8](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/commit/09cdca8cf45d1d2575606cb165921f629d04e4bd))
|
|
121
|
+
|
|
122
|
+
### [0.0.20](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/compare/v0.0.19...v0.0.20) (2020-11-11)
|
|
123
|
+
|
|
124
|
+
### [0.0.19](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/compare/v0.0.18...v0.0.19) (2020-11-11)
|
|
125
|
+
|
|
126
|
+
### 0.0.18 (2020-11-11)
|
|
127
|
+
|
|
128
|
+
### Features
|
|
129
|
+
|
|
130
|
+
- add commitizen ([c901563](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/commit/c901563b1bedcd7de4c9839b1e4aa720a076f61c))
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 smallcase
|
|
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,147 @@
|
|
|
1
|
+
# react-native-smallcase-gateway
|
|
2
|
+
|
|
3
|
+
[📖 Complete Guide](https://developers.gateway.smallcase.com/docs/react-native-integration)
|
|
4
|
+
|
|
5
|
+
## Getting started
|
|
6
|
+
|
|
7
|
+
`$ yarn add react-native-smallcase-gateway`
|
|
8
|
+
|
|
9
|
+
or
|
|
10
|
+
|
|
11
|
+
`$ npm install react-native-smallcase-gateway`
|
|
12
|
+
|
|
13
|
+
## ios setup
|
|
14
|
+
|
|
15
|
+
add these lines at the top of your `Podfile`
|
|
16
|
+
|
|
17
|
+
```ruby
|
|
18
|
+
# private podspec for smallcase
|
|
19
|
+
source 'git@github.com:smallcase/cocoapodspecs.git'
|
|
20
|
+
|
|
21
|
+
# default source for all other pods
|
|
22
|
+
source 'https://cdn.cocoapods.org'
|
|
23
|
+
|
|
24
|
+
# update the ios version if it was previously below 11.0
|
|
25
|
+
platform :ios, '11.0'
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
then run
|
|
29
|
+
`cd ios; pod update`
|
|
30
|
+
|
|
31
|
+
## android setup
|
|
32
|
+
|
|
33
|
+
Add these lines to your project level `build.gradle`
|
|
34
|
+
|
|
35
|
+
```groovy
|
|
36
|
+
allprojects {
|
|
37
|
+
repositories {
|
|
38
|
+
// .. you other repositories
|
|
39
|
+
maven {
|
|
40
|
+
url "http://artifactory.smallcase.com/artifactory/gradle-dev-local"
|
|
41
|
+
credentials {
|
|
42
|
+
username "react_native_user"
|
|
43
|
+
password "reactNativeUser123"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
add these lines in `AndroidManifest.xml` in the main `<application />` tag
|
|
51
|
+
|
|
52
|
+
```xml
|
|
53
|
+
<activity android:name="com.smallcase.gateway.screens.transaction.activity.TransactionProcessActivity">
|
|
54
|
+
<intent-filter>
|
|
55
|
+
<action android:name="android.intent.action.VIEW" />
|
|
56
|
+
|
|
57
|
+
<category android:name="android.intent.category.BROWSABLE" />
|
|
58
|
+
<category android:name="android.intent.category.DEFAULT" />
|
|
59
|
+
<data
|
|
60
|
+
android:host="{YOUR_HOST_NAME}"
|
|
61
|
+
android:scheme="scgateway" />
|
|
62
|
+
</intent-filter>
|
|
63
|
+
</activity>
|
|
64
|
+
|
|
65
|
+
<activity android:name="com.smallcase.gateway.screens.common.RedirectActivity">
|
|
66
|
+
<intent-filter>
|
|
67
|
+
<action android:name="android.intent.action.VIEW" />
|
|
68
|
+
|
|
69
|
+
<category android:name="android.intent.category.BROWSABLE" />
|
|
70
|
+
<category android:name="android.intent.category.DEFAULT" />
|
|
71
|
+
|
|
72
|
+
<data
|
|
73
|
+
android:host="{YOUR_HOST_NAME}"
|
|
74
|
+
android:scheme="scgatewayredirect"
|
|
75
|
+
/>
|
|
76
|
+
</intent-filter>
|
|
77
|
+
</activity>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Example Usage
|
|
81
|
+
|
|
82
|
+
```javascript
|
|
83
|
+
// import gateway into your file
|
|
84
|
+
import SmallcaseGateway from "react-native-smallcase-gateway";
|
|
85
|
+
|
|
86
|
+
// configure environment
|
|
87
|
+
await SmallcaseGateway.setConfigEnvironment({
|
|
88
|
+
isLeprechaun: true,
|
|
89
|
+
isAmoEnabled: true,
|
|
90
|
+
gatewayName: "smallcase-website",
|
|
91
|
+
environmentName: SmallcaseGateway.ENV.PROD,
|
|
92
|
+
brokerList: ["kite", "aliceblue", "trustline"],
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// initialize session
|
|
96
|
+
await SmallcaseGateway.init(sdkToken);
|
|
97
|
+
|
|
98
|
+
// execute a transaction
|
|
99
|
+
const res = await SmallcaseGateway.triggerTransaction(transactionId);
|
|
100
|
+
|
|
101
|
+
// start lead generation flow
|
|
102
|
+
SmallcaseGateway.triggerLeadGen({ email: "test@gmail.com" });
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Debug / Contribution
|
|
106
|
+
|
|
107
|
+
Make sure you have react native dev environment set up
|
|
108
|
+
|
|
109
|
+
### ios
|
|
110
|
+
|
|
111
|
+
- remove `node_modules` in the root directory
|
|
112
|
+
- run `yarn install` in `example/`
|
|
113
|
+
- run `pod update` in `example/ios`
|
|
114
|
+
- open `SmallcaseGateway.xcworkspace` in xcode
|
|
115
|
+
- run `yarn start` (important to get symlinks to work)
|
|
116
|
+
- run in debug mode
|
|
117
|
+
- in xcode, navigate to Pods > Development Pods > react-native-smallcase-gateway
|
|
118
|
+
- you can now edit these file directly and test the results on the running app
|
|
119
|
+
|
|
120
|
+
### android without example app
|
|
121
|
+
|
|
122
|
+
- run `yarn install` in the root directory
|
|
123
|
+
- change directory to `android/`
|
|
124
|
+
- add a file called `gradle.properties`
|
|
125
|
+
- add `artifactory_user` and `artifactory_password`
|
|
126
|
+
- open this folder in android studio
|
|
127
|
+
- let gradle sync complete
|
|
128
|
+
- you can now write code with just the android folder in context
|
|
129
|
+
|
|
130
|
+
### android with example app
|
|
131
|
+
|
|
132
|
+
- run `yarn install` in `example/`
|
|
133
|
+
- add a file called `gradle.properties` in `example/android`
|
|
134
|
+
- add these lines
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
android.useAndroidX=true
|
|
138
|
+
android.enableJetifier=true
|
|
139
|
+
|
|
140
|
+
FLIPPER_VERSION=version_string
|
|
141
|
+
|
|
142
|
+
artifactory_user=sampleUser
|
|
143
|
+
artifactory_password=samplePassword
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
- run `yarn start` (important to get symlinks to work)
|
|
147
|
+
- run `yarn android` to build example project for android
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
README
|
|
2
|
+
======
|
|
3
|
+
|
|
4
|
+
If you want to publish the lib as a maven dependency, follow these steps before publishing a new version to npm:
|
|
5
|
+
|
|
6
|
+
1. Be sure to have the Android [SDK](https://developer.android.com/studio/index.html) and [NDK](https://developer.android.com/ndk/guides/index.html) installed
|
|
7
|
+
2. Be sure to have a `local.properties` file in this folder that points to the Android SDK and NDK
|
|
8
|
+
```
|
|
9
|
+
ndk.dir=/Users/{username}/Library/Android/sdk/ndk-bundle
|
|
10
|
+
sdk.dir=/Users/{username}/Library/Android/sdk
|
|
11
|
+
```
|
|
12
|
+
3. Delete the `maven` folder
|
|
13
|
+
4. Run `./gradlew installArchives`
|
|
14
|
+
5. Verify that latest set of generated files is in the maven folder with the correct version number
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
def DEFAULT_COMPILE_SDK_VERSION = 28
|
|
2
|
+
def DEFAULT_BUILD_TOOLS_VERSION = '28.0.3'
|
|
3
|
+
def DEFAULT_MIN_SDK_VERSION = 21
|
|
4
|
+
def DEFAULT_TARGET_SDK_VERSION = 28
|
|
5
|
+
|
|
6
|
+
def safeExtGet(prop, fallback) {
|
|
7
|
+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
def kotlin_version = safeExtGet('kotlinVersion', '1.3.71')
|
|
11
|
+
|
|
12
|
+
apply plugin: 'com.android.library'
|
|
13
|
+
apply plugin: 'maven'
|
|
14
|
+
|
|
15
|
+
buildscript {
|
|
16
|
+
// Buildscript is evaluated before everything else so we can't use getExtOrDefault
|
|
17
|
+
def kv = rootProject.ext.has('kotlinVersion')
|
|
18
|
+
? rootProject.ext.get('kotlinVersion')
|
|
19
|
+
: '1.3.71'
|
|
20
|
+
|
|
21
|
+
if (project == rootProject) {
|
|
22
|
+
repositories {
|
|
23
|
+
google()
|
|
24
|
+
jcenter()
|
|
25
|
+
}
|
|
26
|
+
dependencies {
|
|
27
|
+
classpath 'com.android.tools.build:gradle:4.0.1'
|
|
28
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kv"
|
|
29
|
+
}
|
|
30
|
+
} else {
|
|
31
|
+
repositories {
|
|
32
|
+
jcenter()
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
dependencies {
|
|
36
|
+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kv")
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
apply plugin: 'com.android.library'
|
|
42
|
+
apply plugin: 'maven'
|
|
43
|
+
apply plugin: 'kotlin-android'
|
|
44
|
+
apply plugin: 'kotlin-android-extensions'
|
|
45
|
+
|
|
46
|
+
android {
|
|
47
|
+
compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
|
|
48
|
+
buildToolsVersion safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION)
|
|
49
|
+
defaultConfig {
|
|
50
|
+
minSdkVersion safeExtGet('minSdkVersion', DEFAULT_MIN_SDK_VERSION)
|
|
51
|
+
targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION)
|
|
52
|
+
versionCode 1
|
|
53
|
+
versionName "1.0"
|
|
54
|
+
}
|
|
55
|
+
lintOptions {
|
|
56
|
+
abortOnError false
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
repositories {
|
|
61
|
+
// ref: https://www.baeldung.com/maven-local-repository
|
|
62
|
+
mavenLocal()
|
|
63
|
+
maven {
|
|
64
|
+
url "http://artifactory.smallcase.com/artifactory/gradle-dev-local"
|
|
65
|
+
credentials {
|
|
66
|
+
username "react_native_user"
|
|
67
|
+
password "reactNativeUser123"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
maven {
|
|
71
|
+
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
|
|
72
|
+
url "$rootDir/../node_modules/react-native/android"
|
|
73
|
+
}
|
|
74
|
+
maven {
|
|
75
|
+
// Android JSC is installed from npm
|
|
76
|
+
url "$rootDir/../node_modules/jsc-android/dist"
|
|
77
|
+
}
|
|
78
|
+
google()
|
|
79
|
+
jcenter()
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
dependencies {
|
|
83
|
+
//noinspection GradleDynamicVersion
|
|
84
|
+
implementation 'com.facebook.react:react-native:+' // From node_modules
|
|
85
|
+
implementation 'com.smallcase.gateway:sdk:3.0.7'
|
|
86
|
+
implementation "androidx.core:core-ktx:1.3.1"
|
|
87
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
def configureReactNativePom(def pom) {
|
|
91
|
+
def packageJson = new groovy.json.JsonSlurper().parseText(file('../package.json').text)
|
|
92
|
+
|
|
93
|
+
pom.project {
|
|
94
|
+
name packageJson.title
|
|
95
|
+
artifactId packageJson.name
|
|
96
|
+
version = packageJson.version
|
|
97
|
+
group = "com.smallcase.gateway.reactnative"
|
|
98
|
+
description packageJson.description
|
|
99
|
+
url packageJson.repository.baseUrl
|
|
100
|
+
|
|
101
|
+
licenses {
|
|
102
|
+
license {
|
|
103
|
+
name packageJson.license
|
|
104
|
+
url packageJson.repository.baseUrl + '/blob/master/' + packageJson.licenseFilename
|
|
105
|
+
distribution 'repo'
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
developers {
|
|
110
|
+
developer {
|
|
111
|
+
id packageJson.author.username
|
|
112
|
+
name packageJson.author.name
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
afterEvaluate { project ->
|
|
119
|
+
// some Gradle build hooks ref:
|
|
120
|
+
// https://www.oreilly.com/library/view/gradle-beyond-the/9781449373801/ch03.html
|
|
121
|
+
task androidJavadoc(type: Javadoc) {
|
|
122
|
+
source = android.sourceSets.main.java.srcDirs
|
|
123
|
+
classpath += files(android.bootClasspath)
|
|
124
|
+
classpath += files(project.getConfigurations().getByName('compile').asList())
|
|
125
|
+
include '**/*.java'
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) {
|
|
129
|
+
classifier = 'javadoc'
|
|
130
|
+
from androidJavadoc.destinationDir
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
task androidSourcesJar(type: Jar) {
|
|
134
|
+
classifier = 'sources'
|
|
135
|
+
from android.sourceSets.main.java.srcDirs
|
|
136
|
+
include '**/*.java'
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
android.libraryVariants.all { variant ->
|
|
140
|
+
def name = variant.name.capitalize()
|
|
141
|
+
def javaCompileTask = variant.javaCompileProvider.get()
|
|
142
|
+
|
|
143
|
+
task "jar${name}"(type: Jar, dependsOn: javaCompileTask) {
|
|
144
|
+
from javaCompileTask.destinationDir
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
artifacts {
|
|
149
|
+
archives androidSourcesJar
|
|
150
|
+
archives androidJavadocJar
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
task installArchives(type: Upload) {
|
|
154
|
+
configuration = configurations.archives
|
|
155
|
+
repositories.mavenDeployer {
|
|
156
|
+
// Deploy to react-native-event-bridge/maven, ready to publish to npm
|
|
157
|
+
repository url: "file://${projectDir}/../android/maven"
|
|
158
|
+
configureReactNativePom pom
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|