diff --git a/config.xml b/config.xml
index 1f793d6..22404fc 100644
--- a/config.xml
+++ b/config.xml
@@ -21,8 +21,8 @@
-
-
+
+
diff --git a/package.json b/package.json
index 894a16b..f6b24a4 100644
--- a/package.json
+++ b/package.json
@@ -12,6 +12,8 @@
"dependencies": {
"cordova-android": "^8.0.0",
"cordova-plugin-app-version": "^0.1.9",
+ "cordova-plugin-barcodescanner": "^0.7.4",
+ "cordova-plugin-compat": "^1.2.0",
"cordova-plugin-headercolor": "^1.0.0",
"cordova-plugin-inappbrowser": "^3.0.0",
"cordova-plugin-statusbar": "^2.4.2",
@@ -23,7 +25,8 @@
"cordova-plugin-statusbar": {},
"cordova-plugin-headercolor": {},
"cordova-plugin-app-version": {},
- "cordova-plugin-inappbrowser": {}
+ "cordova-plugin-inappbrowser": {},
+ "cordova-plugin-barcodescanner": {}
},
"platforms": [
"android"
diff --git a/www/js/home.js b/www/js/home.js
index 310412a..98dbaa8 100644
--- a/www/js/home.js
+++ b/www/js/home.js
@@ -8,7 +8,7 @@ var accountBalance = 0.0;
$(".view-main").on("ptr:refresh", ".ptr-content", function () {
loadHomePage(function () {
- app.ptr.done();
+ setTimeout(app.ptr.done, 500);
});
});
@@ -60,7 +60,7 @@ function loadQrCode(callback) {
var typeNumber = 4;
var errorCorrectionLevel = 'L';
var qr = qrcode(typeNumber, errorCorrectionLevel);
- qr.addData('https://app.helpinghelena.org/?sendto=' + data.profile.publicid);
+ qr.addData(SETTINGS['webapp_url'] + '?sendto=' + data.profile.publicid);
qr.make();
var svg = qr.createSvgTag({
margin: 6,
diff --git a/www/js/main.js b/www/js/main.js
index 5f9ce7f..e74f2ee 100644
--- a/www/js/main.js
+++ b/www/js/main.js
@@ -148,10 +148,10 @@ if (localStorage.getItem("configured") == null) {
} catch (ex) {
router.navigate("/home");
}
-
+
setupKeyRefresh();
} else {
- //router.navigate("/setup/0");
+ router.navigate("/setup/0");
}
});
}
diff --git a/www/js/platform.js b/www/js/platform.js
index ce25402..a6b58da 100644
--- a/www/js/platform.js
+++ b/www/js/platform.js
@@ -30,7 +30,7 @@ function initCordova() {
document.addEventListener("deviceready", function () {
if (cordova.platformId == 'android') {
- StatusBar.backgroundColorByHexString("#D32F2F");
+ StatusBar.backgroundColorByHexString("#F57C00");
StatusBar.styleLightContent();
}
}, false);
diff --git a/www/js/sendmoney.js b/www/js/sendmoney.js
index 7c610ff..33dfe7a 100644
--- a/www/js/sendmoney.js
+++ b/www/js/sendmoney.js
@@ -23,6 +23,30 @@ $("#typecodebtn").on("click", function () {
});
});
+$("#scanqrcodebtn").on("click", function () {
+ cordova.plugins.barcodeScanner.scan(
+ function (result) {
+ if (!result.cancelled) {
+ console.log("Barcode: ", result);
+ if (result.format == "QR_CODE" && result.text.startsWith(SETTINGS['webapp_url'])) {
+ var url = new URL(result.text);
+ if (typeof url.searchParams.get("sendto") == "string") {
+ $("#publicid").val(url.searchParams.get("sendto"));
+ loadSendMoneyPage();
+ } else {
+ app.dialog.alert("Not a valid payment code.", "Scan Error");
+ }
+ } else {
+ app.dialog.alert("Not a valid payment code.", "Scan Error");
+ }
+ }
+ },
+ function (error) {
+ app.dialog.alert(error, "Scan Error");
+ }
+ );
+});
+
function sendMoney(id, amount, name) {
if (id == "0") {
return;
diff --git a/www/pages/sendmoney.html b/www/pages/sendmoney.html
index 13b070d..d663679 100644
--- a/www/pages/sendmoney.html
+++ b/www/pages/sendmoney.html
@@ -25,7 +25,7 @@
{{#if @global.qrenabled}}
-
diff --git a/www/settings.template.js b/www/settings.template.js
index 58b45a7..fdc2323 100644
--- a/www/settings.template.js
+++ b/www/settings.template.js
@@ -8,5 +8,6 @@
* Array of global settings.
*/
var SETTINGS = {
- server: "http://localhost/helpinghelena/api"
+ server: "http://localhost/helpinghelena/api",
+ webapp_url: "https://app.helpinghelena.org/"
};
\ No newline at end of file