settings link when push notifications are disabled by user

This commit is contained in:
Gabriel Bazán 2016-03-30 17:49:48 -04:00
parent 16dcb556e4
commit 0c53e52015
2 changed files with 19 additions and 4 deletions

View File

@ -78,7 +78,12 @@
<div translate>About Copay</div>
</li>
</ul>
<div ng-show="index.usePushNotifications && !PNEnabledByUser && !isAndroid">
<div class="text-centered text-gray size-12 m10" translate>Push notifications for Copay are currently disabled. Enable them in the Settings app.</div>
<ul class="no-bullet m0" ng-click="prefGlobal.openSettings()">
<li ng-style="{'color':index.backgroundColor}" translate>Open Settings app</li>
</ul>
</div>
<h4></h4>
</div>
<div class="extra-margin-bottom"></div>

View File

@ -14,15 +14,25 @@ angular.module('copayApp.controllers').controller('preferencesGlobalController',
this.feeOpts = feeService.feeOpts;
this.currentFeeLevel = feeService.getCurrentFeeLevel();
this.usePushNotifications = isCordova && !isMobile.Windows();
if (!typeof cordova.plugins.diagnostic != undefined && isMobile.iOS()) {
cordova.plugins.diagnostic.isRemoteNotificationsEnabled(function(isEnabled) {
$scope.PNEnabledByUser = isEnabled;
});
}
$scope.spendUnconfirmed = config.wallet.spendUnconfirmed;
$scope.glideraEnabled = config.glidera.enabled;
$scope.glideraTestnet = config.glidera.testnet;
$scope.pushNotifications = config.pushNotifications.enabled;
cordova.plugins.diagnostic.isRemoteNotificationsEnabled(function(isEnabled) {
$scope.PNEnabledByUser = isEnabled;
});
};
this.openSettings = function() {
cordova.plugins.diagnostic.switchToSettings(function() {
$log.debug('switched to settings');
}, function(err) {
$log.debug(err);
});
}
var unwatchSpendUnconfirmed = $scope.$watch('spendUnconfirmed', function(newVal, oldVal) {
if (newVal == oldVal) return;
var opts = {