Skip to content

Commit

Permalink
DEP-461: Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
asklausen committed Oct 3, 2024
1 parent a2e118c commit a9dce40
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 14 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ To integrate with Yoti IDV, a working infrastructure is needed (see [developers.

## Requirements
- [Android SDK 3+](https://github.com/getyoti/yoti-doc-scan-android/releases)
- [iOS SDK 5+](https://github.com/getyoti/yoti-doc-scan-ios/releases)
- [iOS SDK 6+](https://github.com/getyoti/yoti-doc-scan-ios/releases)

## Integration
Start your integration by adding the following dependency to your `package.json` file:
```json
"dependencies": {
"@getyoti/yoti-doc-scan-react-native": "^3.0.0"
"@getyoti/yoti-doc-scan-react-native": "^4.0.0"
}
```

Expand Down Expand Up @@ -108,9 +108,10 @@ RNYotiDocScan.startSession(id, token, successCallback, errorCallback);
```
### 3. Customizations
On iOS, you can set the primary color using the following API:
On iOS, you can set the primary colors using the following API:
```javascript
RNYotiDocScan.setPrimaryColorRGB(0, 0, 0); // default: (40, 117, 188)
RNYotiDocScan.setLightPrimaryColorRGB(0, 0, 0); // default: (40, 117, 188)
RNYotiDocScan.setDarkPrimaryColorRGB(0, 0, 0); // default: (145, 190, 255)
```
To customize the colors on Android, please refer to its separate [documentation](https://github.com/getyoti/yoti-doc-scan-android#colours).
Expand Down
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', 21)
targetSdkVersion safeExtGet('targetSdkVersion', 33)
versionCode 301
versionName "3.0.1"
versionCode 400
versionName "4.0.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ public void useCanadaService() {
}

@ReactMethod
public void setPrimaryColorRGB(double red, double green, double blue) {
public void setLightPrimaryColorRGB(double red, double green, double blue) {
// Required to maintain cross-platform API compatibility.
}

@ReactMethod
public void setDarkPrimaryColorRGB(double red, double green, double blue) {
// Required to maintain cross-platform API compatibility.
}

Expand Down
25 changes: 19 additions & 6 deletions ios/RNYotiDocScan.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ @interface RNYotiDocScan()
@property (nonatomic, strong) NSString *sessionID;
@property (nonatomic, strong) NSString *sessionToken;
@property (nonatomic, assign) BOOL setUpCanadaServerLocation;
@property (nonatomic, strong) UIColor *primaryColor;
@property (nonatomic, strong) UIColor *lightPrimaryColor;
@property (nonatomic, strong) UIColor *darkPrimaryColor;
@property (nonatomic, strong) RCTResponseSenderBlock errorCallback;
@property (nonatomic, strong) RCTResponseSenderBlock successCallback;
@end
Expand All @@ -36,8 +37,12 @@ @implementation RNYotiDocScan
_setUpCanadaServerLocation = YES;
}

RCT_EXPORT_METHOD(setPrimaryColorRGB:(double)red green:(double)green blue:(double)blue) {
_primaryColor = [UIColor colorWithRed:red/255.0 green:green/255.0 blue:blue/255.0 alpha:1.0];
RCT_EXPORT_METHOD(setLightPrimaryColorRGB:(double)red green:(double)green blue:(double)blue) {
_lightPrimaryColor = [UIColor colorWithRed:red/255.0 green:green/255.0 blue:blue/255.0 alpha:1.0];
}

RCT_EXPORT_METHOD(setDarkPrimaryColorRGB:(double)red green:(double)green blue:(double)blue) {
_darkPrimaryColor = [UIColor colorWithRed:red/255.0 green:green/255.0 blue:blue/255.0 alpha:1.0];
}

RCT_EXPORT_METHOD(setRequestCode:(NSNumber * _Nonnull)requestCode) {
Expand Down Expand Up @@ -98,14 +103,22 @@ - (BOOL)isReactNativeClientFor:(YotiSDKNavigationController * _Nonnull)navigatio
}

// MARK: - YotiSDKDelegate
- (UIColor * _Nonnull)primaryColorFor:(YotiSDKNavigationController * _Nonnull)navigationController {
if (_primaryColor != nil) {
return _primaryColor;
- (UIColor * _Nonnull)lightPrimaryColorFor:(YotiSDKNavigationController * _Nonnull)navigationController {
if (_lightPrimaryColor != nil) {
return _lightPrimaryColor;
} else {
return [UIColor colorWithRed:40.0/255.0 green:117.0/255.0 blue:188.0/255.0 alpha:1.0];
}
}

- (UIColor * _Nonnull)darkPrimaryColorFor:(YotiSDKNavigationController * _Nonnull)navigationController {
if (_darkPrimaryColor != nil) {
return _darkPrimaryColor;
} else {
return [UIColor colorWithRed:145.0/255.0 green:190.0/255.0 blue:255.0/255.0 alpha:1.0];
}
}

- (void)navigationController:(YotiSDKNavigationController * _Nonnull)navigationController didFinishWithStatusCode:(NSInteger)statusCode {
[_rootViewController dismissViewControllerAnimated:YES completion:nil];
if (statusCode == kYotiSuccessStatusCode) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "https://www.yoti.com/terms/identity-verification",
"author": "Yoti Ltd",
"main": "RNYotiDocScan.js",
"version": "3.0.1",
"version": "4.0.0",
"devDependencies": {
"react": "^17.0.2",
"react-dom": "^17.0.2",
Expand Down

0 comments on commit a9dce40

Please sign in to comment.