diff --git a/src/js/controllers/onboarding/notifications.js b/src/js/controllers/onboarding/notifications.js index be45c4bcb..0b315608f 100644 --- a/src/js/controllers/onboarding/notifications.js +++ b/src/js/controllers/onboarding/notifications.js @@ -1,14 +1,29 @@ 'use strict'; -angular.module('copayApp.controllers').controller('notificationsController', function($scope, $state, $timeout, $stateParams, $ionicConfig, profileService, configService) { +angular.module('copayApp.controllers').controller('notificationsController', function($scope, $state, $timeout, $stateParams, $ionicConfig, profileService, configService, $interval) { $ionicConfig.views.swipeBackEnabled(false); $scope.walletId = $stateParams.walletId; $scope.allowNotif = function() { + $scope.notificationDialogOpen = true; $timeout(function() { profileService.pushNotificationsInit(); }); + $scope.notificationPromise = $interval(function() { + PushNotification.hasPermission(function(data) { + if (data.isEnabled) { + $interval.cancel($scope.notificationPromise); + $state.go('onboarding.backupRequest', { + walletId: $scope.walletId + }); + } + }); + }, 100); + } + + $scope.continue = function() { + $interval.cancel($scope.notificationPromise); $state.go('onboarding.backupRequest', { walletId: $scope.walletId }); diff --git a/www/views/onboarding/notifications.html b/www/views/onboarding/notifications.html index dac81fdf9..a05648f92 100644 --- a/www/views/onboarding/notifications.html +++ b/www/views/onboarding/notifications.html @@ -4,8 +4,9 @@
Would you like to receive push notifications about payments?
- - + + +