adding send feedback option in settings

This commit is contained in:
Gabriel Bazán 2016-11-08 11:49:03 -03:00
commit 80888f63a1
14 changed files with 132 additions and 102 deletions

View file

@ -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();
})
}
});

View file

@ -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
});
};
});

View file

@ -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) {