Merge pull request #104 from gabrielbazan7/fix/onboarding-02

Fix/onboarding 02
This commit is contained in:
Gustavo Maximiliano Cortez 2016-09-14 10:06:30 -03:00 committed by GitHub
commit c4411961af
12 changed files with 44 additions and 33 deletions

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('backupWarningController', function($scope, $state, $stateParams, $ionicPopup, profileService) {
angular.module('copayApp.controllers').controller('backupWarningController', function($scope, $state, $timeout, $stateParams, $ionicPopup, profileService) {
$scope.walletId = $stateParams.walletId;
$scope.openPopup = function() {
@ -11,7 +11,10 @@ angular.module('copayApp.controllers').controller('backupWarningController', fun
$scope.close = function() {
backupWarningPopup.close();
$state.go('onboarding.backup', {walletId: $stateParams.walletId, fromOnboarding: true});
$state.go('onboarding.backup', {
walletId: $stateParams.walletId,
fromOnboarding: true
});
};
}
});

View file

@ -5,6 +5,7 @@ angular.module('copayApp.controllers').controller('collectEmailController', func
var isCordova = platformInfo.isCordova;
var isWP = platformInfo.isWP;
var usePushNotifications = isCordova && !isWP;
var requiresOptIn = platformInfo.isIOS;
var wallet = profileService.getWallet($stateParams.walletId);
var walletId = wallet.credentials.walletId;
@ -21,16 +22,29 @@ angular.module('copayApp.controllers').controller('collectEmailController', func
if (err) $log.warn(err);
configService.set(opts, function(err) {
if (err) $log.warn(err);
if (!usePushNotifications) $state.go('onboarding.backupRequest', {
walletId: walletId
});
else $state.go('onboarding.notifications', {
walletId: walletId
});
$scope.goNextView();
});
});
};
$scope.goNextView = function() {
if (!usePushNotifications) {
$state.go('onboarding.backupRequest', {
walletId: walletId
});
}
else if (requiresOptIn) {
$state.go('onboarding.notifications', {
walletId: walletId
});
} else {
profileService.pushNotificationsInit();
$state.go('onboarding.backupRequest', {
walletId: walletId
});
}
};
$scope.confirm = function(emailForm) {
if (emailForm.$invalid) return;
$scope.confirmation = true;
@ -44,9 +58,4 @@ angular.module('copayApp.controllers').controller('collectEmailController', func
}, 1);
};
$scope.onboardingMailSkip = function() {
$state.go('onboarding.backupRequest', {
walletId: walletId
});
};
});

View file

@ -5,7 +5,9 @@ angular.module('copayApp.controllers').controller('notificationsController', fun
$scope.walletId = $stateParams.walletId;
$scope.allowNotif = function() {
profileService.pushNotificationsInit();
$state.go('onboarding.backupRequest');
$state.go('onboarding.backupRequest', {
walletId: $scope.walletId
});
}
});

View file

@ -490,14 +490,14 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
}
})
/*
*
* Addressbook
*
*/
/*
*
* Addressbook
*
*/
.state('tabs.addressbook', {
.state('tabs.addressbook', {
url: '/addressbook',
views: {
'tab-settings': {
@ -877,6 +877,6 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
var state = {};
state.name = toState.name;
state.toParams = toParams;
storageService.setLastState(JSON.stringify(state), function() {});
if (state.name != 'starting') storageService.setLastState(JSON.stringify(state), function() {});
});
});

View file

@ -268,9 +268,6 @@ angular.module('copayApp.services')
if (!val) {
return cb(new Error('NONAGREEDDISCLAIMER: Non agreed disclaimer'));
}
if (usePushNotifications)
root.pushNotificationsInit();
$rootScope.$emit('disclaimerAccepted');
return cb();
});
});