Wallet/src/js/controllers/tabsController.js

53 lines
1.4 KiB
JavaScript
Raw Normal View History

2016-08-25 11:18:10 -03:00
'use strict';
angular.module('copayApp.controllers').controller('tabsController', function($rootScope, $log, $scope, $state, $stateParams, $timeout, platformInfo, incomingDataService, lodash, popupService, gettextCatalog, scannerService, sendFlowService) {
2016-08-25 11:18:10 -03:00
$scope.onScan = function(data) {
incomingDataService.redir(data, function onError(err) {
2018-09-03 13:31:58 +09:00
if (err) {
popupService.showAlert(gettextCatalog.getString('Error'), err.message);
}
});
2016-10-16 21:51:50 -03:00
};
2016-08-25 11:18:10 -03:00
$scope.setScanFn = function(scanFn) {
$scope.scan = function() {
$log.debug('Scanning...');
scanFn();
2016-08-25 11:18:10 -03:00
};
};
$scope.startFreshSend = function() {
sendFlowService.start();
};
$scope.importInit = function() {
$scope.fromOnboarding = $stateParams.fromOnboarding;
$timeout(function() {
$scope.$apply();
}, 1);
};
2017-06-07 12:23:07 -03:00
$scope.chooseScanner = function() {
var isWindowsPhoneApp = platformInfo.isCordova && platformInfo.isWP;
2017-06-07 12:23:07 -03:00
if (!isWindowsPhoneApp) {
$state.go('tabs.scan');
return;
}
scannerService.useOldScanner(function(err, contents) {
if (err) {
2018-09-03 13:31:58 +09:00
popupService.showAlert(gettextCatalog.getString('Error'), err.message);
} else {
incomingDataService.redir(contents, function onError(err) {
2018-09-03 13:31:58 +09:00
if (err) {
popupService.showAlert(gettextCatalog.getString('Error'), err.message);
}
});
2017-06-07 12:23:07 -03:00
}
});
};
});