update texts, add updateAll upon glidera TX

This commit is contained in:
Matias Alejo Garcia 2015-09-09 10:39:35 -03:00
commit f562f58afc
5 changed files with 73 additions and 56 deletions

View file

@ -20,7 +20,7 @@
</div> </div>
</div> </div>
<div ng-show="index.glideraLimits"> <div ng-show="index.glideraLimits && !buy.show2faCodeInput && !buy.success">
<h4 class="title m0"> <h4 class="title m0">
<div class="left"> <div class="left">
<i class="fi-info size-24 m10r"></i> <i class="fi-info size-24 m10r"></i>
@ -67,10 +67,14 @@
<div class="text-center text-gray size-12 m20b" ng-show="buy.buyPrice.qty"> <div class="text-center text-gray size-12 m20b" ng-show="buy.buyPrice.qty">
Buy Buy
<span ng-show="qty">${{buy.buyPrice.subtotal}} {{buy.buyPrice.currency}} in Bitcoin</span> <span ng-show="qty">{{buy.buyPrice.currency}} {{buy.buyPrice.subtotal}} in Bitcoin</span>
<span ng-show="fiat">{{buy.buyPrice.qty}} BTC</span> <span ng-show="fiat">{{buy.buyPrice.qty}} BTC</span>
at ${{buy.buyPrice.price}} {{buy.buyPrice.currency}} at {{buy.buyPrice.price}} {{buy.buyPrice.currency}}/BTC
</div> </div>
<div class="text-center text-gray size-12 m20b" ng-show="!buy.buyPrice.qty" translate>
(Enter the amount to get the exchange rate)
</div>
<input class="button black expand round" <input class="button black expand round"
ng-style="{'background-color':index.backgroundColor}" ng-style="{'background-color':index.backgroundColor}"
@ -80,21 +84,23 @@
</form> </form>
</div> </div>
<div ng-show="buy.show2faCodeInput && !buy.success"> <div ng-show="buy.show2faCodeInput && !buy.success">
<p class="text-gray" translate> <div class="m10t text-center" translate>
${{buy.buyPrice.price}} {{buy.buyPrice.currency}} will be immediately withdrawn from your {{buy.buyPrice.currency}} {{buy.buyPrice.subtotal}} &rarr; {{buy.buyPrice.qty}} BTC
bank account. The total of {{buy.buyPrice.qty}} BTC will be purchased and deposited to your bitcoin wallet ({{index.walletName}}) in 2-4 business days. <p class="m20t" translate>
</p> A SMS containing a confirmation code was sent to your phone. <br>
<p class="text-gray" translate> Please, enter the code below
A SMS containing a confirmation code was sent to your phone. Please, enter code below </p>
</p> <form name="buyForm"
<form name="buyForm" ng-submit="buy.sendRequest(index.glideraToken, index.glideraPermissions, twoFaCode)" novalidate>
ng-submit="buy.sendRequest(index.glideraToken, index.glideraPermissions, twoFaCode)" novalidate> <input type="number" ng-model="twoFaCode" required>
<label translate>Glidera 2FA Code</label> <input class="button black expand round"
<input type="number" ng-model="twoFaCode" required> ng-style="{'background-color':index.backgroundColor}"
<input class="button black expand round" type="submit" value="{{'Buy'|translate}}" ng-disabled="buyForm.$invalid || buy.loading">
ng-style="{'background-color':index.backgroundColor}" </form>
type="submit" value="{{'Buy'|translate}}" ng-disabled="buyForm.$invalid || buy.loading"> <p class="m10t size-12 text-gray" translate>
</form> Fiat will be immediately withdrawn from your bank account. The bitcoins will be purchased and deposited to your bitcoin wallet ({{index.walletName}}) in 2-4 business days.
</p>
</div>
</div> </div>
<div class="box-notification" ng-show="buy.error && !buy.success"> <div class="box-notification" ng-show="buy.error && !buy.success">
<span class="text-warning size-14"> <span class="text-warning size-14">

View file

@ -20,7 +20,7 @@
</div> </div>
</div> </div>
<div ng-show="index.glideraLimits"> <div ng-show="index.glideraLimits && !sell.show2faCodeInput && !sell.success">
<h4 class="title m0"> <h4 class="title m0">
<div class="left"> <div class="left">
<i class="fi-info size-24 m10r"></i> <i class="fi-info size-24 m10r"></i>
@ -28,11 +28,11 @@
<div class="size-10"> <div class="size-10">
<span class="text-light" translate>Daily sell limit</span>: <span class="text-light" translate>Daily sell limit</span>:
${{index.glideraLimits.dailySell}} ${{index.glideraLimits.dailySell}}
(remaining ${{index.glideraLimits.dailySellRemaining}}) (${{index.glideraLimits.dailySellRemaining}} remaining)
<br> <br>
<span class="text-light" translate>Monthly sell limit</span>: <span class="text-light" translate>Monthly sell limit</span>:
${{index.glideraLimits.monthlySell}} ${{index.glideraLimits.monthlySell}}
(remaining ${{index.glideraLimits.monthlySellRemaining}}) (${{index.glideraLimits.monthlySellRemaining}} remaining)
</div> </div>
</h4> </h4>
</div> </div>
@ -67,11 +67,14 @@
<div class="text-center text-gray size-12 m20b" ng-show="sell.sellPrice.qty"> <div class="text-center text-gray size-12 m20b" ng-show="sell.sellPrice.qty">
Sell Sell
<span ng-show="qty">${{sell.sellPrice.subtotal}} {{sell.sellPrice.currency}} in Bitcoin</span> <span ng-show="qty"> {{sell.sellPrice.currency}} {{sell.sellPrice.subtotal}} in Bitcoin</span>
<span ng-show="fiat">{{sell.sellPrice.qty}} BTC</span> <span ng-show="fiat">{{sell.sellPrice.qty}} BTC</span>
at ${{sell.sellPrice.price}} {{sell.sellPrice.currency}} at {{sell.sellPrice.price}} {{sell.sellPrice.currency}}/BTC
</div>
</div>
<div class="text-center text-gray size-12 m20b" ng-show="!sell.sellPrice.qty" translate>
(Enter the amount to get the exchange rate)
</div>
<input class="button black expand round" <input class="button black expand round"
ng-style="{'background-color':index.backgroundColor}" ng-style="{'background-color':index.backgroundColor}"
type="submit" value="{{'Continue'|translate}}" type="submit" value="{{'Continue'|translate}}"
@ -80,20 +83,23 @@
</form> </form>
</div> </div>
<div ng-show="sell.show2faCodeInput && !sell.success"> <div ng-show="sell.show2faCodeInput && !sell.success">
<p class="text-gray" translate> <div class="m10t text-center" translate>
{{sell.sellPrice.qty}} BTC will be immediately sent from your wallet to Glidera. The total of ${{sell.sellPrice.subtotal}} {{sell.sellPrice.currency}} will be deposited in your bank account in 4-6 business days. {{sell.sellPrice.qty}} BTC &rarr; {{sell.sellPrice.currency}} {{sell.sellPrice.subtotal}}
</p> <p class="m20t" translate>
<p class="text-gray" translate> A SMS containing a confirmation code was sent to your phone. <br>
A SMS containing a confirmation code was sent to your phone. Please, enter code below Please, enter the code below
</p> </p>
<form name="sellForm" <form name="sellForm"
ng-submit="sell.createTx(index.glideraToken, index.glideraPermissions, twoFaCode)" novalidate> ng-submit="sell.createTx(index.glideraToken, index.glideraPermissions, twoFaCode)" novalidate>
<label translate>Glidera 2FA Code</label> <input type="number" ng-model="twoFaCode" required>
<input type="number" ng-model="twoFaCode" required> <input class="button black expand round"
<input class="button black expand round" ng-style="{'background-color':index.backgroundColor}"
ng-style="{'background-color':index.backgroundColor}" type="submit" value="{{'Sell'|translate}}" ng-disabled="sellForm.$invalid || sell.loading">
type="submit" value="{{'Sell'|translate}}" ng-disabled="sellForm.$invalid || sell.loading"> </form>
</form> <p class="m10t size-12 text-gray" translate>
Bitcoins will be immediately sent from your wallet to Glidera. Fiat will be deposited in your bank account in 4-6 business days.
</p>
</div>
</div> </div>
<div class="box-notification" ng-show="sell.error && !sell.success"> <div class="box-notification" ng-show="sell.error && !sell.success">
<span class="text-warning size-14"> <span class="text-warning size-14">
@ -109,7 +115,6 @@
<button class="outline dark-gray round expand" <button class="outline dark-gray round expand"
ng-click="$root.go('glidera')">OK</button> ng-click="$root.go('glidera')">OK</button>
</div> </div>
</div>
</div> </div>
</div> </div>
<div class="extra-margin-bottom"></div> <div class="extra-margin-bottom"></div>

View file

@ -69,7 +69,7 @@ angular.module('copayApp.controllers').controller('buyGlideraController',
} }
else { else {
self.success = data; self.success = data;
$scope.$emit('Local/GlideraUpdated', token, permissions); $scope.$emit('Local/GlideraTx');
} }
}); });
}, 100); }, 100);

View file

@ -863,15 +863,19 @@ console.log('[index.js:395]',txps); //TODO
else { else {
self.glideraToken = accessToken; self.glideraToken = accessToken;
self.glideraPermissions = p; self.glideraPermissions = p;
self.updateGlidera(accessToken, p); self.updateGlidera({ fullUpdate: true});
} }
}); });
} }
}); });
}; };
self.updateGlidera = function(accessToken, permissions) { self.updateGlidera = function(opts) {
if (!accessToken || !permissions) return; if (!self.glideraToken || !self.glideraPermissions) return;
var accessToken = self.glideraToken;
var permissions = self.glideraPermissions;
opts = opts || {};
glideraService.getStatus(accessToken, function(err, data) { glideraService.getStatus(accessToken, function(err, data) {
self.glideraStatus = data; self.glideraStatus = data;
@ -881,20 +885,6 @@ console.log('[index.js:395]',txps); //TODO
self.glideraLimits = limits; self.glideraLimits = limits;
}); });
if (permissions.view_email_address) {
self.glideraLoadingEmail = gettext('Getting Glidera Email...');
glideraService.getEmail(accessToken, function(err, data) {
self.glideraLoadingEmail = null;
self.glideraEmail = data.email;
});
}
if (permissions.personal_info) {
self.glideraLoadingPersonalInfo = gettext('Getting Glidera Personal Information...');
glideraService.getPersonalInfo(accessToken, function(err, data) {
self.glideraLoadingPersonalInfo = null;
self.glideraPersonalInfo = data;
});
}
if (permissions.transaction_history) { if (permissions.transaction_history) {
self.glideraLoadingHistory = gettext('Getting Glidera transactions...'); self.glideraLoadingHistory = gettext('Getting Glidera transactions...');
glideraService.getTransactions(accessToken, function(err, data) { glideraService.getTransactions(accessToken, function(err, data) {
@ -902,6 +892,22 @@ console.log('[index.js:395]',txps); //TODO
self.glideraTxs = data; self.glideraTxs = data;
}); });
} }
if (permissions.view_email_address && opts.fullUpdate) {
self.glideraLoadingEmail = gettext('Getting Glidera Email...');
glideraService.getEmail(accessToken, function(err, data) {
self.glideraLoadingEmail = null;
self.glideraEmail = data.email;
});
}
if (permissions.personal_info && opts.fullUpdate) {
self.glideraLoadingPersonalInfo = gettext('Getting Glidera Personal Information...');
glideraService.getPersonalInfo(accessToken, function(err, data) {
self.glideraLoadingPersonalInfo = null;
self.glideraPersonalInfo = data;
});
}
}; };
// UX event handlers // UX event handlers
@ -957,8 +963,8 @@ console.log('[index.js:395]',txps); //TODO
self.initGlidera(accessToken); self.initGlidera(accessToken);
}); });
$rootScope.$on('Local/GlideraUpdated', function(event, accessToken, permissions) { $rootScope.$on('Local/GlideraTx', function(event, accessToken, permissions) {
self.updateGlidera(accessToken, permissions); self.updateGlidera();
}); });
$rootScope.$on('Local/GlideraError', function(event) { $rootScope.$on('Local/GlideraError', function(event) {
@ -1063,7 +1069,7 @@ console.log('[index.js:395]',txps); //TODO
}); });
lodash.each(['NewTxProposal', 'TxProposalFinallyRejected', 'TxProposalRemoved', lodash.each(['NewTxProposal', 'TxProposalFinallyRejected', 'TxProposalRemoved',
'Local/NewTxProposal', 'Local/TxProposalAction', 'ScanFinished' 'Local/NewTxProposal', 'Local/TxProposalAction', 'ScanFinished', 'Local/GlideraTx'
], function(eventName) { ], function(eventName) {
$rootScope.$on(eventName, function(event, untilItChanges) { $rootScope.$on(eventName, function(event, untilItChanges) {
self.updateAll({ self.updateAll({

View file

@ -121,7 +121,7 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
} }
else { else {
self.success = data; self.success = data;
$scope.$emit('Local/GlideraUpdated', token, permissions); $scope.$emit('Local/GlideraTx');
} }
}); });
} }