diff --git a/css/src/main.css b/css/src/main.css index f9cc60fc9..9e46e8b4a 100644 --- a/css/src/main.css +++ b/css/src/main.css @@ -128,7 +128,7 @@ header .alt-currency { border-bottom-left-radius: 3px; position: absolute; right: 14px; - width: 100px; + width: 180px; list-style-type: none; top: 47px;nt } diff --git a/js/controllers/createWallet.js b/js/controllers/createWallet.js new file mode 100644 index 000000000..5a7e034db --- /dev/null +++ b/js/controllers/createWallet.js @@ -0,0 +1,5 @@ +'use strict'; +angular.module('copayApp.controllers').controller('CreateWalletController', function($scope, $rootScope) { + + $rootScope.title = 'Create Wallet'; +}); diff --git a/js/controllers/manage.js b/js/controllers/manage.js deleted file mode 100644 index 347d07900..000000000 --- a/js/controllers/manage.js +++ /dev/null @@ -1,36 +0,0 @@ -'use strict'; -angular.module('copayApp.controllers').controller('ManageController', function($scope, $rootScope, $location, controllerUtils, backupService) { - $scope.isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0; - - $rootScope.title = 'Manage wallets'; - - $scope.downloadBackup = function() { - backupService.profileDownload($rootScope.iden); - }; - - $scope.viewBackup = function() { - $scope.backupPlainText = backupService.profileEncrypted($rootScope.iden); - $scope.hideViewBackup = true; - }; - - $scope.getWallets = function() { - $scope.wallets = []; - var wids = _.pluck($rootScope.iden.listWallets(), 'id'); - _.each(wids, function(wid) { - var w = $rootScope.iden.getWalletById(wid); - $scope.wallets.push(w); - controllerUtils.updateBalance(w, function() { - $rootScope.$digest(); - }, true); - }); - }; - - $scope.deleteWallet = function(w) { - if (!w) return; - $scope.loading = w.id; - controllerUtils.deleteWallet($scope, w, function() { - $scope.loading = false; - $scope.getWallets(); - }); - }; -}); diff --git a/js/controllers/more.js b/js/controllers/more.js index f1e129e4a..286cc1f44 100644 --- a/js/controllers/more.js +++ b/js/controllers/more.js @@ -1,7 +1,7 @@ 'use strict'; angular.module('copayApp.controllers').controller('MoreController', - function($scope, $rootScope, $location, $filter, backupService, controllerUtils, notification, rateService) { + function($scope, $rootScope, $location, $filter, controllerUtils, notification, rateService) { controllerUtils.redirIfNotComplete(); var w = $rootScope.wallet; $scope.isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0; @@ -76,26 +76,7 @@ angular.module('copayApp.controllers').controller('MoreController', }); notification.success('Success', $filter('translate')('settings successfully updated')); controllerUtils.updateBalance(); - }; - - $scope.downloadBackup = function() { - backupService.walletDownload(w); - } - - $scope.viewBackup = function() { - $scope.backupPlainText = backupService.walletEncrypted(w); - $scope.hideViewBackup = true; - }; - - $scope.deleteWallet = function() { - $scope.loading = true; - controllerUtils.deleteWallet($scope, $rootScope.wallet, function() { - $rootScope.wallet = null; - var lastFocused = $rootScope.iden.getLastFocusedWallet(); - controllerUtils.bindProfile($scope, $rootScope.iden, lastFocused); - $scope.loading = false; - }); - }; + }; $scope.purge = function(deleteAll) { var removed = w.purgeTxProposals(deleteAll); diff --git a/js/controllers/profile.js b/js/controllers/profile.js new file mode 100644 index 000000000..8794d809a --- /dev/null +++ b/js/controllers/profile.js @@ -0,0 +1,66 @@ +'use strict'; +angular.module('copayApp.controllers').controller('ProfileController', function($scope, $rootScope, $location, $modal, controllerUtils, backupService) { + $scope.isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0; + + $rootScope.title = 'Profile'; + + $scope.downloadProfileBackup = function() { + backupService.profileDownload($rootScope.iden); + }; + + $scope.viewProfileBackup = function() { + $scope.backupProfilePlainText = backupService.profileEncrypted($rootScope.iden); + $scope.hideViewProfileBackup = true; + }; + + $scope.getWallets = function() { + if (!$rootScope.iden) return; + $scope.wallets = []; + var wids = _.pluck($rootScope.iden.listWallets(), 'id'); + _.each(wids, function(wid) { + var w = $rootScope.iden.getWalletById(wid); + $scope.wallets.push(w); + controllerUtils.updateBalance(w, function() { + $rootScope.$digest(); + }, true); + }); + }; + + $scope.deleteWallet = function(w) { + if (!w) return; + $scope.loading = w.id; + controllerUtils.deleteWallet($scope, w, function() { + if ($rootScope.wallet.id === w.id) { + $rootScope.wallet = null; + var lastFocused = $rootScope.iden.getLastFocusedWallet(); + controllerUtils.bindProfile($scope, $rootScope.iden, lastFocused); + } + $scope.loading = false; + $scope.getWallets(); + }); + }; + + $scope.downloadWalletBackup = function(w) { + if (!w) return; + backupService.walletDownload(w); + } + + $scope.viewWalletBackup = function(w) { + var ModalInstanceCtrl = function($scope, $modalInstance) { + + if (!w) return; + $scope.backupWalletPlainText = backupService.walletEncrypted(w); + $scope.hideViewWalletBackup = true; + $scope.cancel = function() { + $modalInstance.dismiss('cancel'); + }; + }; + + $modal.open({ + templateUrl: 'views/modals/backup-text.html', + windowClass: 'tiny', + controller: ModalInstanceCtrl + }); + }; + +}); diff --git a/js/controllers/sidebar.js b/js/controllers/sidebar.js index bf42dce01..4ee22cc00 100644 --- a/js/controllers/sidebar.js +++ b/js/controllers/sidebar.js @@ -66,6 +66,7 @@ angular.module('copayApp.controllers').controller('SidebarController', function( }; $scope.getWallets = function() { + if (!$rootScope.iden) return; $scope.wallets = []; var wids = _.pluck($rootScope.iden.listWallets(), 'id'); _.each(wids, function(wid) { diff --git a/js/routes.js b/js/routes.js index c179876f7..f1747c928 100644 --- a/js/routes.js +++ b/js/routes.js @@ -73,8 +73,12 @@ angular templateUrl: 'views/warning.html', logged: true }) - .when('/manage', { - templateUrl: 'views/manage.html', + .when('/profile', { + templateUrl: 'views/profile.html', + logged: true + }) + .when('/createWallet', { + templateUrl: 'views/createWallet.html', logged: true }); diff --git a/js/services/controllerUtils.js b/js/services/controllerUtils.js index a7e374371..d8c013283 100644 --- a/js/services/controllerUtils.js +++ b/js/services/controllerUtils.js @@ -229,7 +229,7 @@ angular.module('copayApp.services') if (w) { root.setFocusedWallet(w); } else { - $location.path('/manage'); + $location.path('/createWallet'); } $timeout(function() { $rootScope.$digest() diff --git a/views/create.html b/views/create.html index 5c2535aab..592f47a36 100644 --- a/views/create.html +++ b/views/create.html @@ -57,7 +57,7 @@
- + Back diff --git a/views/createWallet.html b/views/createWallet.html new file mode 100644 index 000000000..11ef2e039 --- /dev/null +++ b/views/createWallet.html @@ -0,0 +1,26 @@ +
+

{{$root.title}}

+
+
+
+
+

Create a new Wallet

+ {{'Create' | translate }} +
+
+
+
+
+

Join an existent Wallet

+ {{'Join' | translate }} +
+
+
+
+
+

Import a Wallet to Copay

+ {{'Import wallet' | translate }} +
+
+
+
diff --git a/views/import.html b/views/import.html index 516ec00f0..79cd6074d 100644 --- a/views/import.html +++ b/views/import.html @@ -83,7 +83,7 @@
- + Back diff --git a/views/includes/head.html b/views/includes/head.html index 1f8fdd24d..770b87836 100644 --- a/views/includes/head.html +++ b/views/includes/head.html @@ -22,11 +22,12 @@
-
- {{'Manage wallets' | translate }} -
diff --git a/views/includes/sidebar-mobile.html b/views/includes/sidebar-mobile.html index ce882f4d5..858326237 100644 --- a/views/includes/sidebar-mobile.html +++ b/views/includes/sidebar-mobile.html @@ -56,7 +56,8 @@
- {{'Add Wallet' | translate }} + {{'Create Wallet' | translate }}
@@ -88,8 +89,12 @@
  • - - {{'Manage wallets' | translate }} + + {{'Profile' | translate }} +
  • +
  • + + {{'Create Wallet' | translate }}
  • - + Back diff --git a/views/modals/backup-text.html b/views/modals/backup-text.html new file mode 100644 index 000000000..e6be16bdf --- /dev/null +++ b/views/modals/backup-text.html @@ -0,0 +1,14 @@ +
    +

    Copy backup in a safe place

    +
    + + Copy to clipboard + +
    +
    + +
    +
    Copy this text as it is in a safe place (notepad or email)
    +
    + +× diff --git a/views/more.html b/views/more.html index 59a9e29ad..eb9e73441 100644 --- a/views/more.html +++ b/views/more.html @@ -18,46 +18,6 @@
  • - -
    - -
    -
    -
    -

    Backup

    -

    - It's important to backup your wallet so that you can recover it in case of disaster -

    - Download File - View Backup -
    -
    - - Copy to clipboard -
    -
    - -
    -
    Copy this text as it is in a safe place (notepad or email)
    -
    -
    -
    -
    -
    -

    Delete Wallet

    -

    If all funds have been removed from your wallet and you do not wish to have the wallet data stored on your computer anymore, you can delete your wallet.

    - - Delete - Deleting... - -
    -
    -
    diff --git a/views/manage.html b/views/profile.html similarity index 50% rename from views/manage.html rename to views/profile.html index c952c85c9..cf08e592f 100644 --- a/views/manage.html +++ b/views/profile.html @@ -1,33 +1,33 @@ -
    +

    {{$root.title}}

    +
    -
    -
    -
    -

    Create a new Wallet

    - {{'Create' | translate }} -
    -
    -
    -
    -
    -

    Join an existent Wallet

    - {{'Join' | translate }} -
    -
    -
    -
    -
    -

    Import a Wallet to Copay

    - {{'Import wallet' | translate }} -
    +
    +
    +

    Backup Profile

    +

    It's important to backup your profile so that you can recover it in case of disaster. The backup will include all your profile's wallets

    + Backup profile + View profile backup +
    + +
    + Copy to clipboard +
    +
    + Copy this text as it is in a safe place (notepad or email) +
    +
    +
    -
    +

    Manage wallets

    @@ -42,8 +42,8 @@ + networkName = item.getNetworkName()" + ng-class="{'deleting':loading==item.id}"> @@ -54,41 +54,24 @@
    {{item.name || item.id }} {{item.requiredCopayers}} of {{item.totalCopayers}} - {{networkName}} {{isReady ? 'Complete' : 'Waiting for copayers...'}} - Delete + +
    + + +     + +
    - Active
    -
    - -
    - -
    -
    -
    -

    Backup Profile

    -

    It's important to backup your profile so that you can recover it in case of disaster. The backup will include all your profile's wallets

    - Backup profile - View profile backup -
    - -
    - Copy to clipboard -
    -
    - Copy this text as it is in a safe place (notepad or email) -
    -
    -
    -
    -
    +