Skip to content

Commit 21c93f8

Browse files
author
RN SDK Release User
committed
v1.3.3 release
1 parent 6b24c4e commit 21c93f8

File tree

11 files changed

+3774
-3053
lines changed

11 files changed

+3774
-3053
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## [1.3.3] - 2021-02-26
8+
9+
### Added:
10+
- Public: Added support for hide logo and cobranding enterprise features
11+
712
## [1.3.2] - 2020-09-29
813

914
### Fixed:

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ repositories {
101101
dependencies {
102102
//noinspection GradleDynamicVersion
103103
implementation 'com.facebook.react:react-native:+' // From node_modules
104-
implementation "com.onfido.sdk.capture:onfido-capture-sdk:7.2.0"
104+
implementation "com.onfido.sdk.capture:onfido-capture-sdk:9.0.0"
105105
implementation "com.squareup.okhttp3:logging-interceptor:3.8.0"
106106
implementation "com.squareup.okhttp3:okhttp:3.8.0"
107107
implementation "com.android.support:multidex:1.0.3"

android/src/main/java/com/onfido/reactnative/sdk/OnfidoSdkModule.java

Lines changed: 55 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import com.facebook.react.bridge.Arguments;
1717

1818
import com.onfido.android.sdk.capture.Onfido;
19+
import com.onfido.android.sdk.capture.EnterpriseFeatures;
1920
import com.onfido.android.sdk.capture.ui.options.FlowStep;
2021
import com.onfido.android.sdk.capture.OnfidoConfig;
2122
import com.onfido.android.sdk.capture.OnfidoFactory;
@@ -24,6 +25,7 @@
2425
import com.onfido.android.sdk.capture.DocumentType;
2526
import com.onfido.android.sdk.capture.utils.CountryCode;
2627
import com.onfido.android.sdk.capture.ui.options.CaptureScreenStep;
28+
import com.onfido.android.sdk.capture.errors.*;
2729

2830
public class OnfidoSdkModule extends ReactContextBaseJavaModule {
2931

@@ -77,23 +79,60 @@ public void start(final ReadableMap config, final Promise promise) {
7779
currentPromise = null;
7880
return;
7981
}
80-
82+
8183
Activity currentActivity = getCurrentActivityInParentClass();
8284
if (currentActivity == null) {
8385
currentPromise.reject("error", new Exception("Android activity does not exist"));
8486
currentPromise = null;
8587
return;
8688
}
87-
89+
8890
try {
89-
final OnfidoConfig onfidoConfig = OnfidoConfig.builder(currentActivity)
91+
/* Native SDK seems to have a bug that if an empty EnterpriseFeatures is passed to it,
92+
the logo will still be hidden, even if explicitly set to false */
93+
EnterpriseFeatures.Builder enterpriseFeaturesBuilder = EnterpriseFeatures.builder();
94+
boolean hasSetEnterpriseFeatures = false;
95+
96+
if (getBooleanFromConfig(config, "hideLogo")) {
97+
enterpriseFeaturesBuilder.withHideOnfidoLogo(true);
98+
hasSetEnterpriseFeatures = true;
99+
} else if (getBooleanFromConfig(config, "logoCobrand")) {
100+
int cobrandLogoLight = currentActivity.getApplicationContext().getResources().getIdentifier(
101+
"cobrand_logo_light",
102+
"drawable",
103+
currentActivity.getApplicationContext().getPackageName()
104+
);
105+
int cobrandLogoDark = currentActivity.getApplicationContext().getResources().getIdentifier(
106+
"cobrand_logo_dark",
107+
"drawable",
108+
currentActivity.getApplicationContext().getPackageName()
109+
);
110+
enterpriseFeaturesBuilder.withCobrandingLogo(cobrandLogoLight, cobrandLogoDark);
111+
hasSetEnterpriseFeatures = true;
112+
}
113+
114+
OnfidoConfig.Builder onfidoConfigBuilder = OnfidoConfig.builder(currentActivity)
90115
.withSDKToken(sdkToken)
91-
.withCustomFlow(flowStepsWithOptions)
92-
.build();
93-
client.startActivityForResult(currentActivity, 1, onfidoConfig);
116+
.withCustomFlow(flowStepsWithOptions);
117+
118+
if (hasSetEnterpriseFeatures) {
119+
onfidoConfigBuilder.withEnterpriseFeatures(enterpriseFeaturesBuilder.build());
120+
}
121+
122+
client.startActivityForResult(currentActivity, 1, onfidoConfigBuilder.build());
123+
}
124+
catch (final EnterpriseFeaturesInvalidLogoCobrandingException e) {
125+
currentPromise.reject("error", new EnterpriseFeaturesInvalidLogoCobrandingException());
126+
currentPromise = null;
127+
return;
128+
}
129+
catch (final EnterpriseFeatureNotEnabledException e) {
130+
currentPromise.reject("error", new EnterpriseFeatureNotEnabledException("logoCobrand"));
131+
currentPromise = null;
132+
return;
94133
}
95134
catch (final Exception e) {
96-
currentPromise.reject("error", new Exception("Failed to show Onfido page", e));
135+
currentPromise.reject("error", new Exception(e.getMessage(), e));
97136
currentPromise = null;
98137
return;
99138
}
@@ -112,7 +151,7 @@ public static String getSdkTokenFromConfig(final ReadableMap config) {
112151
return sdkToken;
113152
}
114153

115-
public static FlowStep[] getFlowStepsFromConfig(final ReadableMap config) throws Exception {
154+
public static FlowStep[] getFlowStepsFromConfig(final ReadableMap config) throws Exception {
116155
try {
117156

118157
final ReadableMap flowSteps = config.getMap("flowSteps");
@@ -123,10 +162,10 @@ public static FlowStep[] getFlowStepsFromConfig(final ReadableMap config) throws
123162
} else {
124163
welcomePageIsIncluded = false;
125164
}
126-
165+
127166
ReadableMap captureDocument = null;
128167
Boolean captureDocumentBoolean = null;
129-
168+
130169
// ReadableMap does not have a way to get multi-typed values without throwing exceptions.
131170
try {
132171
captureDocumentBoolean = flowSteps.getBoolean("captureDocument");
@@ -137,7 +176,7 @@ public static FlowStep[] getFlowStepsFromConfig(final ReadableMap config) throws
137176
captureDocument = null;
138177
}
139178
}
140-
179+
141180

142181
final List<FlowStep> flowStepList = new ArrayList<>();
143182

@@ -163,7 +202,7 @@ public static FlowStep[] getFlowStepsFromConfig(final ReadableMap config) throws
163202

164203
String countryCodeString = captureDocument.getString("countryCode");
165204
CountryCode countryCodeEnum = findCountryCodeByAlpha3(countryCodeString);
166-
205+
167206
if (countryCodeEnum ==null) {
168207
System.err.println("Unexpected countryCode value: [" + countryCodeString + "]");
169208
throw new Exception("Unexpected countryCode value.");
@@ -218,4 +257,8 @@ public static CountryCode findCountryCodeByAlpha3(String countryCodeString) {
218257
}
219258
return countryCode;
220259
}
260+
261+
private boolean getBooleanFromConfig(ReadableMap config, String key) {
262+
return config.hasKey(key) && config.getBoolean(key);
263+
}
221264
}

ios/OnfidoSdk.swift

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ public func buildOnfidoConfig(config:NSDictionary, appearance: Appearance) throw
9797
.withSDKToken(sdkToken)
9898
.withAppearance(appearance)
9999

100+
var enterpriseFeatures = EnterpriseFeatures.builder()
101+
100102
if let localisationConfig = config["localisation"] as? NSDictionary, let file = localisationConfig["ios_strings_file_name"] as? String {
101103
onfidoConfig = onfidoConfig.withCustomLocalization(andTableName: file)
102104
}
@@ -137,7 +139,18 @@ public func buildOnfidoConfig(config:NSDictionary, appearance: Appearance) throw
137139
throw NSError(domain: "Invalid or unsupported face variant", code: 0)
138140
}
139141
}
140-
return onfidoConfig;
142+
143+
if let hideLogo = config["hideLogo"] as? Bool {
144+
enterpriseFeatures.withHideOnfidoLogo(hideLogo)
145+
}
146+
147+
if config["logoCobrand"] as? Bool == true {
148+
enterpriseFeatures.withCobrandingLogo(UIImage(named: "cobrand-logo-light")!, cobrandingLogoDarkMode: UIImage(named: "cobrand-logo-dark")!)
149+
}
150+
151+
onfidoConfig.withEnterpriseFeatures(enterpriseFeatures.build())
152+
153+
return onfidoConfig;
141154
}
142155

143156
@objc(OnfidoSdk)

ios/OnfidoSdk.xcodeproj/project.pbxproj

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@
4848
3A9D42D42412F0110087A331 /* Response.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Response.swift; sourceTree = "<group>"; };
4949
3AFE501B2408521F00E21479 /* OnfidoSdk-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "OnfidoSdk-Bridging-Header.h"; sourceTree = "<group>"; };
5050
3AFE501C2408521F00E21479 /* OnfidoSdk.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OnfidoSdk.swift; sourceTree = "<group>"; };
51-
3F1E01B8CD9AA768D0D45FF1 /* Pods-OnfidoSdkTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OnfidoSdkTests.debug.xcconfig"; path = "Target Support Files/Pods-OnfidoSdkTests/Pods-OnfidoSdkTests.debug.xcconfig"; sourceTree = "<group>"; };
5251
49D38F6F9D324D1D7442717F /* Pods_OnfidoSdk_OnfidoSdkTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_OnfidoSdk_OnfidoSdkTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
53-
5D032EE3D8287942CAA34151 /* Pods-OnfidoSdkTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OnfidoSdkTests.release.xcconfig"; path = "Target Support Files/Pods-OnfidoSdkTests/Pods-OnfidoSdkTests.release.xcconfig"; sourceTree = "<group>"; };
5452
6DD905136FC7557A95EFF1C4 /* Pods-OnfidoSdk-OnfidoSdkTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OnfidoSdk-OnfidoSdkTests.release.xcconfig"; path = "Target Support Files/Pods-OnfidoSdk-OnfidoSdkTests/Pods-OnfidoSdk-OnfidoSdkTests.release.xcconfig"; sourceTree = "<group>"; };
5553
731FAC5B375A699FA470D705 /* Pods-OnfidoSdk.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OnfidoSdk.release.xcconfig"; path = "Target Support Files/Pods-OnfidoSdk/Pods-OnfidoSdk.release.xcconfig"; sourceTree = "<group>"; };
5654
8517ACCD244290D10077E909 /* OnfidoSdkTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OnfidoSdkTests.swift; sourceTree = "<group>"; };
@@ -105,8 +103,6 @@
105103
children = (
106104
8B8E5FE3BDE0C9C96B5FE8AB /* Pods-OnfidoSdk.debug.xcconfig */,
107105
731FAC5B375A699FA470D705 /* Pods-OnfidoSdk.release.xcconfig */,
108-
3F1E01B8CD9AA768D0D45FF1 /* Pods-OnfidoSdkTests.debug.xcconfig */,
109-
5D032EE3D8287942CAA34151 /* Pods-OnfidoSdkTests.release.xcconfig */,
110106
B78EF811082AE0A0FC0314D6 /* Pods-OnfidoSdk-OnfidoSdkTests.debug.xcconfig */,
111107
6DD905136FC7557A95EFF1C4 /* Pods-OnfidoSdk-OnfidoSdkTests.release.xcconfig */,
112108
);
@@ -239,7 +235,6 @@
239235
"${BUILT_PRODUCTS_DIR}/DoubleConversion/DoubleConversion.framework",
240236
"${BUILT_PRODUCTS_DIR}/FBReactNativeSpec/FBReactNativeSpec.framework",
241237
"${BUILT_PRODUCTS_DIR}/Folly/folly.framework",
242-
"${PODS_ROOT}/Onfido/Onfido.framework",
243238
"${BUILT_PRODUCTS_DIR}/RCTTypeSafety/RCTTypeSafety.framework",
244239
"${BUILT_PRODUCTS_DIR}/React-Core/React.framework",
245240
"${BUILT_PRODUCTS_DIR}/React-CoreModules/CoreModules.framework",
@@ -258,13 +253,13 @@
258253
"${BUILT_PRODUCTS_DIR}/ReactCommon/ReactCommon.framework",
259254
"${BUILT_PRODUCTS_DIR}/Yoga/yoga.framework",
260255
"${BUILT_PRODUCTS_DIR}/glog/glog.framework",
256+
"${PODS_XCFRAMEWORKS_BUILD_DIR}/Onfido/Onfido.framework/Onfido",
261257
);
262258
name = "[CP] Embed Pods Frameworks";
263259
outputPaths = (
264260
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DoubleConversion.framework",
265261
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FBReactNativeSpec.framework",
266262
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/folly.framework",
267-
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Onfido.framework",
268263
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTTypeSafety.framework",
269264
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/React.framework",
270265
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CoreModules.framework",
@@ -283,6 +278,7 @@
283278
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ReactCommon.framework",
284279
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/yoga.framework",
285280
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/glog.framework",
281+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Onfido.framework",
286282
);
287283
runOnlyForDeploymentPostprocessing = 0;
288284
shellPath = /bin/sh;

ios/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ platform :ios, '10.0'
44
target 'OnfidoSdk' do
55
# Comment the next line if you don't want to use dynamic frameworks
66
use_frameworks!
7-
pod 'Onfido', '18.6.0'
7+
pod 'Onfido', '20.1'
88

99
pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
1010
pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"

ios/Podfile.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ PODS:
1919
- DoubleConversion
2020
- glog
2121
- glog (0.3.5)
22-
- Onfido (18.6.0)
22+
- Onfido (20.1.0)
2323
- RCTRequired (0.62.2)
2424
- RCTTypeSafety (0.62.2):
2525
- FBLazyVector (= 0.62.2)
@@ -250,7 +250,7 @@ DEPENDENCIES:
250250
- FBReactNativeSpec (from `../node_modules/react-native/Libraries/FBReactNativeSpec`)
251251
- Folly (from `../node_modules/react-native/third-party-podspecs/Folly.podspec`)
252252
- glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`)
253-
- Onfido (= 18.6.0)
253+
- Onfido (= 20.1)
254254
- RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`)
255255
- RCTTypeSafety (from `../node_modules/react-native/Libraries/TypeSafety`)
256256
- React (from `../node_modules/react-native/`)
@@ -339,7 +339,7 @@ SPEC CHECKSUMS:
339339
FBReactNativeSpec: 5465d51ccfeecb7faa12f9ae0024f2044ce4044e
340340
Folly: 30e7936e1c45c08d884aa59369ed951a8e68cf51
341341
glog: 1f3da668190260b06b429bb211bfbee5cd790c28
342-
Onfido: 2b65d32be59eb9443dfcfb3c8e69d06663e5efb6
342+
Onfido: 116a268e4cb8b767c15285e8071c2e8304673cdf
343343
RCTRequired: cec6a34b3ac8a9915c37e7e4ad3aa74726ce4035
344344
RCTTypeSafety: 93006131180074cffa227a1075802c89a49dd4ce
345345
React: 29a8b1a02bd764fb7644ef04019270849b9a7ac3
@@ -361,6 +361,6 @@ SPEC CHECKSUMS:
361361
ReactCommon: ed4e11d27609d571e7eee8b65548efc191116eb3
362362
Yoga: 3ebccbdd559724312790e7742142d062476b698e
363363

364-
PODFILE CHECKSUM: 003198abd70d4a02ec28445bb8d36cb5a8a80228
364+
PODFILE CHECKSUM: 91fc748e3b079462313a0f9551bc1ef6ff26650a
365365

366-
COCOAPODS: 1.9.3
366+
COCOAPODS: 1.10.1

onfido-react-native-sdk.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Pod::Spec.new do |s|
2121
s.requires_arc = true
2222

2323
s.dependency "React"
24-
s.dependency "Onfido", "18.6.0"
24+
s.dependency "Onfido", "20.1.0"
2525
# ...
2626
# s.dependency "..."
2727
end

0 commit comments

Comments
 (0)