From 8e7e950eb29d0ac438129a96c15a6433dbf20e1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Tue, 15 Nov 2016 17:38:48 -0300 Subject: [PATCH] delete popup rate card from settings --- src/js/controllers/feedback/rateCard.js | 27 ++++------ src/js/controllers/feedback/send.js | 67 ++++++++++++++++--------- src/js/controllers/modals/search.js | 2 +- src/js/controllers/tab-settings.js | 11 ---- src/js/routes.js | 33 +++++++++--- src/sass/views/feedback/rateCard.scss | 6 +-- src/sass/views/feedback/send.scss | 3 +- www/views/feedback/rateCard.html | 2 +- www/views/feedback/send.html | 8 ++- www/views/tab-settings.html | 2 +- 10 files changed, 92 insertions(+), 69 deletions(-) diff --git a/src/js/controllers/feedback/rateCard.js b/src/js/controllers/feedback/rateCard.js index 6def46bdd..6bc661d4d 100644 --- a/src/js/controllers/feedback/rateCard.js +++ b/src/js/controllers/feedback/rateCard.js @@ -6,10 +6,6 @@ angular.module('copayApp.controllers').controller('rateCardController', function $scope.score = 0; $scope.goFeedbackFlow = function() { - if ($scope.isModal) { - $scope.rateModal.hide(); - $scope.rateModal.remove(); - } if ($scope.isCordova && $scope.score == 5) { $state.go('feedback.rateApp', { score: $scope.score @@ -46,21 +42,16 @@ angular.module('copayApp.controllers').controller('rateCardController', function }; $scope.hideCard = function() { - if ($scope.isModal) { - $scope.rateModal.hide(); - $scope.rateModal.remove(); - } else { - storageService.getFeedbackInfo(function(error, info) { - var feedbackInfo = JSON.parse(info); - feedbackInfo.sent = true; - storageService.setFeedbackInfo(JSON.stringify(feedbackInfo), function() { - $scope.showRateCard.value = false; - }); + storageService.getFeedbackInfo(function(error, info) { + var feedbackInfo = JSON.parse(info); + feedbackInfo.sent = true; + storageService.setFeedbackInfo(JSON.stringify(feedbackInfo), function() { + $scope.showRateCard.value = false; + $timeout(function() { + $scope.$apply(); + }, 100); }); - } - $timeout(function() { - $scope.$apply(); - }, 100); + }); } }); diff --git a/src/js/controllers/feedback/send.js b/src/js/controllers/feedback/send.js index 0fb06753b..a849d97e9 100644 --- a/src/js/controllers/feedback/send.js +++ b/src/js/controllers/feedback/send.js @@ -1,29 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('sendController', function($scope, $state, $log, $stateParams, gettextCatalog, popupService, configService, lodash, feedbackService, ongoingProcess) { - $scope.score = parseInt($stateParams.score); - switch ($scope.score) { - case 1: - $scope.reaction = gettextCatalog.getString("Ouch!"); - $scope.comment = gettextCatalog.getString("There's obviously something we're doing wrong.") + ' ' + gettextCatalog.getString("How could we improve your experience?"); - break; - case 2: - $scope.reaction = gettextCatalog.getString("Oh no!"); - $scope.comment = gettextCatalog.getString("There's obviously something we're doing wrong.") + ' ' + gettextCatalog.getString("How could we improve your experience?"); - break; - case 3: - $scope.reaction = gettextCatalog.getString("Hmm..."); - $scope.comment = gettextCatalog.getString("We'd love to do better.") + ' ' + gettextCatalog.getString("How could we improve your experience?"); - break; - case 4: - $scope.reaction = gettextCatalog.getString("Thanks!"); - $scope.comment = gettextCatalog.getString("That's exciting to hear. We'd love to earn that fifth star from you – how could we improve your experience?"); - break; - case 5: - $scope.reaction = gettextCatalog.getString("Thank you!"); - $scope.comment = gettextCatalog.getString("We're always looking for ways to improve BitPay wallet.") + ' ' + gettextCatalog.getString("Is there anything we could do better?"); - break; - } +angular.module('copayApp.controllers').controller('sendController', function($scope, $state, $log, $timeout, $stateParams, $ionicNavBarDelegate, gettextCatalog, popupService, configService, lodash, feedbackService, ongoingProcess) { $scope.sendFeedback = function(feedback, skip) { @@ -32,7 +9,7 @@ angular.module('copayApp.controllers').controller('sendController', function($sc var dataSrc = { "Email": lodash.values(config.emailFor)[0] || ' ', "Feedback": skip ? ' ' : feedback, - "Score": $stateParams.score + "Score": $stateParams.score || ' ' }; ongoingProcess.set('sendingFeedback', true); @@ -42,6 +19,14 @@ angular.module('copayApp.controllers').controller('sendController', function($sc popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Could not send feedback')); return; } + if (!$stateParams.score) { + popupService.showAlert(gettextCatalog.getString('Thank you!'), gettextCatalog.getString('A member of the team will review your feedback as soon as possible.')); + $scope.feedback.value = ''; + $timeout(function() { + $scope.$apply(); + }); + return; + } $state.go('feedback.complete', { score: $stateParams.score, skipped: skip @@ -49,4 +34,36 @@ angular.module('copayApp.controllers').controller('sendController', function($sc }); }; + $scope.$on("$ionicView.beforeEnter", function(event, data) { + $scope.score = parseInt($stateParams.score); + $scope.feedback = {}; + + switch ($scope.score) { + case 1: + $scope.reaction = gettextCatalog.getString("Ouch!"); + $scope.comment = gettextCatalog.getString("There's obviously something we're doing wrong.") + ' ' + gettextCatalog.getString("How could we improve your experience?"); + break; + case 2: + $scope.reaction = gettextCatalog.getString("Oh no!"); + $scope.comment = gettextCatalog.getString("There's obviously something we're doing wrong.") + ' ' + gettextCatalog.getString("How could we improve your experience?"); + break; + case 3: + $scope.reaction = gettextCatalog.getString("Hmm..."); + $scope.comment = gettextCatalog.getString("We'd love to do better.") + ' ' + gettextCatalog.getString("How could we improve your experience?"); + break; + case 4: + $scope.reaction = gettextCatalog.getString("Thanks!"); + $scope.comment = gettextCatalog.getString("That's exciting to hear. We'd love to earn that fifth star from you – how could we improve your experience?"); + break; + case 5: + $scope.reaction = gettextCatalog.getString("Thank you!"); + $scope.comment = gettextCatalog.getString("We're always looking for ways to improve BitPay wallet.") + ' ' + gettextCatalog.getString("Is there anything we could do better?"); + break; + default: + $scope.reaction = gettextCatalog.getString("Feedback!"); + $scope.comment = gettextCatalog.getString("We're always looking for ways to improve BitPay wallet. How could we improve your experience?"); + break; + } + }); + }); diff --git a/src/js/controllers/modals/search.js b/src/js/controllers/modals/search.js index ed1861074..963e89e18 100644 --- a/src/js/controllers/modals/search.js +++ b/src/js/controllers/modals/search.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('searchController', function($scope, $rootScope, $interval, $timeout, $filter, $log, $ionicModal, $ionicPopover, $ionicNavBarDelegate, $state, $stateParams, $ionicScrollDelegate, bwcError, profileService, lodash, configService, gettext, gettextCatalog, platformInfo, walletService) { +angular.module('copayApp.controllers').controller('searchController', function($scope, $rootScope, $interval, $timeout, $filter, $log, $ionicModal, $ionicPopover, $state, $stateParams, $ionicScrollDelegate, bwcError, profileService, lodash, configService, gettext, gettextCatalog, platformInfo, walletService) { var HISTORY_SHOW_LIMIT = 10; var currentTxHistoryPage = 0; diff --git a/src/js/controllers/tab-settings.js b/src/js/controllers/tab-settings.js index 13d482102..4387685c3 100644 --- a/src/js/controllers/tab-settings.js +++ b/src/js/controllers/tab-settings.js @@ -32,15 +32,4 @@ angular.module('copayApp.controllers').controller('tabSettingsController', funct updateConfig(); }); - $scope.openRateModal = function() { - $scope.isModal = true; - $ionicModal.fromTemplateUrl('views/feedback/rateCard.html', { - scope: $scope, - backdropClickToClose: false, - hardwareBackButtonClose: false - }).then(function(modal) { - $scope.rateModal = modal; - $scope.rateModal.show(); - }); - } }); diff --git a/src/js/routes.js b/src/js/routes.js index a80c3e791..8b6a3d5ac 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -722,7 +722,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr /* * - * Feedback + * Feedback from home * */ @@ -758,11 +758,32 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr } } }) - /* - * - * Buy or Sell Bitcoin - * - */ + + /* + * + * Feedback from settings + * + */ + .state('tabs.settings.feedback', { + url: '/feedback', + abstract: true, + template: '' + }) + .state('tabs.settings.feedback.send', { + url: '/send', + views: { + 'tab-settings@tabs': { + controller: 'sendController', + templateUrl: 'views/feedback/send.html' + } + } + }) + + /* + * + * Buy or Sell Bitcoin + * + */ .state('tabs.buyandsell', { url: '/buyandsell', diff --git a/src/sass/views/feedback/rateCard.scss b/src/sass/views/feedback/rateCard.scss index e2c96c447..9d57643d6 100644 --- a/src/sass/views/feedback/rateCard.scss +++ b/src/sass/views/feedback/rateCard.scss @@ -1,10 +1,10 @@ #rate-card { + .item-heading { + font-weight: 700; + } .row { border: none; } - .row.row-margin{ - margin: 20px 0px 20px 0px; - } .item-icon-right { margin: 0; } diff --git a/src/sass/views/feedback/send.scss b/src/sass/views/feedback/send.scss index 3179642d3..284975501 100644 --- a/src/sass/views/feedback/send.scss +++ b/src/sass/views/feedback/send.scss @@ -1,10 +1,11 @@ #send-feedback { background-color: #ffffff; .row { + padding: 20px; border: none; } .skip { - margin: 20px 20px 10px; + margin: 8px 20px 10px; color: #667; text-decoration: none; } diff --git a/www/views/feedback/rateCard.html b/www/views/feedback/rateCard.html index 1ac2b0935..4772f5587 100644 --- a/www/views/feedback/rateCard.html +++ b/www/views/feedback/rateCard.html @@ -1,4 +1,4 @@ -
+
How do you like BitPay Wallet? diff --git a/www/views/feedback/send.html b/www/views/feedback/send.html index 4064eede8..fba13c725 100644 --- a/www/views/feedback/send.html +++ b/www/views/feedback/send.html @@ -1,4 +1,8 @@ + + + +
@@ -24,9 +28,9 @@ {{comment}}
- +
-
diff --git a/www/views/tab-settings.html b/www/views/tab-settings.html index 735a125e8..585a780b0 100644 --- a/www/views/tab-settings.html +++ b/www/views/tab-settings.html @@ -29,7 +29,7 @@ - +