diff --git a/public/views/preferencesNotifications.html b/public/views/preferencesNotifications.html new file mode 100644 index 000000000..8b54a93e2 --- /dev/null +++ b/public/views/preferencesNotifications.html @@ -0,0 +1,29 @@ + + + {{'Notifications' | translate}} + + + + + +
+
+
Notifications
+ + + Enable push notifications + +
+ +
+
Notifications
+
+ Push notifications for Copay are currently disabled. Enable them in the Settings app. +
+ + Open Settings app + +
+
+
+
diff --git a/public/views/tab-settings.html b/public/views/tab-settings.html index cb9113da9..0231d8d99 100644 --- a/public/views/tab-settings.html +++ b/public/views/tab-settings.html @@ -14,6 +14,12 @@
Preferences
+ + + Notifications + + + Language @@ -50,24 +56,6 @@ -
-
Notifications
- - - Enable push notifications - -
- -
-
Notifications
-
- Push notifications for Copay are currently disabled. Enable them in the Settings app. -
- - Open Settings app - -
-
Wallets Preferences
-
- - - About {{appName}} - - -
Advanced @@ -97,6 +78,11 @@
+ + + About {{appName}} + + diff --git a/src/js/controllers/modals/txDetails.js b/src/js/controllers/modals/txDetails.js index f9d7dd4ff..37f6718fa 100644 --- a/src/js/controllers/modals/txDetails.js +++ b/src/js/controllers/modals/txDetails.js @@ -73,6 +73,8 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio time: $scope.btx.time, description: actionDescriptions['broadcasted'], }); + + $scope.actionList.reverse(); }; $scope.showCommentPopup = function() { diff --git a/src/js/controllers/modals/txpDetails.js b/src/js/controllers/modals/txpDetails.js index 23ba059b3..8f76d7f4d 100644 --- a/src/js/controllers/modals/txpDetails.js +++ b/src/js/controllers/modals/txpDetails.js @@ -49,6 +49,8 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi by: action.copayerName }); }); + + $scope.actionList.reverse(); }; $scope.$on('accepted', function(event) { diff --git a/src/js/controllers/preferencesNotifications.js b/src/js/controllers/preferencesNotifications.js new file mode 100644 index 000000000..8d947dde8 --- /dev/null +++ b/src/js/controllers/preferencesNotifications.js @@ -0,0 +1,52 @@ +'use strict'; + +angular.module('copayApp.controllers').controller('preferencesNotificationsController', + function($scope, $rootScope, $log, $window, lodash, configService, uxLanguage, platformInfo, pushNotificationsService, profileService, feeService) { + + var updateConfig = function() { + + var config = configService.getSync(); + var isCordova = platformInfo.isCordova; + var isIOS = platformInfo.isIOS; + + $scope.PNEnabledByUser = true; + $scope.isIOSApp = isIOS && isCordova; + if ($scope.isIOSApp) { + cordova.plugins.diagnostic.isRemoteNotificationsEnabled(function(isEnabled) { + $scope.PNEnabledByUser = isEnabled; + $scope.$digest(); + }); + } + + $scope.pushNotifications = { + value: config.pushNotifications.enabled + }; + }; + + $scope.openSettings = function() { + cordova.plugins.diagnostic.switchToSettings(function() { + $log.debug('switched to settings'); + }, function(err) { + $log.debug(err); + }); + }; + + $scope.pushNotificationsChange = function() { + var opts = { + pushNotifications: { + enabled: $scope.pushNotifications.value + } + }; + configService.set(opts, function(err) { + if (opts.pushNotifications.enabled) + pushNotificationsService.enableNotifications(profileService.walletClients); + else + pushNotificationsService.disableNotifications(profileService.walletClients); + if (err) $log.debug(err); + }); + }; + + $scope.$on("$ionicView.enter", function(event, data) { + updateConfig(); + }); + }); diff --git a/src/js/controllers/tab-settings.js b/src/js/controllers/tab-settings.js index ba4bfafda..ec1492ef9 100644 --- a/src/js/controllers/tab-settings.js +++ b/src/js/controllers/tab-settings.js @@ -9,6 +9,8 @@ angular.module('copayApp.controllers').controller('tabSettingsController', funct var isWP = platformInfo.isWP; var isIOS = platformInfo.isIOS; + $scope.usePushNotifications = isCordova && !isWP; + $scope.appName = $window.appConfig.nameCase; $scope.unitName = config.wallet.settings.unitName; @@ -19,48 +21,13 @@ angular.module('copayApp.controllers').controller('tabSettingsController', funct }; $scope.feeOpts = feeService.feeOpts; $scope.currentFeeLevel = feeService.getCurrentFeeLevel(); - $scope.usePushNotifications = isCordova && !isWP; - $scope.PNEnabledByUser = true; - $scope.isIOSApp = isIOS && isCordova; - if ($scope.isIOSApp) { - cordova.plugins.diagnostic.isRemoteNotificationsEnabled(function(isEnabled) { - $scope.PNEnabledByUser = isEnabled; - $scope.$digest(); - }); - } - $scope.pushNotifications = { - value: config.pushNotifications.enabled - }; $scope.otherWallets = lodash.filter(profileService.getWallets(self.network), function(w) { return w.id != self.walletId; }); $scope.wallets = profileService.getWallets(); }; - $scope.openSettings = function() { - cordova.plugins.diagnostic.switchToSettings(function() { - $log.debug('switched to settings'); - }, function(err) { - $log.debug(err); - }); - }; - - $scope.pushNotificationsChange = function() { - var opts = { - pushNotifications: { - enabled: $scope.pushNotifications.value - } - }; - configService.set(opts, function(err) { - if (opts.pushNotifications.enabled) - pushNotificationsService.enableNotifications(profileService.walletClients); - else - pushNotificationsService.disableNotifications(profileService.walletClients); - if (err) $log.debug(err); - }); - }; - $scope.$on("$ionicView.enter", function(event, data) { updateConfig(); }); diff --git a/src/js/routes.js b/src/js/routes.js index 501a304f5..ba828213c 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -318,7 +318,16 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr * */ - .state('tabs.language', { + .state('tabs.notifications', { + url: '/notifications', + views: { + 'tab-settings@tabs': { + controller: 'preferencesNotificationsController', + templateUrl: 'views/preferencesNotifications.html' + } + } + }) + .state('tabs.language', { url: '/language', views: { 'tab-settings@tabs': { @@ -986,6 +995,8 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr $log.debug('Route change from:', fromState.name || '-', ' to:', toState.name); $log.debug(' toParams:' + JSON.stringify(toParams || {})); $log.debug(' fromParams:' + JSON.stringify(fromParams || {})); + + if (!toState.name.match(/onboarding/)) return; var state = {}; state.name = toState.name; state.toParams = toParams; diff --git a/src/sass/views/notifications.scss b/src/sass/views/notifications.scss new file mode 100644 index 000000000..a0433cc5d --- /dev/null +++ b/src/sass/views/notifications.scss @@ -0,0 +1,43 @@ +.settings { + .item { + color: #444; + border-color: rgba(221, 221, 221, 0.3); + } +} + +#tab-notifications { + .list { + .item { + color: #444; + border-top: none; + padding-top: 1.5rem; + padding-bottom: 1.5rem; + &:before { + display: block; + position: absolute; + width: 100%; + height: 1px; + background: rgba(221, 221, 221, 0.3); + top: 0; + right: 0; + content: ''; + } + &.item-divider { + color: rgba(74, 74, 74, .8); + } + &.item-heading { + &:before { + top: 99% + } + } + &:nth-child(2) { + &:before { + width: 0; + } + } + .item-note { + color: rgb(58, 58, 58); + } + } + } +}