onboarding
This commit is contained in:
parent
ad7f04a272
commit
aacfe0a326
47 changed files with 699 additions and 332 deletions
21
src/js/controllers/onboarding/backupRequest.js
Normal file
21
src/js/controllers/onboarding/backupRequest.js
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('backupRequestController', function($rootScope, $scope, $state, $ionicPopup, $stateParams, profileService, walletService) {
|
||||
|
||||
$scope.openPopup = function() {
|
||||
var backupLaterPopup = $ionicPopup.show({
|
||||
templateUrl: "views/includes/backupLaterPopup.html",
|
||||
scope: $scope,
|
||||
});
|
||||
|
||||
$scope.goBack = function() {
|
||||
backupLaterPopup.close();
|
||||
};
|
||||
|
||||
$scope.continue = function() {
|
||||
backupLaterPopup.close();
|
||||
$state.go('onboarding.disclaimer');
|
||||
};
|
||||
}
|
||||
|
||||
});
|
||||
21
src/js/controllers/onboarding/backupWarning.js
Normal file
21
src/js/controllers/onboarding/backupWarning.js
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('backupWarningController', function($rootScope, $scope, $state, $ionicPopup, $stateParams, profileService, walletService) {
|
||||
|
||||
$scope.openPopup = function() {
|
||||
var backupWarningPopup = $ionicPopup.show({
|
||||
templateUrl: "views/includes/backupWarningPopup.html",
|
||||
scope: $scope,
|
||||
});
|
||||
|
||||
$scope.close = function() {
|
||||
backupWarningPopup.close();
|
||||
var wallet = profileService.getWallets()[0];
|
||||
$state.go('wallet.backup', {
|
||||
walletId: wallet.credentials.walletId,
|
||||
fromOnboarding: true
|
||||
})
|
||||
};
|
||||
}
|
||||
|
||||
});
|
||||
17
src/js/controllers/onboarding/collectEmail.js
Normal file
17
src/js/controllers/onboarding/collectEmail.js
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('collectEmailController', function($rootScope, $scope, $state, $stateParams, $timeout, $ionicModal, profileService, walletService) {
|
||||
|
||||
$scope.save = function(form) {
|
||||
var wallet = profileService.getWallet($stateParams.walletId);
|
||||
var email = $scope.email || '';
|
||||
|
||||
walletService.updateRemotePreferences(wallet, {
|
||||
email: email,
|
||||
}, function(err) {
|
||||
if (err) $log.warn(err);
|
||||
$state.go('onboarding.notifications');
|
||||
});
|
||||
};
|
||||
|
||||
});
|
||||
24
src/js/controllers/onboarding/disclaimer.js
Normal file
24
src/js/controllers/onboarding/disclaimer.js
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('disclaimerController', function($scope, $state, $log, $ionicModal, profileService) {
|
||||
|
||||
$scope.confirm = function() {
|
||||
profileService.setDisclaimerAccepted(function(err) {
|
||||
if (err) $log.error(err);
|
||||
else {
|
||||
$state.go('tabs.home');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
this.openModal = function() {
|
||||
|
||||
$ionicModal.fromTemplateUrl('views/modals/addressbook.html', {
|
||||
scope: $scope
|
||||
}).then(function(modal) {
|
||||
$scope.addressbookModal = modal;
|
||||
$scope.addressbookModal.show();
|
||||
});
|
||||
};
|
||||
|
||||
});
|
||||
12
src/js/controllers/onboarding/notifications.js
Normal file
12
src/js/controllers/onboarding/notifications.js
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('notificationsController', function($scope, $state, platformInfo) {
|
||||
|
||||
if (!platformInfo.isCordova) $state.go('onboarding.backupRequest');
|
||||
|
||||
$scope.allowNotif = function() {
|
||||
// T O D O
|
||||
$state.go('onboarding.backupRequest');
|
||||
}
|
||||
|
||||
});
|
||||
15
src/js/controllers/onboarding/terms.js
Normal file
15
src/js/controllers/onboarding/terms.js
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('termsController', function($scope, $log, $state, uxLanguage, profileService) {
|
||||
$scope.lang = uxLanguage.currentLanguage;
|
||||
|
||||
$scope.confirm = function() {
|
||||
profileService.setDisclaimerAccepted(function(err) {
|
||||
if (err) $log.error(err);
|
||||
else {
|
||||
$state.go('tabs.home');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
});
|
||||
71
src/js/controllers/onboarding/tour.js
Normal file
71
src/js/controllers/onboarding/tour.js
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
'use strict';
|
||||
angular.module('copayApp.controllers').controller('tourController',
|
||||
function($scope, $stateParams, $state, $log, $timeout, ongoingProcess, storageService, profileService) {
|
||||
|
||||
$scope.init = function() {
|
||||
|
||||
$scope.data = {
|
||||
index: 0
|
||||
};
|
||||
|
||||
$scope.options = {
|
||||
loop: false,
|
||||
effect: 'flip',
|
||||
speed: 500,
|
||||
spaceBetween: 100
|
||||
}
|
||||
};
|
||||
|
||||
$scope.createProfile = function(opts) {
|
||||
var tries = 0;
|
||||
opts = opts || {};
|
||||
$log.debug('Creating profile');
|
||||
ongoingProcess.set('creatingWallet', true);
|
||||
profileService.create(opts, function(err) {
|
||||
if (err) {
|
||||
$log.warn(err);
|
||||
$scope.error = err;
|
||||
$scope.$apply();
|
||||
|
||||
return $timeout(function() {
|
||||
$log.warn('Retrying to create profile......');
|
||||
if (tries == 3) {
|
||||
tries == 0;
|
||||
return $scope.createProfile({
|
||||
noWallet: true
|
||||
});
|
||||
} else {
|
||||
tries += 1;
|
||||
return $scope.createProfile();
|
||||
}
|
||||
}, 3000);
|
||||
};
|
||||
$scope.error = "";
|
||||
ongoingProcess.set('creatingWallet', false);
|
||||
var wallet = profileService.getWallets()[0];
|
||||
$state.go('onboarding.collectEmail', {
|
||||
walletId: wallet.credentials.walletId
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$scope.goBack = function() {
|
||||
if ($scope.data.index != 0) $scope.slider.slidePrev();
|
||||
else $state.go('onboarding.welcome');
|
||||
}
|
||||
|
||||
$scope.slideNext = function() {
|
||||
if ($scope.data.index != 2) $scope.slider.slideNext();
|
||||
else $state.go('onboarding.welcome');
|
||||
}
|
||||
|
||||
$scope.$on("$ionicSlides.sliderInitialized", function(event, data) {
|
||||
$scope.slider = data.slider;
|
||||
});
|
||||
|
||||
$scope.$on("$ionicSlides.slideChangeStart", function(event, data) {
|
||||
$scope.data.index = data.slider.activeIndex;
|
||||
});
|
||||
|
||||
$scope.$on("$ionicSlides.slideChangeEnd", function(event, data) {});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue