Skip to content

Commit a76c2fc

Browse files
author
RN SDK Release User
committed
v10.1.0 release
1 parent 12b48e5 commit a76c2fc

File tree

13 files changed

+219
-61
lines changed

13 files changed

+219
-61
lines changed

README.md

Lines changed: 91 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,11 @@ config = {
474474
},
475475
}
476476
```
477+
* `theme`: The theme in which Onfido SDK is displayed. By default, the user's active device theme will be
478+
automatically applied to the Onfido SDK. However, you can opt out from dynamic theme switching at run time
479+
and instead set a theme statically at the build time as shown below. In this case, the flow will always be in displayed
480+
in the selected theme regardless of the user's device theme.
481+
* Valid values in `OnfidoTheme`: `AUTOMATIC`, `LIGHT`, `DARK`.
477482

478483
### 3. Success Response
479484

@@ -612,52 +617,93 @@ Finally, as you are testing with the sandbox token, please be aware that the res
612617

613618
### Android
614619

615-
You can customize the SDK's appearance by overriding `OnfidoActivityTheme` in `app/src/main/res/values/styles.xml` or `app/src/main/res/values/themes.xml` in the `android` directory of your project. Make sure to set `OnfidoBaseActivityTheme` as the parent of `OnfidoActivityTheme` in your style definition.
620+
Onfido SDK supports the dark theme. By default, the user's active device theme will be
621+
automatically applied to the Onfido SDK. However, you can opt out from dynamic theme switching at run time
622+
and instead set a theme statically at the build time. In this case, the flow will always be in displayed
623+
in the selected theme regardless of the user's device theme. To set a static theme, use the `theme` parameter in the SDK
624+
initialization config. The value type should be `OnfidoTheme`.
625+
Valid values in `OnfidoTheme` are: `AUTOMATIC` (default value), `LIGHT`, `DARK`.
626+
627+
You can customize the SDK's appearance by overriding Onfido's light and dark themes (`OnfidoActivityTheme` and `OnfidoDarkTheme`)
628+
in `app/src/main/res/values/styles.xml` or `app/src/main/res/values/themes.xml` in the `android` directory of your project.
629+
Make sure to set `OnfidoBaseActivityTheme` as the parent of `OnfidoActivityTheme` and `OnfidoBaseDarkTheme` as the parent of `OnfidoDarkTheme` in your style definition.
616630

617631
You can use the following snippet as an example:
618632

619633
```xml
634+
<!-- Light theme -->
620635
<style name="OnfidoActivityTheme" parent="OnfidoBaseActivityTheme">
621-
<!--
622-
All colors referenced in this theme should be defined in your colors.xml.
623-
Alternatively, you can use hexadecimal color values directly in this theme.
624-
-->
625-
<item name="onfidoColorToolbarBackground">@color/brand_dark_blue</item>
626-
<item name="colorPrimary">@color/brand_dark_blue</item>
627-
<item name="colorPrimaryDark">@color/brand_transparent</item>
628-
<item name="colorAccent">@color/brand_accent_color</item>
629-
630-
<!--
631-
All referenced fonts need to be added to your project first.
632-
See https://developer.android.com/develop/ui/views/text-and-emoji/fonts-in-xml
633-
-->
634-
<item name="onfidoFontFamilyTitle">@font/montserrat_semibold</item>
635-
<item name="onfidoFontFamilyBody">@font/font_montserrat</item>
636-
<item name="onfidoFontFamilyButton">@font/font_montserrat</item>
637-
<item name="onfidoFontFamilyDialogButton">@font/font_montserrat</item>
636+
<item name="onfidoColorToolbarBackground">@color/brand_dark_blue</item>
637+
<item name="onfidoColorActionMain">@color/brand_accent_color</item>
638+
</style>
639+
640+
<!-- Dark theme -->
641+
<style name="OnfidoDarkTheme" parent="OnfidoBaseDarkTheme">
642+
<item name="onfidoColorToolbarBackground">@color/brand_dark_blue</item>
643+
<item name="onfidoColorActionMain">@color/brand_accent_color</item>
638644
</style>
639645
```
640646

641647
The following attributes are currently supported:
642648

643-
* **`onfidoColorToolbarBackground` and `colorPrimary`**: Background color of the tool bar that guides the user through the flow. Both attributes need to be provided if you want to customize the tool bar across all screens in the SDK.
644-
* **`onfidoColorToolbarBackgroundDark`**: Background color of the tool bar in screens with a dark background such as the capture screen (when overlay views are displayed)
645-
* **`colorPrimaryDark`**: Color of the status bar (above the tool bar)
646-
* **`onfidoColorToolbarTitle`**: Color of the tool bar's title text
647-
* **`onfidoColorToolbarTitleDark`**: Color of the tool bar's title text in screens with a dark background
648-
* **`colorAccent`**: Accent color. Default value is blue
649-
* **`onfidoColorButtonPrimary`**: Background color of primary buttons
650-
* **`onfidoColorButtonPrimaryText`**: Text color of primary buttons
651-
* **`onfidoColorButtonPrimaryPressed`**: Background color of primary buttons when pressed
652-
* **`onfidoColorTextPrimary`**: Color of primary texts on screen
653-
* **`onfidoColorTextSecondary`**: Color of secondary texts on screen
654-
* **`onfidoColorTextPrimaryDark`**: Color of primary texts on dark backgrounds (in the light theme) such as Motion screens and overlay views in the capture screen
655-
* **`onfidoFontFamilyTitle`**: Name of the font used for title texts
656-
* **`onfidoFontFamilySubtitle`**: Name of the font used for subtitle texts
657-
* **`onfidoFontFamilyBody`**: Name of the font used for body/content texts
658-
* **`onfidoFontFamilyButton`**: Name of the font used in buttons
659-
* **`onfidoFontFamilyToolbarTitle`**: Name of the font used for toolbar title texts
660-
* **`onfidoFontFamilyDialogButton`**: Name of the font used in dialogs' buttons
649+
* `onfidoColorToolbarBackground`: Background color of the `Toolbar` which guides the user through the flow
650+
651+
* `colorPrimaryDark`: Color of the status bar (with system icons) above the `Toolbar`
652+
653+
* `onfidoColorContentToolbarTitle`: Color of the `Toolbar`'s title text
654+
655+
* `onfidoColorContentMain`: Color of primary texts on screen, e.g. titles and regular body texts
656+
657+
* `onfidoColorContentSecondary`: Color of secondary texts on screen, e.g. subtitles
658+
659+
* `onfidoColorContentNegative`: Color of error texts
660+
661+
* `onfidoColorActionMain`: Background color of primary buttons
662+
663+
* `onfidoColorActionMainPressed`: Background color of primary buttons when pressed
664+
665+
* `onfidoColorActionMainDisabled`: Background color of primary buttons when disabled
666+
667+
* `onfidoColorContentOnAction`: Text color of primary buttons
668+
669+
* `onfidoColorContentOnActionDisabled`: Text color of primary buttons when disabled
670+
671+
* `onfidoColorActionSecondary`: Background color of secondary buttons
672+
673+
* `onfidoColorActionSecondaryPressed`: Background color of secondary buttons when pressed
674+
675+
* `onfidoColorActionSecondaryDisabled`: Background color of secondary buttons when disabled
676+
677+
* `onfidoColorContentOnActionSecondary`: Text color of secondary buttons
678+
679+
* `onfidoColorContentOnActionSecondaryDisabled`: Text color of secondary buttons when disabled
680+
681+
* `onfidoColorActionSecondaryBorder`: Border of the secondary buttons
682+
683+
* `onfidoColorActionSecondaryBorderDisabled`: Border of the secondary buttons when disabled
684+
685+
* `onfidoColorProgressTrack`: Track color of progress indicators (background color)
686+
687+
* `onfidoColorProgressIndicator`: Indicator color of progress indicators (foreground color)
688+
689+
* `colorAccent`: Defines alert dialogs' accent color, and text input fields' focused underline, cursor, and floating
690+
label color
691+
692+
* `onfidoColorWatermark`: Color of the Onfido logo and co-brand logo in the footer of screens
693+
694+
* `onfidoColorDisclaimerBackground`: Background color of disclaimer boxes
695+
696+
* `onfidoColorContentDisclaimer`: Text color of disclaimer boxes
697+
698+
* `onfidoColorIconDisclaimer`: Icon color of disclaimer boxes
699+
700+
* `onfidoColorIconStroke`: Stroke color of icons
701+
702+
* `onfidoColorIconFill`: Fill color of icons
703+
704+
* `onfidoColorIconBackground`: Background color of icons
705+
706+
* `onfidoColorIconAccent`: Background color of accented icons
661707
662708
**Note:**
663709
The usage of `color.json` and the `updateColors` command is now deprecated for Android. Please provide the theme attributes in your `styles.xml` or `themes.xml` as mentioned above.
@@ -688,12 +734,16 @@ You can customize the SDK by adding a `colors.json` file to your xcode project a
688734
"onfidoPrimaryColor": "#FF0000",
689735
"onfidoPrimaryButtonTextColor": "#FFFFFF",
690736
"onfidoPrimaryButtonColorPressed": "#FFA500",
691-
"onfidoIosSupportDarkMode": true,
737+
"interfaceStyle": <"unspecified" | "light" | "dark">,
692738
"secondaryTitleColor": "#FF0000",
693739
"secondaryBackgroundPressedColor": "#FF0000",
694740
"buttonCornerRadius": 20,
695741
"fontFamilyTitle": "FONT_NAME_FOR_TITLES",
696742
"fontFamilyBody": "FONT_NAME_FOR_CONTENT",
743+
"backgroundColor": {
744+
"light": "#FCFCFD",
745+
"dark": "#000000"
746+
},
697747
}
698748
```
699749
@@ -702,7 +752,7 @@ The following attributes are currently supported:
702752
* **`onfidoPrimaryColor`**: Background color of views such as capture confirmation buttons, back navigation button, and play and pause buttons in liveness/video capture intro
703753
* **`onfidoPrimaryButtonTextColor`**: Text color of labels included in views such as capture confirmation buttons
704754
* **`onfidoPrimaryButtonColorPressed`**: Defines the background color of capture confirmation buttons when pressed
705-
* **`onfidoIosSupportDarkMode`**: Defines whether dark mode will be supported (true by default)
755+
* **`interfaceStyle`**: Defines the supported interface styles ("unspecified" by default, which follows the sytem's interface style)
706756
* **`secondaryTitleColor`**: Secondary button text and border color
707757
* **`secondaryBackgroundPressedColor`**: Secondary button pressed state color
708758
* **`buttonCornerRadius`**: Border corner radius for all buttons (default value is 5.0)
@@ -711,6 +761,9 @@ The following attributes are currently supported:
711761

712762
You can check out the [iOS SampleApp](https://github.com/onfido/onfido-ios-sdk/tree/master/SampleApp) for example usage. When running on an iOS device, the values will be picked up dynamically at runtime.
713763

764+
**Note:**
765+
The usage of `onfidoIosSupportDarkMode` in the `color.json` is now deprecated. Please use `interfaceStyle` instead.
766+
714767
## Going live
715768

716769
Once you are happy with your integration and are ready to go live, please contact [client-support@onfido.com](mailto:client-support@onfido.com) to obtain live versions of the API token and the mobile SDK token. You will have to replace the sandbox tokens in your code with the live tokens.

SampleApp/colors.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"onfidoPrimaryColor": "#FF0000",
33
"onfidoPrimaryButtonTextColor": "#FFFFFF",
44
"onfidoPrimaryButtonColorPressed": "#FFA500",
5-
"onfidoIosSupportDarkMode": true,
5+
"interfaceStyle": "system",
66
"secondaryTitleColor": "#FF0000",
77
"secondaryBackgroundPressedColor": "#FF0000",
88
"bubbleErrorBackgroundColor": "#F53636",
@@ -13,5 +13,9 @@
1313
"borderColor": "#51D17B",
1414
"tickViewImageTintColor": "#058731",
1515
"tickViewBackgroundColor": "#CBF8DA"
16-
}
17-
}
16+
},
17+
"backgroundColor": {
18+
"light": "#FCFCFD",
19+
"dark": "#000000"
20+
},
21+
}

SampleApp/ios/Podfile.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ PODS:
1111
- ReactCommon/turbomodule/core (= 0.69.5)
1212
- fmt (6.2.1)
1313
- glog (0.3.5)
14-
- Onfido (29.1.0)
15-
- onfido-react-native-sdk (9.0.0):
16-
- Onfido (~> 29.1.0)
14+
- Onfido (29.3.0)
15+
- onfido-react-native-sdk (10.0.0):
16+
- Onfido (~> 29.3.0)
1717
- React
1818
- RCT-Folly (2021.06.28.00-v2):
1919
- boost
@@ -408,8 +408,8 @@ SPEC CHECKSUMS:
408408
FBReactNativeSpec: 82e74141263f8c962e288f5cd6b5d149cdc8afe1
409409
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
410410
glog: 3d02b25ca00c2d456734d0bcff864cbc62f6ae1a
411-
Onfido: ae6d4e6e02a8be79f013e410cb4d0429b3c2580d
412-
onfido-react-native-sdk: cf06b03ef4ce46c918dbac72c5f68a13bb338314
411+
Onfido: f85c79acd4b162abd9872ddf43565ff5a6164749
412+
onfido-react-native-sdk: 6d0098bdf42b9b74fcfa345aa33a31d2679da8d9
413413
RCT-Folly: b9d9fe1fc70114b751c076104e52f3b1b5e5a95a
414414
RCTRequired: 85c60c4bde8241278be2c93420de4c65475a2151
415415
RCTTypeSafety: 15990f289215eb0fc65c5eb6e2610faeeda8d5e1

SampleApp/yalc.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"version": "v1",
33
"packages": {
44
"@onfido/react-native-sdk": {
5-
"signature": "93e6037c5ffaea76fa4a36594b140408",
5+
"signature": "d05a537e3e56298258e0e5835604c33e",
66
"file": true
77
}
88
}

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="10.0.0" />
11+
android:value="10.1.0" />
1212
</application>
1313
</manifest>

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

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import com.onfido.android.sdk.capture.ui.options.CaptureScreenStep;
3232
import com.onfido.android.sdk.capture.ui.options.FlowStep;
3333
import com.onfido.android.sdk.capture.utils.CountryCode;
34+
import com.onfido.android.sdk.capture.OnfidoTheme;
3435
import com.onfido.workflow.OnfidoWorkflow;
3536
import com.onfido.workflow.WorkflowConfig;
3637

@@ -124,7 +125,7 @@ public void start(final ReadableMap config, final Promise promise) {
124125
}
125126

126127
@SuppressLint("UnsafeOptInUsageError")
127-
private void workflowSDKConfiguration(final ReadableMap config, Activity currentActivity, String sdkToken) {
128+
private void workflowSDKConfiguration(final ReadableMap config, Activity currentActivity, String sdkToken) throws Exception {
128129
final String workflowRunId = getWorkflowRunIdFromConfig(config);
129130

130131
final OnfidoWorkflow flow = OnfidoWorkflow.create(currentActivity);
@@ -140,6 +141,11 @@ private void workflowSDKConfiguration(final ReadableMap config, Activity current
140141
onfidoConfigBuilder.withMediaCallback(addMediaCallback());
141142
}
142143

144+
OnfidoTheme onfidoTheme = getThemeFromConfig(config);
145+
if(onfidoTheme != null){
146+
onfidoConfigBuilder.withTheme(onfidoTheme);
147+
}
148+
143149
flow.startActivityForResult(currentActivity,
144150
OnfidoSdkActivityEventListener.workflowActivityCode,
145151
onfidoConfigBuilder.build()
@@ -172,6 +178,11 @@ private void defaultSDKConfiguration(final ReadableMap config, Activity currentA
172178
onfidoConfigBuilder.disableNFC();
173179
}
174180

181+
OnfidoTheme onfidoTheme = getThemeFromConfig(config);
182+
if(onfidoTheme != null){
183+
onfidoConfigBuilder.withTheme(onfidoTheme);
184+
}
185+
175186
client.startActivityForResult(currentActivity,
176187
OnfidoSdkActivityEventListener.checksActivityCode,
177188
onfidoConfigBuilder.build());
@@ -221,6 +232,21 @@ public static String getWorkflowRunIdFromConfig(final ReadableMap config) {
221232
return config.hasKey(key) ? config.getString(key) : "";
222233
}
223234

235+
public static OnfidoTheme getThemeFromConfig(final ReadableMap config) throws Exception{
236+
String themeString = config.getString("theme");
237+
if(themeString == null){
238+
return null;
239+
}
240+
OnfidoTheme onfidoTheme;
241+
try {
242+
onfidoTheme = OnfidoTheme.valueOf(themeString);
243+
} catch (Exception e) {
244+
System.err.println("Unexpected theme value: [" + themeString + "]");
245+
throw new Exception("Unexpected theme value");
246+
}
247+
return onfidoTheme;
248+
}
249+
224250
public static FlowStep[] getFlowStepsFromConfig(
225251
final ReadableMap config,
226252
OnfidoConfig.Builder configBuilder

0 commit comments

Comments
 (0)