From 51ad7d83dc2d8a1bb12a4c518804fc98fb08c035 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Wed, 13 May 2015 11:58:19 -0300 Subject: [PATCH] import on splash --- public/views/add.html | 7 ------- public/views/import.html | 6 ++++++ public/views/importLegacy.html | 8 +------- public/views/{splash/1.html => splash.html} | 4 +++- public/views/splash/2.html | 3 --- public/views/splash/3.html | 3 --- public/views/splash/4.html | 3 --- public/views/splash/5.html | 15 --------------- src/js/controllers/index.js | 2 +- src/js/models/profile.js | 5 ++++- src/js/routes.js | 10 +++++----- src/js/services/profileService.js | 14 ++++++++------ 12 files changed, 28 insertions(+), 52 deletions(-) rename public/views/{splash/1.html => splash.html} (84%) delete mode 100644 public/views/splash/2.html delete mode 100644 public/views/splash/3.html delete mode 100644 public/views/splash/4.html delete mode 100644 public/views/splash/5.html diff --git a/public/views/add.html b/public/views/add.html index 86c7505d4..d42824a7b 100644 --- a/public/views/add.html +++ b/public/views/add.html @@ -29,13 +29,6 @@ Import wallet -
  • - - - - Import from Copay Beta 0.9 - -
  • diff --git a/public/views/import.html b/public/views/import.html index 2edf34ff3..71e1dc4a7 100644 --- a/public/views/import.html +++ b/public/views/import.html @@ -54,6 +54,12 @@ Import backup + + + Importing Backup from Copay v0.9? Click here + + + diff --git a/public/views/importLegacy.html b/public/views/importLegacy.html index 8442f7208..0f9b09fff 100644 --- a/public/views/importLegacy.html +++ b/public/views/importLegacy.html @@ -1,18 +1,13 @@
    + ng-init="titleSection='Import legacy wallet'; goBackToState = 'import'; noColor = true">
    -
    -
    - Copay -
    -

    Importing...

    @@ -78,6 +73,5 @@
    -
    diff --git a/public/views/splash/1.html b/public/views/splash.html similarity index 84% rename from public/views/splash/1.html rename to public/views/splash.html index dcaf084c7..92cef28fa 100644 --- a/public/views/splash/1.html +++ b/public/views/splash.html @@ -22,10 +22,12 @@
    - Creating Wallet... + Creating Profile...
    +

    Already have a wallet?

    +
    diff --git a/public/views/splash/2.html b/public/views/splash/2.html deleted file mode 100644 index 9d902e76c..000000000 --- a/public/views/splash/2.html +++ /dev/null @@ -1,3 +0,0 @@ -
    - tour1 -
    diff --git a/public/views/splash/3.html b/public/views/splash/3.html deleted file mode 100644 index 53dfcd551..000000000 --- a/public/views/splash/3.html +++ /dev/null @@ -1,3 +0,0 @@ -
    - tour1 -
    diff --git a/public/views/splash/4.html b/public/views/splash/4.html deleted file mode 100644 index 47c02065b..000000000 --- a/public/views/splash/4.html +++ /dev/null @@ -1,3 +0,0 @@ -
    - tour1 -
    diff --git a/public/views/splash/5.html b/public/views/splash/5.html deleted file mode 100644 index 2612f963e..000000000 --- a/public/views/splash/5.html +++ /dev/null @@ -1,15 +0,0 @@ -
    - tour1 -
    -
    -
    - -
    -
    - -
    -
    \ No newline at end of file diff --git a/src/js/controllers/index.js b/src/js/controllers/index.js index 2b24e300c..e3b4388d2 100644 --- a/src/js/controllers/index.js +++ b/src/js/controllers/index.js @@ -721,7 +721,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r self.noFocusedWallet = true; self.isComplete = null; self.walletName = null; - go.addWallet(); + go.path('import'); }); }); diff --git a/src/js/models/profile.js b/src/js/models/profile.js index c18967ded..b5374c1c1 100644 --- a/src/js/models/profile.js +++ b/src/js/models/profile.js @@ -14,17 +14,20 @@ Profile.create = function(opts) { var x = new Profile(); x.createdOn = Date.now(); - x.credentials = opts.credentials; + x.credentials = opts.credentials || []; return x; }; Profile.fromObj = function(obj) { var x = new Profile(); + x.createdOn = obj.createdOn; x.credentials = obj.credentials; + if (x.credentials[0] && typeof x.credentials[0] != 'object') throw ("credentials should be an object"); + return x; }; diff --git a/src/js/routes.js b/src/js/routes.js index a60dc0796..e0ebe98a3 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -68,23 +68,23 @@ angular needProfile: false, views: { 'main': { - templateUrl: 'views/splash/1.html', + templateUrl: 'views/splash.html', controller: function($scope, $timeout, $log, profileService, go) { if (profileService.profile) { go.walletHome(); } - $scope.create = function() { + $scope.create = function(noWallet) { $scope.creatingProfile = true; - profileService.create(function(err) { + profileService.create({noWallet: noWallet}, function(err) { if (err) { $scope.creatingProfile = false; $log.warn(err); $scope.error = err; $scope.$apply(); $timeout(function() { - $scope.create(); + $scope.create(noWallet); }, 3000); } }); @@ -384,7 +384,7 @@ angular create: 12, join: 12, import: 12, - importLegacy: 12 + importLegacy: 13 }; diff --git a/src/js/services/profileService.js b/src/js/services/profileService.js index 80ea5a1f0..e2d85d1ce 100644 --- a/src/js/services/profileService.js +++ b/src/js/services/profileService.js @@ -157,9 +157,13 @@ angular.module('copayApp.services') }); }; - root._createNewProfile = function(cb) { - var walletClient = bwcService.getClient(); + root._createNewProfile = function(opts, cb) { + if (opts.noWallet) { + return cb(null, Profile.create()); + } + + var walletClient = bwcService.getClient(); walletClient.createWallet('Personal Wallet', 'me', 1, 1, { network: 'livenet' }, function(err) { @@ -276,13 +280,11 @@ angular.module('copayApp.services') }); }; - - - root.create = function(cb) { + root.create = function(opts, cb) { $log.info('Creating profile'); configService.get(function(err) { root.applyConfig(); - root._createNewProfile(function(err, p) { + root._createNewProfile(opts, function(err, p) { if (err) return cb(err); root.bindProfile(p, function(err) {