This commit is contained in:
Matias Alejo Garcia 2016-08-19 13:07:18 -03:00
commit a8cf875def
No known key found for this signature in database
GPG key ID: 02470DB551277AB3
22 changed files with 53 additions and 1392 deletions

View file

@ -4,27 +4,25 @@ angular.module('copayApp.controllers').controller('backupController',
function($rootScope, $scope, $timeout, $log, $state, lodash, fingerprintService, platformInfo, configService, profileService, gettext, bwcService, walletService, ongoingProcess) {
var fc = profileService.focusedClient;
var prevState;
$scope.customWords = [];
$scope.walletName = fc.credentials.walletName;
$scope.credentialsEncrypted = fc.isPrivKeyEncrypted;
$scope.init = function(state) {
prevState = state || 'walletHome';
$scope.init = function() {
$scope.step = 1;
$scope.deleted = isDeletedSeed();
if ($scope.deleted) return;
fingerprintService.check(fc, function(err) {
if (err) {
go.path(prevState);
$state.go('tabs.home')
return;
}
handleEncryptedWallet(fc, function(err) {
if (err) {
$log.warn('Error decrypting credentials:', $scope.error);
go.path(prevState);
$state.go('tabs.home')
return;
}
$scope.credentialsEncrypted = false;

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('copayersController',
function($scope, $rootScope, $timeout, $log, $ionicModal, profileService, go, notification, platformInfo, gettext, gettextCatalog, $stateParams, $state) {
function($scope, $rootScope, $timeout, $log, $ionicModal, profileService, $state, notification, platformInfo, gettext, gettextCatalog, $stateParams, $state) {
var self = this;
$scope.isCordova = platformInfo.isCordova;
var isWP = platformInfo.isWP;
@ -39,7 +39,7 @@ angular.module('copayApp.controllers').controller('copayersController',
$scope.$digest();
});
} else {
go.walletHome();
$state.go('tabs.home');
$timeout(function() {
notification.success(
gettextCatalog.getString('Success'),

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('createController',
function($scope, $rootScope, $timeout, $log, lodash, go, profileService, configService, gettext, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess, walletService) {
function($scope, $rootScope, $timeout, $log, lodash, $state, profileService, configService, gettext, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess, walletService) {
var isChromeApp = platformInfo.isChromeApp;
var isCordova = platformInfo.isCordova;
@ -187,8 +187,7 @@ angular.module('copayApp.controllers').controller('createController',
$rootScope.$emit('Local/BackupDone');
}, 1);
}
go.walletHome();
$state.go('tabs.home')
});
}, 100);
}

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('disclaimerController',
function($scope, $rootScope, $timeout, $log, $ionicSideMenuDelegate, profileService, applicationService, gettextCatalog, uxLanguage, go, storageService, gettext, platformInfo, ongoingProcess) {
function($scope, $rootScope, $timeout, $log, $ionicSideMenuDelegate, profileService, applicationService, gettextCatalog, uxLanguage, $state, storageService, gettext, platformInfo, ongoingProcess) {
var tries = 0;
var isCordova = platformInfo.isCordova;
@ -49,7 +49,7 @@ angular.module('copayApp.controllers').controller('disclaimerController',
if (!err || !err.message || !err.message.match('NONAGREEDDISCLAIMER')) {
$log.debug('Disclaimer already accepted at #disclaimer. Redirect to Wallet Home.');
$ionicSideMenuDelegate.canDragContent(true);
go.walletHome();
$state.go('tabs.home');
}
});
}
@ -62,7 +62,7 @@ angular.module('copayApp.controllers').controller('disclaimerController',
else {
$ionicSideMenuDelegate.canDragContent(true);
$rootScope.$emit('disclaimerAccepted');
go.walletHome();
$state.go('tabs.home');
}
});
};

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('exportController',
function($rootScope, $scope, $timeout, $log, lodash, backupService, walletService, storageService, profileService, platformInfo, notification, go, gettext, gettextCatalog, $state, $stateParams) {
function($rootScope, $scope, $timeout, $log, lodash, backupService, walletService, storageService, profileService, platformInfo, notification, gettext, gettextCatalog, $state, $stateParams) {
var prevState;
var isWP = platformInfo.isWP;
var isAndroid = platformInfo.isAndroid;
@ -69,7 +69,7 @@ angular.module('copayApp.controllers').controller('exportController',
return;
}
notification.success(gettext('Success'), gettext('Encrypted export file saved'));
go.walletHome();
$state.go('tabs.home');
});
});
};

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('importController',
function($scope, $rootScope, $timeout, $log, profileService, configService, notification, go, sjcl, gettext, ledger, trezor, derivationPathHelper, platformInfo, bwcService, ongoingProcess, walletService) {
function($scope, $rootScope, $timeout, $log, profileService, configService, notification, sjcl, gettext, ledger, trezor, derivationPathHelper, platformInfo, bwcService, ongoingProcess, walletService) {
var isChromeApp = platformInfo.isChromeApp;
var isDevel = platformInfo.isDevel;
@ -111,7 +111,7 @@ angular.module('copayApp.controllers').controller('importController',
$rootScope.$emit('Local/WalletImported', client.credentials.walletId);
notification.success(gettext('Success'), gettext('Your wallet has been imported correctly'));
go.walletHome();
$state.go('tabs.home');
});
}, 100);
};
@ -139,7 +139,7 @@ angular.module('copayApp.controllers').controller('importController',
$rootScope.$emit('Local/WalletImported', client.credentials.walletId);
notification.success(gettext('Success'), gettext('Your wallet has been imported correctly'));
go.walletHome();
$state.go('tabs.home');
});
}, 100);
};
@ -160,7 +160,7 @@ angular.module('copayApp.controllers').controller('importController',
}
$rootScope.$emit('Local/WalletImported', walletId);
notification.success(gettext('Success'), gettext('Your wallet has been imported correctly'));
go.walletHome();
$state.go('tabs.home');
});
}, 100);
};
@ -190,7 +190,7 @@ angular.module('copayApp.controllers').controller('importController',
$rootScope.$emit('Local/WalletImported', client.credentials.walletId);
notification.success(gettext('Success'), gettext('Your wallet has been imported correctly'));
go.walletHome();
$state.go('tabs.home');
});
}, 100);
};
@ -325,7 +325,7 @@ angular.module('copayApp.controllers').controller('importController',
});
$rootScope.$emit('Local/WalletImported', wallet.walletId);
notification.success(gettext('Success'), gettext('Your wallet has been imported correctly'));
go.walletHome();
$state.go('tabs.home');
});
}, 100);
};
@ -403,7 +403,7 @@ angular.module('copayApp.controllers').controller('importController',
});
$rootScope.$emit('Local/WalletImported', wallet.walletId);
notification.success(gettext('Success'), gettext('Your wallet has been imported correctly'));
go.walletHome();
$state.go('tabs.home');
});
}, 100);
};

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('joinController',
function($scope, $rootScope, $timeout, go, notification, profileService, configService, storageService, applicationService, gettext, lodash, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess, walletService, $log) {
function($scope, $rootScope, $timeout, $state, notification, profileService, configService, storageService, applicationService, gettext, lodash, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess, walletService, $log) {
var isChromeApp = platformInfo.isChromeApp;
var isDevel = platformInfo.isDevel;
@ -140,7 +140,7 @@ angular.module('copayApp.controllers').controller('joinController',
$log.debug('Remote preferences saved for:' + client.credentials.walletId)
});
go.walletHome();
$state.go('tabs.home');
});
}, 100);
};

View file

@ -1,5 +1,5 @@
angular.module('copayApp.controllers').controller('paperWalletController',
function($scope, $timeout, $log, $ionicModal, configService, profileService, go, addressService, txStatus, bitcore, ongoingProcess, txFormatService) {
function($scope, $timeout, $log, $ionicModal, configService, profileService, $state, addressService, txStatus, bitcore, ongoingProcess, txFormatService) {
var fc = profileService.focusedClient;
var rawTx;
@ -102,7 +102,7 @@ angular.module('copayApp.controllers').controller('paperWalletController',
} else {
var type = txStatus.notify(txp);
$scope.openStatusModal(type, txp, function() {
go.walletHome();
$state.go('tabs.home');
});
}
$scope.$apply();

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('paymentUriController',
function($rootScope, $scope, $stateParams, $location, $timeout, profileService, configService, lodash, bitcore, go) {
function($rootScope, $scope, $stateParams, $location, $timeout, profileService, configService, lodash, bitcore, $state) {
function strip(number) {
return (parseFloat(number.toPrecision(12)));
};
@ -47,7 +47,7 @@ angular.module('copayApp.controllers').controller('paymentUriController',
this.selectWallet = function(wid) {
var self = this;
profileService.setAndStoreFocus(wid, function() {});
go.walletHome();
$state.go('tabs.home');
$timeout(function() {
$rootScope.$emit('paymentUri', self.bitcoinURI);
}, 1000);

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesDeleteWalletController',
function($scope, $rootScope, $filter, $timeout, $log, $ionicModal, storageService, notification, profileService, platformInfo, go, gettext, gettextCatalog, applicationService, ongoingProcess) {
function($scope, $rootScope, $filter, $timeout, $log, $ionicModal, storageService, notification, profileService, platformInfo, $state, gettext, gettextCatalog, applicationService, ongoingProcess) {
var isCordova = platformInfo.isCordova;
$scope.isCordova = isCordova;
$scope.error = null;
@ -38,7 +38,7 @@ angular.module('copayApp.controllers').controller('preferencesDeleteWalletContro
if (err) {
$scope.error = err.message || err;
} else {
go.walletHome();
$state.go('tabs.home');
notification.success(gettextCatalog.getString('Success'), gettextCatalog.getString('The wallet "{{walletName}}" was deleted', {
walletName: walletName
}));

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesHistory',
function($scope, $log, $timeout, storageService, go, profileService, lodash) {
function($scope, $log, $timeout, storageService, $state, profileService, lodash) {
var fc = profileService.focusedClient;
var c = fc.credentials;
$scope.csvReady = false;
@ -125,7 +125,7 @@ angular.module('copayApp.controllers').controller('preferencesHistory',
$scope.$emit('Local/ClearHistory');
$timeout(function() {
go.walletHome();
$state.go('tabs.home');
}, 100);
});
};

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesInformation',
function($scope, $log, $timeout, platformInfo, gettextCatalog, lodash, profileService, configService, go, $stateParams) {
function($scope, $log, $timeout, platformInfo, gettextCatalog, lodash, profileService, configService, $stateParams, walletService, $state) {
var base = 'xpub';
var wallet = profileService.getWallet($stateParams.walletId);
var walletId = wallet.id;
@ -104,7 +104,7 @@ angular.module('copayApp.controllers').controller('preferencesInformation',
opts.colorFor[walletId] = color;
configService.set(opts, function(err) {
go.walletHome();
$state.go('tabs.home');
if (err) $log.warn(err);
$scope.$emit('Local/ColorUpdated');
});
@ -121,4 +121,11 @@ angular.module('copayApp.controllers').controller('preferencesInformation',
}
};
$scope.scan = function() {
walletService.startScan(wallet);
$state.go('tabs.home');
};
});

View file

@ -1,13 +0,0 @@
'use strict';
angular.module('copayApp.controllers').controller('topbarController', function(go) {
this.goHome = function() {
go.walletHome();
};
this.goPreferences = function() {
go.preferences();
};
});