Skip to content

Commit 780305b

Browse files
author
RN SDK Release User
committed
v15.2.0 release
1 parent cf9371e commit 780305b

File tree

13 files changed

+124
-19
lines changed

13 files changed

+124
-19
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## Future version
99

10+
## [15.2.0] - 2025-09-12
11+
12+
### Added:
13+
14+
- Support for Generic Document
15+
16+
### Changed:
17+
18+
- Updated underlying Onfido native SDK version:
19+
- Android 23.2.x (up from 23.1.x)
20+
21+
## [15.1.0] - 2025-09-03
22+
1023
### Fixed:
1124

1225
- Fixed Kosovo XKX country code support

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,9 +580,13 @@ export default class App extends Component {
580580
* **`proofOfAddress`**: **Optional**. This toggles the proof of address screen on or off. If omitted, this screen does not appear in the flow. Valid values are `true` or `false`
581581
* **`captureDocument`**: **Optional**. This object contains configurations for the document capture screen. If `docType` and `countryCode` are not specified, a screen will appear allowing the user to choose the document type and issuing country. If all parameters are not specified or the step is omitted, this screen will not appear in the flow.
582582
* **`docType`**: **Required** if `countryCode` is specified.
583-
* Valid values in `OnfidoDocumentType`: `PASSPORT`, `DRIVING_LICENCE`, `NATIONAL_IDENTITY_CARD`, `RESIDENCE_PERMIT`, `RESIDENCE_PERMIT`, `VISA`, `WORK_PERMIT`. <br>
583+
* Valid values in `OnfidoDocumentType`: `PASSPORT`, `DRIVING_LICENCE`, `NATIONAL_IDENTITY_CARD`, `RESIDENCE_PERMIT`, `RESIDENCE_PERMIT`, `VISA`, `WORK_PERMIT`, `GENERIC`. <br>
584584
* **`countryCode`**: **Required** if `docType` is specified.
585585
* Valid values in `OnfidoCountryCode`: Any ISO 3166-1 alpha-3 code. For example: `OnfidoCountryCode.USA`.
586+
* **`pages`**: **Required** if `docType` is `GENERIC`, will have no effect otherwise.
587+
* Valid values in `OnfidoDocumentPages`: `SINGLE`, `FRONT_AND_BACK`.
588+
* **`title`**: **Required** if `docType` is `GENERIC`, will have no effect otherwise.
589+
* This is used to specify the type of document, any string is permitted here. (`Tax Id`, `Voter Id`, etc.)
586590
* **`allowedDocumentTypes`**: **Optional**. If specified, `docType` and `countryCode` must not be specified. This parameter allows you to specify a list of document types that can be selected for all available issuing countries.
587591
* Valid values in `OnfidoDocumentType`: `PASSPORT`, `DRIVING_LICENCE`, `NATIONAL_IDENTITY_CARD`, `RESIDENCE_PERMIT`, `RESIDENCE_PERMIT`, `VISA`, `WORK_PERMIT`.
588592
* **`captureFace`**: **Optional**. This object contains configuration options for the face capture screen. If omitted, this screen does not appear in the flow.

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
def DEFAULT_COMPILE_SDK_VERSION = 34
1414
def DEFAULT_MIN_SDK_VERSION = 21
1515
def DEFAULT_TARGET_SDK_VERSION = 34
16-
def NATIVE_ANDROID_SDK_VERSION = "23.1.+"
16+
def NATIVE_ANDROID_SDK_VERSION = "23.2.+"
1717

1818
def safeExtGet(prop, fallback) {
1919
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback

android/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88

99
<meta-data
1010
android:name="onfido_integration_version"
11-
android:value="15.1.0" />
11+
android:value="15.2.0" />
1212
</application>
1313
</manifest>

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

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import com.onfido.android.sdk.capture.analytics.OnfidoAnalyticsEventListener;
2424
import com.onfido.android.sdk.capture.config.BiometricTokenCallback;
2525
import com.onfido.android.sdk.capture.config.MediaCallback;
26+
import com.onfido.android.sdk.capture.document.DocumentPages;
2627
import com.onfido.android.sdk.capture.errors.EnterpriseFeatureNotEnabledException;
2728
import com.onfido.android.sdk.capture.errors.EnterpriseFeaturesInvalidLogoCobrandingException;
2829
import com.onfido.android.sdk.capture.model.NFCOptions;
@@ -437,11 +438,32 @@ private static void extractDocTypeAndCountryForCaptureStep(
437438
String countryCodeString = captureDocument.getString("alpha2CountryCode");
438439
CountryCode countryCodeEnum = findCountryCodeByAlpha2(countryCodeString);
439440

440-
if (countryCodeEnum == null) {
441-
System.err.println("Unexpected countryCode value: [" + countryCodeString + "]");
442-
throw new Exception("Unexpected countryCode value.");
443-
}
444-
flowStepList.add(getFlowStep(docTypeEnum, countryCodeEnum));
441+
if (countryCodeEnum == null) {
442+
System.err.println("Unexpected countryCode value: [" + countryCodeString + "]");
443+
throw new Exception("Unexpected countryCode value.");
444+
}
445+
446+
if (docTypeString.equals("GENERIC")) {
447+
final boolean pagesExists = captureDocument.hasKey("pages");
448+
449+
if (pagesExists) {
450+
String pagesString = captureDocument.getString("pages");
451+
try {
452+
DocumentPages documentPagesEnum = DocumentPages.valueOf(pagesString);
453+
flowStepList.add(
454+
DocumentCaptureStepBuilder
455+
.forGenericDocument()
456+
.withCountry(countryCodeEnum)
457+
.withDocumentPages(documentPagesEnum)
458+
.build()
459+
);
460+
} catch (IllegalArgumentException e) {
461+
throw new IllegalArgumentException("Unsupported pages value: " + pagesString);
462+
}
463+
}
464+
} else {
465+
flowStepList.add(getFlowStep(docTypeEnum, countryCodeEnum));
466+
}
445467
}
446468

447469
private static FlowStep getFlowStep(

ios/OnfidoConfigBuilder.swift

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,19 @@ struct OnfidoConfigBuilder {
149149
type: .workPermit(config: WorkPermitConfiguration(country: countryCode))
150150
)
151151
case .generic:
152-
builder.withDocumentStep(
153-
type: .generic(config: GenericDocumentConfiguration(country: countryCode))
154-
)
152+
if let title = steps.captureDocument?.title,
153+
let pages = steps.captureDocument?.pages {
154+
switch pages {
155+
case .single:
156+
builder.withDocumentStep(
157+
type: .generic(config: try GenericDocumentConfiguration(title: title, country: countryCode, pages: .single))
158+
)
159+
case .frontAndBack:
160+
builder.withDocumentStep(
161+
type: .generic(config: try GenericDocumentConfiguration(title: title, country: countryCode, pages: .frontAndBack))
162+
)
163+
}
164+
}
155165
}
156166

157167
} else if let allowedDocumentTypes = steps.captureDocument?.allowedDocumentTypes {

ios/OnfidoPluginConfig.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ struct OnfidoCaptureDocument: Codable {
3131
let alpha2CountryCode: String?
3232
let docType: OnfidoDocumentType?
3333
let allowedDocumentTypes: [OnfidoDocumentType]?
34+
let pages: OnfidoDocumentPages?
35+
let title: String?
3436
}
3537

3638
struct OnfidoCaptureFace: Codable {
@@ -64,6 +66,11 @@ enum OnfidoDocumentType: String, Codable {
6466
case generic = "GENERIC"
6567
}
6668

69+
enum OnfidoDocumentPages: String, Codable {
70+
case single = "SINGLE"
71+
case frontAndBack = "FRONT_AND_BACK"
72+
}
73+
6774
enum OnfidoCaptureType: String, Codable {
6875
case photo = "PHOTO"
6976
case video = "VIDEO"

ios/OnfidoSdkTests/OnfidoSdkTests.swift

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,14 @@ class OnfidoSdkTests : XCTestCase {
4141
sdkToken: "demo",
4242
workflowRunId: nil,
4343
flowSteps: .init(captureDocument: .init(
44-
.init(countryCode: nil, alpha2CountryCode: nil, docType: nil, allowedDocumentTypes: nil))
44+
.init(
45+
countryCode: nil,
46+
alpha2CountryCode: nil,
47+
docType: nil,
48+
allowedDocumentTypes: nil,
49+
pages: nil,
50+
title: nil
51+
))
4552
),
4653
localisation: nil,
4754
theme: nil,
@@ -81,7 +88,9 @@ class OnfidoSdkTests : XCTestCase {
8188
countryCode: "USA",
8289
alpha2CountryCode: "US",
8390
docType: .drivingLicence,
84-
allowedDocumentTypes: nil
91+
allowedDocumentTypes: nil,
92+
pages: nil,
93+
title: nil
8594
)
8695
),
8796
captureFace: .init(
@@ -134,7 +143,9 @@ class OnfidoSdkTests : XCTestCase {
134143
countryCode: "USA",
135144
alpha2CountryCode: "US",
136145
docType: .drivingLicence,
137-
allowedDocumentTypes: nil
146+
allowedDocumentTypes: nil,
147+
pages: nil,
148+
title: nil
138149
)
139150
),
140151
captureFace: .init(
@@ -190,7 +201,9 @@ class OnfidoSdkTests : XCTestCase {
190201
.passport,
191202
.nationalIdentityCard,
192203
.residencePermit
193-
]
204+
],
205+
pages: nil,
206+
title: nil
194207
)
195208
)),
196209
localisation: nil,
@@ -235,7 +248,9 @@ class OnfidoSdkTests : XCTestCase {
235248
.nationalIdentityCard,
236249
.residencePermit,
237250
.drivingLicence
238-
]
251+
],
252+
pages: nil,
253+
title: nil
239254
)
240255
)),
241256
localisation: nil,

ios/PluginMetadata.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ - (instancetype)init
1313
self = [super init];
1414
if (self) {
1515
_pluginPlatform = @"react-native";
16-
_pluginVersion = @"15.1.0";
16+
_pluginVersion = @"15.2.0";
1717
}
1818
return self;
1919
}

js/Onfido.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
OnfidoCaptureType,
55
OnfidoConfig,
66
OnfidoCountryCode,
7+
OnfidoDocumentPages,
78
OnfidoDocumentType,
89
OnfidoError,
910
OnfidoMediaResult,
@@ -66,6 +67,16 @@ const Onfido = {
6667
return configError("docType is invalid");
6768
}
6869

70+
if (config.flowSteps.captureDocument.docType === OnfidoDocumentType.GENERIC) {
71+
if (!config.flowSteps.captureDocument.title) {
72+
return configError("title is required for GENERIC docType");
73+
}
74+
75+
if (!config.flowSteps.captureDocument.pages || !(config.flowSteps.captureDocument.pages in OnfidoDocumentPages)) {
76+
return configError("pages is required and must one of OnfidoDocumentPages for GENERIC docType");
77+
}
78+
}
79+
6980

7081
if (config.flowSteps.captureDocument.countryCode) {
7182
if (!(config.flowSteps.captureDocument.countryCode in OnfidoCountryCode)) {

0 commit comments

Comments
 (0)