Fix barcode detection
This commit is contained in:
parent
36bab31f7b
commit
cb06dcdbfb
@ -27,13 +27,14 @@ function addTrackingSuggestions() {
|
||||
function openTrackingBarcodeScanner() {
|
||||
scanBarcode(function (result) {
|
||||
var code = "";
|
||||
var coderegex = /^[0-9a-zA-Z]{5,40}$/;
|
||||
if (result.startsWith("https://helena.express/track#")) {
|
||||
code = result.split("#")[1];
|
||||
} else if (result.startsWith("http") && result.includes("#")) {
|
||||
if (result.split("#")[1].test(/^[0-9a-zA-Z]{5,40}$/)) {
|
||||
if (coderegex.test(result.split("#")[1])) {
|
||||
code = result.split("#")[1];
|
||||
}
|
||||
} else if (result.test(/^[0-9a-zA-Z]{5,40}$/)) {
|
||||
} else if (coderegex.test(result)) {
|
||||
code = result;
|
||||
} else {
|
||||
app.dialog.alert("This app can't understand what's in that barcode.", "Error");
|
||||
|
Loading…
x
Reference in New Issue
Block a user