mirror of
https://github.com/mosip/inji-wallet.git
synced 2026-01-09 21:48:04 -05:00
[INJIMOB-2125]: Bundle face model as asset of the app (#1651)
* [INJIMOB-2125]: bundle face model as asset to the app Signed-off-by: adityankannan-tw <adityan410pm@gmail.com> * [INJIMOB-2125]: bundle face model as asset to the app Signed-off-by: adityankannan-tw <adityan410pm@gmail.com> * [INJIMOB-2125]: bundle face model as asset to the app Signed-off-by: adityankannan-tw <adityan410pm@gmail.com> --------- Signed-off-by: adityankannan-tw <adityan410pm@gmail.com> Co-authored-by: adityankannan-tw <adityan410pm@gmail.com>
This commit is contained in:
@@ -282,49 +282,25 @@ export default async function getAllConfigurations(
|
||||
return await CACHED_API.getAllProperties(isCachePreferred);
|
||||
}
|
||||
|
||||
export async function downloadModel() {
|
||||
try {
|
||||
console.log('restart Face model init');
|
||||
const injiProp = await getAllConfigurations();
|
||||
const maxRetryStr = injiProp.modelDownloadMaxRetry;
|
||||
const maxRetry = parseInt(maxRetryStr);
|
||||
const resp: string = injiProp != null ? injiProp.faceSdkModelUrl : null;
|
||||
|
||||
if (resp != null) {
|
||||
for (let counter = 0; counter < maxRetry; counter++) {
|
||||
const config = faceMatchConfig(resp);
|
||||
const result = await configure(config);
|
||||
console.log('model download result is = ' + result);
|
||||
if (result) {
|
||||
sendImpressionEvent(
|
||||
getImpressionEventData(
|
||||
TelemetryConstants.FlowType.faceModelInit,
|
||||
TelemetryConstants.Screens.home,
|
||||
{status: TelemetryConstants.EndEventStatus.success},
|
||||
),
|
||||
);
|
||||
break;
|
||||
} else if (!result && counter === maxRetry - 1) {
|
||||
sendErrorEvent(
|
||||
getErrorEventData(
|
||||
TelemetryConstants.FlowType.faceModelInit,
|
||||
TelemetryConstants.ErrorId.failure,
|
||||
TelemetryConstants.ErrorMessage.faceModelInitFailed,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
export async function initializeFaceModel() {
|
||||
const config = faceMatchConfig();
|
||||
const result = await configure(config);
|
||||
if (result) {
|
||||
sendImpressionEvent(
|
||||
getImpressionEventData(
|
||||
TelemetryConstants.FlowType.faceModelInit,
|
||||
TelemetryConstants.Screens.home,
|
||||
{status: TelemetryConstants.EndEventStatus.success},
|
||||
),
|
||||
);
|
||||
} else {
|
||||
sendErrorEvent(
|
||||
getErrorEventData(
|
||||
TelemetryConstants.FlowType.faceModelInit,
|
||||
TelemetryConstants.ErrorId.failure,
|
||||
TelemetryConstants.ErrorMessage.faceModelInitFailed,
|
||||
error,
|
||||
),
|
||||
);
|
||||
console.error('Error while downloading face model - ', error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user