-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
724 additions
and
527 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
/* | ||
* Anyline Cordova Plugin | ||
* anyline.universalId.js | ||
* | ||
* Copyright (c) 2016 Anyline GmbH | ||
*/ | ||
|
||
if (anyline === undefined) { | ||
var anyline = {}; | ||
} | ||
anyline.universalId = { | ||
onResult: function (result) { | ||
changeLoadingState(false); | ||
//this is called for every universal Id scan result | ||
//the result is a json-object containing all the scaned values and check-digits | ||
console.log("Universal Id result: " + JSON.stringify(result)); | ||
var div = document.getElementById('results'); | ||
|
||
if (div.childElementCount >= 3) { | ||
div.removeChild(div.childNodes[div.childElementCount - 1]); | ||
} | ||
|
||
var s = "<p>" + "<img src=\"" + result.imagePath + "\" width=\"100%\" height=\"auto\"/><br/>"; | ||
console.log("s 1: " + s); | ||
console.log("result length: " + result.length); | ||
|
||
// for (var i = 0; i < result.length; i++){ | ||
// var obj = result[i]; | ||
// for (var key in obj){ | ||
// var attrName = key; | ||
// var attrValue = obj[key]; | ||
// console.log("name, value: " + attrName + " - " + attrValue); | ||
// s = s.concat("<br/><b>" + attrName + ": </b>" + attrValue); | ||
// console.log("s 2: " + s); | ||
// } | ||
// } | ||
|
||
|
||
for (var key in result) { | ||
if (result.hasOwnProperty(key)) { | ||
var val = result[key]; | ||
if (key != "imagePath" && key != "fullImagePath" ) | ||
s = s.concat("<br/><b>" + key + ": </b>" + val); | ||
console.log("-------------- key, value: " + key + " - " + val); | ||
} | ||
} | ||
|
||
|
||
|
||
s = s.concat ("</p>"); | ||
console.log("s 3: " + s); | ||
div.innerHTML = s; | ||
|
||
document.getElementById("details_scan_modes").removeAttribute("open"); | ||
document.getElementById("details_results").setAttribute("open", ""); | ||
window.scrollTo(0, 0); | ||
}, | ||
|
||
onError: function (error) { | ||
changeLoadingState(false); | ||
//called if an error occurred or the user canceled the scanning | ||
if (error == "Canceled") { | ||
//do stuff when user has canceled | ||
// this can be used as an indicator that the user finished the scanning if canclelOnResult is false | ||
console.log("Universal Id scanning canceled"); | ||
return; | ||
} | ||
|
||
alert(error); | ||
}, | ||
|
||
anylineUniversalIdViewConfig: { | ||
"camera" : { | ||
"captureResolution" : "1080p", | ||
"zoomGesture": true | ||
}, | ||
"flash" : { | ||
"mode": "manual", | ||
"alignment": "bottom_right", | ||
"imageOn": "flash_on", | ||
"imageOff": "flash_off" | ||
}, | ||
"viewPlugin" : { | ||
"plugin":{ | ||
"id":"ID", | ||
"idPlugin": { | ||
"templateConfig": { | ||
"drivingLicense": { | ||
"surname": {"scanOption": 0, "minConfidence": 40}, | ||
"givenNames": {"scanOption": 0, "minConfidence": 40}, | ||
"dateOfBirth": {"scanOption": 0, "minConfidence": 50}, | ||
"placeOfBirth": {"scanOption": 0, "minConfidence": 50}, | ||
"dateOfIssue": {"scanOption": 0, "minConfidence": 50}, | ||
"dateOfExpiry": {"scanOption": 1, "minConfidence": 50}, | ||
"authority": {"scanOption": 1, "minConfidence": 30}, | ||
"documentNumber": {"scanOption": 0, "minConfidence": 40}, | ||
"categories": {"scanOption": 1, "minConfidence": 30}, | ||
"address": {"scanOption": 1} | ||
}, | ||
"idFront": { | ||
"surname": {"scanOption": 0, "minConfidence": 60}, | ||
"givenNames": {"scanOption": 0, "minConfidence": 60}, | ||
"dateOfBirth": {"scanOption": 0, "minConfidence": 60}, | ||
"placeOfBirth": {"scanOption": 0, "minConfidence": 60}, | ||
"dateOfExpiry": {"scanOption": 0, "minConfidence": 60}, | ||
"cardAccessNumber": {"scanOption": 0, "minConfidence": 60}, | ||
"documentNumber": {"scanOption": 0, "minConfidence": 60}, | ||
"nationality": {"scanOption": 0, "minConfidence": 60} | ||
} | ||
} | ||
|
||
} | ||
}, | ||
"cutoutConfig" : { | ||
"style": "rect", | ||
"maxWidthPercent": "90%", | ||
"maxHeightPercent": "90%", | ||
"alignment": "center", | ||
"strokeWidth": 2, | ||
"cornerRadius": 4, | ||
"strokeColor": "FFFFFF", | ||
"outerColor": "000000", | ||
"outerAlpha": 0.3, | ||
"ratioFromSize" : { | ||
"width": 50, | ||
"height": 31 | ||
}, | ||
"cropPadding": { | ||
"x": -30, | ||
"y": -90 | ||
}, | ||
"cropOffset": { | ||
"x": 0, | ||
"y": 90 | ||
}, | ||
"feedbackStrokeColor": "0099FF" | ||
}, | ||
"scanFeedback" : { | ||
"style": "contour_rect", | ||
"visualFeedbackRedrawTimeout": 100, | ||
"strokeColor": "0099FF", | ||
"fillColor" : "220099FF", | ||
"beepOnResult": true, | ||
"vibrateOnResult": true, | ||
"strokeWidth": 2 | ||
}, | ||
"cancelOnResult" : true | ||
} | ||
}, | ||
|
||
scan: function () { | ||
if (localStorage.getItem("hasStartedAnyline") === 'true') { | ||
return; | ||
} | ||
changeLoadingState(true); | ||
// start the UniversalId scanning | ||
// pass the success and error callbacks, as well as the license key and the config to the plugin | ||
// see http://documentation.anyline.io/#anyline-config for config details | ||
// and http://documentation.anyline.io/#universalId for module details | ||
|
||
var licenseKey = "eyAiYW5kcm9pZElkZW50aWZpZXIiOiBbICJpby5hbnlsaW5lLmV4YW1wbGVzLmNvcmRvdmEiIF0sICJkZWJ1Z1JlcG9ydGluZyI6ICJvcHQtb3V0IiwgImltYWdlUmVwb3J0Q2FjaGluZyI6I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.anylineUniversalIdViewConfig]); | ||
} | ||
}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.