add rate card flag

This commit is contained in:
Gabriel Bazán 2016-11-02 10:52:04 -03:00
commit 7b2d3b1df0
8 changed files with 111 additions and 82 deletions

View file

@ -2,7 +2,6 @@
angular.module('copayApp.controllers').controller('rateAppStoreController', function($scope, $state, $stateParams, externalLinkService, configService, gettextCatalog, platformInfo) {
$scope.score = parseInt($stateParams.score);
$scope.isCordova = platformInfo.isCordova;
var isAndroid = platformInfo.isAndroid;
var isIOS = platformInfo.isIOS;
var isWP = platformInfo.isWP;

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('sendFeedbackController', function($scope, $state, $timeout, $stateParams, gettextCatalog) {
angular.module('copayApp.controllers').controller('sendFeedbackController', function($scope, $state, $stateParams, gettextCatalog) {
$scope.score = parseInt($stateParams.score);
switch ($scope.score) {
case 1:

View file

@ -1,13 +1,12 @@
'use strict';
angular.module('copayApp.controllers').controller('thanksController', function($scope, $state, $stateParams, platformInfo, configService) {
angular.module('copayApp.controllers').controller('thanksController', function($scope, $stateParams, configService, storageService) {
$scope.score = parseInt($stateParams.score);
$scope.skip = $stateParams.skip && $scope.score == 5;
storageService.setRateCardFlag('true', function() {});
$scope.$on("$ionicView.beforeEnter", function(event, data) {
if (platformInfo.isCordova) {
var config = configService.getSync();
window.plugins.socialsharing.share(config.download.url, null, null, null);
}
var config = configService.getSync();
window.plugins.socialsharing.share(config.download.url, null, null, null);
});
});

View file

@ -18,27 +18,107 @@ angular.module('copayApp.controllers').controller('tabHomeController',
startupService.ready();
});
if (!$scope.homeTip) {
storageService.getHomeTipAccepted(function(error, value) {
$scope.homeTip = (value == 'accepted') ? false : true;
});
}
$scope.$on("$ionicView.beforeEnter", function(event, data) {
if (!$scope.homeTip) {
storageService.getHomeTipAccepted(function(error, value) {
$scope.homeTip = (value == 'accepted') ? false : true;
});
}
if ($scope.isNW) {
latestReleaseService.checkLatestRelease(function(err, newRelease) {
if (err) {
$log.warn(err);
return;
}
if ($scope.isNW) {
latestReleaseService.checkLatestRelease(function(err, newRelease) {
if (err) {
$log.warn(err);
return;
}
if (newRelease) $scope.newRelease = true;
if (newRelease) $scope.newRelease = true;
});
}
$scope.hideRateCard = $stateParams.fromAppRate || !$scope.isCordova;
if (!$scope.hideRateCard) {
storageService.getRateCardFlag(function(error, value) {
$scope.hideRateCard = (value == 'true') ? true : false;
});
}
});
$scope.$on("$ionicView.enter", function(event, data) {
updateAllWallets();
addressbookService.list(function(err, ab) {
if (err) $log.error(err);
$scope.addressbook = ab || {};
});
}
listeners = [
$rootScope.$on('bwsEvent', function(e, walletId, type, n) {
var wallet = profileService.getWallet(walletId);
updateWallet(wallet);
if ($scope.recentTransactionsEnabled) getNotifications();
}),
$rootScope.$on('Local/TxAction', function(e, walletId) {
$log.debug('Got action for wallet ' + walletId);
var wallet = profileService.getWallet(walletId);
updateWallet(wallet);
if ($scope.recentTransactionsEnabled) getNotifications();
})
];
configService.whenAvailable(function() {
nextStep(function() {
var config = configService.getSync();
var isWindowsPhoneApp = platformInfo.isWP && platformInfo.isCordova;
$scope.glideraEnabled = config.glidera.enabled && !isWindowsPhoneApp;
$scope.coinbaseEnabled = config.coinbase.enabled && !isWindowsPhoneApp;
$scope.amazonEnabled = config.amazon.enabled;
$scope.bitpayCardEnabled = config.bitpayCard.enabled;
var buyAndSellEnabled = !$scope.externalServices.BuyAndSell && ($scope.glideraEnabled || $scope.coinbaseEnabled);
var amazonEnabled = !$scope.externalServices.AmazonGiftCards && $scope.amazonEnabled;
var bitpayCardEnabled = !$scope.externalServices.BitpayCard && $scope.bitpayCardEnabled;
$scope.nextStepEnabled = buyAndSellEnabled || amazonEnabled || bitpayCardEnabled;
$scope.recentTransactionsEnabled = config.recentTransactions.enabled;
if ($scope.recentTransactionsEnabled) getNotifications();
if ($scope.bitpayCardEnabled) bitpayCardCache();
$timeout(function() {
$ionicScrollDelegate.resize();
$scope.$apply();
}, 10);
});
});
});
$scope.$on("$ionicView.leave", function(event, data) {
lodash.each(listeners, function(x) {
x();
});
});
$scope.$on("$ionicView.leave", function(event, data) {
lodash.each(listeners, function(x) {
x();
});
});
$scope.openExternalLink = function(url, optIn, title, message, okText, cancelText) {
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) {
@ -232,61 +312,4 @@ angular.module('copayApp.controllers').controller('tabHomeController',
}, 300);
updateAllWallets();
};
$scope.$on("$ionicView.beforeEnter", function(event, data) {
updateAllWallets();
addressbookService.list(function(err, ab) {
if (err) $log.error(err);
$scope.addressbook = ab || {};
});
listeners = [
$rootScope.$on('bwsEvent', function(e, walletId, type, n) {
var wallet = profileService.getWallet(walletId);
updateWallet(wallet);
if ($scope.recentTransactionsEnabled) getNotifications();
}),
$rootScope.$on('Local/TxAction', function(e, walletId) {
$log.debug('Got action for wallet ' + walletId);
var wallet = profileService.getWallet(walletId);
updateWallet(wallet);
if ($scope.recentTransactionsEnabled) getNotifications();
})
];
configService.whenAvailable(function() {
nextStep(function() {
var config = configService.getSync();
var isWindowsPhoneApp = platformInfo.isWP && platformInfo.isCordova;
$scope.glideraEnabled = config.glidera.enabled && !isWindowsPhoneApp;
$scope.coinbaseEnabled = config.coinbase.enabled && !isWindowsPhoneApp;
$scope.amazonEnabled = config.amazon.enabled;
$scope.bitpayCardEnabled = config.bitpayCard.enabled;
var buyAndSellEnabled = !$scope.externalServices.BuyAndSell && ($scope.glideraEnabled || $scope.coinbaseEnabled);
var amazonEnabled = !$scope.externalServices.AmazonGiftCards && $scope.amazonEnabled;
var bitpayCardEnabled = !$scope.externalServices.BitpayCard && $scope.bitpayCardEnabled;
$scope.nextStepEnabled = buyAndSellEnabled || amazonEnabled || bitpayCardEnabled;
$scope.recentTransactionsEnabled = config.recentTransactions.enabled;
if ($scope.recentTransactionsEnabled) getNotifications();
if ($scope.bitpayCardEnabled) bitpayCardCache();
$timeout(function() {
$ionicScrollDelegate.resize();
$scope.$apply();
}, 10);
});
});
});
$scope.$on("$ionicView.leave", function(event, data) {
lodash.each(listeners, function(x) {
x();
});
});
});

View file

@ -203,6 +203,14 @@ angular.module('copayApp.services')
storage.set('homeTip', val, cb);
};
root.getRateCardFlag = function(cb) {
storage.get('rateCardFlag', cb);
};
root.setRateCardFlag = function(val, cb) {
storage.set('rateCardFlag', val, cb);
};
root.setHideBalanceFlag = function(walletId, val, cb) {
storage.set('hideBalance-' + walletId, val, cb);
};

View file

@ -22,11 +22,11 @@
<span translate>Would you be willing to rate BitPay Wallet in the app store?</span>
</div>
<div>
<button type="submit" class="button button-standard button-primary" ng-click="goAppStore()" ng-if="isCordova">
<button type="submit" class="button button-standard button-primary" ng-click="goAppStore()">
<span translate>Rate on the app store</span>
</button>
<button type="submit" class="button button-standard button-primary" ng-click="sendFeedback()">
<span translate>Send us feedback</span>
<span translate>Send us feedback instead</span>
</button>
</div>
</ion-content>

View file

@ -1,7 +1,7 @@
<ion-view id="thanks-feedback">
<ion-nav-bar class="bar-royal">
<ion-nav-buttons side="secondary">
<button class="button icon ion-ios-close-empty " ui-sref="tabs.home">
<button class="button icon ion-ios-close-empty" ui-sref="tabs.home({fromAppRate: 'true'})">
</button>
</ion-nav-buttons>
</ion-nav-bar>

View file

@ -10,13 +10,13 @@
spinner="ios-small"
on-refresh="onRefresh()">
</ion-refresher>
<div class="release" ng-show="newRelease" ng-click="openExternalLink('https://github.com/bitpay/copay/releases/latest', true, 'Update Available', 'An update to this app is available. For your security, please update to the latest version.', 'View Update', 'Go Back')">
<div class="release ng-hide" ng-show="newRelease" ng-click="openExternalLink('https://github.com/bitpay/copay/releases/latest', true, 'Update Available', 'An update to this app is available. For your security, please update to the latest version.', 'View Update', 'Go Back')">
<span translate>An update to this app is available</span><span><i class="icon bp-arrow-right"></i></span>
</div>
<div class="list card">
<div class="list card ng-hide" ng-show="!hideRateCard">
<div class="item item-icon-right item-heading">
<span translate>How do you like BitPay Wallet?</span>
<a><i class="icon ion-ios-close-empty close-home-tip"></i></a>
<a ng-click="hideCard()" ><i class="icon ion-ios-close-empty close-home-tip"></i></a>
</div>
<div class="starts item item-sub">
<button class="button icon ion-android-star" ng-click="setScore(1)" ng-class="{'gold': 1 <= score, 'grey': 1 > score}"></button>