Merge pull request #3276 from cmgustavo/glidera/disclosure-disable-sandbox

Adds btc values. Adds disclosure. Fix modals. Removes sandbox
This commit is contained in:
Matias Alejo Garcia 2015-10-05 15:43:09 -03:00
commit e9e20e1503
10 changed files with 105 additions and 31 deletions

View file

@ -58,11 +58,21 @@
<div class="text-center m20v">
<img src="img/glidera-logo.png" ng-click="index.updateGlidera(index.glideraToken, index.glideraPermissions)" width="200">
</div>
<div class="text-center small-10 small-centered columns" ng-show="!showOauthForm">
<div class="text-center small-10 small-centered columns" ng-show="!showOauthForm">
<p class="m10b">You can buy and sell Bitcoin with a US bank account directly in Copay.</p>
<p class="text-gray size-12">Connect your Glidera account to get started</p>
<a class="button m20t light-gray outline round small"
<p class="m20t text-gray size-12 text-left">
DISCLOSURE.<br>
Glidera Inc. (Glidera) is providing the service of buying or selling bitcoins to Copay users. To enable this
service, Glidera has registered with US Treasury Departments FinCEN as a Money Service Business
(#31000042625755). Users of Copay must agree to the service agreement presented by Glidera prior to obtaining
Glideras service of buying or selling bitcoins. Service available in U.S. only; (buy & sell) CA, GA, IL, KS,
MA, MD, MO, MT, MN, SC, TX; (buy only) AZ, CO, DE, ME, NJ, PA, TN, UT.
</p>
<p class="m20t text-gray size-12">Connect your Glidera account to get started</p>
<a class="button light-gray outline round small"
ng-click="$root.openExternalLink(glidera.getAuthenticateUrl(), '_system'); showOauthForm = true">
Connect to Glidera
</a>
@ -175,6 +185,11 @@
</div>
<div class="large-4 medium-4 small-4 columns">
<div class="size-14">
<span ng-show="tx.type == 'BUY'">Bought</span>
<span ng-show="tx.type == 'SELL'">Sold</span>
<b>{{tx.qty}}</b> BTC
</div>
<span class="size-14 text-bold">
{{tx.subtotal|currency:'':2}} {{tx.currency}}
</span>

View file

@ -26,7 +26,6 @@
<div translate>Create, join or import</div>
</a>
</li>
<!-- // DISABLED
<li ng-show="index.glideraEnabled">
<a ng-click="$root.go('glidera')" class="oh">
<i class="icon-arrow-right3 size-18 right m10t"></i>
@ -37,6 +36,5 @@
<div>Glidera</div>
</a>
</li>
-->
</ul>
</nav>

View file

@ -22,6 +22,7 @@
</div>
<span ng-show="tx.type == 'BUY'">Bought</span>
<span ng-show="tx.type == 'SELL'">Sold</span>
<b>{{tx.qty}}</b> BTC
<div class="size-36 m20b">
{{tx.subtotal|currency:'':2}} {{tx.currency}}
</div>

View file

@ -0,0 +1,40 @@
<nav class="tab-bar">
<section class="left-small">
<a ng-click="cancel()" class="p10">
<span class="text-close" translate>Close</span>
</a>
</section>
<section class="middle tab-bar-section">
<h1 class="title ellipsis">
<span ng-show="type == 'BUY'">Choose your destination wallet</span>
<span ng-show="type == 'SELL'">Choose your source wallet</span>
</h1>
</section>
</nav>
<div class="modal-content">
<div ng-show="type == 'SELL'">
<h4 class="title m0 oh">
<div class="left">
<i class="fi-info size-18 m10r"></i>
</div>
<div class="size-10 m5t">
Notice: only 1-1 (single signature) wallets can be used for sell bitcoin
</div>
</h4>
</div>
<ul class="no-bullet">
<li class="line-b" ng-repeat="w in wallets">
<a ng-click="selectWallet(w.id, w.name)" class="db oh">
<div class="avatar-wallet"
ng-style="{'background-color':w.color}">{{(w.name || w.id) | limitTo: 1}}</div>
<div class="ellipsis name-wallet text-bold">{{w.name || w.id}}</div>
<div class="size-12">{{w.m}} of {{w.n}}
<span ng-show="w.network=='testnet'">[Testnet]</span>
</div>
</a>
</li>
</ul>
<div class="extra-margin-bottom"></div>
</div>

View file

@ -105,11 +105,11 @@
</span>
</li>
<!-- // DISABLED
<li class="line-b p20" ng-show="!index.noFocusedWallet">
<span>Enable Glidera Service</span>
<switch id="glidera-enabled" name="glideraEnabled" ng-model="glideraEnabled" class="green right"></switch>
</li>
<!-- Disabled for testnet
<li class="line-b p20" ng-show="!index.noFocusedWallet && glideraEnabled">
<span>Glidera Sandbox</span>
<switch id="glidera-testnet" name="glideraTestnet" ng-model="glideraTestnet" class="green right"></switch>

View file

@ -51,12 +51,12 @@
ng-submit="sell.get2faCode(index.glideraToken)" novalidate>
<div ng-if="index.glideraToken"
ng-init="otherWallets = sell.otherWallets(index.glideraTestnet)"
ng-click="openWalletsModal(otherWallets)">
ng-init="sell.init(index.glideraTestnet)"
ng-click="openWalletsModal(sell.otherWallets)">
<label>Wallet</label>
<div class="input">
<input type="text" id="address" name="address" ng-disabled="sell.selectedWalletId"
ng-attr-placeholder="{{'Choose your destination wallet'}}"
ng-attr-placeholder="{{'Choose your source wallet'}}"
ng-model="sell.selectedWalletName" required>
<a class="postfix size-12 m0 text-gray">
<i class="icon-wallet size-18"></i>

View file

@ -22,6 +22,7 @@ angular.module('copayApp.controllers').controller('buyGlideraController',
self.selectedWalletName = null;
self.selectedWalletAddr = null;
var ModalInstanceCtrl = function($scope, $modalInstance) {
$scope.type = 'BUY';
$scope.wallets = wallets;
$scope.cancel = function() {
$modalInstance.dismiss('cancel');
@ -49,7 +50,7 @@ angular.module('copayApp.controllers').controller('buyGlideraController',
};
var modalInstance = $modal.open({
templateUrl: 'views/modals/wallets.html',
templateUrl: 'views/modals/glidera-wallets.html',
windowClass: animationService.modalAnimated.slideUp,
controller: ModalInstanceCtrl,
});

View file

@ -1,9 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('glideraController',
function($scope, $timeout, $modal, profileService, configService, storageService, glideraService, isChromeApp) {
var config = configService.getSync().wallet.settings;
function($scope, $timeout, $modal, profileService, configService, storageService, glideraService, isChromeApp, animationService) {
this.getAuthenticateUrl = function() {
return glideraService.getOauthCodeUrl();
@ -35,16 +33,9 @@ angular.module('copayApp.controllers').controller('glideraController',
}, 100);
};
// DISABLE ANIMATION ON CHROMEAPP
if (isChromeApp) {
var animatedSlideRight = 'full';
}
else {
var animatedSlideRight = 'full animated slideInRight';
}
this.openTxModal = function(token, tx) {
var self = this;
var config = configService.getSync().wallet.settings;
var fc = profileService.focusedClient;
var ModalInstanceCtrl = function($scope, $modalInstance) {
$scope.tx = tx;
@ -63,13 +54,13 @@ angular.module('copayApp.controllers').controller('glideraController',
var modalInstance = $modal.open({
templateUrl: 'views/modals/glidera-tx-details.html',
windowClass: animatedSlideRight,
windowClass: animationService.modalAnimated.slideRight,
controller: ModalInstanceCtrl,
});
modalInstance.result.finally(function() {
var m = angular.element(document.getElementsByClassName('reveal-modal'));
m.addClass('slideOutRight');
m.addClass(animationService.modalAnimated.slideOutRight);
});
};

View file

@ -110,8 +110,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.updateColor();
self.updateAlias();
// DISABLED
//self.initGlidera();
self.initGlidera();
if (fc.isPrivKeyExternal()) {
self.needsBackup = false;
@ -840,8 +839,11 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.initGlidera = function(accessToken) {
self.glideraEnabled = configService.getSync().glidera.enabled;
self.glideraTestnet = configService.getSync().glidera.testnet;
var network = self.glideraTestnet ? 'testnet' : 'livenet';
// self.glideraTestnet = configService.getSync().glidera.testnet;
// var network = self.glideraTestnet ? 'testnet' : 'livenet';
// Disabled for testnet
self.glideraTestnet = false;
var network = 'livenet';
self.glideraToken = null;
self.glideraError = null;
@ -851,7 +853,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.glideraTxs = null;
self.glideraStatus = null;
if (!self.glideraEnabled || self.isShared) return;
if (!self.glideraEnabled) return;
glideraService.setCredentials(network);
@ -1062,6 +1064,11 @@ angular.module('copayApp.controllers').controller('indexController', function($r
$rootScope.$on('NewBlock', function() {
if (self.glideraEnabled) {
$timeout(function() {
self.updateGlidera();
});
}
if (self.pendingAmount) {
self.updateAll({
walletStatus: null,
@ -1164,4 +1171,4 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.setFocusedWallet();
});
});
});
});

View file

@ -14,18 +14,39 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
this.currentFeeLevel = config.wallet.settings.feeLevel || 'normal';
var fc;
this.otherWallets = function(testnet) {
var otherWallets = function(testnet) {
var network = testnet ? 'testnet' : 'livenet';
return lodash.filter(profileService.getWallets(network), function(w) {
return w.network == network && w.m == 1;
});
};
this.init = function(testnet) {
self.otherWallets = otherWallets(testnet);
// Choose focused wallet
try {
var currentWalletId = profileService.focusedClient.credentials.walletId;
lodash.find(self.otherWallets, function(w) {
if (w.id == currentWalletId) {
$timeout(function() {
self.selectedWalletId = w.id;
self.selectedWalletName = w.name;
fc = profileService.getClient(w.id);
$scope.$apply();
}, 100);
}
});
} catch(e) {
$log.debug(e);
};
};
$scope.openWalletsModal = function(wallets) {
self.error = null;
self.selectedWalletId = null;
self.selectedWalletName = null;
var ModalInstanceCtrl = function($scope, $modalInstance) {
$scope.type = 'SELL';
$scope.wallets = wallets;
$scope.cancel = function() {
$modalInstance.dismiss('cancel');
@ -45,7 +66,7 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
};
var modalInstance = $modal.open({
templateUrl: 'views/modals/wallets.html',
templateUrl: 'views/modals/glidera-wallets.html',
windowClass: animationService.modalAnimated.slideUp,
controller: ModalInstanceCtrl,
});