From a9dce40ab45e2498e9b1ff6fe230ddb52be5a5d8 Mon Sep 17 00:00:00 2001 From: asklausen Date: Thu, 3 Oct 2024 12:02:04 +0100 Subject: [PATCH] DEP-461: Updates --- README.md | 9 ++++--- android/build.gradle | 4 +-- .../docscan/RNYotiDocScanModule.java | 7 +++++- ios/RNYotiDocScan.m | 25 ++++++++++++++----- package.json | 2 +- 5 files changed, 33 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index cd01030..c7302fe 100644 --- a/README.md +++ b/README.md @@ -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" } ``` @@ -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). diff --git a/android/build.gradle b/android/build.gradle index c933fdd..ce5c15f 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -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" } diff --git a/android/src/main/java/com/yoti/reactnative/docscan/RNYotiDocScanModule.java b/android/src/main/java/com/yoti/reactnative/docscan/RNYotiDocScanModule.java index e8106fa..8e4ba4b 100644 --- a/android/src/main/java/com/yoti/reactnative/docscan/RNYotiDocScanModule.java +++ b/android/src/main/java/com/yoti/reactnative/docscan/RNYotiDocScanModule.java @@ -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. } diff --git a/ios/RNYotiDocScan.m b/ios/RNYotiDocScan.m index 5484be6..8702bb9 100644 --- a/ios/RNYotiDocScan.m +++ b/ios/RNYotiDocScan.m @@ -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 @@ -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) { @@ -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) { diff --git a/package.json b/package.json index bc864a3..7a713ef 100644 --- a/package.json +++ b/package.json @@ -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",