"Testnet not supported" message when scanning a testnet address.

This commit is contained in:
Brendon Duncan 2018-08-30 15:49:59 +12:00
commit 5747cbfb66
2 changed files with 23 additions and 6 deletions

View file

@ -3858,3 +3858,11 @@ msgstr ""
#: src/js/controllers/tab-scan.js:121 #: src/js/controllers/tab-scan.js:121
msgid "Data not recognised." msgid "Data not recognised."
msgstr "" msgstr ""
#: src/js/controllers/tab-scan.js:121
msgid "Unsupported"
msgstr ""
#: src/js/controllers/tab-scan.js:121
msgid "Testnet is not supported."
msgstr ""

View file

@ -113,15 +113,24 @@ angular.module('copayApp.controllers').controller('tabScanController', function(
contents = contents.result || contents; contents = contents.result || contents;
var parsed = bitcoinUriService.parse(contents); var parsed = bitcoinUriService.parse(contents);
if (parsed.isValid && !parsed.testnet) { var title = '';
incomingData.redir(contents); var msg = '';
} else { if (parsed.isValid) {
var title = gettextCatalog.getString('Scan Failed'); if (parsed.testnet) {
var msg = gettextCatalog.getString('Data not recognised.'); title = gettextCatalog.getString('Unsupported');
var okText = gettextCatalog.getString('OK'); msg = gettextCatalog.getString('Testnet is not supported.');
popupService.showAlert(title, msg, function onAlertShown() { popupService.showAlert(title, msg, function onAlertShown() {
scannerService.resumePreview(); scannerService.resumePreview();
}, okText); });
} else {
incomingData.redir(contents);
}
} else {
title = gettextCatalog.getString('Scan Failed');
msg = gettextCatalog.getString('Data not recognised.');
popupService.showAlert(title, msg, function onAlertShown() {
scannerService.resumePreview();
});
} }
} }