Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export default function App() {
};

const params: Params = {
isDevelopment: true,
isDevelopment: false,
deviceKeyIdentifier: 'YOUR_DEVICE_KEY_IDENTIFIER',
baseUrl: 'YOUR_BASE_URL',
};
Expand Down Expand Up @@ -507,11 +507,11 @@ vocal();

Here must be passed to initialize the Aziface SDK! Case the parameters isn't provided the Aziface SDK goes to be not initialized.

| `Params` | type | Required | Default |
| --------------------- | --------- | -------- | ------- |
| `deviceKeyIdentifier` | `string` | βœ… | - |
| `baseUrl` | `string` | βœ… | - |
| `isDevelopment` | `boolean` | ❌ | `false` |
| `Params` | type | Required | Default | Description |
| --------------------- | --------- | -------- | ------- | ----------------------------------------------------------------------------------------------------------------- |
| `deviceKeyIdentifier` | `string` | βœ… | - | The identifier used to initialize the SDK. |
| `baseUrl` | `string` | βœ… | - | The base URL used during the request of the processor. |
| `isDevelopment` | `boolean` | ❌ | `false` | Only effective in **DEBUG** builds. Release builds always ignore this flag and never send `X-Testing-API-Header`. |

### `Headers`

Expand Down Expand Up @@ -659,7 +659,6 @@ The `Locale` type use the [ISO 639](https://en.wikipedia.org/wiki/List_of_ISO_63
| `NotInitialized` | When trying to initialize a process, but SDK wasn't initialized. | All |
| `ConfigNotProvided` | When `deviceKeyIdentifier` and `baseUrl` aren't provided. | All |
| `ParamsNotProvided` | When parameters aren't provided, this case, it is `null`. | All |
| `NotAuthenticated` | When `authenticate` process is called, but `enroll` wasn't done first. | All |
| `NotFoundTargetView` | When `Activity` (Android) or `ViewController` (iOS) aren't found on call processor. | All |
| `CameraError` | When an error on use the camera occurs. | All |
| `CameraPermissionsDenied` | When the user doesn't permit the use camera. | All |
Expand Down Expand Up @@ -729,7 +728,7 @@ export default function App() {

function onInitialize() {
const params: Params = {
isDevelopment: true,
isDevelopment: false,
deviceKeyIdentifier: 'YOUR_DEVICE_KEY_IDENTIFIER',
baseUrl: 'YOUR_BASE_URL',
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,14 @@ public String getName() {

@Override
public void onActivityResult(@NonNull Activity activity, int requestCode, int resultCode, Intent data) {
if (this.sdkInstance == null || this.promise == null) {
return;
}

FaceTecSessionResult sessionResult = sdkInstance.getActivitySessionResult(requestCode, resultCode, data);
assert sessionResult != null;
if (sessionResult == null) {
return;
}

final FaceTecSessionStatus status = sessionResult.getStatus();
final boolean isCompleted = status == FaceTecSessionStatus.SESSION_COMPLETED;
Expand Down Expand Up @@ -221,12 +227,6 @@ public void authenticate(ReadableMap data, Promise promise) {
return;
}

if (DemonstrationExternalDatabaseRefID.isEmpty()) {
this.onProcessorError("User isn't authenticated! You must enroll first!", "NotAuthenticated");
promise.resolve(this.getStringifyResponse());
return;
}

this.setPromise(promise);
this.sendOpenEvent();

Expand Down
9 changes: 5 additions & 4 deletions android/src/main/java/com/azifacemobile/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static void setHeaders(ReadableMap headers) {
}

public static void setIsDevelopment(Boolean isDevelopment) {
IsDevelopment = isDevelopment;
IsDevelopment = BuildConfig.DEBUG && Boolean.TRUE.equals(isDevelopment);
}

public static boolean isEmpty() {
Expand Down Expand Up @@ -147,15 +147,16 @@ public static FaceTecCustomization retrieveConfigurationCustomization(Theme them
FaceTecFrameCustomization frameCustomization = defaultCustomization.getFrameCustomization();
Frame frame = theme.getFrame();
frameCustomization.cornerRadius = frame.getCornerRadius();
frameCustomization.backgroundColor = frame.getBackgroundColor();
frameCustomization.borderColor = frame.getBorderColor();
frameCustomization.borderWidth = frame.getBorderWidth();
frameCustomization.elevation = frame.getElevation();

FaceTecOverlayCustomization overlayCustomization = defaultCustomization.getOverlayCustomization();
overlayCustomization.brandingImage = image.getSource("branding", R.drawable.facetec_your_app_logo);
overlayCustomization.showBrandingImage = image.getShowBranding();
overlayCustomization.backgroundColor = theme.getColor("backgroundColor");
int overlayBackgroundColor = theme.getColor("backgroundColor");
overlayCustomization.backgroundColor = overlayBackgroundColor;
frameCustomization.backgroundColor = overlayBackgroundColor;
frameCustomization.borderColor = overlayBackgroundColor;

FaceTecGuidanceCustomization guidanceCustomization = defaultCustomization.getGuidanceCustomization();
Guidance guidance = theme.getGuidance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ private int getInt(String key, int defaultValue) {
return defaultValue;
}

Object value = this.target.get(key);
if (value instanceof Number) {
return ((Number) value).intValue();
}

return this.target.getInt(key);
} catch (JSONException e) {
return defaultValue;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.azifacemobile.utils;

import com.azifacemobile.BuildConfig;
import com.azifacemobile.Config;
import com.facebook.react.bridge.ReadableMap;

Expand Down Expand Up @@ -34,7 +35,7 @@ public void build() {
if (!this.isNull()) {
Config.setDeviceKeyIdentifier(this.getParam("deviceKeyIdentifier"));
Config.setBaseUrl(this.getParam("baseUrl"));
Config.setIsDevelopment(this.isDevelopment());
Config.setIsDevelopment(BuildConfig.DEBUG && this.isDevelopment());
}
}
}
7 changes: 2 additions & 5 deletions android/src/main/res/xml/network_security_config.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This configuration file allows non-secure request.
It is purely for development purposes and should never be used for production apps. -->
<network-security-config xmlns:tools="http://schemas.android.com/tools">
<base-config cleartextTrafficPermitted="true"
tools:ignore="InsecureBaseConfiguration">
<network-security-config>
<base-config cleartextTrafficPermitted="false">
<trust-anchors>
<certificates src="system" />
</trust-anchors>
Expand Down
24 changes: 11 additions & 13 deletions docs/THEME.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,16 +261,14 @@ An object containing the initial loading animation styles used in the Aziface SD

#### `ThemeFrame`

An object containing the frame styles used in the Aziface SDK.
An object containing the frame styles used in the Aziface SDK. The frame background and border follow the root `backgroundColor`, so the frame blends with the overlay.

| `ThemeFrame` | type | Platform | Required | Default |
| ----------------- | -------------------------------------- | -------- | -------- | ----------- |
| `cornerRadius` | `number` | All | ❌ | `20` |
| `borderColor` | `string` | All | ❌ | `#ffffff` |
| `borderWidth` | `number` | All | ❌ | `undefined` |
| `backgroundColor` | `string` | All | ❌ | `#ffffff` |
| `elevation` | `number` | Android | ❌ | `0` |
| `shadow` | [`ThemeShadow`](#themeshadow-ios-only) | iOS | ❌ | `undefined` |
| `ThemeFrame` | type | Platform | Required | Default |
| -------------- | -------------------------------------- | -------- | -------- | ----------- |
| `cornerRadius` | `number` | All | ❌ | `20` |
| `borderWidth` | `number` | All | ❌ | `undefined` |
| `elevation` | `number` | Android | ❌ | `0` |
| `shadow` | [`ThemeShadow`](#themeshadow-ios-only) | iOS | ❌ | `undefined` |

#### `ThemeButton`

Expand Down Expand Up @@ -546,7 +544,7 @@ An object containing the styles used in the OCR confirmation.

| `ThemeOCRConfirmation` | type | Platform | Required | Default |
| ---------------------- | ----------------------------------------------- | -------- | -------- | ------------- |
| `backgroundColor` | `string` | Android | ❌ | `transparent` |
| `backgroundColor` | `string` | All | ❌ | `transparent` |
| `lineColor` | `string` | All | ❌ | `#026ff4` |
| `lineWidth` | `number` | All | ❌ | `undefined` |
| `headerTextColor` | `string` | All | ❌ | `#026ff4` |
Expand Down Expand Up @@ -586,7 +584,7 @@ An object containing the styles used in the input field.

| `ThemeInputField` | type | Platform | Required | Default |
| ----------------------- | --------- | -------- | -------- | ------------- |
| `backgroundColor` | `string` | Android | ❌ | `transparent` |
| `backgroundColor` | `string` | All | ❌ | `transparent` |
| `borderColor` | `string` | All | ❌ | `#0264dc` |
| `borderWidth` | `string` | All | ❌ | `undefined` |
| `cornerRadius` | `number` | All | ❌ | `4` |
Expand Down Expand Up @@ -638,7 +636,7 @@ import {
export default function App() {
useEffect(() => {
const params: Params = {
isDevelopment: true,
isDevelopment: false,
deviceKeyIdentifier: 'YOUR_DEVICE_KEY_IDENTIFIER',
baseUrl: 'YOUR_BASE_URL',
};
Expand Down Expand Up @@ -700,7 +698,7 @@ import {
export default function App() {
useEffect(() => {
const params: Params = {
isDevelopment: true,
isDevelopment: false,
deviceKeyIdentifier: 'YOUR_DEVICE_KEY_IDENTIFIER',
baseUrl: 'YOUR_BASE_URL',
};
Expand Down
4 changes: 2 additions & 2 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PODS:
- AzifaceMobile (3.8.1):
- AzifaceMobile (3.8.4):
- boost
- DoubleConversion
- fast_float
Expand Down Expand Up @@ -2738,7 +2738,7 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/yoga"

SPEC CHECKSUMS:
AzifaceMobile: eb89fbfcfcd41baf0431f7ef2b636116552c7c0f
AzifaceMobile: 6dd916d60266574fc7833d76bdb448d595e362fc
boost: 7e761d76ca2ce687f7cc98e698152abd03a18f90
DoubleConversion: cb417026b2400c8f53ae97020b2be961b59470cb
fast_float: b32c788ed9c6a8c584d114d0047beda9664e7cc6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static void setHeaders(Map<String, Object> headers) {
}

public static void setIsDevelopment(Boolean isDevelopment) {
IsDevelopment = isDevelopment;
IsDevelopment = BuildConfig.DEBUG && Boolean.TRUE.equals(isDevelopment);
}

public static boolean isEmpty() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import androidx.annotation.Nullable;

import com.azifacemobile.BuildConfig;
import com.azifacemobile.Config;

import java.util.Map;
Expand Down Expand Up @@ -36,7 +37,7 @@ public void build() {
if (!this.isNull()) {
Config.setDeviceKeyIdentifier(this.getParam("deviceKeyIdentifier"));
Config.setBaseUrl(this.getParam("baseUrl"));
Config.setIsDevelopment(this.isDevelopment());
Config.setIsDevelopment(BuildConfig.DEBUG && this.isDevelopment());
}
}
}
7 changes: 0 additions & 7 deletions ios/Aziface.swift
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,6 @@ public class Aziface: NSObject, URLSessionDelegate, FaceTecInitializeCallback {
message: "AziFace SDK not found target View!", code: "NotFoundTargetView"))
}

if Aziface.DemonstrationExternalDatabaseRefID.isEmpty {
return resolve(
self.onProcessorError(
message: "User isn't authenticated! You must enroll first!", code: "NotAuthenticated")
)
}

self.setResolver(resolve: resolve)
let controller = self.sdkInstance.start3DLivenessThen3DFaceMatch(
with: SessionRequestProcessor(module: self, data: data))
Expand Down
15 changes: 10 additions & 5 deletions ios/Config.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ public class Config {
}

public static func setIsDevelopment(_ isDevelopment: Bool) {
#if DEBUG
Config.IsDevelopment = isDevelopment
#else
Config.IsDevelopment = false
#endif
}

public static func setHeaders(_ headers: NSDictionary?) {
Expand Down Expand Up @@ -77,7 +81,7 @@ public class Config {
let ocrConfirmationButton = ocrConfirmation.getButton()
let ocrConfirmationScrollIndicator = ocrConfirmation.getScrollIndicator()
let ocrConfirmationInputField = ocrConfirmation.getInputField()
// ocrConfirmationCustomization.backgroundColors = [ocrConfirmation.getBackgroundColor()]
ocrConfirmationCustomization.backgroundColors = [ocrConfirmation.getBackgroundColor()]
ocrConfirmationCustomization.enableFixedConfirmButton = ocrConfirmation.getEnableFixedConfirmButton()
ocrConfirmationCustomization.mainHeaderDividerLineColor = ocrConfirmation.getLineColor()
ocrConfirmationCustomization.mainHeaderDividerLineWidth = ocrConfirmation.getLineWidth()
Expand Down Expand Up @@ -106,7 +110,7 @@ public class Config {
ocrConfirmationCustomization.showScrollIndicatorImage = ocrConfirmationScrollIndicator.getShowScrollIndicatorImage()
ocrConfirmationCustomization.scrollIndicatorFont = ocrConfirmationScrollIndicator.getFont()
ocrConfirmationCustomization.scrollIndicatorShadow = ocrConfirmationScrollIndicator.getShadow()
// ocrConfirmationCustomization.inputFieldBackgroundColor = ocrConfirmationInputField.getBackgroundColor()
ocrConfirmationCustomization.inputFieldBackgroundColor = ocrConfirmationInputField.getBackgroundColor()
ocrConfirmationCustomization.inputFieldBorderColor = ocrConfirmationInputField.getBorderColor()
ocrConfirmationCustomization.inputFieldCornerRadius = ocrConfirmationInputField.getCornerRadius()
ocrConfirmationCustomization.inputFieldTextColor = ocrConfirmationInputField.getTextColor()
Expand All @@ -124,16 +128,17 @@ public class Config {
let frameCustomization = defaultCustomization.frameCustomization
let frame = theme.getFrame()
frameCustomization.cornerRadius = frame.getCornerRadius()
frameCustomization.backgroundColor = frame.getBackgroundColor()
frameCustomization.borderColor = frame.getBorderColor()
frameCustomization.borderWidth = frame.getBorderWidth()
frameCustomization.shadow = frame.getShadow()

let overlayCustomization = defaultCustomization.overlayCustomization
overlayCustomization.brandingImage = image.getSource(
"branding", defaultImage: "facetec_your_app_logo")
overlayCustomization.showBrandingImage = image.getShowBranding()
overlayCustomization.backgroundColor = theme.getColor("backgroundColor")
let overlayBackgroundColor = theme.getColor("backgroundColor")
overlayCustomization.backgroundColor = overlayBackgroundColor
frameCustomization.backgroundColor = overlayBackgroundColor
frameCustomization.borderColor = overlayBackgroundColor

let guidanceCustomization = defaultCustomization.guidanceCustomization
let guidance = theme.getGuidance()
Expand Down
2 changes: 1 addition & 1 deletion ios/Theme/AdditionalReview.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class AdditionalReview: ViewStyle {
self.color = Color()
self.image = Image(target: self.target)

super.init(target: self.target, key: AdditionalReview.KEY)
super.init(target: target, key: AdditionalReview.KEY)
}

private func getBoolean(_ key: String, defaultValue: Bool) -> Bool {
Expand Down
4 changes: 2 additions & 2 deletions ios/Theme/Button.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation

public class Button: ViewStyle {
private static let KEY: String = "guidance"
private static let KEY: String = "button"
private let target: NSDictionary?
private let font: Font
private let color: Color
Expand All @@ -11,7 +11,7 @@ public class Button: ViewStyle {
self.font = Font()
self.color = Color()

super.init(key: Button.KEY)
super.init(target: target, key: Button.KEY)
}

override public func getCornerRadius() -> Int32 {
Expand Down
2 changes: 1 addition & 1 deletion ios/Theme/IdFeedback.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class IdFeedback: ViewStyle {
self.color = Color()
self.image = Image(target: self.target)

super.init(target: self.target, key: IdFeedback.KEY)
super.init(target: target, key: IdFeedback.KEY)
}

override func getForegroundColor() -> UIColor {
Expand Down
7 changes: 3 additions & 4 deletions ios/Theme/InputField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ public class InputField: ViewStyle {
super.init(key: InputField.KEY)
}

// TODO: Add it in the next versions because it currently is wrong on iOS
// override public func getBackgroundColor() -> UIColor {
// return super.getBackgroundColor(defaultColor: Color.TRANSPARENT)
// }
override public func getBackgroundColor() -> UIColor {
return self.color.getColor(Color.TRANSPARENT)
}

override public func getBorderColor() -> UIColor {
return super.getBorderColor("#0264dc")
Expand Down
12 changes: 12 additions & 0 deletions ios/Theme/LinearGradient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,18 @@ public class LinearGradient {
return defaultLinearGradient
}

if let hexColors = theme?[key] as? [String] {
let colors = self.color.parseColors(hexColors)
if !colors.isEmpty {
return colors
}
}

if let hexColor = theme?[key] as? String, !hexColor.isEmpty {
let parsed = UIColor(hexString: hexColor)
return [parsed, parsed]
}

let hexColors = Theme.Style?[key] as? [String?] ?? []
let colors = self.color.parseColors(hexColors)
if colors.isEmpty {
Expand Down
7 changes: 3 additions & 4 deletions ios/Theme/OcrConfirmation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ public class OcrConfirmation: ViewStyle {
super.init(key: OcrConfirmation.KEY)
}

// TODO: Add it in the next versions because it currently is wrong on iOS
// override public func getBackgroundColor() -> UIColor {
// return super.getBackgroundColor(defaultColor: Color.TRANSPARENT)
// }
override public func getBackgroundColor() -> UIColor {
return super.getBackgroundColor(defaultColor: Color.TRANSPARENT)
}

public func getEnableFixedConfirmButton() -> Bool {
let key = "isFixedConfirmButton"
Expand Down
Loading
Loading