diff --git a/README.md b/README.md
index 6583180..ee572b2 100644
--- a/README.md
+++ b/README.md
@@ -413,8 +413,13 @@ You can customize the SDK by adding a `colors.json` file to your project at the
"onfidoPrimaryColor": "#FF0000",
"onfidoPrimaryButtonTextColor": "#008000",
"onfidoPrimaryButtonColorPressed": "#FFA500",
+ "onfidoAndroidColorAccent":"#4BC0B1",
"onfidoAndroidStatusBarColor": "#A52A2A",
"onfidoAndroidToolBarColor": "#800080",
+ "onfidoAndroidToolBarTitleColor": "#3E3B32",
+ "onfidoAndroidToolBarSubtitleColor": "#F5D033",
+ "onfidoAndroidButtonCornerRadius": 32,
+ "onfidoIosButtonCornerRadius": 26,
"onfidoIosSupportDarkMode": true
}
```
@@ -423,8 +428,13 @@ Below is a description of all available keys:
* **`onfidoPrimaryColor`**: Defines the background color of views such as the document type icon, capture confirmation buttons, and back navigation button.
* **`onfidoPrimaryButtonTextColor`**: Defines the text color of labels included in views such as capture confirmation buttons.
* **`onfidoPrimaryButtonColorPressed`**: Defines the background color of capture confirmation buttons when pressed.
+* **`onfidoAndroidColorAccent`**: Android only. Defines the color of the `FloatingActionButton` which allows the user to move between steps, as well as some details on the alert dialogs shown during the flow.
* **`onfidoAndroidStatusBarColor`**: Android only. Defines the background color of the `Toolbar` that guides the user through the flow.
* **`onfidoAndroidToolBarColor`**: Android only. Defines the color of the status bar above the `Toolbar`.
+* **`onfidoAndroidToolBarTitleColor`**: Android only. Defines the color of the title on the `Toolbar`.
+* **`onfidoAndroidToolBarSubtitleColor`**: Android only. Defines the color of the subtitle on the `Toolbar`.
+* **`onfidoAndroidButtonCornerRadius`**: Android only. Defines the radius dimensions of all the corners of primary and secondary buttons
+* **`onfidoIosButtonCornerRadius`**: iOS Only. Defines the radius dimensions of all the corners of primary and secondary buttons
* **`onfidoIosSupportDarkMode`**: iOS Only. Defines if Dark Mode will be supported on SDK screens. The value is true by default.
Once you've added the colors.json to your project, you should add colors.json file to your xcode project as bundle resource. You can create symbolic link (rather than copy paste) to prevent redundancy. You can check out SampleApp project to see example usage.
diff --git a/ios/OnfidoSdk.swift b/ios/OnfidoSdk.swift
index c6c6a6f..1547ac5 100644
--- a/ios/OnfidoSdk.swift
+++ b/ios/OnfidoSdk.swift
@@ -14,16 +14,19 @@ public class AppearancePublic: NSObject {
public let primaryColor: UIColor
public let primaryTitleColor: UIColor
public let primaryBackgroundPressedColor: UIColor
+ public let buttonCornerRadius: CGFloat
public let supportDarkMode: Bool
public init(
primaryColor: UIColor,
primaryTitleColor: UIColor,
primaryBackgroundPressedColor: UIColor,
+ buttonCornerRadius: CGFloat,
supportDarkMode: Bool = true) {
self.primaryColor = primaryColor
self.primaryTitleColor = primaryTitleColor
self.primaryBackgroundPressedColor = primaryBackgroundPressedColor
+ self.buttonCornerRadius = buttonCornerRadius
self.supportDarkMode = supportDarkMode
}
}
@@ -51,6 +54,8 @@ public func loadAppearancePublicFromFile(filePath: String?) throws -> Appearance
? UIColor.white : UIColor.from(hex: jsonResult["onfidoPrimaryButtonTextColor"] as! String)
let primaryBackgroundPressedColor: UIColor = (jsonResult["onfidoPrimaryButtonColorPressed"] == nil)
? UIColor.primaryButtonColorPressed : UIColor.from(hex: jsonResult["onfidoPrimaryButtonColorPressed"] as! String)
+ let buttonCornerRadius: CGFloat = (jsonResult["onfidoIosButtonCornerRadius"] == nil)
+ ? 5 : jsonResult["onfidoIosButtonCornerRadius"] as! CGFloat
let supportDarkMode: Bool = (jsonResult["onfidoIosSupportDarkMode"] == nil)
? true : jsonResult["onfidoIosSupportDarkMode"] as! Bool
@@ -59,6 +64,7 @@ public func loadAppearancePublicFromFile(filePath: String?) throws -> Appearance
primaryColor: primaryColor,
primaryTitleColor: primaryTitleColor,
primaryBackgroundPressedColor: primaryBackgroundPressedColor,
+ buttonCornerRadius: buttonCornerRadius,
supportDarkMode: supportDarkMode
)
return appearancePublic
@@ -80,6 +86,7 @@ public func loadAppearanceFromFile(filePath: String?) throws -> Appearance {
appearance.primaryColor = appearancePublic.primaryColor
appearance.primaryTitleColor = appearancePublic.primaryTitleColor
appearance.primaryBackgroundPressedColor = appearancePublic.primaryBackgroundPressedColor
+ appearance.buttonCornerRadius = appearancePublic.buttonCornerRadius
appearance.supportDarkMode = appearancePublic.supportDarkMode
return appearance
} else {
diff --git a/scripts/update_colors.js b/scripts/update_colors.js
index f748d3e..979d606 100644
--- a/scripts/update_colors.js
+++ b/scripts/update_colors.js
@@ -26,13 +26,23 @@ try {
fs.mkdirSync('android/src/main/res/values')
}
- fs.writeFile('android/src/main/res/values/colors.xml', generateFileContent(colors), function (e) {
+ fs.writeFile('android/src/main/res/values/colors.xml', generateColorsFileContent(colors), function (e) {
if (e != null) {
console.log('\nAn error occured while trying to update colors:\n' + e + '\n')
} else {
console.log("\nColors were successfully updated\n")
}
})
+
+ if (colors.onfidoAndroidButtonCornerRadius) {
+ fs.writeFile('android/src/main/res/values/dimens.xml', generateDimensFileContent(colors.onfidoAndroidButtonCornerRadius), function (e) {
+ if (e != null) {
+ console.log('\nAn error occured while trying to update border radius:\n' + e + '\n')
+ } else {
+ console.log("\Border radius was successfully updated\n")
+ }
+ })
+ }
});
} else {
console.log('\nNo colors.json was found. Ensure it is at the same level as your node-modules directory\n')
@@ -41,31 +51,58 @@ try {
console.log(e)
}
-function generateFileContent(colors) {
+function generateColorsFileContent(colors) {
let fileContent = '\n'
fileContent += '\n'
Object.keys(colors).forEach((color) => {
let keyName = color;
switch (keyName) {
+ case 'onfidoAndroidColorAccent':
+ keyName = 'onfidoColorAccent'
+ break
case 'onfidoPrimaryColor':
keyName = 'onfidoPrimaryButtonColor'
break
+ case 'onfidoPrimaryButtonColorPressed':
+ keyName = 'onfidoPrimaryButtonColorPressed'
+ break
+ case 'onfidoPrimaryButtonTextColor':
+ keyName = 'onfidoPrimaryButtonTextColor'
+ break
case 'onfidoAndroidStatusBarColor':
keyName = 'onfidoColorPrimary'
break
case 'onfidoAndroidToolBarColor':
keyName = 'onfidoColorPrimaryDark'
break
+ case 'onfidoAndroidToolBarTitleColor':
+ keyName = 'onfidoTextColorPrimary'
+ break
+ case 'onfidoAndroidToolBarSubtitleColor':
+ keyName = 'onfidoTextColorSecondary'
+ break
+ default:
+ return
}
- if (color !== 'onfidoIosSupportDarkMode') {
- fileContent += '\t"
- fileContent += colors[color]
- fileContent += "\n"
- }
+ fileContent += '\t"
+ fileContent += colors[color]
+ fileContent += "\n"
})
fileContent += ""
return fileContent
}
+
+function generateDimensFileContent(borderRadius) {
+ let fileContent = '\n'
+ fileContent += '\t"
+ fileContent += borderRadius
+ fileContent += "dp"
+ fileContent += "\n"
+ fileContent += ""
+ return fileContent
+}