Code snippet from MB Vaccine App
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
}, u.default.createElement(s.Camera, { | |
onBarCodeScanned: R ? function(t) { | |
var l, o, u, c, s, p, y; | |
return n.default.async(function(v) { | |
for (;;) switch (v.prev = v.next) { | |
case 0: | |
return l = t.type, o = t.data, v.next = 3, n.default.awrap(f.getNetworkStateAsync()); | |
case 3: | |
if (!1 !== (u = v.sent).isConnected && !1 !== u.isInternetReachable) { | |
v.next = 8; | |
break | |
} | |
O.navigate('Result', { | |
result: void 0 | |
}), v.next = 25; | |
break; | |
case 8: | |
if (c = (0, w.sanitize)(o), s = (0, w.parseCertificateId)(c), p = (0, w.parseBaseURL)(c), !(0, w.validate)(l.toString(), s, p)) { | |
v.next = 24; | |
break | |
} | |
return v.prev = 12, v.next = 15, n.default.awrap(b.UserService.verify(s)); | |
case 15: | |
y = v.sent, O.navigate('Result', { | |
result: y.data | |
}), v.next = 22; | |
break; | |
case 19: | |
v.prev = 19, v.t0 = v.catch(12), O.navigate('Result', { | |
result: void 0 | |
}); | |
case 22: | |
v.next = 25; | |
break; | |
case 24: | |
O.navigate('Result', { | |
result: { | |
isValid: !1 | |
} | |
}); | |
case 25: | |
N(); | |
case 26: | |
case "end": | |
return v.stop() | |
} | |
}, null, null, [ | |
[12, 19] | |
], Promise) |
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
// from lines 123806 through 123812 in assets/app.bundle | |
extra: { | |
azure: { | |
appId: "1dc2b25e-fafe-4982-8571-eb67b94023ee", | |
tenant: "govmbcitizen", | |
baseURL: "https://immunizationcard.manitoba.ca/api" | |
} | |
} |
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
e.formatName = function(n, t) { | |
return n.length > 30 && t.length <= 30 ? n.slice(0, 30) + "\u2026\n" + t : n.length <= 30 && t.length > 30 ? n + "\n" + t.slice(0, 30) + "\u2026" : n.length > 30 && t.length > 30 ? n.slice(0, 30) + "\u2026\n" + t.slice(0, 30) + "\u2026" : n.length + t.length > 30 || t.length - n.length >= 7 || n.length - t.length >= 7 ? n + "\n" + t : n + " " + t | |
}; | |
e.parseCertificateId = function(n) { | |
var t = n.indexOf('ID='); | |
return n.substring(t + 3) | |
}; | |
e.parseBaseURL = function(n) { | |
var t = n.indexOf('ID='); | |
return n.substring(0, t - 1) | |
}; | |
e.ucFirst = function(n) { | |
return n.charAt(0).toUpperCase() + n.slice(1) | |
} |
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
}, l.verify = function(n) { | |
return t.default.async(function(t) { | |
for (;;) switch (t.prev = t.next) { | |
case 0: | |
return t.abrupt("return", c.default.get("/verification/" + n)); | |
case 1: | |
case "end": | |
return t.stop() | |
} | |
}, null, null, null, Promise) |
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
e.sanitize = function(t) { | |
for (var w = t; w.includes('<') || w.includes('>');) w = w.replace('<', '').replace('>', ''); | |
return w | |
}; | |
e.validate = function(t, w, s) { | |
return ('256' === t || 'org.iso.QRCode' === t) && /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(w) && /(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,})/i.test(s) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment