diff --git a/public/views/import.html b/public/views/import.html index 79d347ebd..17e6187aa 100644 --- a/public/views/import.html +++ b/public/views/import.html @@ -1,17 +1,33 @@ - + - - - +
+ + + - - - + + + - - - + + + +
+ +
+ + + + + + + + + + + +
diff --git a/public/views/onboarding/welcome.html b/public/views/onboarding/welcome.html index 8e44f87aa..05459b33d 100644 --- a/public/views/onboarding/welcome.html +++ b/public/views/onboarding/welcome.html @@ -1,6 +1,6 @@ - +
@@ -14,7 +14,7 @@
- +
diff --git a/src/js/controllers/import.js b/src/js/controllers/import.js index c1fbaf111..4ba74e011 100644 --- a/src/js/controllers/import.js +++ b/src/js/controllers/import.js @@ -36,7 +36,6 @@ angular.module('copayApp.controllers').controller('importController', $scope.processWalletInfo = function(code) { if (!code) return; - $scope.importErr = false; var parsedCode = code.split('|'); @@ -102,18 +101,7 @@ angular.module('copayApp.controllers').controller('importController', return; } - - walletService.updateRemotePreferences(client, {}, function() { - $log.debug('Remote preferences saved for:' + client.credentials.walletId) - }); - - profileService.setBackupFlag(client.credentials.walletId); - if ($stateParams.fromOnboarding) { - profileService.setDisclaimerAccepted(function(err) { - if (err) $log.error(err); - }); - } - $state.go('tabs.home'); + finish(client); }); }, 100); }; @@ -133,19 +121,7 @@ angular.module('copayApp.controllers').controller('importController', $scope.$apply(); }); } - - - walletService.updateRemotePreferences(client, {}, function() { - $log.debug('Remote preferences saved for:' + client.credentials.walletId) - }); - - profileService.setBackupFlag(client.credentials.walletId); - if ($stateParams.fromOnboarding) { - profileService.setDisclaimerAccepted(function(err) { - if (err) $log.error(err); - }); - } - $state.go('tabs.home'); + finish(client); }); }, 100); }; @@ -166,11 +142,12 @@ angular.module('copayApp.controllers').controller('importController', } profileService.setBackupFlag(walletId); - if ($stateParams.fromOnboarding) { - profileService.setDisclaimerAccepted(function(err) { - if (err) $log.error(err); - }); - } + if ($stateParams.fromOnboarding) { + profileService.setDisclaimerAccepted(function(err) { + if (err) $log.error(err); + }); + } + $state.go('tabs.home'); }); }, 100); @@ -194,18 +171,7 @@ angular.module('copayApp.controllers').controller('importController', $scope.$apply(); }); } - - walletService.updateRemotePreferences(client, {}, function() { - $log.debug('Remote preferences saved for:' + client.credentials.walletId) - }); - - profileService.setBackupFlag(client.credentials.walletId); - if ($stateParams.fromOnboarding) { - profileService.setDisclaimerAccepted(function(err) { - if (err) $log.error(err); - }); - } - $state.go('tabs.home'); + finish(client); }); }, 100); }; @@ -313,19 +279,7 @@ angular.module('copayApp.controllers').controller('importController', popupService.showAlert(gettextCatalog.getString('Error'), err); return; } - - - walletService.updateRemotePreferences(wallet, {}, function() { - $log.debug('Remote preferences saved for:' + wallet.walletId) - }); - - profileService.setBackupFlag(wallet.walletId); - if ($stateParams.fromOnboarding) { - profileService.setDisclaimerAccepted(function(err) { - if (err) $log.error(err); - }); - } - $state.go('tabs.home'); + finish(wallet); }); }, 100); }; @@ -389,23 +343,27 @@ angular.module('copayApp.controllers').controller('importController', popupService.showAlert(gettextCatalog.getString('Error'), err); return; } - - - walletService.updateRemotePreferences(wallet, {}, function() { - $log.debug('Remote preferences saved for:' + wallet.walletId) - }); - - profileService.setBackupFlag(wallet.walletId); - if ($stateParams.fromOnboarding) { - profileService.setDisclaimerAccepted(function(err) { - if (err) $log.error(err); - }); - } - $state.go('tabs.home'); + finish(wallet); }); }, 100); }; + var finish = function(wallet) { + + walletService.updateRemotePreferences(wallet, {}, function() { + $log.debug('Remote preferences saved for:' + wallet.credentials.walletId) + }); + + profileService.setBackupFlag(wallet.credentials.walletId); + if ($stateParams.fromOnboarding) { + profileService.setDisclaimerAccepted(function(err) { + if (err) $log.error(err); + }); + } + $state.go('tabs.home'); + }; + updateSeedSourceSelect(); - $scope.setSeedSource('new'); + $scope.setSeedSource(); + if ($stateParams.code) $scope.processWalletInfo($stateParams.code); }); diff --git a/src/js/controllers/onboarding/welcomeController.js b/src/js/controllers/onboarding/welcomeController.js index f217639ad..f08a5b5eb 100644 --- a/src/js/controllers/onboarding/welcomeController.js +++ b/src/js/controllers/onboarding/welcomeController.js @@ -2,6 +2,13 @@ angular.module('copayApp.controllers').controller('welcomeController', function($scope, $state, $timeout, $log, $ionicPopup, profileService) { + $scope.goImport = function(code) { + $state.go('onboarding.import.phrase', { + fromOnboarding: true, + code: code + }); + }; + $scope.createProfile = function() { $log.debug('Creating profile'); profileService.createProfile(function(err) { diff --git a/src/js/controllers/tabsController.js b/src/js/controllers/tabsController.js index b9114db36..ccd1b1e88 100644 --- a/src/js/controllers/tabsController.js +++ b/src/js/controllers/tabsController.js @@ -1,21 +1,27 @@ - 'use strict'; -angular.module('copayApp.controllers').controller('tabsController', function($log, $scope, $ionicModal, incomingData) { +angular.module('copayApp.controllers').controller('tabsController', function($log, $scope, $stateParams, $ionicModal, $timeout, incomingData) { - $scope.onScan = function(data) { -console.log('[tabsController.js.6:data:]',data); //TODO - if (!incomingData.redir(data)) { - $ionicPopup.alert({ - title: 'Invalid data', - }); - } + $scope.onScan = function(data) { + if (!incomingData.redir(data)) { + $ionicPopup.alert({ + title: 'Invalid data', + }); } + } - $scope.setScanFn = function(scanFn) { - $scope.scan = function() { - $log.debug('Scanning...'); - scanFn(); - }; + $scope.setScanFn = function(scanFn) { + $scope.scan = function() { + $log.debug('Scanning...'); + scanFn(); }; - }); + }; + + $scope.importInit = function() { + $scope.fromOnboarding = $stateParams.fromOnboarding; + $timeout(function() { + $scope.$apply(); + }, 1); + } + +}); diff --git a/src/js/routes.js b/src/js/routes.js index d580f3f4d..e70269936 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -270,12 +270,15 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr }) .state('tabs.import', { url: '/import/:fromOnboarding', -// abstract: true, + // abstract: true, views: { 'tab-home': { templateUrl: 'views/import.html' }, - } + }, + params: { + code: null + }, }) .state('tabs.import.phrase', { url: '/tab-import-phrase', @@ -628,6 +631,42 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr } } }) + .state('onboarding.import', { + url: '/import/:fromOnboarding', + abstract: true, + views: { + 'onboarding': { + templateUrl: 'views/import.html' + }, + }, + params: { + code: null + }, + }) + .state('onboarding.import.phrase', { + url: '/tab-import-phrase', + views: { + 'tab-import-phrase': { + templateUrl: 'views/tab-import-phrase.html', + }, + } + }) + .state('onboarding.import.file', { + url: '/tab-import-file', + views: { + 'tab-import-file': { + templateUrl: 'views/tab-import-file.html', + }, + } + }) + .state('onboarding.import.hardware', { + url: '/tab-import-hardware', + views: { + 'tab-import-hardware': { + templateUrl: 'views/tab-import-hardware.html', + }, + } + }) /* * diff --git a/src/sass/views/onboarding/onboard-welcome.scss b/src/sass/views/onboarding/onboard-welcome.scss index 2e9c19e01..8e40facd9 100644 --- a/src/sass/views/onboarding/onboard-welcome.scss +++ b/src/sass/views/onboarding/onboard-welcome.scss @@ -5,6 +5,7 @@ background-size: contain; background-repeat-y: no-repeat; #shopping-24 { + content: url("../img/onboarding-welcome-shopping24.png"); position: absolute; top: 2%; right: 5%;