diff --git a/src/js/controllers/feedback/rateAppStore.js b/src/js/controllers/feedback/rateAppStore.js index 3bc49f140..b659fa516 100644 --- a/src/js/controllers/feedback/rateAppStore.js +++ b/src/js/controllers/feedback/rateAppStore.js @@ -10,7 +10,7 @@ angular.module('copayApp.controllers').controller('rateAppStoreController', func $scope.skip = function() { $state.go('feedback.thanks', { score: $scope.score, - skip: true + skipped: true }); }; diff --git a/src/js/controllers/feedback/sendFeedback.js b/src/js/controllers/feedback/sendFeedback.js index cce2b9d06..d26b2e2ff 100644 --- a/src/js/controllers/feedback/sendFeedback.js +++ b/src/js/controllers/feedback/sendFeedback.js @@ -28,14 +28,15 @@ angular.module('copayApp.controllers').controller('sendFeedbackController', func $scope.sendFeedback = function() { //Feedback entered in feedback flow should be sent to BWS, and BWS should send a plain-text email to feedback@bitpay.com with a reply-to going to the user's email address. (From the onboarding process) $state.go('feedback.thanks', { - score: $stateParams.score + score: $stateParams.score, + skipped: false }); }; $scope.skip = function() { $state.go('feedback.thanks', { score: $scope.score, - skip: true + skipped: true }); }; diff --git a/src/js/controllers/feedback/thanks.js b/src/js/controllers/feedback/thanks.js index 0ccdae254..80f3f6218 100644 --- a/src/js/controllers/feedback/thanks.js +++ b/src/js/controllers/feedback/thanks.js @@ -1,12 +1,75 @@ 'use strict'; -angular.module('copayApp.controllers').controller('thanksController', function($scope, $stateParams, configService, storageService) { +angular.module('copayApp.controllers').controller('thanksController', function($scope, $stateParams, platformInfo, configService, storageService) { $scope.score = parseInt($stateParams.score); - $scope.skip = $stateParams.skip && $scope.score == 5; - storageService.setRateCardFlag('true', function() {}); + $scope.skipped = $stateParams.skipped == 'false' ? false : true; + $scope.isCordova = platformInfo.isCordova; + var config = configService.getSync(); + + $scope.shareFacebook = function() { + window.plugins.socialsharing.shareViaFacebook(config.download.url, null, null, null); + }; + + $scope.shareTwitter = function() { + window.plugins.socialsharing.shareVia('com.apple.social.twitter', config.download.url, null, null, 'http://www.x-services.nl', null, null); + }; + + $scope.shareGooglePlus = function() { + window.plugins.socialsharing.shareVia('com.google.android.apps.plus', config.download.url, null, null, null); + }; + + $scope.shareEmail = function() { + window.plugins.socialsharing.shareViaEmail(config.download.url, null, null, null); + }; + + $scope.shareWhatsapp = function() { + window.plugins.socialsharing.shareViaWhatsApp(config.download.url, null, null, null); + }; + + $scope.shareMessage = function() { + window.plugins.socialsharing.shareViaSMS(config.download.url, null, null, null); + }; $scope.$on("$ionicView.beforeEnter", function(event, data) { - var config = configService.getSync(); - window.plugins.socialsharing.share(config.download.url, null, null, null); + storageService.setRateCardFlag('true', function() {}); + if (!$scope.isCordova) return; + + window.plugins.socialsharing.available(function(isAvailable) { + // the boolean is only false on iOS < 6 + $scope.socialsharing = isAvailable; + if (isAvailable) { + + window.plugins.socialsharing.canShareVia('com.apple.social.facebook', 'msg', null, null, null, function(e) { + $scope.facebook = true; + }, function(e) { + $scope.facebook = false; + }); + window.plugins.socialsharing.canShareVia('com.apple.social.twitter', 'msg', null, null, null, function(e) { + $scope.twitter = true; + }, function(e) { + $scope.twitter = false; + }); + window.plugins.socialsharing.canShareVia('com.google.android.apps.plus', 'msg', null, null, null, function(e) { + $scope.googleplus = true; + }, function(e) { + $scope.googleplus = false; + }) + window.plugins.socialsharing.canShareViaEmail(function(e) { + $scope.email = true; + }, function(e) { + $scope.email = false; + }) + window.plugins.socialsharing.canShareVia('whatsapp', 'msg', null, null, null, function(e) { + $scope.whatsapp = true; + }, function(e) { + $scope.whatsapp = false; + }) + window.plugins.socialsharing.canShareVia('sms', 'msg', null, null, null, function(e) { + $scope.sms = true; + }, function(e) { + $scope.sms = false; + }) + } + }); }); }); diff --git a/src/js/controllers/tab-home.js b/src/js/controllers/tab-home.js index be2c5d8b9..ca77a1838 100644 --- a/src/js/controllers/tab-home.js +++ b/src/js/controllers/tab-home.js @@ -36,12 +36,10 @@ angular.module('copayApp.controllers').controller('tabHomeController', }); } - $scope.hideRateCard = $stateParams.fromAppRate || !$scope.isCordova; - if (!$scope.hideRateCard) { - storageService.getRateCardFlag(function(error, value) { - $scope.hideRateCard = (value == 'true') ? true : false; - }); - } + storageService.getRateCardFlag(function(error, value) { + $scope.hideRateCard = (value == 'true') ? true : false; + }); + }); $scope.$on("$ionicView.enter", function(event, data) { @@ -144,14 +142,15 @@ angular.module('copayApp.controllers').controller('tabHomeController', }; $scope.goFeedbackFlow = function() { - if ($scope.score != 5) - $state.go('feedback.sendFeedback', { - score: $scope.score - }); - else + 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) { diff --git a/src/js/routes.js b/src/js/routes.js index 91d4cd6d0..ee65083d3 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -741,7 +741,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr } }) .state('feedback.thanks', { - url: '/thanks/:score/:skip', + url: '/thanks/:score/:skipped', views: { 'feedback': { controller: 'thanksController', diff --git a/src/sass/views/feedback/thanks.scss b/src/sass/views/feedback/thanks.scss index 3ab9c4ca0..2a92e173b 100644 --- a/src/sass/views/feedback/thanks.scss +++ b/src/sass/views/feedback/thanks.scss @@ -9,4 +9,15 @@ .subtitle { padding: 10px 30px 20px 40px; } + .row { + margin: 20px 0px 20px; + span { + margin-top: 15px; + display: block; + } + div { + text-align: center; + width: 100%; + } + } } diff --git a/www/views/feedback/thanks.html b/www/views/feedback/thanks.html index a76b5afda..3a82a99d5 100644 --- a/www/views/feedback/thanks.html +++ b/www/views/feedback/thanks.html @@ -1,19 +1,28 @@ - -
-
- Thank you! +
+
Invite friends to BitPay Wallet!
+
+ + +
+
+ Share the love by inviting your friends. +
+
+
+
Thank you!
A member of the team will review your feedback as soon as possible.
-
+
If you have additional feedback, please let us know by tapping the "Send feedback" option in the Settings tab.
@@ -21,17 +30,53 @@
-
-
- Invite friends to BitPay Wallet! -
- - - +
+ Share the love by inviting your friends.
-
- Share the love by inviting your friends. +
+
+
+
+ + + + Facebook +
+
+ + + + Twitter +
+
+ + + + Google+ +
+
+
+
+ + + + Email +
+
+ + + + Whatsapp +
+
+ + + + Message +
+
+