judokit-react-native 4.1.2 → 4.2.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.
Files changed (101) hide show
  1. package/JudoKit-ReactNative.podspec +42 -0
  2. package/LICENSE +1 -2
  3. package/README.md +106 -119
  4. package/android/build.gradle +65 -202
  5. package/android/gradle.properties +6 -1
  6. package/android/src/main/AndroidManifest.xml +2 -2
  7. package/android/src/main/AndroidManifestNew.xml +2 -0
  8. package/android/src/main/java/com/judopay/judokit/reactnative/Extensions.kt +382 -0
  9. package/android/src/main/java/com/judopay/judokit/reactnative/Helpers.kt +653 -0
  10. package/android/src/main/java/com/judopay/judokit/reactnative/JudoActivityEventListener.kt +49 -0
  11. package/android/src/main/java/com/judopay/judokit/reactnative/JudoKitReactNativeModule.kt +238 -0
  12. package/android/src/main/java/com/judopay/judokit/reactnative/JudoKitReactNativePackage.kt +16 -0
  13. package/ios/{Classes/Extensions → Extensions}/NSDictionary+JudoConvert.h +1 -1
  14. package/ios/{Classes/Extensions → Extensions}/NSDictionary+JudoConvert.m +2 -2
  15. package/ios/{Classes/Extensions → Extensions}/NSException+JudoValidationExceptions.h +1 -1
  16. package/ios/{Classes/Extensions → Extensions}/NSException+JudoValidationExceptions.m +1 -1
  17. package/ios/{Classes/Extensions → Extensions}/UIColor+RNAdditions.h +1 -1
  18. package/ios/{Classes/Extensions → Extensions}/UIColor+RNAdditions.m +3 -3
  19. package/ios/{Classes/RNJudo.h → JudoKitReactNative.h} +12 -6
  20. package/ios/{Classes/RNJudo.m → JudoKitReactNative.mm} +83 -81
  21. package/ios/{Classes/RNTypes.h → RNTypes.h} +8 -2
  22. package/ios/{Classes/Wrappers → Wrappers}/RNApplePayWrappers.h +1 -1
  23. package/ios/{Classes/Wrappers → Wrappers}/RNApplePayWrappers.m +105 -4
  24. package/ios/{Classes/Wrappers → Wrappers}/RNWrappers.h +14 -14
  25. package/ios/{Classes/Wrappers → Wrappers}/RNWrappers.m +46 -25
  26. package/lib/commonjs/index.js +268 -0
  27. package/lib/commonjs/index.js.map +1 -0
  28. package/lib/commonjs/judo-kit/index.js +212 -0
  29. package/lib/commonjs/judo-kit/index.js.map +1 -0
  30. package/lib/commonjs/types/index.js +267 -0
  31. package/lib/commonjs/types/index.js.map +1 -0
  32. package/lib/commonjs/types/judo-apple-pay-configuration.js +49 -0
  33. package/lib/commonjs/types/judo-apple-pay-configuration.js.map +1 -0
  34. package/lib/commonjs/types/judo-configuration.js +71 -0
  35. package/lib/commonjs/types/judo-configuration.js.map +1 -0
  36. package/lib/commonjs/types/judo-google-pay-configuration.js +28 -0
  37. package/lib/commonjs/types/judo-google-pay-configuration.js.map +1 -0
  38. package/lib/module/index.js +6 -0
  39. package/lib/module/index.js.map +1 -0
  40. package/lib/module/judo-kit/index.js +205 -0
  41. package/lib/module/judo-kit/index.js.map +1 -0
  42. package/lib/module/types/index.js +8 -0
  43. package/lib/module/types/index.js.map +1 -0
  44. package/lib/module/types/judo-apple-pay-configuration.js +43 -0
  45. package/lib/module/types/judo-apple-pay-configuration.js.map +1 -0
  46. package/lib/module/types/judo-configuration.js +65 -0
  47. package/lib/module/types/judo-configuration.js.map +1 -0
  48. package/lib/module/types/judo-google-pay-configuration.js +22 -0
  49. package/lib/module/types/judo-google-pay-configuration.js.map +1 -0
  50. package/lib/typescript/src/index.d.ts +4 -0
  51. package/lib/typescript/src/index.d.ts.map +1 -0
  52. package/lib/typescript/src/judo-kit/index.d.ts +86 -0
  53. package/lib/typescript/src/judo-kit/index.d.ts.map +1 -0
  54. package/lib/typescript/src/types/index.d.ts +4 -0
  55. package/lib/typescript/src/types/index.d.ts.map +1 -0
  56. package/lib/typescript/src/types/judo-apple-pay-configuration.d.ts +75 -0
  57. package/lib/typescript/src/types/judo-apple-pay-configuration.d.ts.map +1 -0
  58. package/lib/typescript/src/types/judo-configuration.d.ts +236 -0
  59. package/lib/typescript/src/types/judo-configuration.d.ts.map +1 -0
  60. package/lib/typescript/src/types/judo-google-pay-configuration.d.ts +42 -0
  61. package/lib/typescript/src/types/judo-google-pay-configuration.d.ts.map +1 -0
  62. package/package.json +158 -79
  63. package/src/index.tsx +50 -0
  64. package/src/judo-kit/index.ts +262 -0
  65. package/src/types/index.ts +53 -0
  66. package/src/types/judo-apple-pay-configuration.ts +85 -0
  67. package/src/types/judo-configuration.ts +263 -0
  68. package/src/types/judo-google-pay-configuration.ts +47 -0
  69. package/JudoPay.tsx +0 -334
  70. package/RNJudopay.podspec +0 -24
  71. package/android/src/main/java/com/reactlibrary/Extensions.kt +0 -372
  72. package/android/src/main/java/com/reactlibrary/Helpers.kt +0 -606
  73. package/android/src/main/java/com/reactlibrary/JudoReactNativeActivityEventListener.kt +0 -48
  74. package/android/src/main/java/com/reactlibrary/JudoReactNativeModule.kt +0 -257
  75. package/android/src/main/java/com/reactlibrary/JudoReactNativePBBAManager.kt +0 -52
  76. package/android/src/main/java/com/reactlibrary/JudoReactNativePackage.kt +0 -14
  77. package/components/JudoPBBAButton.ts +0 -2
  78. package/ios/.xcode.env +0 -11
  79. package/ios/Classes/Views/RNPBBAButtonManager.m +0 -42
  80. package/ios/Classes/Wrappers/RNPBBAWrappers.h +0 -40
  81. package/ios/Classes/Wrappers/RNPBBAWrappers.m +0 -57
  82. package/ios/Podfile +0 -44
  83. package/ios/Podfile.lock +0 -572
  84. package/ios/RNJudo.xcodeproj/project.pbxproj +0 -703
  85. package/ios/RNJudo.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  86. package/ios/RNJudo.xcodeproj/xcshareddata/xcschemes/RNJudo.xcscheme +0 -97
  87. package/ios/RNJudo.xcworkspace/contents.xcworkspacedata +0 -10
  88. package/ios/RNJudoTests/Info.plist +0 -22
  89. package/ios/RNJudoTests/MockConfiguration.json +0 -114
  90. package/ios/RNJudoTests/NSDictionaryConvertTests.m +0 -475
  91. package/ios/RNJudoTests/RNApplePayWrappersTests.m +0 -770
  92. package/ios/RNJudoTests/RNJudoTests.m +0 -37
  93. package/ios/RNJudoTests/RNMocks.h +0 -54
  94. package/ios/RNJudoTests/RNMocks.m +0 -55
  95. package/ios/RNJudoTests/RNPBBAWrappersTests.m +0 -121
  96. package/ios/RNJudoTests/RNThemeTests.m +0 -576
  97. package/ios/RNJudoTests/RNWrappersTests.m +0 -947
  98. package/types/JudoApplePayTypes.tsx +0 -59
  99. package/types/JudoGooglePayTypes.tsx +0 -47
  100. package/types/JudoPBBATypes.tsx +0 -7
  101. package/types/JudoTypes.tsx +0 -251
@@ -0,0 +1,42 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+ folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
5
+
6
+ Pod::Spec.new do |s|
7
+ s.name = "JudoKit-ReactNative"
8
+ s.version = package["version"]
9
+ s.summary = package["description"]
10
+ s.homepage = package["homepage"]
11
+ s.license = package["license"]
12
+ s.authors = package["author"]
13
+
14
+ s.platforms = { :ios => "12.0" }
15
+ s.source = { :git => "https://github.com/Judopay/JudoKit-ReactNative.git", :tag => "#{s.version}" }
16
+
17
+ s.source_files = "ios/**/*.{h,m,mm}"
18
+ s.dependency "JudoKit-iOS", "3.3.1"
19
+
20
+ # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
21
+ # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
22
+ if respond_to?(:install_modules_dependencies, true)
23
+ install_modules_dependencies(s)
24
+ else
25
+ s.dependency "React-Core"
26
+
27
+ # Don't install the dependencies when we run `pod install` in the old architecture.
28
+ if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
29
+ s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
30
+ s.pod_target_xcconfig = {
31
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
32
+ "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
33
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
34
+ }
35
+ s.dependency "React-Codegen"
36
+ s.dependency "RCT-Folly"
37
+ s.dependency "RCTRequired"
38
+ s.dependency "RCTTypeSafety"
39
+ s.dependency "ReactCommon/turbomodule/core"
40
+ end
41
+ end
42
+ end
package/LICENSE CHANGED
@@ -1,7 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2019 Judopay
4
-
3
+ Copyright (c) 2019-2024 Alternative Payments Ltd
5
4
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
5
  of this software and associated documentation files (the "Software"), to deal
7
6
  in the Software without restriction, including without limitation the rights
package/README.md CHANGED
@@ -1,136 +1,123 @@
1
- # JudoPay React Native module
1
+ # JudoKit-ReactNative
2
2
 
3
- JudoPay's React Native module and sample app. This module is a wrapper around the JudoKit-iOS library on iOS and the JudoKit-Android library on Android.
3
+ [![npm version](https://badge.fury.io/js/judokit-react-native.svg)](https://www.npmjs.com/package/judokit-react-native)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
5
+ [![React Native](https://img.shields.io/badge/React%20Native-%3E%3D0.70-blue.svg)](https://facebook.github.io/react-native/)
6
+ [![install size](https://packagephobia.com/badge?p=judokit-react-native)](https://packagephobia.com/result?p=judokit-react-native)
7
+ [![CircleCI](https://dl.circleci.com/status-badge/img/gh/Judopay/JudoKit-ReactNative/tree/master.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/Judopay/JudoKit-ReactNative/tree/master)
4
8
 
5
- ## Features
9
+ [![NPM](https://nodei.co/npm/judokit-react-native.png?downloads=true&mini=true)](https://nodei.co/npm/judokit-react-native/)
6
10
 
7
- - Card transactions *(Payment, PreAuth, Save Card, Register Card, Check Card)*;
8
- - Token payments/pre-auths;
9
- - Apple Pay;
10
- - Google Pay;
11
- - iDEAL;
12
- - Pay By Bank App;
13
- - 3DS;
14
- - Server-to-server transactions;
15
- - Payment Method Selection screen;
11
+ A React Native module for the Judopay native [JudoKit-iOS](https://github.com/Judopay/JudoKit-iOS) and [JudoKit-Android](https://github.com/Judopay/JudoKit-Android) to process payments on iOS and Android.
16
12
 
17
- ## Getting started
13
+ ## Installation
18
14
 
19
- - `yarn add judokit-react-native`
20
-
21
- or if you use npm: `npm install judokit-react-native --save`
22
-
23
- ### iOS
24
-
25
- - Make sure that the minimum deployment target is set to `11.0` or higher in your `ios/Podfile` :
26
-
27
- `platform :ios, '11.0'`
28
-
29
- - Install Cocopods
30
-
31
- `cd ios && pod install`
32
-
33
- ### Android
34
-
35
- - Make sure that `minSdkVersion` is set to 19 or higher in your `android/build.gradle`:
36
-
37
- ```
38
- buildscript {
39
- ext {
40
- buildToolsVersion = "29.0.3"
41
- minSdkVersion = 19
42
- compileSdkVersion = 29
43
- targetSdkVersion = 29
44
- }
45
- ...
46
- }
47
- ```
48
-
49
- - Make sure that you use Android Gradle plugin version 4.0.1+ in your `android/build.gradle`:
50
-
51
- ```
52
- dependencies {
53
- classpath 'com.android.tools.build:gradle:4.0.1'
54
- }
55
- ```
56
-
57
- - Add the Judopay maven repository to `allprojects / repositories` in your `android/build.gradle`:
58
-
59
- ```
60
- allprojects {
61
- repositories {
62
- mavenLocal()
63
-
64
- mavenCentral()
65
- google()
66
- maven {
67
- // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
68
- url("$rootDir/../node_modules/react-native/android")
69
- }
70
- maven {
71
- // Android JSC is installed from npm
72
- url("$rootDir/../node_modules/jsc-android/dist")
73
- }
74
- }
75
- }
76
-
77
- ```
78
-
79
- ## Update an existing project
80
-
81
- `yarn upgrade judokit-react-native`
82
-
83
- ### iOS
84
-
85
- - Update Cocoapods
86
-
87
- `cd ios && pod update JudoKit-iOS`
88
-
89
- ### Android
90
-
91
- - Rebuild your project
15
+ ```sh
16
+ yarn add judokit-react-native
17
+ ```
92
18
 
93
19
  ## Usage
94
-
95
- For a detailed description of all features, visit [our documentation](https://docs.judopay.com/) or try out the sample app attached to the package.
96
-
97
20
  ```ts
21
+ import JudoPay, {JudoTransactionType} from 'judokit-react-native';
22
+
23
+ const judoKit = new JudoPay({
24
+ token: 'your-judo-token',
25
+ paymentSession: 'your-payment-session',
26
+ });
27
+
28
+ judoKit
29
+ .invokeTransaction(JudoTransactionType.Payment, {
30
+ judoId: '123456',
31
+ amount: {
32
+ value: '1.5',
33
+ currency: 'GBP',
34
+ },
35
+ reference: {
36
+ paymentReference: 'your-payment-reference',
37
+ consumerReference: 'your-consumer-reference',
38
+ },
39
+ })
40
+ .then(
41
+ response => {
42
+ console.log(response);
43
+ },
44
+ error => {
45
+ console.error(error);
46
+ },
47
+ );
98
48
 
99
- import Judo, {
49
+ ```
50
+ ## Example
51
+ Below is a simple example to showcase the basic usage of the library.
52
+ ```tsx
53
+ import JudoPay, {
54
+ JudoAmount,
100
55
  JudoAuthorization,
56
+ JudoConfiguration,
57
+ JudoReference,
101
58
  JudoTransactionType,
102
- } from 'judokit-react-native'
59
+ } from 'judokit-react-native';
60
+ import React from 'react';
61
+ import {Button, StyleSheet, View} from 'react-native';
62
+
63
+ const authorization: JudoAuthorization = {
64
+ token: 'your-judo-token',
65
+ paymentSession: 'your-payment-session',
66
+ };
67
+
68
+ const judoKit = new JudoPay(authorization);
69
+
70
+ function App(): React.JSX.Element {
71
+ const invokeJudoKit = () => {
72
+ const amount: JudoAmount = {value: '1.5', currency: 'GBP'};
73
+ const reference: JudoReference = {
74
+ paymentReference: 'your-payment-reference',
75
+ consumerReference: 'your-consumer-reference',
76
+ };
77
+
78
+ const configuration: JudoConfiguration = {
79
+ amount,
80
+ judoId: '123456',
81
+ reference,
82
+ };
83
+
84
+ judoKit.invokeTransaction(JudoTransactionType.Payment, configuration).then(
85
+ response => {
86
+ console.log(response);
87
+ },
88
+ error => {
89
+ console.error(error);
90
+ },
91
+ );
92
+ };
93
+
94
+ return (
95
+ <View style={styles.container}>
96
+ <Button title="Invoke JudoKit" onPress={invokeJudoKit} />
97
+ </View>
98
+ );
99
+ }
103
100
 
104
- // 1. Create a Judo session by providing an authorization object (basic or session)
105
- const auth: JudoAuthorization = {token: 'YOUR-TOKEN', secret: 'YOUR_SECRET'}
106
- const judo = new Judo(auth)
101
+ const styles = StyleSheet.create({
102
+ container: {
103
+ flex: 1,
104
+ justifyContent: 'center',
105
+ alignItems: 'center',
106
+ },
107
+ });
107
108
 
108
- // 2. Set the Judo session to sandbox mode for testing
109
- judo.isSandboxed = true
109
+ export default App;
110
110
 
111
- // 3. Create a Judo configuration to setup your payment flow
112
- const amount: JudoAmount = {
113
- value: '0.01',
114
- currency: 'GBP',
115
- }
111
+ ```
116
112
 
117
- const reference: JudoReference = {
118
- consumerReference: 'MY-CONSUMER-REFERENCE',
119
- paymentReference: 'MY-PAYMENT-REFERENCE'
120
- }
113
+ ## Contributing
114
+ If you want to contribute to this project, follow instructions from [CONTRIBUTING](https://github.com/Judopay/JudoKit-ReactNative/blob/master/CONTRIBUTING.md) file.
121
115
 
122
- const configuration: JudoConfiguration = {
123
- judoId: 'MY-JUDO-ID',
124
- amount: amount,
125
- reference: reference
126
- }
116
+ ## See also
127
117
 
128
- // 4. Invoke a payment transaction and handle the result
129
- judo.invokeTransaction(JudoTransactionType.Payment, configuration)
130
- .then((response) => {
131
- // Handle response
132
- })
133
- .catch((error) => {
134
- // Handle error
135
- });
136
- ```
118
+ - [JudoKit-ReactNative documentation](https://docs.judopay.com/Content/Mobile/React_Native.htm)
119
+ - [Judopay Transaction API documentation](https://docs.judopay.com/api-reference/index.html)
120
+
121
+ ## License
122
+
123
+ This project is licensed under the MIT License - see the [LICENSE](https://github.com/Judopay/JudoKit-ReactNative/blob/master/LICENSE) file for details.
@@ -1,233 +1,96 @@
1
- apply plugin: 'com.android.library'
2
- apply plugin: 'kotlin-android'
3
- apply plugin: 'de.mannodermaus.android-junit5'
4
- apply plugin: 'jacoco'
1
+ buildscript {
2
+ // Buildscript is evaluated before everything else so we can't use getExtOrDefault
3
+ def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["JudoKitReactNative_kotlinVersion"]
5
4
 
6
- def DEFAULT_COMPILE_SDK_VERSION = 33
7
- def DEFAULT_MIN_SDK_VERSION = 21
8
- def DEFAULT_TARGET_SDK_VERSION = 33
5
+ repositories {
6
+ google()
7
+ mavenCentral()
8
+ }
9
+
10
+ dependencies {
11
+ classpath "com.android.tools.build:gradle:7.2.1"
12
+ // noinspection DifferentKotlinGradleVersion
13
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14
+ }
15
+ }
9
16
 
10
17
  def isNewArchitectureEnabled() {
11
- return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
18
+ return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
12
19
  }
13
20
 
21
+ apply plugin: "com.android.library"
22
+ apply plugin: "kotlin-android"
23
+
14
24
  if (isNewArchitectureEnabled()) {
15
- apply plugin: 'com.facebook.react'
25
+ apply plugin: "com.facebook.react"
16
26
  }
17
27
 
18
- def getExtOrIntegerDefault(name, fallback) {
19
- return rootProject.ext.has(name) ? rootProject.ext.get(name) : (fallback).toInteger()
28
+ def getExtOrDefault(name) {
29
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["JudoKitReactNative_" + name]
20
30
  }
21
31
 
22
- buildscript {
23
- ext.kotlin_version = '1.7.20'
24
- ext.junit5_version = '5.9.1'
32
+ def getExtOrIntegerDefault(name) {
33
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["JudoKitReactNative_" + name]).toInteger()
34
+ }
25
35
 
26
- repositories {
27
- maven { url 'https://plugins.gradle.org/m2/' }
28
- google()
29
- mavenCentral()
30
- }
36
+ def supportsNamespace() {
37
+ def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
38
+ def major = parsed[0].toInteger()
39
+ def minor = parsed[1].toInteger()
31
40
 
32
- dependencies {
33
- classpath 'com.android.tools.build:gradle:7.3.1'
34
- classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
35
- classpath 'de.mannodermaus.gradle.plugins:android-junit5:1.8.2.1'
36
- }
41
+ // Namespace support was added in 7.3.0
42
+ return (major == 7 && minor >= 3) || major >= 8
37
43
  }
38
44
 
39
45
  android {
40
- compileSdkVersion getExtOrIntegerDefault('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
46
+ if (supportsNamespace()) {
47
+ namespace "com.judopay.judokit.reactnative"
41
48
 
42
- defaultConfig {
43
- minSdkVersion getExtOrIntegerDefault('minSdkVersion', DEFAULT_MIN_SDK_VERSION)
44
- targetSdkVersion getExtOrIntegerDefault('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION)
45
- buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
46
- }
47
- buildTypes {
48
- release {
49
- minifyEnabled false
50
- }
51
- debug {
52
- testCoverageEnabled true
53
- }
49
+ sourceSets {
50
+ main {
51
+ manifest.srcFile "src/main/AndroidManifestNew.xml"
52
+ }
54
53
  }
54
+ }
55
55
 
56
- lintOptions {
57
- disable 'GradleCompatible'
58
- }
56
+ compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
59
57
 
60
- testOptions {
61
- animationsDisabled = true
62
- unitTests.returnDefaultValues = true
63
- unitTests.all {
64
- jacoco {
65
- includeNoLocationClasses = true
66
- jacoco.excludes = ['jdk.internal.*']
67
- }
68
- }
69
- }
70
- }
58
+ defaultConfig {
59
+ minSdkVersion getExtOrIntegerDefault("minSdkVersion")
60
+ targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
71
61
 
72
- repositories {
73
- mavenLocal()
74
- mavenCentral()
75
- google()
62
+ }
76
63
 
77
- def found = false
78
- def defaultDir = null
79
- def androidSourcesName = 'React Native sources'
80
-
81
- if (rootProject.ext.has('reactNativeAndroidRoot')) {
82
- defaultDir = rootProject.ext.get('reactNativeAndroidRoot')
83
- } else {
84
- defaultDir = new File(
85
- projectDir,
86
- '/../../../node_modules/react-native/android'
87
- )
64
+ buildTypes {
65
+ release {
66
+ minifyEnabled false
88
67
  }
68
+ }
89
69
 
90
- if (defaultDir.exists()) {
91
- maven {
92
- url defaultDir.toString()
93
- name androidSourcesName
94
- }
95
-
96
- logger.info(":${project.name}:reactNativeAndroidRoot ${defaultDir.canonicalPath}")
97
- found = true
98
- } else {
99
- def parentDir = rootProject.projectDir
100
-
101
- 1.upto(5, {
102
- if (found) return true
103
- parentDir = parentDir.parentFile
104
-
105
- def androidSourcesDir = new File(
106
- parentDir,
107
- 'node_modules/react-native'
108
- )
109
-
110
- def androidPrebuiltBinaryDir = new File(
111
- parentDir,
112
- 'node_modules/react-native/android'
113
- )
114
-
115
- if (androidPrebuiltBinaryDir.exists()) {
116
- maven {
117
- url androidPrebuiltBinaryDir.toString()
118
- name androidSourcesName
119
- }
120
-
121
- logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}")
122
- found = true
123
- } else if (androidSourcesDir.exists()) {
124
- maven {
125
- url androidSourcesDir.toString()
126
- name androidSourcesName
127
- }
128
-
129
- logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}")
130
- found = true
131
- }
132
- })
133
- }
70
+ lintOptions {
71
+ disable "GradleCompatible"
72
+ }
134
73
 
135
- if (!found) {
136
- throw new GradleException(
137
- "${project.name}: unable to locate React Native android sources. " +
138
- "Ensure you have you installed React Native as a dependency in your project and try again."
139
- )
140
- }
74
+ compileOptions {
75
+ sourceCompatibility JavaVersion.VERSION_1_8
76
+ targetCompatibility JavaVersion.VERSION_1_8
77
+ }
141
78
  }
142
79
 
143
- dependencies {
144
- //noinspection GradleDynamicVersion
145
- implementation 'com.facebook.react:react-native:+'
146
- implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
147
-
148
- implementation 'androidx.appcompat:appcompat:1.5.1'
149
- implementation 'androidx.appcompat:appcompat-resources:1.5.1'
150
- implementation 'com.google.android.gms:play-services-wallet:19.1.0'
151
- implementation 'androidx.core:core-ktx:1.9.0'
152
- implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0'
153
-
154
- implementation 'com.judopay:judokit-android:4.1.2'
155
-
156
- //JUnit 5
157
- testImplementation "org.junit.jupiter:junit-jupiter-api:$junit5_version"
158
- testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit5_version"
159
- testImplementation "org.junit.jupiter:junit-jupiter-params:$junit5_version"
160
- testRuntimeOnly "org.junit.vintage:junit-vintage-engine:$junit5_version"
161
-
162
- testImplementation 'androidx.test:core:1.5.0'
163
- testImplementation 'io.mockk:mockk:1.13.3'
164
- testImplementation 'android.arch.core:core-testing:1.1.1'
165
- }
166
-
167
- if (isNewArchitectureEnabled()) {
168
- react {
169
- jsRootDir = file("../src/")
170
- libraryName = "JudoKit-ReactNative"
171
- codegenJavaPackageName = "com.reactlibrary"
172
- }
173
- }
174
-
175
- task generateCodeAnalysisReport {
176
- group 'Reporting'
177
- description 'Start reporting code analysis tasks (Jacoco)'
178
- dependsOn ":jacocoTestReport"
80
+ repositories {
81
+ mavenCentral()
82
+ google()
179
83
  }
180
84
 
181
- task jacocoTestReport(type: JacocoReport, group: 'verification', description: 'Generate Jacoco Reports for all android variants')
85
+ def kotlin_version = getExtOrDefault("kotlinVersion")
86
+ def judokit_android_version = getExtOrDefault("judoKitAndroidVersion")
182
87
 
183
- project.afterEvaluate {
184
- def variants = android.hasProperty('libraryVariants') ? android.libraryVariants : android.applicationVariants
185
- variants.forEach {
186
- tasks.jacocoTestReport.dependsOn(addJacocoTask(it))
187
- }
88
+ dependencies {
89
+ // For < 0.71, this will be from the local maven repo
90
+ // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
91
+ //noinspection GradleDynamicVersion
92
+ implementation "com.facebook.react:react-native:+"
93
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
94
+ implementation "com.judopay:judokit-android:$judokit_android_version"
188
95
  }
189
96
 
190
- def addJacocoTask(variant) {
191
- def variantName = variant.name.capitalize()
192
- logger.info("Adding jacoco task for variant $variantName")
193
-
194
- // see https://docs.gradle.org/current/dsl/org.gradle.testing.jacoco.tasks.JacocoReport.html
195
- def taskName = "jacocoTestReport${variantName}"
196
- def foundTask = project.tasks.findByName(taskName)
197
- def jacocoTask = foundTask ? foundTask : project.tasks.create(taskName, JacocoReport)
198
-
199
- jacocoTask.dependsOn("test${variantName}UnitTest")
200
- jacocoTask.group = 'verification'
201
- jacocoTask.description = "Generate Jacoco Report for variant $variantName"
202
-
203
- jacocoTask.reports {
204
- csv.enabled false
205
- html.enabled true
206
- xml.enabled true
207
- }
208
-
209
- def excludedFiles = [
210
- '**/R.class',
211
- '**/R$*.class',
212
- '**/BuildConfig.*',
213
- '**/Manifest*.*',
214
- '**/*test*.*',
215
- 'android/**/*.*'
216
- ]
217
-
218
- def sourceDirectories = files(variant.sourceSets.java.srcDirs.flatten())
219
- def classDirectories = fileTree(dir: variant.javaCompileProvider.get().destinationDir, excludes: excludedFiles)
220
-
221
- if (project.plugins.hasPlugin("kotlin-android")) {
222
- sourceDirectories.from(files(variant.sourceSets.kotlin.srcDirs.flatten()))
223
- def kotlinTask = tasks.getByName("compile${variantName}Kotlin")
224
- if (kotlinTask) {
225
- classDirectories += fileTree(dir: kotlinTask.destinationDirectory, excludes: excludedFiles)
226
- }
227
- }
228
-
229
- jacocoTask.sourceDirectories.from = sourceDirectories
230
- jacocoTask.classDirectories.from = classDirectories
231
- jacocoTask.executionData.from = files("${buildDir}/jacoco/test${variantName}UnitTest.exec")
232
- jacocoTask
233
- }
@@ -1 +1,6 @@
1
- android.useAndroidX=true
1
+ JudoKitReactNative_kotlinVersion=1.7.0
2
+ JudoKitReactNative_minSdkVersion=21
3
+ JudoKitReactNative_targetSdkVersion=31
4
+ JudoKitReactNative_compileSdkVersion=31
5
+ JudoKitReactNative_ndkversion=21.4.7075529
6
+ JudoKitReactNative_judoKitAndroidVersion=4.2.1
@@ -1,3 +1,3 @@
1
- <manifest package="com.reactlibrary">
2
-
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
+ package="com.judopay.judokit.reactnative">
3
3
  </manifest>
@@ -0,0 +1,2 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+ </manifest>