new flow for NW.js

This commit is contained in:
Gabriel Bazán 2016-11-02 15:30:14 -03:00
commit 9668870a07
7 changed files with 152 additions and 33 deletions

View file

@ -10,7 +10,7 @@ angular.module('copayApp.controllers').controller('rateAppStoreController', func
$scope.skip = function() { $scope.skip = function() {
$state.go('feedback.thanks', { $state.go('feedback.thanks', {
score: $scope.score, score: $scope.score,
skip: true skipped: true
}); });
}; };

View file

@ -28,14 +28,15 @@ angular.module('copayApp.controllers').controller('sendFeedbackController', func
$scope.sendFeedback = function() { $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) //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', { $state.go('feedback.thanks', {
score: $stateParams.score score: $stateParams.score,
skipped: false
}); });
}; };
$scope.skip = function() { $scope.skip = function() {
$state.go('feedback.thanks', { $state.go('feedback.thanks', {
score: $scope.score, score: $scope.score,
skip: true skipped: true
}); });
}; };

View file

@ -1,12 +1,75 @@
'use strict'; '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.score = parseInt($stateParams.score);
$scope.skip = $stateParams.skip && $scope.score == 5; $scope.skipped = $stateParams.skipped == 'false' ? false : true;
storageService.setRateCardFlag('true', function() {}); $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) { $scope.$on("$ionicView.beforeEnter", function(event, data) {
var config = configService.getSync(); storageService.setRateCardFlag('true', function() {});
window.plugins.socialsharing.share(config.download.url, null, null, null); 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;
})
}
});
}); });
}); });

View file

@ -36,12 +36,10 @@ angular.module('copayApp.controllers').controller('tabHomeController',
}); });
} }
$scope.hideRateCard = $stateParams.fromAppRate || !$scope.isCordova; storageService.getRateCardFlag(function(error, value) {
if (!$scope.hideRateCard) { $scope.hideRateCard = (value == 'true') ? true : false;
storageService.getRateCardFlag(function(error, value) { });
$scope.hideRateCard = (value == 'true') ? true : false;
});
}
}); });
$scope.$on("$ionicView.enter", function(event, data) { $scope.$on("$ionicView.enter", function(event, data) {
@ -144,14 +142,15 @@ angular.module('copayApp.controllers').controller('tabHomeController',
}; };
$scope.goFeedbackFlow = function() { $scope.goFeedbackFlow = function() {
if ($scope.score != 5) if ($scope.isCordova && $scope.score == 5) {
$state.go('feedback.sendFeedback', {
score: $scope.score
});
else
$state.go('feedback.rateAppStore', { $state.go('feedback.rateAppStore', {
score: $scope.score score: $scope.score
}); });
} else {
$state.go('feedback.sendFeedback', {
score: $scope.score
});
}
}; };
$scope.openNotificationModal = function(n) { $scope.openNotificationModal = function(n) {

View file

@ -741,7 +741,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
} }
}) })
.state('feedback.thanks', { .state('feedback.thanks', {
url: '/thanks/:score/:skip', url: '/thanks/:score/:skipped',
views: { views: {
'feedback': { 'feedback': {
controller: 'thanksController', controller: 'thanksController',

View file

@ -9,4 +9,15 @@
.subtitle { .subtitle {
padding: 10px 30px 20px 40px; padding: 10px 30px 20px 40px;
} }
.row {
margin: 20px 0px 20px;
span {
margin-top: 15px;
display: block;
}
div {
text-align: center;
width: 100%;
}
}
} }

View file

@ -1,19 +1,28 @@
<ion-view id="thanks-feedback"> <ion-view id="thanks-feedback">
<ion-nav-bar class="bar-royal"> <ion-nav-bar class="bar-royal">
<ion-nav-buttons side="secondary"> <ion-nav-buttons side="secondary">
<button class="button icon ion-ios-close-empty" ui-sref="tabs.home({fromAppRate: 'true'})"> <button class="button icon ion-ios-close-empty" ui-sref="tabs.home()">
</button> </button>
</ion-nav-buttons> </ion-nav-buttons>
</ion-nav-bar> </ion-nav-bar>
<ion-content scroll="false"> <ion-content scroll="false">
<div ng-if="!skip"> <div ng-show="skipped && isCordova">
<div class="title"> <div class="title" translate>Invite friends to BitPay Wallet!</div>
<span translate>Thank you!</span> <div>
<i class="icon zero-state-icon">
<img src="img/address-book-add.svg"/>
</i>
</div> </div>
<div class="text-center">
<span translate>Share the love by inviting your friends.</span>
</div>
</div>
<div ng-show="!skipped || !isCordova">
<div class="title" translate>Thank you!</div>
<div class="subtitle"> <div class="subtitle">
<span translate>A member of the team will review your feedback as soon as possible.</span> <span translate>A member of the team will review your feedback as soon as possible.</span>
</div> </div>
<div class="subtitle" ng-if="score < 4"> <div class="subtitle" ng-if="score <= 3 || !isCordova">
<span translate>If you have additional feedback, please let us know by tapping the "Send feedback" option in the Settings tab.</span> <span translate>If you have additional feedback, please let us know by tapping the "Send feedback" option in the Settings tab.</span>
<div> <div>
<i class="icon zero-state-icon"> <i class="icon zero-state-icon">
@ -21,17 +30,53 @@
</i> </i>
</div> </div>
</div> </div>
</div> <div class="text-center" ng-if="score > 3 && isCordova">
<div ng-if="skip" class="title"> <span translate>Share the love by inviting your friends.</span>
<span translate>Invite friends to BitPay Wallet!</span>
<div>
<i class="icon zero-state-icon">
<img src="img/address-book-add.svg"/>
</i>
</div> </div>
</div> </div>
<div class="text-center" ng-if="score >= 4"> <div ng-if="isCordova && score > 3">
<span translate>Share the love by inviting your friends.</span> <div class="ng-hide" ng-show="socialsharing" ng-if="score >= 4">
<div class="row">
<div class="ng-hide" ng-show="facebook" ng-click="shareFacebook()">
<i class="icon zero-state-icon">
<img src="img/address-book-add.svg"/>
</i>
<span>Facebook</span>
</div>
<div class="ng-hide" ng-show="twitter" ng-click="shareTwitter()">
<i class="icon zero-state-icon">
<img src="img/address-book-add.svg"/>
</i>
<span>Twitter</span>
</div>
<div class="ng-hide" ng-show="googleplus" ng-click="shareGooglePlus()">
<i class="icon zero-state-icon">
<img src="img/address-book-add.svg"/>
</i>
<span>Google+</span>
</div>
</div>
<div class="row">
<div class="ng-hide" ng-show="email" ng-click="shareEmail()">
<i class="icon zero-state-icon">
<img src="img/address-book-add.svg"/>
</i>
<span>Email</span>
</div>
<div class="ng-hide" ng-show="whatsapp" ng-click="shareWhatsapp()">
<i class="icon zero-state-icon">
<img src="img/address-book-add.svg"/>
</i>
<span>Whatsapp</span>
</div>
<div class="ng-hide" ng-show="message" ng-click="shareMessage()">
<i class="icon zero-state-icon">
<img src="img/address-book-add.svg"/>
</i>
<span>Message</span>
</div>
</div>
</div>
</div> </div>
</ion-content> </ion-content>
</ion-view> </ion-view>