fidel-react-native 1.4.1 → 1.6.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 +13 -0
- package/README.md +20 -114
- package/android/build.gradle +2 -2
- package/android/src/main/java/com/fidelreactlibrary/FidelModule.java +10 -0
- package/android/src/main/java/com/fidelreactlibrary/adapters/FidelCountryAdapter.java +2 -0
- package/android/src/main/java/com/fidelreactlibrary/adapters/FidelOptionsAdapter.java +4 -0
- package/android/src/test/java/com/fidelreactlibrary/FidelCountryAdapterTests.java +0 -1
- package/ios/FLRNOptionsAdapter.m +6 -1
- package/ios/FLRNSDKOptions.h +10 -9
- package/ios/RCTConvert+Options.h +3 -1
- package/ios/RCTConvert+Options.m +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Fidel React Native bridge library change log
|
|
2
2
|
|
|
3
|
+
## 1.6.0
|
|
4
|
+
- Added the `defaultSelectedCountry` property which sets the country that will be selected by default, when opening the card enrollment screen.
|
|
5
|
+
|
|
6
|
+
## 1.5.0
|
|
7
|
+
- Remove card scanning confirmation screen.
|
|
8
|
+
|
|
9
|
+
## 1.4.3
|
|
10
|
+
- Add United Arab Emirates option as a country of issuance.
|
|
11
|
+
- Country label shrinks its font size, to fit longer country names, on smaller devices.
|
|
12
|
+
|
|
13
|
+
## 1.4.2
|
|
14
|
+
- Update Fidel Android SDK version to allow French & Swedish translations be available in more countries.
|
|
15
|
+
|
|
3
16
|
## 1.4.1
|
|
4
17
|
- Update Fidel & Android SDK versions.
|
|
5
18
|
- Prepare for the newest React Native versions.
|
package/README.md
CHANGED
|
@@ -7,21 +7,17 @@ This SDK is a bridge between React Native and Fidel's native iOS and Android SDK
|
|
|
7
7
|
|
|
8
8
|
## Getting started
|
|
9
9
|
|
|
10
|
-
`$ npm install fidel-react-native
|
|
10
|
+
`$ npm install fidel-react-native`
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
or
|
|
13
13
|
|
|
14
|
-
`$
|
|
14
|
+
`$ yarn add fidel-react-native`
|
|
15
15
|
|
|
16
16
|
### iOS
|
|
17
17
|
|
|
18
|
-
**1.**
|
|
18
|
+
**1.** Please make sure that the minimum platform is set to 9.1 in your Podfile: `platform :ios, '9.1'`.
|
|
19
19
|
|
|
20
|
-
`pod
|
|
21
|
-
|
|
22
|
-
**2.** Please make sure that the minimum platform is set to 9.1 in your Podfile: `platform :ios, '9.1'`.
|
|
23
|
-
|
|
24
|
-
**3.** Run `pod install`.
|
|
20
|
+
**2.** Run `pod install`.
|
|
25
21
|
|
|
26
22
|
### Android
|
|
27
23
|
|
|
@@ -48,109 +44,6 @@ buildscript {
|
|
|
48
44
|
}
|
|
49
45
|
```
|
|
50
46
|
|
|
51
|
-
## Manual linking
|
|
52
|
-
|
|
53
|
-
### iOS manual linking
|
|
54
|
-
|
|
55
|
-
#### Step 1: Add the Fidel React Native iOS project as a dependency
|
|
56
|
-
|
|
57
|
-
**1.** In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]`
|
|
58
|
-
|
|
59
|
-
**2.** Go to `node_modules` ➜ `fidel-react-native` and add `Fidel.xcodeproj`
|
|
60
|
-
|
|
61
|
-
**3.** In XCode, in the project navigator, select your project. Add `libFidel.a` to your project's `Build Phases` ➜ `Link Binary With Libraries`
|
|
62
|
-
|
|
63
|
-
**4.** Under your target's `Build Settings`, make sure to set `YES` for `Always Embed Swift Standard Libraries`. That's because, by default, your project might not need it. It needs to be `YES` because otherwise the project will not find the Swift libraries to be able to run our native iOS SDK.
|
|
64
|
-
|
|
65
|
-
#### Step 2: Add the Native iOS SDK as a dependency
|
|
66
|
-
|
|
67
|
-
You can use Cocoapods or install the library as a dynamic library.
|
|
68
|
-
|
|
69
|
-
**5.** Add a `Podfile` in your `ios/` folder of your React Native project. It should include the following dependency:
|
|
70
|
-
|
|
71
|
-
```ruby
|
|
72
|
-
use_frameworks!
|
|
73
|
-
pod 'Fidel'
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
Here is the simplest `Podfile` you need to link with our native iOS SDK:
|
|
77
|
-
|
|
78
|
-
```ruby
|
|
79
|
-
platform :ios, '9.1'
|
|
80
|
-
|
|
81
|
-
workspace 'example'
|
|
82
|
-
|
|
83
|
-
target 'example' do
|
|
84
|
-
use_frameworks!
|
|
85
|
-
pod 'Fidel'
|
|
86
|
-
end
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
**6.** If you use an older Swift version, you should install a different `Fidel` pod version. If your project uses Swift `4.2.1`, for example, your Podfile should include `pod Fidel, '~>1.4'`, *not* `pod 'Fidel'` (which installs the latest version of the latest Swift supported version). Please check our [iOS SDK README (step 1)](https://github.com/FidelLimited/fidel-ios#step-1). You'll find a suitable version you should set for our Fidel iOS SDK.
|
|
90
|
-
|
|
91
|
-
**7.** Run `pod install` in your terminal.
|
|
92
|
-
|
|
93
|
-
**8.** Make sure to use the new `.xcworkspace` created by Cocoapods when you run your iOS app. React Native should use it by default.
|
|
94
|
-
|
|
95
|
-
**9.** In order to allow scanning cards with the camera, make sure to add the key `NSCameraUsageDescription` to your iOS app `Info.plist` and set the value to a string describing why your app needs to use the camera (e.g. "To scan credit cards."). This string will be displayed when the app initially requests permission to access the camera.
|
|
96
|
-
|
|
97
|
-
### Android manual linking
|
|
98
|
-
|
|
99
|
-
**1.** Append the following lines to `android/settings.gradle`:
|
|
100
|
-
|
|
101
|
-
```java
|
|
102
|
-
include ':fidel-react-native'
|
|
103
|
-
project(':fidel-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/fidel-react-native/android')
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
**2.** Insert the following lines inside the dependencies block in `android/app/build.gradle`:
|
|
107
|
-
|
|
108
|
-
```java
|
|
109
|
-
implementation project(':fidel-react-native')
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
**3.** Append Jitpack to `android/build.gradle`:
|
|
113
|
-
|
|
114
|
-
```java
|
|
115
|
-
allprojects {
|
|
116
|
-
repositories {
|
|
117
|
-
...
|
|
118
|
-
maven { url "https://jitpack.io" }
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
**4.** Make sure that the `minSdkVersion` is the same or higher than the `minSdkVersion` of our native Android SDK:
|
|
124
|
-
|
|
125
|
-
```java
|
|
126
|
-
buildscript {
|
|
127
|
-
ext {
|
|
128
|
-
...
|
|
129
|
-
minSdkVersion = 19
|
|
130
|
-
...
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
**5.** Only for projects initialized with **RN <= 0.59**: Open up `android/app/src/main/java/[...]/MainApplication.java`
|
|
136
|
-
|
|
137
|
-
- Add `import com.fidelreactlibrary.FidelPackage;` to the imports at the top of the file
|
|
138
|
-
- Add `new FidelPackage()` to the list returned by the `getPackages()` method:
|
|
139
|
-
|
|
140
|
-
```java
|
|
141
|
-
protected List <ReactPackage> getPackages() {
|
|
142
|
-
return Arrays.<ReactPackage>asList(
|
|
143
|
-
new MainReactPackage(),
|
|
144
|
-
new FidelPackage(),
|
|
145
|
-
//you might have other Packages here as well.
|
|
146
|
-
);
|
|
147
|
-
}
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
**6.** Ensure that you have *Google Play Services* installed.
|
|
151
|
-
|
|
152
|
-
For a physical device you need to search on Google for *Google Play Services*. There will be a link that takes you to the Play Store and from there you will see a button to update it (*do not* search within the Play Store).
|
|
153
|
-
|
|
154
47
|
## How to use Fidel's React Native SDK
|
|
155
48
|
|
|
156
49
|
Import Fidel in your RN project:
|
|
@@ -188,6 +81,7 @@ const countries = [Fidel.Country.ireland, Fidel.Country.unitedStates];
|
|
|
188
81
|
Fidel.setOptions({
|
|
189
82
|
bannerImage: resolvedImage,
|
|
190
83
|
allowedCountries: countries,
|
|
84
|
+
defaultSelectedCountry: Fidel.Country.unitedStates,
|
|
191
85
|
supportedCardSchemes: Array.from(cardSchemes),
|
|
192
86
|
autoScan: false,
|
|
193
87
|
metaData: {'meta-data-1': 'value1'}, // additional data to pass with the card
|
|
@@ -288,7 +182,19 @@ Fidel.setOptions({
|
|
|
288
182
|
});
|
|
289
183
|
```
|
|
290
184
|
|
|
291
|
-
The possible options are: `.
|
|
185
|
+
The possible options are: `.canada`, `.ireland`, `.japan`, `.sweden`, `.unitedArabEmirates`, `.unitedKingdom`, `.unitedStates`. You can set one or multiple of these countries. If you don't set any allowed countries, the user will be able to choose any of the countries above. If you set only one country, the card linking screen will not show the country picker UI. Note that, when you set multiple countries, they will be displayed in the country picker UI in the order that you set them.
|
|
186
|
+
|
|
187
|
+
### defaultSelectedCountry
|
|
188
|
+
|
|
189
|
+
Use this parameter to set the country that will be selected by default when opening the card enrollment screen.
|
|
190
|
+
|
|
191
|
+
```javascript
|
|
192
|
+
Fidel.setOptions({
|
|
193
|
+
defaultSelectedCountry: Fidel.Country.unitedKingdom
|
|
194
|
+
});
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
The possible options are: `.canada`, `.ireland`, `.japan`, `.sweden`, `.unitedArabEmirates`, `.unitedKingdom`, `.unitedStates`. The `defaultSelectedCountry` has to be part of the `allowedCountries` list. The default value of this option is `.unitedKingdom`.
|
|
292
198
|
|
|
293
199
|
### supportedCardSchemes
|
|
294
200
|
|
|
@@ -455,7 +361,7 @@ If you do not set a ```privacyUrl```, the text will become _in accordance with t
|
|
|
455
361
|
|
|
456
362
|
### Consent text for the rest of the world
|
|
457
363
|
|
|
458
|
-
When you set
|
|
364
|
+
When you set Ireland, Japan , Sweden, United Arab Emirates or United Kingdom as allowed countries or the user selects one of these countries from the list, a consent text specific for these countries will be applied.
|
|
459
365
|
|
|
460
366
|
The following would be an example Terms & Conditions text for ```Cashback Inc``` (an example company):
|
|
461
367
|
|
package/android/build.gradle
CHANGED
|
@@ -20,7 +20,7 @@ android {
|
|
|
20
20
|
minSdkVersion 21
|
|
21
21
|
targetSdkVersion 30
|
|
22
22
|
versionCode 1
|
|
23
|
-
versionName "1.0"
|
|
23
|
+
versionName "1.6.0"
|
|
24
24
|
}
|
|
25
25
|
lintOptions {
|
|
26
26
|
abortOnError false
|
|
@@ -39,7 +39,7 @@ repositories {
|
|
|
39
39
|
|
|
40
40
|
dependencies {
|
|
41
41
|
implementation 'com.facebook.react:react-native:+'
|
|
42
|
-
implementation 'com.github.FidelLimited:android-sdk:1.
|
|
42
|
+
implementation 'com.github.FidelLimited:android-sdk:1.7.0'
|
|
43
43
|
|
|
44
44
|
testImplementation 'junit:junit:4.13.2'
|
|
45
45
|
testImplementation 'androidx.test.ext:junit:1.1.2'
|
|
@@ -50,6 +50,16 @@ public class FidelModule extends ReactContextBaseJavaModule {
|
|
|
50
50
|
return "NativeFidelBridge";
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
@ReactMethod
|
|
54
|
+
public void addListener(String eventName) {
|
|
55
|
+
// Keep: Required for RN built in Event Emitter Calls.
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@ReactMethod
|
|
59
|
+
public void removeListeners(Integer count) {
|
|
60
|
+
// Keep: Required for RN built in Event Emitter Calls.
|
|
61
|
+
}
|
|
62
|
+
|
|
53
63
|
@ReactMethod
|
|
54
64
|
public void openForm(Callback callback) {
|
|
55
65
|
final Activity activity = getCurrentActivity();
|
|
@@ -15,6 +15,7 @@ public final class FidelCountryAdapter implements CountryAdapter {
|
|
|
15
15
|
|
|
16
16
|
private static final String UNITED_KINGDOM_COUNTRY_KEY = "unitedKingdom";
|
|
17
17
|
private static final String UNITED_STATES_COUNTRY_KEY = "unitedStates";
|
|
18
|
+
private static final String UNITED_ARAB_EMIRATES_KEY = "unitedArabEmirates";
|
|
18
19
|
private static final String JAPAN_COUNTRY_KEY = "japan";
|
|
19
20
|
private static final String SWEDEN_COUNTRY_KEY = "sweden";
|
|
20
21
|
private static final String IRELAND_COUNTRY_KEY = "ireland";
|
|
@@ -26,6 +27,7 @@ public final class FidelCountryAdapter implements CountryAdapter {
|
|
|
26
27
|
switch (country) {
|
|
27
28
|
case UNITED_KINGDOM: return UNITED_KINGDOM_COUNTRY_KEY;
|
|
28
29
|
case UNITED_STATES: return UNITED_STATES_COUNTRY_KEY;
|
|
30
|
+
case UNITED_ARAB_EMIRATES: return UNITED_ARAB_EMIRATES_KEY;
|
|
29
31
|
case JAPAN: return JAPAN_COUNTRY_KEY;
|
|
30
32
|
case SWEDEN: return SWEDEN_COUNTRY_KEY;
|
|
31
33
|
case IRELAND: return IRELAND_COUNTRY_KEY;
|
|
@@ -30,6 +30,7 @@ public final class FidelOptionsAdapter implements DataProcessor<ReadableMap>, Da
|
|
|
30
30
|
public static final String TERMS_CONDITIONS_URL_KEY = "termsConditionsUrl";
|
|
31
31
|
public static final String META_DATA_KEY = "metaData";
|
|
32
32
|
public static final String ALLOWED_COUNTRIES_KEY = "allowedCountries";
|
|
33
|
+
public static final String DEFAULT_SELECTED_COUNTRY_KEY = "defaultSelectedCountry";
|
|
33
34
|
public static final String CARD_SCHEMES_KEY = "supportedCardSchemes";
|
|
34
35
|
public static final List<String> OPTION_KEYS = Collections.unmodifiableList(
|
|
35
36
|
Arrays.asList(
|
|
@@ -89,6 +90,9 @@ public final class FidelOptionsAdapter implements DataProcessor<ReadableMap>, Da
|
|
|
89
90
|
if (valueIsValidFor(data, ALLOWED_COUNTRIES_KEY)) {
|
|
90
91
|
Fidel.allowedCountries = countryAdapter.parseAllowedCountries(data.getArray(ALLOWED_COUNTRIES_KEY));
|
|
91
92
|
}
|
|
93
|
+
if (valueIsValidFor(data, DEFAULT_SELECTED_COUNTRY_KEY)) {
|
|
94
|
+
Fidel.defaultSelectedCountry = countryAdapter.countryWithInteger(data.getInt(DEFAULT_SELECTED_COUNTRY_KEY));
|
|
95
|
+
}
|
|
92
96
|
if (data.hasKey(CARD_SCHEMES_KEY)) {
|
|
93
97
|
Fidel.supportedCardSchemes = cardSchemesAdapter.cardSchemesWithReadableArray(data.getArray(CARD_SCHEMES_KEY));
|
|
94
98
|
}
|
package/ios/FLRNOptionsAdapter.m
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
#import "FLRNCardSchemesAdapter.h"
|
|
19
19
|
#import "RCTConvert+Options.h"
|
|
20
20
|
|
|
21
|
-
#define FLCountryValues @{@"unitedKingdom" : @(FLCountryUnitedKingdom), @"ireland" : @(FLCountryIreland), @"unitedStates" : @(FLCountryUnitedStates), @"sweden" : @(FLCountrySweden), @"japan" : @(FLCountryJapan), @"canada" : @(FLCountryCanada)}
|
|
21
|
+
#define FLCountryValues @{@"unitedArabEmirates" : @(FLCountryUnitedArabEmirates), @"unitedKingdom" : @(FLCountryUnitedKingdom), @"ireland" : @(FLCountryIreland), @"unitedStates" : @(FLCountryUnitedStates), @"sweden" : @(FLCountrySweden), @"japan" : @(FLCountryJapan), @"canada" : @(FLCountryCanada)}
|
|
22
22
|
|
|
23
23
|
@interface FLRNOptionsAdapter()
|
|
24
24
|
|
|
@@ -62,6 +62,11 @@ NSString *const kOptionKey = @"Option";
|
|
|
62
62
|
FLFidel.objc_allowedCountries = (NSArray<NSNumber *> *) rawData;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
if ([self valueIsValidFor:kDefaultSelectedCountryOptionKey fromDictionary:options]) {
|
|
66
|
+
id rawData = options[kDefaultSelectedCountryOptionKey];
|
|
67
|
+
FLFidel.defaultSelectedCountry = [((NSNumber *) rawData) integerValue];
|
|
68
|
+
}
|
|
69
|
+
|
|
65
70
|
if ([self valueIsValidFor:kAutoScanOptionKey fromDictionary:options]) {
|
|
66
71
|
FLFidel.autoScan = [options[kAutoScanOptionKey] boolValue];
|
|
67
72
|
}
|
package/ios/FLRNSDKOptions.h
CHANGED
|
@@ -10,14 +10,15 @@
|
|
|
10
10
|
|
|
11
11
|
typedef NS_ENUM(NSUInteger, FLSDKOption) {
|
|
12
12
|
FLSDKOptionBannerImage = 0,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
FLSDKOptionAllowedCountries = 1,
|
|
14
|
+
FLSDKOptionDefaultSelectedCountry = 2,
|
|
15
|
+
FLSDKOptionAutoScan = 3,
|
|
16
|
+
FLSDKOptionMetaData = 4,
|
|
17
|
+
FLSDKOptionCompanyName = 5,
|
|
18
|
+
FLSDKOptionProgramName = 6,
|
|
19
|
+
FLSDKOptionDeleteInstructions = 7,
|
|
20
|
+
FLSDKOptionPrivacyURL = 8,
|
|
21
|
+
FLSDKOptionTermsConditionsURL = 9,
|
|
22
|
+
FLSDKOptionCardSchemes = 10,
|
|
22
23
|
FLSDKOptionUnexistent = NSUIntegerMax
|
|
23
24
|
};
|
package/ios/RCTConvert+Options.h
CHANGED
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
#define FLSDKOptionValues\
|
|
21
21
|
@{\
|
|
22
22
|
kBannerImageOptionKey: @(FLSDKOptionBannerImage), \
|
|
23
|
-
kAllowedCountriesOptionKey: @(
|
|
23
|
+
kAllowedCountriesOptionKey: @(FLSDKOptionAllowedCountries), \
|
|
24
|
+
kDefaultSelectedCountryOptionKey: @(FLSDKOptionDefaultSelectedCountry), \
|
|
24
25
|
kAutoScanOptionKey: @(FLSDKOptionAutoScan),\
|
|
25
26
|
kMetaDataOptionKey: @(FLSDKOptionMetaData), \
|
|
26
27
|
kCompanyNameOptionKey: @(FLSDKOptionCompanyName), \
|
|
@@ -33,6 +34,7 @@
|
|
|
33
34
|
|
|
34
35
|
FOUNDATION_EXPORT NSString *const kBannerImageOptionKey;
|
|
35
36
|
FOUNDATION_EXPORT NSString *const kAllowedCountriesOptionKey;
|
|
37
|
+
FOUNDATION_EXPORT NSString *const kDefaultSelectedCountryOptionKey;
|
|
36
38
|
FOUNDATION_EXPORT NSString *const kAutoScanOptionKey;
|
|
37
39
|
FOUNDATION_EXPORT NSString *const kMetaDataOptionKey;
|
|
38
40
|
FOUNDATION_EXPORT NSString *const kCompanyNameOptionKey;
|
package/ios/RCTConvert+Options.m
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
NSString *const kBannerImageOptionKey = @"bannerImage";
|
|
12
12
|
NSString *const kAllowedCountriesOptionKey = @"allowedCountries";
|
|
13
|
+
NSString *const kDefaultSelectedCountryOptionKey = @"defaultSelectedCountry";
|
|
13
14
|
NSString *const kAutoScanOptionKey = @"autoScan";
|
|
14
15
|
NSString *const kMetaDataOptionKey = @"metaData";
|
|
15
16
|
NSString *const kCompanyNameOptionKey = @"companyName";
|