diff --git a/src/js/controllers/feedback/rateCard.js b/src/js/controllers/feedback/rateCard.js new file mode 100644 index 000000000..7aa47d381 --- /dev/null +++ b/src/js/controllers/feedback/rateCard.js @@ -0,0 +1,61 @@ +'use strict'; + +angular.module('copayApp.controllers').controller('rateCardController', function($scope, $state, $timeout, gettextCatalog, storageService) { + + $scope.goFeedbackFlow = function() { + if ($scope.isModal) { + $scope.rateModal.hide(); + $scope.rateModal.remove(); + } + if ($scope.isCordova && $scope.score == 5) { + $state.go('feedback.rateAppStore', { + score: $scope.score + }); + } else { + $state.go('feedback.sendFeedback', { + score: $scope.score + }); + } + }; + + $scope.setScore = function(score) { + $scope.score = score; + switch ($scope.score) { + case 1: + $scope.button_title = gettextCatalog.getString("I think this app is terrible"); + break; + case 2: + $scope.button_title = gettextCatalog.getString("I don't like it"); + break; + case 3: + $scope.button_title = gettextCatalog.getString("Meh - it's alright"); + break; + case 4: + $scope.button_title = gettextCatalog.getString("I like the app"); + break; + case 5: + $scope.button_title = gettextCatalog.getString("This app is fantastic"); + break; + } + $timeout(function() { + $scope.$apply(); + }); + }; + + $scope.cancel = function() {}; + + $scope.hideCard = function() { + if ($scope.isModal) { + $scope.rateModal.hide(); + $scope.rateModal.remove(); + } else { + storageService.setRateCardFlag('true', function() { + $scope.hideRateCard.value = true; + }); + } + $timeout(function() { + $scope.$apply(); + }) + } + +}); diff --git a/src/js/controllers/feedback/sendFeedback.js b/src/js/controllers/feedback/sendFeedback.js index 6c230a90e..a45b9e7f9 100644 --- a/src/js/controllers/feedback/sendFeedback.js +++ b/src/js/controllers/feedback/sendFeedback.js @@ -26,12 +26,12 @@ angular.module('copayApp.controllers').controller('sendFeedbackController', func break; } - $scope.sendFeedback = function(feedback) { + $scope.sendFeedback = function(feedback, skip) { var config = configService.getSync(); var dataSrc = { "entry.490635314": lodash.values(config.emailFor)[0] || 'no email setted', - "entry.1447064148": feedback, + "entry.1447064148": skip ? '-' : feedback, "entry.2142850951": $stateParams.score }; @@ -39,11 +39,14 @@ angular.module('copayApp.controllers').controller('sendFeedbackController', func $log.info("SUCCESS: Feedback sent"); $state.go('feedback.thanks', { score: $stateParams.score, - skipped: false + skipped: skip }); }, function(data) { - $log.info("Could not send feedback"); - popupService.showAlert(gettextCatalog.getString("Error"), gettextCatalog.getString("Could not send feedback, try again please")); + $log.info("ERROR: Feedback sent anyway."); + $state.go('feedback.thanks', { + score: $stateParams.score, + skipped: skip + }); }); }; @@ -58,11 +61,4 @@ angular.module('copayApp.controllers').controller('sendFeedbackController', func }; }; - $scope.skip = function() { - $state.go('feedback.thanks', { - score: $scope.score, - skipped: true - }); - }; - }); diff --git a/src/js/controllers/feedback/thanks.js b/src/js/controllers/feedback/thanks.js index e85d926c7..7aa84334f 100644 --- a/src/js/controllers/feedback/thanks.js +++ b/src/js/controllers/feedback/thanks.js @@ -31,10 +31,10 @@ angular.module('copayApp.controllers').controller('thanksController', function($ }; $scope.$on("$ionicView.beforeEnter", function(event, data) { + storageService.setRateCardFlag('true', function() {}); if (!$scope.isCordova) return; window.plugins.socialsharing.available(function(isAvailable) { - storageService.setRateCardFlag('true', function() {}); // the boolean is only false on iOS < 6 $scope.socialsharing = isAvailable; if (isAvailable) { diff --git a/src/js/controllers/tab-home.js b/src/js/controllers/tab-home.js index ca77a1838..3ebfeed1b 100644 --- a/src/js/controllers/tab-home.js +++ b/src/js/controllers/tab-home.js @@ -13,6 +13,7 @@ angular.module('copayApp.controllers').controller('tabHomeController', $scope.isCordova = platformInfo.isCordova; $scope.isAndroid = platformInfo.isAndroid; $scope.isNW = platformInfo.isNW; + $scope.hideRateCard = {}; $scope.$on("$ionicView.afterEnter", function() { startupService.ready(); @@ -37,7 +38,7 @@ angular.module('copayApp.controllers').controller('tabHomeController', } storageService.getRateCardFlag(function(error, value) { - $scope.hideRateCard = (value == 'true') ? true : false; + $scope.hideRateCard.value = (value == 'true') ? true : false; }); }); @@ -108,51 +109,6 @@ angular.module('copayApp.controllers').controller('tabHomeController', externalLinkService.open(url, optIn, title, message, okText, cancelText); }; - $scope.hideCard = function() { - storageService.setRateCardFlag('true', function() { - $scope.hideRateCard = true; - $timeout(function() { - $scope.$apply(); - }) - }); - } - - $scope.setScore = function(score) { - $scope.score = score; - switch ($scope.score) { - case 1: - $scope.button_title = gettextCatalog.getString("I think this app is terrible"); - break; - case 2: - $scope.button_title = gettextCatalog.getString("I don't like it"); - break; - case 3: - $scope.button_title = gettextCatalog.getString("Meh - it's alright"); - break; - case 4: - $scope.button_title = gettextCatalog.getString("I like the app"); - break; - case 5: - $scope.button_title = gettextCatalog.getString("This app is fantastic"); - break; - } - $timeout(function() { - $scope.$apply(); - }); - }; - - $scope.goFeedbackFlow = function() { - if ($scope.isCordova && $scope.score == 5) { - $state.go('feedback.rateAppStore', { - score: $scope.score - }); - } else { - $state.go('feedback.sendFeedback', { - score: $scope.score - }); - } - }; - $scope.openNotificationModal = function(n) { wallet = profileService.getWallet(n.walletId); diff --git a/src/js/controllers/tab-settings.js b/src/js/controllers/tab-settings.js index 773a6a5f3..13d482102 100644 --- a/src/js/controllers/tab-settings.js +++ b/src/js/controllers/tab-settings.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('tabSettingsController', function($scope, $window, uxLanguage, platformInfo, profileService, feeService, configService, externalLinkService) { +angular.module('copayApp.controllers').controller('tabSettingsController', function($scope, $window, $ionicModal, uxLanguage, platformInfo, profileService, feeService, configService, externalLinkService) { var updateConfig = function() { @@ -32,4 +32,15 @@ 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/sass/views/feedback/rateCard.scss b/src/sass/views/feedback/rateCard.scss new file mode 100644 index 000000000..9d01ea078 --- /dev/null +++ b/src/sass/views/feedback/rateCard.scss @@ -0,0 +1,22 @@ +#rate-card { + .stars { + display: flex; + border-bottom: none; + .button { + background-color: #fff; + outline: none; + border: none; + height:10px; + width:10px; + } + .gold { + color: #ffd700; + } + .subtle-gray { + color: $subtle-gray; + } + } + .feedback-flow-button { + padding: 20px; + } +} diff --git a/src/sass/views/feedback/sendFeedBack.scss b/src/sass/views/feedback/sendFeedBack.scss index 8e3060984..95ab3532c 100644 --- a/src/sass/views/feedback/sendFeedBack.scss +++ b/src/sass/views/feedback/sendFeedBack.scss @@ -1,7 +1,7 @@ #send-feedback { background-color: #ffffff; .skip { - margin: 10px; + margin: 20px 20px 10px; color: #667; } .title { diff --git a/src/sass/views/feedback/thanks.scss b/src/sass/views/feedback/thanks.scss index bd4d3ccab..58ad59ec2 100644 --- a/src/sass/views/feedback/thanks.scss +++ b/src/sass/views/feedback/thanks.scss @@ -2,7 +2,7 @@ background-color: #ffffff; .item-heading { border-style: none; - margin-top: 5px; + margin-top: 10px; a { color: $dark-gray; } diff --git a/src/sass/views/tab-home.scss b/src/sass/views/tab-home.scss index 6e1314294..ae1f52936 100644 --- a/src/sass/views/tab-home.scss +++ b/src/sass/views/tab-home.scss @@ -118,24 +118,4 @@ position: absolute; } } - .stars { - display: flex; - border-bottom: none; - .button { - background-color: #fff; - outline: none; - border: none; - height:10px; - width:10px; - } - .gold { - color: #ffd700; - } - .subtle-gray { - color: $subtle-gray; - } - } - .feedback-flow-button { - padding: 20px; - } } diff --git a/src/sass/views/views.scss b/src/sass/views/views.scss index 0e3f21ae9..5b3e8290d 100644 --- a/src/sass/views/views.scss +++ b/src/sass/views/views.scss @@ -17,6 +17,7 @@ @import "wallet-backup-phrase"; @import "zero-state"; @import "onboarding/onboarding"; +@import "feedback/rateCard"; @import "feedback/sendFeedback"; @import "feedback/thanks"; @import "feedback/rateAppStore"; diff --git a/www/views/feedback/rateCard.html b/www/views/feedback/rateCard.html new file mode 100644 index 000000000..fd9f95f73 --- /dev/null +++ b/www/views/feedback/rateCard.html @@ -0,0 +1,18 @@ +