Skip to content

Commit

Permalink
fix: error messages android (#4)
Browse files Browse the repository at this point in the history
* fix: fixed documentation and added custom comments to interface `Methods`

* fix: add `endOfLine` property to prettier rules

* fix: improved on the error messages and changed some names

* fix: removed `Log` from `initializeSdk`

* fix: small adjust in invalid message

* fix: another small adjust in invalid message and upgrade documentation

* chore: removed unnecessary `.xml` and image

* fix: removed unnecessaries `.xml` and `.png` files

* chore: upgraded documentation

* fix: added send event as `false` when modal is closed with success
  • Loading branch information
DanielAraldi authored Sep 12, 2023
1 parent 8a1e46d commit eee093a
Show file tree
Hide file tree
Showing 25 changed files with 208 additions and 387 deletions.
35 changes: 16 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ export default function App() {
<TouchableOpacity style={styles.button} onPress={onPressPhotoMatch}>
<Text style={styles.text}>Open Photo Match</Text>
</TouchableOpacity>

<TouchableOpacity style={styles.button} onPress={onPressEnroll}>
<Text style={styles.text}>Open Enroll</Text>
</TouchableOpacity>
Expand Down Expand Up @@ -175,7 +174,6 @@ const styles = StyleSheet.create({
fontSize: 22,
},
});

```

<hr/>
Expand Down Expand Up @@ -259,13 +257,13 @@ This method must be used to **set** the **theme** of the Capface SDK screen.

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

| `CapfaceSdk.Params` | type | Required |
| ------------------- | -------- | -------- |
| `device` | `string` ||
| `url` | `string` ||
| `key` | `string` ||
| `productionKey` | `string` ||
| `isDeveloperMode` | `boolean`||
| `CapfaceSdk.Params` | type | Required |
| ------------------- | --------- | -------- |
| `device` | `string` ||
| `url` | `string` ||
| `key` | `string` ||
| `productionKey` | `string` ||
| `isDeveloperMode` | `boolean` ||

### `CapfaceSdk.Headers`

Expand All @@ -281,8 +279,8 @@ This is a list of theme properties that can be used to styling. Note, we recomme

| `CapfaceSdk.Theme` | type | iOS | Android | Required | Default |
| ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | --- | ------- | -------- | ------------------------------------------------------------------------------------------------------- |
| `logoImage` | `string` |||| `faceTec_your_app_logo.png` |
| `cancelImage` | `string` |||| `faceTec_cancel.png` |
| `logoImage` | `string` |||| `facetec_your_app_logo.png` |
| `cancelImage` | `string` |||| `facetec_cancel.png` |
| `cancelButtonLocation` | [`CapfaceSdk.ButtonLocation`](#capfacesdkbuttonlocation) |||| `TOP_RIGHT` |
| `defaultStatusBarColorIos` | [`CapfaceSdk.StatusBarColor`](#capfacesdkstatusbarcolor-ios-only) |||| `DARK_CONTENT` |
| `frameCornerRadius` | `number` |||| `10` (iOS) and `20` (Android) |
Expand Down Expand Up @@ -427,14 +425,13 @@ This interface represents the all scan messages during to CapfaceSDK flow. It in

| `CapfaceSdk.Errors` | Description | iOS | Android |
| ------------------------------- | ------------------------------------------------------------------------------------ | --- | ------- |
| `FaceTecDoenstInitialized` | When some processors method is runned, but CapfaceSDK **wasn't initialized**. |||
| `FaceTecWasntProcessed` | When the image sent to the processors cannot be processed due to inconsistency. |||
| `CapFaceHasNotBeenInitialized` | When some processors method is runned, but CapfaceSDK **has not been initialized**. |||
| `CapFaceValuesWereNotProcessed` | When the image sent to the processors cannot be processed due to inconsistency. |||
| `HTTPSError` | When exists some network error. |||
| `JSONError` | When exists some problem in getting data in request of **base URL** information. |||
| `FaceTecDifferentStatus` | When session status is different completed successfully. |||
| `FaceTecLivenessWasntProcessed` | When the image user sent to the processors cannot be processed due to inconsistency. |||
| `FaceTecScanWasntProcessed` | When the image ID sent to the processors cannot be processed due to inconsistency. |||
| `NoParametersProvided` | When parameters is not provided. |||
| `CapFaceInvalidSession` | When session status is invalid. |||
| `CapFaceLivenessWasntProcessed` | When the image user sent to the processors cannot be processed due to inconsistency. |||
| `CapFaceScanWasntProcessed` | When the image ID sent to the processors cannot be processed due to inconsistency. |||

<hr/>

Expand All @@ -456,11 +453,11 @@ This is a list of event types that can be used on `addListener`.

## How to add images in CapfaceSDK module?

The `logoImage` and `cancelImage` properties represents your logo and icon of the button cancel. Does not possible to remove them from the module. Default are [Capitual](https://www.capitual.com/) images and `.png` format. In `Android` you can find the image's full name in lower case and in `iOS` the image's full name, but, with a difference of the first letter to be in the upper case.
The `logoImage` and `cancelImage` properties represents your logo and icon of the button cancel. Does not possible to remove them from the module. Default are [Capitual](https://www.capitual.com/) images and `.png` format. By default in `Android` the logo image is shown, but on `iOS` it isn't shown, It's necessary to add manually.

### How to add images in Android?

To add your images in `Android`, you must go to your project's `android/src/main/res/drawable` directory. Inside the `drawable` folder, you must put your images and done!
To add your images in `Android`, you must go to your project's `android/src/main/res/drawable` directory. If in your project `drawable` folder doesn't exist, it create one. Inside the `drawable` folder, you must put your images and done!

### How to add images in iOS?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void processSessionWhileFaceTecSDKWaits(final FaceTecSessionResult sessio
NetworkingHelpers.cancelPendingRequests();
faceScanResultCallback.cancel();
capFaceModule.sendEvent("onCloseModal", false);
capFaceModule.processorPromise.reject("Status is not session completed successfully!", "FaceTecDifferentStatus");
capFaceModule.processorPromise.reject("The session status has not been completed!", "CapFaceInvalidSession");
return;
}

Expand Down Expand Up @@ -94,13 +94,14 @@ public void onResponse(@NonNull Call call, @NonNull okhttp3.Response response) t
.handleMessage(principalKey, "successMessage", "Authenticated");
success = faceScanResultCallback.proceedToNextStep(scanResultBlob);
if (success) {
capFaceModule.sendEvent("onCloseModal", false);
capFaceModule.processorPromise.resolve(true);
}
} else {
faceScanResultCallback.cancel();
capFaceModule.sendEvent("onCloseModal", false);
capFaceModule.processorPromise.reject("FaceTec SDK wasn't have to values processed!",
"FaceTecWasntProcessed");
capFaceModule.processorPromise.reject("CapFace SDK values were not processed!",
"CapFaceValuesWereNotProcessed");
}
} catch (JSONException e) {
e.printStackTrace();
Expand Down
5 changes: 1 addition & 4 deletions android/src/main/java/com/capitual/processors/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,7 @@ public static boolean hasConfig() {
&& ProductionKeyText != null;
}

public static void initializeFaceTecSDKFromAutogeneratedConfig(
Context context,
boolean isDeveloperMode,
FaceTecSDK.InitializeCallback callback) {
public static void initialize(Context context, boolean isDeveloperMode, FaceTecSDK.InitializeCallback callback) {
if (isDeveloperMode) {
FaceTecSDK.initializeInDevelopmentMode(
context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void processSessionWhileFaceTecSDKWaits(final FaceTecSessionResult sessio
NetworkingHelpers.cancelPendingRequests();
faceScanResultCallback.cancel();
capFaceModule.sendEvent("onCloseModal", false);
capFaceModule.processorPromise.reject("Status is not session completed successfully!", "FaceTecDifferentStatus");
capFaceModule.processorPromise.reject("The session status has not been completed!", "CapFaceInvalidSession");
return;
}

Expand Down Expand Up @@ -94,13 +94,14 @@ public void onResponse(@NonNull Call call, @NonNull okhttp3.Response response) t
"successMessage", "Liveness\nConfirmed");
success = faceScanResultCallback.proceedToNextStep(scanResultBlob);
if (success) {
capFaceModule.sendEvent("onCloseModal", false);
capFaceModule.processorPromise.resolve(true);
}
} else {
faceScanResultCallback.cancel();
capFaceModule.sendEvent("onCloseModal", false);
capFaceModule.processorPromise.reject("FaceTec SDK wasn't have to values processed!",
"FaceTecWasntProcessed");
capFaceModule.processorPromise.reject("CapFace SDK values were not processed!",
"CapFaceValuesWereNotProcessed");
}
} catch (JSONException e) {
e.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void processSessionWhileFaceTecSDKWaits(final FaceTecSessionResult sessio
NetworkingHelpers.cancelPendingRequests();
faceScanResultCallback.cancel();
capFaceModule.sendEvent("onCloseModal", false);
capFaceModule.processorPromise.reject("Status is not session completed successfully!", "FaceTecDifferentStatus");
capFaceModule.processorPromise.reject("The session status has not been completed!", "CapFaceInvalidSession");
return;
}

Expand Down Expand Up @@ -92,13 +92,14 @@ public void onResponse(@NonNull Call call, @NonNull okhttp3.Response response) t
"successMessage", "Liveness\nConfirmed");
success = faceScanResultCallback.proceedToNextStep(scanResultBlob);
if (success) {
capFaceModule.sendEvent("onCloseModal", false);
capFaceModule.processorPromise.resolve(true);
}
} else {
faceScanResultCallback.cancel();
capFaceModule.sendEvent("onCloseModal", false);
capFaceModule.processorPromise.reject("FaceTec SDK wasn't have to values processed!",
"FaceTecWasntProcessed");
capFaceModule.processorPromise.reject("CapFace SDK values were not processed!",
"CapFaceValuesWereNotProcessed");
}
} catch (JSONException e) {
e.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public void processSessionWhileFaceTecSDKWaits(final FaceTecSessionResult sessio
NetworkingHelpers.cancelPendingRequests();
faceScanResultCallback.cancel();
capFaceModule.sendEvent("onCloseModal", false);
capFaceModule.processorPromise.reject("Status is not session completed successfully!", "FaceTecDifferentStatus");
capFaceModule.processorPromise.reject("The session status has not been completed!", "CapFaceInvalidSession");
return;
}

Expand Down Expand Up @@ -173,8 +173,8 @@ public void onResponse(@NonNull Call call, @NonNull okhttp3.Response response) t
} else {
faceScanResultCallback.cancel();
capFaceModule.sendEvent("onCloseModal", false);
capFaceModule.processorPromise.reject("FaceTec SDK wasn't have to liveness values processed!",
"FaceTecLivenessWasntProcessed");
capFaceModule.processorPromise.reject("CapFace SDK wasn't have to liveness values processed!",
"CapFaceLivenessWasntProcessed");
}
} catch (JSONException e) {
e.printStackTrace();
Expand Down Expand Up @@ -204,7 +204,7 @@ public void processIDScanWhileFaceTecSDKWaits(final FaceTecIDScanResult idScanRe
NetworkingHelpers.cancelPendingRequests();
idScanResultCallback.cancel();
capFaceModule.sendEvent("onCloseModal", false);
capFaceModule.processorPromise.reject("Status is not success!", "FaceTecDifferentStatus");
capFaceModule.processorPromise.reject("The scan status has not been completed!", "CapFaceInvalidSession");
return;
}

Expand Down Expand Up @@ -309,13 +309,14 @@ public void onResponse(@NonNull Call call, @NonNull okhttp3.Response response) t

success = idScanResultCallback.proceedToNextStep(scanResultBlob);
if (success) {
capFaceModule.sendEvent("onCloseModal", false);
capFaceModule.processorPromise.resolve(true);
}
} else {
idScanResultCallback.cancel();
capFaceModule.sendEvent("onCloseModal", false);
capFaceModule.processorPromise.reject("FaceTec SDK wasn't have to scan values processed!",
"FaceTecScanWasntProcessed");
capFaceModule.processorPromise.reject("CapFace SDK wasn't have to scan values processed!",
"CapFaceScanWasntProcessed");
}
} catch (JSONException e) {
e.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public void processIDScanWhileFaceTecSDKWaits(final FaceTecIDScanResult idScanRe
NetworkingHelpers.cancelPendingRequests();
idScanResultCallback.cancel();
capFaceModule.sendEvent("onCloseModal", false);
capFaceModule.processorPromise.reject("Status is not success!", "FaceTecDifferentStatus");
capFaceModule.processorPromise.reject("The scan status has not been completed!", "CapFaceInvalidSession");
return;
}

Expand Down Expand Up @@ -226,13 +226,14 @@ public void onResponse(@NonNull Call call, @NonNull okhttp3.Response response) t

success = idScanResultCallback.proceedToNextStep(scanResultBlob);
if (success) {
capFaceModule.sendEvent("onCloseModal", false);
capFaceModule.processorPromise.resolve(true);
}
} else {
idScanResultCallback.cancel();
capFaceModule.sendEvent("onCloseModal", false);
capFaceModule.processorPromise.reject("FaceTec SDK wasn't have to values processed!",
"FaceTecWasntProcessed");
capFaceModule.processorPromise.reject("CapFace SDK values were not processed!",
"CapFaceValuesWereNotProcessed");
}
} catch (JSONException e) {
e.printStackTrace();
Expand Down
Loading

0 comments on commit eee093a

Please sign in to comment.