+
+
×
+
+
+
+ Email not confirmed .
+ Please confirm your email address using the confirmation link at the message we sent you
+
+
+
+ {{ loading ? 'Resending...' : 'Resend' }}
+
+
+
+
+
×
@@ -72,11 +76,11 @@
An email was sent to {{$root.iden.getName()}}. Please follow the link on it to confirm it. Unconfirmed profiles could be deleted from server.
-
-
+
+
Network Error . Attempting to reconnect..
-
+
diff --git a/js/controllers/copayers.js b/js/controllers/copayers.js
index a988ad048..c424741a8 100644
--- a/js/controllers/copayers.js
+++ b/js/controllers/copayers.js
@@ -1,9 +1,9 @@
'use strict';
angular.module('copayApp.controllers').controller('CopayersController',
- function($scope, $rootScope, $timeout, go) {
+ function($scope, $rootScope, $timeout, go, identityService, notification) {
+ var w = $rootScope.wallet;
$scope.init = function() {
- var w = $rootScope.wallet;
$rootScope.title = 'Share this secret with your copayers';
$scope.loading = false;
$scope.secret = $rootScope.wallet.getSecret();
@@ -27,4 +27,25 @@ angular.module('copayApp.controllers').controller('CopayersController',
$rootScope.$digest();
}, 1);
};
+
+ $scope.deleteWallet = function() {
+ $scope.loading = true;
+ identityService.deleteWallet(w, function(err) {
+ if (err) {
+ $scope.loading = null;
+ $scope.error = err.message || err;
+ copay.logger.warn(err);
+ $timeout(function () { $scope.$digest(); });
+ } else {
+ $scope.loading = false;
+ if ($rootScope.wallet) {
+ go.walletHome();
+ }
+ $timeout(function() {
+ notification.success('Success', 'The wallet "' + (w.name || w.id) + '" was deleted');
+ });
+ }
+ });
+ };
+
});
diff --git a/js/controllers/createProfile.js b/js/controllers/createProfile.js
index cb16a0559..a34ad8796 100644
--- a/js/controllers/createProfile.js
+++ b/js/controllers/createProfile.js
@@ -41,13 +41,6 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun
$scope.passwordStrength = null;
_firstpin = null;
-
- $scope.setPinForm.newpin.$setViewValue('');
- $scope.setPinForm.newpin.$render();
- $scope.setPinForm.repeatpin.$setViewValue('');
- $scope.setPinForm.repeatpin.$render();
- $scope.setPinForm.$setPristine();
-
$scope.error = 'Entered PINs were not equal. Try again';
$timeout(function() {
$scope.$digest();
@@ -79,7 +72,6 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun
_credentials = null;
$scope.askForPin = 0;
$rootScope.hasPin = true;
- $rootScope.starting = null;
$scope.createDefaultWallet();
});
}, 100);
@@ -123,8 +115,10 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun
/* Last step. Will emit after creation so the UX gets updated */
$scope.createDefaultWallet = function() {
$rootScope.hideNavigation = false;
+ $rootScope.starting = true;
identityService.createDefaultWallet(function(err) {
$scope.askForPin = 0;
+ $rootScope.starting = null;
if (err) {
var msg = err.toString();
@@ -143,10 +137,8 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun
preconditions.checkArgument(_.isString(password));
$rootScope.hideNavigation = false;
- $rootScope.starting = true;
identityService.create(emailOrUsername, password, function(err) {
- $rootScope.starting = null;
$scope.error = null;
if (err) {
var msg = err.toString();
@@ -162,6 +154,7 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun
} else {
// mobile
if ($scope.isMobile) {
+ $rootScope.starting = null;
_credentials = {
email: emailOrUsername,
password: password,
@@ -206,6 +199,7 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun
$scope.saveSettings(function(err) {
preconditions.checkState(!err, err);
+ $rootScope.starting = true;
$scope._doCreateProfile($scope.userOrEmail, form.password.$modelValue, function(err) {
$timeout(function() {
diff --git a/js/controllers/join.js b/js/controllers/join.js
index e1029fac2..3234e1bae 100644
--- a/js/controllers/join.js
+++ b/js/controllers/join.js
@@ -127,13 +127,13 @@ angular.module('copayApp.controllers').controller('JoinController',
return;
}
- $scope.loading = true;
+ $rootScope.starting = true;
identityService.joinWallet({
secret: $scope.connectionId,
nickname: $scope.nickname,
privateHex: $scope.private,
}, function(err) {
- $scope.loading = false;
+ $rootScope.starting = false;
if (err) {
if (err === 'joinError')
notification.error('Fatal error connecting to Insight server');
diff --git a/js/controllers/more.js b/js/controllers/more.js
index f3068922a..36f8e5159 100644
--- a/js/controllers/more.js
+++ b/js/controllers/more.js
@@ -1,9 +1,20 @@
'use strict';
angular.module('copayApp.controllers').controller('MoreController',
- function($scope, $rootScope, $location, $filter, balanceService, notification, rateService) {
+ function($scope, $rootScope, $location, $filter, $timeout, balanceService, notification, rateService, backupService, identityService, isMobile, isCordova, go) {
var w = $rootScope.wallet;
- $scope.isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
+ var max = $rootScope.quotaPerItem;
+ $scope.isSafari = isMobile.Safari();
+ $scope.isCordova = isCordova;
+ $scope.wallet = w;
+ $scope.error = null;
+ $scope.success = null;
+
+ var bits = w.sizes().total;
+ w.kb = $filter('noFractionNumber')(bits / 1000, 1);
+ if (max) {
+ w.usage = $filter('noFractionNumber')(bits / max * 100, 0);
+ }
$rootScope.title = 'Settings';
@@ -105,4 +116,34 @@ angular.module('copayApp.controllers').controller('MoreController',
}, true);
});
};
+
+ $scope.deleteWallet = function() {
+ $scope.loading = true;
+ identityService.deleteWallet(w, function(err) {
+ if (err) {
+ $scope.loading = null;
+ $scope.error = err.message || err;
+ copay.logger.warn(err);
+ $timeout(function () { $scope.$digest(); });
+ } else {
+ $scope.loading = false;
+ if ($rootScope.wallet) {
+ go.walletHome();
+ }
+ $timeout(function() {
+ notification.success('Success', 'The wallet "' + (w.name || w.id) + '" was deleted');
+ });
+ }
+ });
+ };
+
+ $scope.downloadWalletBackup = function() {
+ backupService.walletDownload(w);
+ };
+
+ $scope.viewWalletBackup = function() {
+ $scope.backupWalletPlainText = backupService.walletEncrypted(w);
+ };
+
+
});
diff --git a/js/controllers/profile.js b/js/controllers/profile.js
index 8bebdfeae..be37345a2 100644
--- a/js/controllers/profile.js
+++ b/js/controllers/profile.js
@@ -1,5 +1,5 @@
'use strict';
-angular.module('copayApp.controllers').controller('ProfileController', function($scope, $rootScope, $location, $modal, $filter, $timeout, backupService, identityService, isMobile, isCordova) {
+angular.module('copayApp.controllers').controller('ProfileController', function($scope, $rootScope, $location, $modal, $filter, $timeout, backupService, identityService, isMobile, isCordova, notification) {
$scope.username = $rootScope.iden.getName();
$scope.isSafari = isMobile.Safari();
$scope.isCordova = isCordova;
@@ -25,86 +25,21 @@ angular.module('copayApp.controllers').controller('ProfileController', function(
// no need to add event handlers here. Wallet deletion is handle by callback.
};
- $scope.setWallets = function() {
- if (!$rootScope.iden) return;
-
- var wallets = $rootScope.iden.getWallets();
- var max = $rootScope.quotaPerItem;
-
- _.each(wallets, function(w) {
- var bits = w.sizes().total;
- w.kb = $filter('noFractionNumber')(bits / 1000, 1);
- if (max) {
- w.usage = $filter('noFractionNumber')(bits / max * 100, 0);
- }
- });
- $scope.wallets = wallets;
- $timeout(function(){
- $scope.$digest();
- })
- };
-
$scope.deleteProfile = function() {
+ $scope.loading = true;
identityService.deleteProfile(function(err, res) {
+ $scope.loading = false;
if (err) {
log.warn(err);
notification.error('Error', 'Could not delete profile');
- return;
+ $timeout(function () { $scope.$digest(); });
}
- $location.path('/');
- $timeout(function() {
- notification.error('Success', 'Profile successfully deleted');
- });
- });
- };
-
- $scope.showWalletInfo = function(w) {
- var ModalInstanceCtrl = function($scope, $modalInstance) {
- if (!w) return;
- $scope.isSafari = isMobile.Safari();
- $scope.isCordova = isCordova;
- $scope.item = w;
- $scope.error = null;
- $scope.success = null;
-
- $scope.deleteWallet = function() {
-
- $scope.loading = true;
- identityService.deleteWallet($scope.item, function(err) {
- if (err) {
- $scope.loading = null;
- $scope.error = err.message || err;
- copay.logger.warn(err);
- $timeout(function () { $scope.$digest(); });
- } else {
- $modalInstance.close($scope.item.name || $scope.item.id);
- }
+ else {
+ $location.path('/');
+ $timeout(function() {
+ notification.success('Success', 'Profile successfully deleted');
});
- };
-
- $scope.downloadWalletBackup = function() {
- backupService.walletDownload($scope.item);
- };
-
- $scope.viewWalletBackup = function() {
- $scope.backupWalletPlainText = backupService.walletEncrypted($scope.item);
- };
-
- $scope.close = function() {
- $modalInstance.dismiss('cancel');
- };
- };
-
- var modalInstance = $modal.open({
- templateUrl: 'views/modals/wallet-info.html',
- windowClass: 'medium',
- controller: ModalInstanceCtrl
- });
-
- modalInstance.result.then(function(walletName) {
- $scope.loading = false;
- $scope.success = 'The wallet "' + walletName + '" was deleted';
- $scope.setWallets();
+ }
});
};
});
diff --git a/js/models/Identity.js b/js/models/Identity.js
index 08652d5f2..396e78ae5 100644
--- a/js/models/Identity.js
+++ b/js/models/Identity.js
@@ -218,6 +218,9 @@ Identity.prototype.deleteWallet = function(walletId, cb) {
self.storage.removeItem(Wallet.getStorageKey(walletId), function(err) {
if (err) return cb(err);
self.emitAndKeepAlive('walletDeleted', walletId);
+ if (!self.walletIds.length) {
+ self.emitAndKeepAlive('noWallets')
+ }
self.store({
noWallets: true
}, cb);
diff --git a/js/services/identityService.js b/js/services/identityService.js
index 7429c3727..9ae9c6983 100644
--- a/js/services/identityService.js
+++ b/js/services/identityService.js
@@ -323,7 +323,9 @@ angular.module('copayApp.services')
if ($rootScope.iden) {
$rootScope.signingOut = true;
$rootScope.iden.close(function() { // Will trigger 'closed'
- $rootScope.signingOut = false;
+ $timeout(function() {
+ $rootScope.signingOut = null;
+ }, 100);
}); // Will trigger 'closed'
}
};
diff --git a/test/unit/controllers/controllersSpec.js b/test/unit/controllers/controllersSpec.js
index d0688342a..edf7f472f 100644
--- a/test/unit/controllers/controllersSpec.js
+++ b/test/unit/controllers/controllersSpec.js
@@ -568,25 +568,12 @@ describe("Unit: Controllers", function() {
});
});
- describe('Profile Controller', function() {
- var ctrl, inScope, modalCtrl;
+ describe('More Controller', function() {
+ var ctrl, modalCtrl;
beforeEach(inject(function($controller, $rootScope) {
scope = $rootScope.$new();
- ctrl = $controller('ProfileController', {
- $scope: scope,
- $modal: {
- open: function(opts) {
- inScope = $rootScope.$new();
- modalCtrl = opts.controller(inScope, {
- close: sinon.stub(),
- });
- return {
- result: {
- then: sinon.stub(),
- }
- };
- },
- },
+ ctrl = $controller('MoreController', {
+ $scope: scope
});
saveAsLastCall = null;
@@ -595,8 +582,7 @@ describe("Unit: Controllers", function() {
it('Backup Wallet controller #download', function() {
var w = scope.wallet;
expect(saveAsLastCall).equal(null);
- scope.showWalletInfo(w);
- inScope.downloadWalletBackup();
+ scope.downloadWalletBackup();
expect(saveAsLastCall.blob.size).equal(7);
expect(saveAsLastCall.blob.type).equal('text/plain;charset=utf-8');
@@ -605,8 +591,7 @@ describe("Unit: Controllers", function() {
it('Backup Wallet controller should name backup correctly for multiple copayers', function() {
var w = scope.wallet;
expect(saveAsLastCall).equal(null);
- scope.showWalletInfo(w);
- inScope.downloadWalletBackup();
+ scope.downloadWalletBackup();
expect(saveAsLastCall.filename).equal('nickname-fakeWallet-keybackup.json.aes');
});
@@ -614,16 +599,14 @@ describe("Unit: Controllers", function() {
var w = scope.wallet;
expect(saveAsLastCall).equal(null);
scope.wallet.totalCopayers = 1;
- scope.showWalletInfo(w);
- inScope.downloadWalletBackup();
+ scope.downloadWalletBackup();
expect(saveAsLastCall.filename).equal('fakeWallet-keybackup.json.aes');
});
it('Delete a wallet', function() {
var w = scope.wallet;
- scope.showWalletInfo(w);
- inScope.deleteWallet();
+ scope.deleteWallet();
scope.$digest();
scope.iden.deleteWallet.calledOnce.should.equal(true);
scope.iden.deleteWallet.getCall(0).args[0].should.equal(w.getId());
diff --git a/views/copayers.html b/views/copayers.html
index 9ca0fdcd3..14db0f488 100644
--- a/views/copayers.html
+++ b/views/copayers.html
@@ -49,6 +49,32 @@