Skip to content

Commit

Permalink
remove deprecated calls
Browse files Browse the repository at this point in the history
  • Loading branch information
gilgameshskytrooper committed Jul 30, 2019
1 parent c671b2b commit c8a27ec
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 147 deletions.
2 changes: 1 addition & 1 deletion dist/voiceit2.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion frontend/dist/voiceit2.min.js

Large diffs are not rendered by default.

25 changes: 2 additions & 23 deletions frontend/src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,36 +125,15 @@ export default function api(modal, endPoint){
);
}

apiRef.deleteFaceEnrollments = (callback) => {
apiRef.deleteAllEnrollments = (callback) => {
vi$.post(
modal,
BASE_END_POINT,
'deleteFaceEnrollments',
'deleteAllEnrollments',
vi$.getToken(),
{},
callback
);
}

apiRef.deleteVoiceEnrollments = (callback) => {
vi$.post(
modal,
BASE_END_POINT,
'deleteVoiceEnrollments',
vi$.getToken(),
{},
callback
);
}

apiRef.deleteVideoEnrollments = (callback) => {
vi$.post(
modal,
BASE_END_POINT,
'deleteVideoEnrollments',
vi$.getToken(),
{},
callback
);
}
}
10 changes: 5 additions & 5 deletions frontend/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,19 +253,19 @@ voiceIt2ObjRef.initModalClickListeners = function(){
// Proceed for enrollment
vi$.clickOn(voiceIt2ObjRef.modal.domRef.rightArrowIcon, function() {
if (voiceIt2ObjRef.type.biometricType === "face"){
voiceIt2ObjRef.apiRef.deleteFaceEnrollments(voiceIt2ObjRef.handleDeletion);
voiceIt2ObjRef.apiRef.deleteAllEnrollments(voiceIt2ObjRef.handleDeletion);
} else if (voiceIt2ObjRef.type.biometricType === "video"){
voiceIt2ObjRef.apiRef.deleteFaceEnrollments(function(responseFace){
voiceIt2ObjRef.apiRef.deleteAllEnrollments(function(responseFace){
if (responseFace.responseCode === "SUCC") {
voiceIt2ObjRef.apiRef.deleteVoiceEnrollments(function(responseVoice){
voiceIt2ObjRef.apiRef.deleteAllEnrollments(function(responseVoice){
if (responseVoice.responseCode === "SUCC") {
voiceIt2ObjRef.apiRef.deleteVideoEnrollments(voiceIt2ObjRef.handleDeletion);
voiceIt2ObjRef.apiRef.deleteAllEnrollments(voiceIt2ObjRef.handleDeletion);
}
});
}
});
} else {
voiceIt2ObjRef.apiRef.deleteVoiceEnrollments(voiceIt2ObjRef.handleDeletion);
voiceIt2ObjRef.apiRef.deleteAllEnrollments(voiceIt2ObjRef.handleDeletion);
}
voiceIt2ObjRef.modal.hideWarningOverlay(300, function() {
voiceIt2ObjRef.modal.showWaitingLoader();
Expand Down
2 changes: 1 addition & 1 deletion node-example/public/js/voiceit2.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion php-example/js/voiceit2.min.js

Large diffs are not rendered by default.

42 changes: 1 addition & 41 deletions voiceit-node-backend/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,7 @@ function VoiceIt2(apk, tok) {

const extractedUserId = payloadObj.userId;
switch(reqType) {
case "deleteVoiceEnrollments":
mainThis.deleteAllEnrollments({userId: extractedUserId}, (result) =>{
res.json(result);
});
break;
case "deleteFaceEnrollments":
mainThis.deleteAllEnrollments({userId: extractedUserId}, (result) =>{
res.json(result);
});
break;
case "deleteVideoEnrollments":
case "deleteAllEnrollments":
mainThis.deleteAllEnrollments({userId: extractedUserId}, (result) =>{
res.json(result);
});
Expand Down Expand Up @@ -388,36 +378,6 @@ function VoiceIt2(apk, tok) {
});
};

// deprecation warning
this.deleteAllFaceEnrollments = (options, callback) => {
this.axiosInstance.delete(`${BASE_URL}/enrollments/${options.userId}/face${this.notificationUrl}`)
.then((httpResponse) => {
callback(httpResponse.data);
}).catch((error) => {
callback(error.response.data);
});
};

// deprecation warning
this.deleteAllVoiceEnrollments = (options, callback) => {
this.axiosInstance.delete(`${BASE_URL}/enrollments/${options.userId}/voice${this.notificationUrl}`)
.then((httpResponse) => {
callback(httpResponse.data);
}).catch((error) => {
callback(error.response.data);
});
};

// deprecation warning
this.deleteAllVideoEnrollments = (options, callback) => {
this.axiosInstance.delete(`${BASE_URL}/enrollments/${options.userId}/video${this.notificationUrl}`)
.then((httpResponse) => {
callback(httpResponse.data);
}).catch((error) => {
callback(error.response.data);
});
};

this.deleteAllEnrollments = (options, callback) => {
this.axiosInstance.delete(`${BASE_URL}/enrollments/${options.userId}/all${this.notificationUrl}`)
.then((httpResponse) => {
Expand Down
75 changes: 1 addition & 74 deletions voiceit-php-backend/VoiceIt2WebBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,7 @@ public function InitBackend($POST_REF, $FILES_REF, $resultCallback){

$EXTRACTED_USER_ID = $this->getPayload($secureToken);

if($reqType == "deleteVoiceEnrollments"){
$resp = $this->deleteAllEnrollments($EXTRACTED_USER_ID);
returnJson($resp);
}

if($reqType == "deleteFaceEnrollments"){
$resp = $this->deleteAllEnrollments($EXTRACTED_USER_ID);
returnJson($resp);
}

if($reqType == "deleteVideoEnrollments"){
if($reqType == "deleteAllEnrollments"){
$resp = $this->deleteAllEnrollments($EXTRACTED_USER_ID);
returnJson($resp);
}
Expand Down Expand Up @@ -363,69 +353,6 @@ public function createVideoEnrollment($userId, $contentLanguage, $phrase, $fileP
return curl_exec($crl);
}

// deprecation warning
public function deleteAllVoiceEnrollments($userId) {
$crl = curl_init();
curl_setopt($crl, CURLOPT_URL, $this->BASE_URL.'/enrollments/'.$userId.'/voice'.$this->notification_url);
curl_setopt($crl, CURLOPT_USERPWD, "$this->api_key:$this->api_token");
curl_setopt($crl, CURLOPT_HTTPHEADER, array('platformId: '.$this->platformId, 'platformVersion: '.VoiceIt2WebBackend::VERSION));
curl_setopt($crl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($crl, CURLOPT_CUSTOMREQUEST, 'DELETE');
return curl_exec($crl);
}

// deprecation warning
public function deleteAllFaceEnrollments($userId) {
$crl = curl_init();
curl_setopt($crl, CURLOPT_URL, $this->BASE_URL.'/enrollments/'.$userId.'/face'.$this->notification_url);
curl_setopt($crl, CURLOPT_USERPWD, "$this->api_key:$this->api_token");
curl_setopt($crl, CURLOPT_HTTPHEADER, array('platformId: '.$this->platformId, 'platformVersion: '.VoiceIt2WebBackend::VERSION));
curl_setopt($crl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($crl, CURLOPT_CUSTOMREQUEST, 'DELETE');
return curl_exec($crl);
}

// deprecation warning
public function deleteAllVideoEnrollments($userId) {
$crl = curl_init();
curl_setopt($crl, CURLOPT_URL, $this->BASE_URL.'/enrollments/'.$userId.'/video'.$this->notification_url);
curl_setopt($crl, CURLOPT_USERPWD, "$this->api_key:$this->api_token");
curl_setopt($crl, CURLOPT_HTTPHEADER, array('platformId: '.$this->platformId, 'platformVersion: '.VoiceIt2WebBackend::VERSION));
curl_setopt($crl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($crl, CURLOPT_CUSTOMREQUEST, 'DELETE');
return curl_exec($crl);
}

public function deleteVoiceEnrollment($userId, $enrollmentId) {
$crl = curl_init();
curl_setopt($crl, CURLOPT_URL, $this->BASE_URL.'/enrollments/voice/'.$userId.'/'.strval($enrollmentId).$this->notification_url);
curl_setopt($crl, CURLOPT_USERPWD, "$this->api_key:$this->api_token");
curl_setopt($crl, CURLOPT_HTTPHEADER, array('platformId: '.$this->platformId, 'platformVersion: '.VoiceIt2WebBackend::VERSION));
curl_setopt($crl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($crl, CURLOPT_CUSTOMREQUEST, 'DELETE');
return curl_exec($crl);
}

public function deleteFaceEnrollment($userId, $faceEnrollmentId) {
$crl = curl_init();
curl_setopt($crl, CURLOPT_URL, $this->BASE_URL.'/enrollments/face/'.$userId.'/'.strval($faceEnrollmentId).$this->notification_url);
curl_setopt($crl, CURLOPT_USERPWD, "$this->api_key:$this->api_token");
curl_setopt($crl, CURLOPT_HTTPHEADER, array('platformId: '.$this->platformId, 'platformVersion: '.VoiceIt2WebBackend::VERSION));
curl_setopt($crl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($crl, CURLOPT_CUSTOMREQUEST, 'DELETE');
return curl_exec($crl);
}

public function deleteVideoEnrollment($userId, $enrollmentId) {
$crl = curl_init();
curl_setopt($crl, CURLOPT_URL, $this->BASE_URL.'/enrollments/video/'.$userId.'/'.strval($enrollmentId).$this->notification_url);
curl_setopt($crl, CURLOPT_USERPWD, "$this->api_key:$this->api_token");
curl_setopt($crl, CURLOPT_HTTPHEADER, array('platformId: '.$this->platformId, 'platformVersion: '.VoiceIt2WebBackend::VERSION));
curl_setopt($crl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($crl, CURLOPT_CUSTOMREQUEST, 'DELETE');
return curl_exec($crl);
}

public function voiceVerification($userId, $contentLanguage, $phrase, $filePath) {
$this->checkFileExists($filePath);
$crl = curl_init();
Expand Down

0 comments on commit c8a27ec

Please sign in to comment.