create profile separately from default wallet
This commit is contained in:
parent
7584d2b145
commit
74e6897d66
10 changed files with 57 additions and 68 deletions
|
|
@ -1,10 +1,19 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('backController', function($scope, $state, $stateParams) {
|
||||
angular.module('copayApp.controllers').controller('backController', function($scope, $state, $stateParams, platformInfo) {
|
||||
|
||||
var isCordova = platformInfo.isCordova;
|
||||
var isWP = platformInfo.isWP;
|
||||
var usePushNotifications = isCordova && !isWP;
|
||||
|
||||
$scope.importGoBack = function() {
|
||||
if ($stateParams.fromOnboarding) $state.go('onboarding.welcome');
|
||||
else $state.go('add.main');
|
||||
};
|
||||
|
||||
$scope.onboardingMailSkip = function() {
|
||||
if (!usePushNotifications) $state.go('onboarding.backupRequest');
|
||||
else $state.go('onboarding.notifications');
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('backupWarningController', function($scope, $state, $ionicPopup, profileService) {
|
||||
angular.module('copayApp.controllers').controller('backupWarningController', function($scope, $state, $ionicPopup, $stateParams, profileService) {
|
||||
|
||||
$scope.openPopup = function() {
|
||||
var backupWarningPopup = $ionicPopup.show({
|
||||
|
|
@ -10,12 +10,10 @@ angular.module('copayApp.controllers').controller('backupWarningController', fun
|
|||
|
||||
$scope.close = function() {
|
||||
backupWarningPopup.close();
|
||||
var wallet = profileService.getWallets()[0];
|
||||
$state.go('wallet.backup', {
|
||||
walletId: wallet.credentials.walletId,
|
||||
walletId: $stateParams.walletId,
|
||||
fromOnboarding: true
|
||||
})
|
||||
};
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -6,11 +6,6 @@ angular.module('copayApp.controllers').controller('collectEmailController', func
|
|||
var isWP = platformInfo.isWP;
|
||||
var usePushNotifications = isCordova && !isWP;
|
||||
|
||||
$scope.skip = function() {
|
||||
if (!usePushNotifications) $state.go('onboarding.backupRequest');
|
||||
else $state.go('onboarding.notifications');
|
||||
}
|
||||
|
||||
$scope.save = function(form) {
|
||||
var wallet = profileService.getWallet($stateParams.walletId);
|
||||
var email = $scope.email || '';
|
||||
|
|
|
|||
|
|
@ -2,8 +2,9 @@
|
|||
angular.module('copayApp.controllers').controller('tourController',
|
||||
function($scope, $state, $log, $timeout, ongoingProcess, profileService) {
|
||||
|
||||
$scope.init = function() {
|
||||
var tries = 0;
|
||||
|
||||
$scope.init = function() {
|
||||
$scope.data = {
|
||||
index: 0
|
||||
};
|
||||
|
|
@ -16,33 +17,25 @@ angular.module('copayApp.controllers').controller('tourController',
|
|||
}
|
||||
};
|
||||
|
||||
$scope.createProfile = function(opts) {
|
||||
var tries = 0;
|
||||
opts = opts || {};
|
||||
$log.debug('Creating profile');
|
||||
$scope.createDefaultWallet = function() {
|
||||
ongoingProcess.set('creatingWallet', true);
|
||||
profileService.create(opts, function(err) {
|
||||
profileService.createDefaultWallet(function(err, walletClient) {
|
||||
if (err) {
|
||||
$log.warn(err);
|
||||
$scope.error = err;
|
||||
$scope.$apply();
|
||||
|
||||
return $timeout(function() {
|
||||
$log.warn('Retrying to create profile......');
|
||||
$log.warn('Retrying to create default wallet......');
|
||||
if (tries == 3) {
|
||||
tries == 0;
|
||||
return $scope.createProfile({
|
||||
noWallet: true
|
||||
});
|
||||
return $scope.createDefaultWallet();
|
||||
} else {
|
||||
tries += 1;
|
||||
return $scope.createProfile();
|
||||
return $scope.createDefaultWallet();
|
||||
}
|
||||
}, 3000);
|
||||
};
|
||||
$scope.error = "";
|
||||
ongoingProcess.set('creatingWallet', false);
|
||||
var wallet = profileService.getWallets()[0];
|
||||
var wallet = walletClient;
|
||||
$state.go('onboarding.collectEmail', {
|
||||
walletId: wallet.credentials.walletId
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,11 +1,18 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('welcomeController', function($scope, $state, $ionicPopup, profileService) {
|
||||
angular.module('copayApp.controllers').controller('welcomeController', function($scope, $state, $timeout, $log, $ionicPopup, profileService) {
|
||||
|
||||
$scope.goImport = function() {
|
||||
$state.go('add.import.phrase', {
|
||||
fromOnboarding: true
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.createProfile = function() {
|
||||
$log.debug('Creating profile');
|
||||
profileService.createProfile(function(err) {
|
||||
if (err) $log.warn(err);
|
||||
});
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue