From 16dcb556e4350f11c89054a40335512c6a98afee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Tue, 29 Mar 2016 16:52:35 -0400 Subject: [PATCH 1/3] if pn was not enabled by user, do not show pn options --- cordova/build.sh | 7 ++++--- public/views/preferencesGlobal.html | 2 +- src/js/controllers/preferencesGlobal.js | 3 +++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/cordova/build.sh b/cordova/build.sh index b171a68f6..3106908b4 100755 --- a/cordova/build.sh +++ b/cordova/build.sh @@ -97,6 +97,9 @@ if [ ! -d $PROJECT ]; then cordova plugin add cordova-plugin-globalization checkOK + cordova plugin add cordova.plugins.diagnostic + checkOK + cordova plugin add cordova-plugin-splashscreen checkOK @@ -190,7 +193,7 @@ if [ $CURRENT_OS == "ANDROID" ]; then # cp android/AndroidManifest.xml $PROJECT/platforms/android/AndroidManifest.xml # checkOK - + cp android/build-extras.gradle $PROJECT/platforms/android/build-extras.gradle checkOK @@ -243,5 +246,3 @@ if [ $CURRENT_OS == "WP8" ]; then checkOK fi fi - - diff --git a/public/views/preferencesGlobal.html b/public/views/preferencesGlobal.html index 97234d94f..c0df8be0a 100644 --- a/public/views/preferencesGlobal.html +++ b/public/views/preferencesGlobal.html @@ -48,7 +48,7 @@
Use Unconfirmed Funds
-
+

  • diff --git a/src/js/controllers/preferencesGlobal.js b/src/js/controllers/preferencesGlobal.js index 8961d7de2..748da7e39 100644 --- a/src/js/controllers/preferencesGlobal.js +++ b/src/js/controllers/preferencesGlobal.js @@ -18,6 +18,9 @@ angular.module('copayApp.controllers').controller('preferencesGlobalController', $scope.glideraEnabled = config.glidera.enabled; $scope.glideraTestnet = config.glidera.testnet; $scope.pushNotifications = config.pushNotifications.enabled; + cordova.plugins.diagnostic.isRemoteNotificationsEnabled(function(isEnabled) { + $scope.PNEnabledByUser = isEnabled; + }); }; var unwatchSpendUnconfirmed = $scope.$watch('spendUnconfirmed', function(newVal, oldVal) { From 0c53e5201518902de0f00eda0a13f2e070b43c84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Wed, 30 Mar 2016 17:49:48 -0400 Subject: [PATCH 2/3] settings link when push notifications are disabled by user --- public/views/preferencesGlobal.html | 7 ++++++- src/js/controllers/preferencesGlobal.js | 16 +++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/public/views/preferencesGlobal.html b/public/views/preferencesGlobal.html index c0df8be0a..6b02229c7 100644 --- a/public/views/preferencesGlobal.html +++ b/public/views/preferencesGlobal.html @@ -78,7 +78,12 @@
    About Copay
+
+
Push notifications for Copay are currently disabled. Enable them in the Settings app.
+
    +
  • Open Settings app
  • +
+

-
diff --git a/src/js/controllers/preferencesGlobal.js b/src/js/controllers/preferencesGlobal.js index 748da7e39..d6b0634ee 100644 --- a/src/js/controllers/preferencesGlobal.js +++ b/src/js/controllers/preferencesGlobal.js @@ -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 = { From 86f151de830b05d10049396372d1b268e96c1f10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Thu, 31 Mar 2016 11:33:59 -0400 Subject: [PATCH 3/3] always switch enable for android devices --- public/views/preferencesGlobal.html | 2 +- src/js/controllers/preferencesGlobal.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/public/views/preferencesGlobal.html b/public/views/preferencesGlobal.html index 6b02229c7..fd296396c 100644 --- a/public/views/preferencesGlobal.html +++ b/public/views/preferencesGlobal.html @@ -78,7 +78,7 @@
About Copay
-
+
Push notifications for Copay are currently disabled. Enable them in the Settings app.
  • Open Settings app
  • diff --git a/src/js/controllers/preferencesGlobal.js b/src/js/controllers/preferencesGlobal.js index d6b0634ee..8cedfe62b 100644 --- a/src/js/controllers/preferencesGlobal.js +++ b/src/js/controllers/preferencesGlobal.js @@ -14,7 +14,9 @@ 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()) { + $scope.PNEnabledByUser = true; + $scope.isIOS = isMobile.iOS(); + if (!typeof cordova.plugins.diagnostic != undefined && $scope.isIOS) { cordova.plugins.diagnostic.isRemoteNotificationsEnabled(function(isEnabled) { $scope.PNEnabledByUser = isEnabled; });