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 ng-show="index.glideraLimits">
<div ng-show="index.glideraLimits && !buy.show2faCodeInput && !buy.success">
<h4 class="title m0">
<div class="left">
<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">
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>
at ${{buy.buyPrice.price}} {{buy.buyPrice.currency}}
at {{buy.buyPrice.price}} {{buy.buyPrice.currency}}/BTC
</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"
ng-style="{'background-color':index.backgroundColor}"
@ -80,21 +84,23 @@
</form>
</div>
<div ng-show="buy.show2faCodeInput && !buy.success">
<p class="text-gray" translate>
${{buy.buyPrice.price}} {{buy.buyPrice.currency}} will be immediately withdrawn from your
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>
<p class="text-gray" translate>
A SMS containing a confirmation code was sent to your phone. Please, enter code below
</p>
<form name="buyForm"
ng-submit="buy.sendRequest(index.glideraToken, index.glideraPermissions, twoFaCode)" novalidate>
<label translate>Glidera 2FA Code</label>
<input type="number" ng-model="twoFaCode" required>
<input class="button black expand round"
ng-style="{'background-color':index.backgroundColor}"
type="submit" value="{{'Buy'|translate}}" ng-disabled="buyForm.$invalid || buy.loading">
</form>
<div class="m10t text-center" translate>
{{buy.buyPrice.currency}} {{buy.buyPrice.subtotal}} &rarr; {{buy.buyPrice.qty}} BTC
<p class="m20t" translate>
A SMS containing a confirmation code was sent to your phone. <br>
Please, enter the code below
</p>
<form name="buyForm"
ng-submit="buy.sendRequest(index.glideraToken, index.glideraPermissions, twoFaCode)" novalidate>
<input type="number" ng-model="twoFaCode" required>
<input class="button black expand round"
ng-style="{'background-color':index.backgroundColor}"
type="submit" value="{{'Buy'|translate}}" ng-disabled="buyForm.$invalid || buy.loading">
</form>
<p class="m10t size-12 text-gray" translate>
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 class="box-notification" ng-show="buy.error && !buy.success">
<span class="text-warning size-14">

View file

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

View file

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

View file

@ -863,15 +863,19 @@ console.log('[index.js:395]',txps); //TODO
else {
self.glideraToken = accessToken;
self.glideraPermissions = p;
self.updateGlidera(accessToken, p);
self.updateGlidera({ fullUpdate: true});
}
});
}
});
};
self.updateGlidera = function(accessToken, permissions) {
if (!accessToken || !permissions) return;
self.updateGlidera = function(opts) {
if (!self.glideraToken || !self.glideraPermissions) return;
var accessToken = self.glideraToken;
var permissions = self.glideraPermissions;
opts = opts || {};
glideraService.getStatus(accessToken, function(err, data) {
self.glideraStatus = data;
@ -880,21 +884,7 @@ console.log('[index.js:395]',txps); //TODO
glideraService.getLimits(accessToken, function(err, 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) {
self.glideraLoadingHistory = gettext('Getting Glidera transactions...');
glideraService.getTransactions(accessToken, function(err, data) {
@ -902,6 +892,22 @@ console.log('[index.js:395]',txps); //TODO
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
@ -957,8 +963,8 @@ console.log('[index.js:395]',txps); //TODO
self.initGlidera(accessToken);
});
$rootScope.$on('Local/GlideraUpdated', function(event, accessToken, permissions) {
self.updateGlidera(accessToken, permissions);
$rootScope.$on('Local/GlideraTx', function(event, accessToken, permissions) {
self.updateGlidera();
});
$rootScope.$on('Local/GlideraError', function(event) {
@ -1063,7 +1069,7 @@ console.log('[index.js:395]',txps); //TODO
});
lodash.each(['NewTxProposal', 'TxProposalFinallyRejected', 'TxProposalRemoved',
'Local/NewTxProposal', 'Local/TxProposalAction', 'ScanFinished'
'Local/NewTxProposal', 'Local/TxProposalAction', 'ScanFinished', 'Local/GlideraTx'
], function(eventName) {
$rootScope.$on(eventName, function(event, untilItChanges) {
self.updateAll({

View file

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