Alert and resume scanning if data is not recognised.
This commit is contained in:
parent
6d48572f28
commit
529bdf3386
2 changed files with 21 additions and 2 deletions
|
|
@ -3849,4 +3849,12 @@ msgstr ""
|
||||||
|
|
||||||
#: src/js/services/incomingData.js:129
|
#: src/js/services/incomingData.js:129
|
||||||
msgid "This invoice is no longer accepting payments"
|
msgid "This invoice is no longer accepting payments"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/js/controllers/tab-scan.js:120
|
||||||
|
msgid "Scan Failed"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/js/controllers/tab-scan.js:121
|
||||||
|
msgid "Data not recognised."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('tabScanController', function($scope, $log, $timeout, scannerService, incomingData, $state, $ionicHistory, $rootScope, $ionicNavBarDelegate) {
|
angular.module('copayApp.controllers').controller('tabScanController', function(bitcoinUriService, gettextCatalog, popupService, $scope, $log, $timeout, scannerService, incomingData, $state, $ionicHistory, $rootScope, $ionicNavBarDelegate) {
|
||||||
|
|
||||||
var scannerStates = {
|
var scannerStates = {
|
||||||
unauthorized: 'unauthorized',
|
unauthorized: 'unauthorized',
|
||||||
|
|
@ -111,7 +111,18 @@ angular.module('copayApp.controllers').controller('tabScanController', function(
|
||||||
// Sometimes (testing in Chrome, when reading QR Code) data is an object
|
// Sometimes (testing in Chrome, when reading QR Code) data is an object
|
||||||
// that has a string data.result.
|
// that has a string data.result.
|
||||||
contents = contents.result || contents;
|
contents = contents.result || contents;
|
||||||
incomingData.redir(contents);
|
|
||||||
|
var parsed = bitcoinUriService.parse(contents);
|
||||||
|
if (parsed.isValid) {
|
||||||
|
incomingData.redir(contents);
|
||||||
|
} else {
|
||||||
|
var title = gettextCatalog.getString('Scan Failed');
|
||||||
|
var msg = gettextCatalog.getString('Data not recognised.');
|
||||||
|
var okText = gettextCatalog.getString('OK');
|
||||||
|
popupService.showAlert(title, msg, function onAlertShown() {
|
||||||
|
scannerService.resumePreview();
|
||||||
|
}, okText);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$rootScope.$on('incomingDataMenu.menuHidden', function() {
|
$rootScope.$on('incomingDataMenu.menuHidden', function() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue