redir cb
This commit is contained in:
parent
e8b3476ea1
commit
6f28f6ba2b
6 changed files with 84 additions and 111 deletions
|
|
@ -111,27 +111,17 @@ angular.module('copayApp.controllers').controller('tabScanController', function(
|
|||
// Sometimes (testing in Chrome, when reading QR Code) data is an object
|
||||
// that has a string data.result.
|
||||
contents = contents.result || contents;
|
||||
|
||||
var parsed = bitcoinUriService.parse(contents);
|
||||
var title = '';
|
||||
var msg = '';
|
||||
if (parsed.isValid) {
|
||||
if (parsed.isTestnet) {
|
||||
title = gettextCatalog.getString('Unsupported');
|
||||
msg = gettextCatalog.getString('Testnet is not supported.');
|
||||
popupService.showAlert(title, msg, function onAlertShown() {
|
||||
incomingData.redir(contents, function onError(err) {
|
||||
if (err) {
|
||||
var title = gettextCatalog.getString('Scan Failed');
|
||||
popupService.showAlert(title, err.message, function onAlertShown() {
|
||||
scannerService.resumePreview();
|
||||
});
|
||||
} else {
|
||||
incomingData.redir(contents);
|
||||
}
|
||||
} else {
|
||||
title = gettextCatalog.getString('Scan Failed');
|
||||
msg = gettextCatalog.getString('Data not recognised.');
|
||||
popupService.showAlert(title, msg, function onAlertShown() {
|
||||
scannerService.resumePreview();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$rootScope.$on('incomingDataMenu.menuHidden', function() {
|
||||
|
|
|
|||
|
|
@ -3,9 +3,11 @@
|
|||
angular.module('copayApp.controllers').controller('tabsController', function($rootScope, $log, $scope, $state, $stateParams, $timeout, platformInfo, incomingData, lodash, popupService, gettextCatalog, scannerService, sendFlowService) {
|
||||
|
||||
$scope.onScan = function(data) {
|
||||
if (!incomingData.redir(data)) {
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Invalid data'));
|
||||
}
|
||||
incomingData.redir(data, function onError(err) {
|
||||
if (err) {
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), err.message);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.setScanFn = function(scanFn) {
|
||||
|
|
@ -36,10 +38,14 @@ angular.module('copayApp.controllers').controller('tabsController', function($ro
|
|||
|
||||
scannerService.useOldScanner(function(err, contents) {
|
||||
if (err) {
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), err);
|
||||
return;
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), err.message);
|
||||
} else {
|
||||
incomingData.redir(contents, function onError(err) {
|
||||
if (err) {
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), err.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
incomingData.redir(contents);
|
||||
});
|
||||
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue