fix push notifications and remove onboarding email
This commit is contained in:
parent
2370fc97ad
commit
3320510d35
9 changed files with 74 additions and 53 deletions
|
|
@ -17,6 +17,7 @@
|
||||||
"winAppName": "BitPayWallet",
|
"winAppName": "BitPayWallet",
|
||||||
"wpPublisherId": "{}",
|
"wpPublisherId": "{}",
|
||||||
"wpProductId": "{}",
|
"wpProductId": "{}",
|
||||||
|
"pushSenderId": "1036948132229",
|
||||||
"description": "Secure Bitcoin Storage",
|
"description": "Secure Bitcoin Storage",
|
||||||
"version": "0.14.0",
|
"version": "0.14.0",
|
||||||
"androidVersion": "1",
|
"androidVersion": "1",
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
"winAppName": "CopayWallet",
|
"winAppName": "CopayWallet",
|
||||||
"wpPublisherId": "{31cdd08b-457c-413d-b440-f6665eec847d}",
|
"wpPublisherId": "{31cdd08b-457c-413d-b440-f6665eec847d}",
|
||||||
"wpProductId": "{5381aa50-9069-11e4-84cc-293caf9cbdc8}",
|
"wpProductId": "{5381aa50-9069-11e4-84cc-293caf9cbdc8}",
|
||||||
|
"pushSenderId": "1036948132229",
|
||||||
"description": "A Secure Bitcoin Wallet",
|
"description": "A Secure Bitcoin Wallet",
|
||||||
"version": "2.5.0",
|
"version": "2.5.0",
|
||||||
"androidVersion": "115",
|
"androidVersion": "115",
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,32 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('notificationsController', function($scope, $state, $stateParams, profileService) {
|
angular.module('copayApp.controllers').controller('notificationsController', function($scope, $state, $timeout, $stateParams, profileService, configService) {
|
||||||
|
|
||||||
|
$scope.$on("$ionicView.enter", function(event, data) {
|
||||||
|
$scope.walletId = data.stateParams.walletId;
|
||||||
|
});
|
||||||
|
|
||||||
$scope.walletId = $stateParams.walletId;
|
|
||||||
$scope.allowNotif = function() {
|
$scope.allowNotif = function() {
|
||||||
profileService.pushNotificationsInit();
|
$timeout(function() {
|
||||||
|
profileService.pushNotificationsInit();
|
||||||
|
});
|
||||||
$state.go('onboarding.backupRequest', {
|
$state.go('onboarding.backupRequest', {
|
||||||
walletId: $scope.walletId
|
walletId: $scope.walletId
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$scope.disableNotif = function() {
|
||||||
|
var opts = {
|
||||||
|
pushNotifications: {
|
||||||
|
enabled: false
|
||||||
|
}
|
||||||
|
};
|
||||||
|
configService.set(opts, function(err) {
|
||||||
|
if (err) $log.warn(err);
|
||||||
|
$state.go('onboarding.backupRequest', {
|
||||||
|
walletId: $scope.walletId
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,40 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
angular.module('copayApp.controllers').controller('tourController',
|
angular.module('copayApp.controllers').controller('tourController',
|
||||||
function($scope, $state, $log, $timeout, $filter, ongoingProcess, profileService, rateService) {
|
function($scope, $state, $log, $timeout, $filter, ongoingProcess, platformInfo, profileService, rateService) {
|
||||||
|
|
||||||
var tries = 0;
|
var isCordova = platformInfo.isCordova;
|
||||||
|
var isWP = platformInfo.isWP;
|
||||||
|
var usePushNotifications = isCordova && !isWP;
|
||||||
|
|
||||||
$scope.init = function() {
|
$scope.data = {
|
||||||
$scope.data = {
|
index: 0
|
||||||
index: 0
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.options = {
|
|
||||||
loop: false,
|
|
||||||
effect: 'flip',
|
|
||||||
speed: 500,
|
|
||||||
spaceBetween: 100
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
rateService.whenAvailable(function() {
|
$scope.options = {
|
||||||
var localCurrency = 'USD';
|
loop: false,
|
||||||
var btcAmount = 1;
|
effect: 'flip',
|
||||||
var rate = rateService.toFiat(btcAmount * 1e8, localCurrency);
|
speed: 500,
|
||||||
$scope.localCurrencySymbol = '$';
|
spaceBetween: 100
|
||||||
$scope.localCurrencyPerBtc = $filter('formatFiatAmount')(parseFloat(rate.toFixed(2), 10));
|
}
|
||||||
|
|
||||||
|
$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) {});
|
||||||
|
|
||||||
|
$scope.$on("$ionicView.enter", function(event, data) {
|
||||||
|
rateService.whenAvailable(function() {
|
||||||
|
var localCurrency = 'USD';
|
||||||
|
var btcAmount = 1;
|
||||||
|
var rate = rateService.toFiat(btcAmount * 1e8, localCurrency);
|
||||||
|
$scope.localCurrencySymbol = '$';
|
||||||
|
$scope.localCurrencyPerBtc = $filter('formatFiatAmount')(parseFloat(rate.toFixed(2), 10));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.createDefaultWallet = function() {
|
$scope.createDefaultWallet = function() {
|
||||||
|
|
@ -33,21 +45,22 @@ angular.module('copayApp.controllers').controller('tourController',
|
||||||
|
|
||||||
return $timeout(function() {
|
return $timeout(function() {
|
||||||
$log.warn('Retrying to create default wallet......');
|
$log.warn('Retrying to create default wallet......');
|
||||||
if (tries == 3) {
|
return $scope.createDefaultWallet();
|
||||||
tries == 0;
|
|
||||||
return $scope.createDefaultWallet();
|
|
||||||
} else {
|
|
||||||
tries += 1;
|
|
||||||
return $scope.createDefaultWallet();
|
|
||||||
}
|
|
||||||
}, 3000);
|
}, 3000);
|
||||||
};
|
};
|
||||||
ongoingProcess.set('creatingWallet', false);
|
ongoingProcess.set('creatingWallet', false);
|
||||||
var wallet = walletClient;
|
var wallet = walletClient;
|
||||||
$state.go('onboarding.collectEmail', {
|
var walletId = wallet.credentials.walletId;
|
||||||
fromOnboarding: true,
|
if (!usePushNotifications) {
|
||||||
walletId: wallet.credentials.walletId
|
$state.go('onboarding.backupRequest', {
|
||||||
});
|
walletId: walletId
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$state.go('onboarding.notifications', {
|
||||||
|
walletId: walletId
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -60,14 +73,4 @@ angular.module('copayApp.controllers').controller('tourController',
|
||||||
if ($scope.data.index != 2) $scope.slider.slideNext();
|
if ($scope.data.index != 2) $scope.slider.slideNext();
|
||||||
else $state.go('onboarding.welcome');
|
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) {});
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -39,9 +39,9 @@ angular.module('copayApp.controllers').controller('preferencesNotificationsContr
|
||||||
};
|
};
|
||||||
configService.set(opts, function(err) {
|
configService.set(opts, function(err) {
|
||||||
if (opts.pushNotifications.enabled)
|
if (opts.pushNotifications.enabled)
|
||||||
pushNotificationsService.enableNotifications(profileService.walletClients);
|
profileService.pushNotificationsInit();
|
||||||
else
|
else
|
||||||
pushNotificationsService.disableNotifications(profileService.walletClients);
|
pushNotificationsService.disableNotifications(profileService.getWallets());
|
||||||
if (err) $log.debug(err);
|
if (err) $log.debug(err);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -296,7 +296,8 @@ angular.module('copayApp.services')
|
||||||
if (!val) {
|
if (!val) {
|
||||||
return cb(new Error('NONAGREEDDISCLAIMER: Non agreed disclaimer'));
|
return cb(new Error('NONAGREEDDISCLAIMER: Non agreed disclaimer'));
|
||||||
}
|
}
|
||||||
if (usePushNotifications)
|
var config = configService.getSync();
|
||||||
|
if (config.pushNotifications.enabled && usePushNotifications)
|
||||||
root.pushNotificationsInit();
|
root.pushNotificationsInit();
|
||||||
return cb();
|
return cb();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ angular.module('copayApp.services')
|
||||||
var push = PushNotification.init(defaults.pushNotifications.config);
|
var push = PushNotification.init(defaults.pushNotifications.config);
|
||||||
|
|
||||||
push.on('registration', function(data) {
|
push.on('registration', function(data) {
|
||||||
if (root.token) return;
|
|
||||||
$log.debug('Starting push notification registration');
|
$log.debug('Starting push notification registration');
|
||||||
root.token = data.registrationId;
|
root.token = data.registrationId;
|
||||||
var config = configService.getSync();
|
var config = configService.getSync();
|
||||||
|
|
@ -31,7 +30,7 @@ angular.module('copayApp.services')
|
||||||
if (!config.pushNotifications.enabled) return;
|
if (!config.pushNotifications.enabled) return;
|
||||||
|
|
||||||
if (!root.token) {
|
if (!root.token) {
|
||||||
$log.warn('No token available for this device. Cannot set push notifications');
|
$log.warn('No token available for this device. Cannot set push notifications. Needs registration.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<div class="onboarding-illustration-notifications"></div>
|
<div class="onboarding-illustration-notifications"></div>
|
||||||
<div id="cta-buttons">
|
<div id="cta-buttons">
|
||||||
<button class="button button-standard button-primary" ng-click="allowNotif()" translate>Allow notifications</button>
|
<button class="button button-standard button-primary" ng-click="allowNotif()" translate>Allow notifications</button>
|
||||||
<button class="button button-standard button-secondary button-clear" href ui-sref="onboarding.backupRequest({walletId: walletId})" translate>Not now</button>
|
<button class="button button-standard button-secondary button-clear" ng-click="disableNotif()" translate>Not now</button>
|
||||||
</div>
|
</div>
|
||||||
</ion-content>
|
</ion-content>
|
||||||
</ion-view>
|
</ion-view>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<ion-view ng-controller="tourController" ng-init="init()" class="onboarding" id="onboarding-tour">
|
<ion-view ng-controller="tourController" class="onboarding" id="onboarding-tour">
|
||||||
<ion-nav-bar>
|
<ion-nav-bar>
|
||||||
<ion-nav-title></ion-nav-title>
|
<ion-nav-title></ion-nav-title>
|
||||||
<ion-nav-buttons side="primary">
|
<ion-nav-buttons side="primary">
|
||||||
|
|
@ -6,9 +6,6 @@
|
||||||
<i class="icon ion-ios-arrow-thin-left"></i>
|
<i class="icon ion-ios-arrow-thin-left"></i>
|
||||||
</button>
|
</button>
|
||||||
</ion-nav-buttons>
|
</ion-nav-buttons>
|
||||||
<ion-nav-buttons side="secondary">
|
|
||||||
<button class="button back-button button-clear" ng-show="data.index == 0" ng-click="createDefaultWallet()">{{'Skip' | translate}}</button>
|
|
||||||
</ion-nav-buttons>
|
|
||||||
</ion-nav-bar>
|
</ion-nav-bar>
|
||||||
<ion-slides class="slides" options="options" slider="data.slider">
|
<ion-slides class="slides" options="options" slider="data.slider">
|
||||||
<ion-slide-page>
|
<ion-slide-page>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue