Fixed Conflicts:

index.html
This commit is contained in:
Gustavo Cortez 2014-06-03 18:49:25 -03:00
commit 5a0c1e235b
33 changed files with 322 additions and 202 deletions

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copay.addresses').controller('AddressesController',
angular.module('copayApp.controllers').controller('AddressesController',
function($scope, $rootScope, $timeout, controllerUtils) {
$scope.loading = false;
var w = $rootScope.wallet;

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copay.backup').controller('BackupController',
function($scope, $rootScope, $location, $window, $timeout) {
angular.module('copayApp.controllers').controller('BackupController',
function($scope, $rootScope, $location, $window, $timeout, $modal) {
$scope.title = 'Backup';
var _getEncryptedWallet = function() {
@ -18,29 +18,40 @@ angular.module('copay.backup').controller('BackupController',
saveAs(blob, filename);
};
$scope.email = function() {
var email = prompt('Please enter your email addres.');
var mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
if (email && email !== '') {
if (!email.match(mailformat)) {
alert('Enter a valid email address');
} else {
var body = _getEncryptedWallet();
var subject = ($rootScope.wallet.name ? $rootScope.wallet.name + ' - ' : '') + $rootScope.wallet.id;
var href = 'mailto:' + email + '?'
+ 'subject=[Copay Backup] ' + subject + '&'
+ 'body=' + body;
$scope.openModal = function () {
var modalInstance = $modal.open({
templateUrl: 'backupModal.html',
controller: ModalInstanceCtrl,
});
var newWin = $window.open(href, '_blank', 'scrollbars=yes,resizable=yes,width=10,height=10');
modalInstance.result.then(sendEmail);
};
if (newWin) {
$timeout(function() {
newWin.close();
}, 1000);
}
}
}
};
});
var sendEmail = function(email) {
var body = _getEncryptedWallet();
var subject = ($rootScope.wallet.name ? $rootScope.wallet.name + ' - ' : '') + $rootScope.wallet.id;
var href = 'mailto:' + email + '?'
+ 'subject=[Copay Backup] ' + subject + '&'
+ 'body=' + body;
var newWin = $window.open(href, '_blank', 'scrollbars=yes,resizable=yes,width=10,height=10');
if (newWin) {
$timeout(function() {
newWin.close();
}, 1000);
}
};
});
var ModalInstanceCtrl = function ($scope, $modalInstance) {
$scope.submit = function (form) {
$modalInstance.close($scope.email);
};
$scope.cancel = function () {
$modalInstance.dismiss('cancel');
};
};

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copay.footer').controller('FooterController', function($rootScope, $sce, $scope, $http) {
angular.module('copayApp.controllers').controller('FooterController', function($rootScope, $sce, $scope, $http) {
if (config.themes && Array.isArray(config.themes) && config.themes[0]) {
$scope.themes = config.themes;

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copay.header').controller('HeaderController',
angular.module('copayApp.controllers').controller('HeaderController',
function($scope, $rootScope, $location, $notification, $http, walletFactory, controllerUtils) {
$scope.menu = [
{

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copay.import').controller('ImportController',
angular.module('copayApp.controllers').controller('ImportController',
function($scope, $rootScope, walletFactory, controllerUtils, Passphrase) {
$scope.title = 'Import a backup';
var reader = new FileReader();

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copay.send').controller('SendController',
angular.module('copayApp.controllers').controller('SendController',
function($scope, $rootScope, $window, $location, $timeout) {
$scope.title = 'Send';
$scope.loading = false;

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copay.settings').controller('SettingsController',
angular.module('copayApp.controllers').controller('SettingsController',
function($scope, $rootScope, $window, $location) {
$scope.title = 'Settings';

View file

@ -32,7 +32,7 @@ var valid_pairs = {
'1,12': 489
};
angular.module('copay.setup').controller('SetupController',
angular.module('copayApp.controllers').controller('SetupController',
function($scope, $rootScope, $location, $timeout, walletFactory, controllerUtils, Passphrase) {
$rootScope.videoInfo = {};

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copay.signin').controller('SigninController',
angular.module('copayApp.controllers').controller('SigninController',
function($scope, $rootScope, $location, walletFactory, controllerUtils, Passphrase) {
var cmp = function(o1, o2){
var v1 = o1.show.toLowerCase(), v2 = o2.show.toLowerCase();
@ -24,10 +24,16 @@ angular.module('copay.signin').controller('SigninController',
console.log('## Obtaining passphrase...');
Passphrase.getBase64Async(password, function(passphrase){
console.log('## Passphrase obtained');
var w = walletFactory.open($scope.selectedWalletId, { passphrase: passphrase});
var w, errMsg;
try{
var w = walletFactory.open($scope.selectedWalletId, { passphrase: passphrase});
} catch (e){
errMsg = e.message;
};
if (!w) {
$scope.loading = $scope.failure = false;
$rootScope.$flashMessage = { message: 'Wrong password', type: 'error'};
$rootScope.$flashMessage = { message: errMsg || 'Wrong password', type: 'error'};
$rootScope.$digest();
return;
}

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copay.transactions').controller('TransactionsController',
angular.module('copayApp.controllers').controller('TransactionsController',
function($scope, $rootScope, $timeout, controllerUtils) {
$scope.title = 'Transactions';