ionic modals in coinbase and glidera and delete confirmation

This commit is contained in:
Gabriel Bazán 2016-06-10 15:16:02 -03:00
commit d2bdca00f4
28 changed files with 566 additions and 717 deletions

View file

@ -24,7 +24,7 @@
</div>
</div>
<div class="row m20t"
<div class="row m20ti"
ng-show="index.coinbaseAccount && !buy.buyInfo && !buy.receiveInfo">
<div class="columns">
@ -105,7 +105,7 @@
</div>
</div>
<div class="m20t row" ng-show="buy.receiveInfo && !buy.sellInfo && !buy.success">
<div class="m20ti row" ng-show="buy.receiveInfo && !buy.sellInfo && !buy.success">
<div class="columns">
<h1>Funds sent to Copay Wallet</h1>
<p class="size-12 text-gray">

View file

@ -10,7 +10,7 @@
</a>
</section>
<section class="right-small">
<section class="right-small" ng-show="index.coinbaseAccount">
<a class="p10" ng-click="$root.go('preferencesCoinbase')">
<i class="fi-widget size-24"></i>
</a>

View file

@ -1,16 +1,18 @@
<div class="m20tp text-center">
<div class="row">
<h1 class="text-center m20b p20h">Are you sure you would like to log out of your Coinbase account?</h1>
<p class="text-gray p20h">You will need to log back in to buy or sell bitcoin in Copay.</p>
<div class="large-6 medium-6 small-6 columns">
<button class="button light-gray expand outline round" ng-click="cancel()">
<i class="fi-arrow-left"></i> <span class="tu">Back</span>
</button>
<ion-modal-view ng-controller="coinbaseConfirmationController">
<div class="m20tp text-center">
<div class="row">
<h1 class="text-center m20b p20h">Are you sure you would like to log out of your Coinbase account?</h1>
<p class="text-gray p20h">You will need to log back in to buy or sell bitcoin in Copay.</p>
<div class="large-6 medium-6 small-6 columns">
<button class="button light-gray expand outline round" ng-click="cancel()">
<i class="fi-arrow-left"></i> <span class="tu">Back</span>
</button>
</div>
<div class="large-6 medium-6 small-6 columns">
<button class="button warning expand round" ng-click="ok()">
<span>Log out</span>
</button>
</div>
</div>
</div>
<div class="large-6 medium-6 small-6 columns">
<button class="button warning expand round" ng-click="ok()">
<span>Log out</span>
</button>
</div>
</div>
</div>
</ion-modal-view>

View file

@ -1,107 +1,109 @@
<nav class="tab-bar">
<section class="left-small">
<a ng-click="cancel()">
<i class="icon-arrow-left3 icon-back"></i>
<span class="text-back">Back</span>
</a>
</section>
<section class="middle tab-bar-section">
<h1 class="title ellipsis">
Details
</h1>
</section>
</nav>
<ion-modal-view ng-controller="coinbaseTxDetailsController">
<nav class="tab-bar" ng-style="{'background-color': '#2b71b1'}">
<section class="left-small">
<a ng-click="cancel()">
<i class="icon-arrow-left3 icon-back"></i>
<span class="text-back">Back</span>
</a>
</section>
<section class="middle tab-bar-section">
<h1 class="title ellipsis">
Details
</h1>
</section>
</nav>
<div class="modal-content fix-modals-touch"
ng-swipe-disable-mouse
ng-swipe-right="cancel()">
<div class="header-modal bg-gray text-center">
<div class="p20">
<img src="img/bought.svg" alt="bought" width="65" ng-show="(tx.type == 'buy' || (tx.type == 'send' && tx.to)) && tx.status == 'completed'">
<img src="img/bought-pending.svg" alt="bought" width="65"
ng-show="(tx.type == 'buy' || (tx.type == 'send' && tx.to)) && tx.status != 'completed'">
<img src="img/sold.svg" alt="bought" width="65" ng-show="tx.type == 'sell' && tx.status == 'completed'">
<img src="img/sold-pending.svg" alt="bought" width="65"
ng-show="(tx.type == 'sell' || (tx.type == 'send' && tx.from)) && tx.status != 'completed'">
<ion-content overflow-scroll="true">
<div class="modal-content fix-modals-touch">
<div class="header-modal bg-gray text-center">
<div class="p20">
<img src="img/bought.svg" alt="bought" width="65" ng-show="(tx.type == 'buy' || (tx.type == 'send' && tx.to)) && tx.status == 'completed'">
<img src="img/bought-pending.svg" alt="bought" width="65"
ng-show="(tx.type == 'buy' || (tx.type == 'send' && tx.to)) && tx.status != 'completed'">
<img src="img/sold.svg" alt="bought" width="65" ng-show="tx.type == 'sell' && tx.status == 'completed'">
<img src="img/sold-pending.svg" alt="bought" width="65"
ng-show="(tx.type == 'sell' || (tx.type == 'send' && tx.from)) && tx.status != 'completed'">
</div>
<div ng-show="tx.status == 'completed'">
<span ng-show="tx.type == 'buy' || tx.type == 'send'">Bought</span>
<span ng-show="tx.type == 'sell'">Sold</span>
</div>
<div ng-show="tx.type == 'send' && (tx.to || tx.from) && tx.status != 'completed'">
<span ng-show="tx.to">Receiving purchased bitcoin</span>
<span ng-show="tx.from">Sending bitcoin to sell</span>
</div>
<div ng-show="(tx.type == 'sell' || tx.type == 'buy') && tx.status != 'completed'">
<span ng-show="tx.type == 'buy'">Buying bitcoin</span>
<span ng-show="tx.type == 'sell'">Selling bitcoin</span>
</div>
<div class="size-24 text-bold">
<span ng-if="tx.type == 'sell' || (tx.type == 'send' && tx.from)">-</span>{{tx.amount.amount.replace('-','')}}
{{tx.amount.currency}}
</div>
<div class="label gray radius m10b">
<span ng-if="tx.type == 'sell' || (tx.type == 'send' && tx.from)">-</span>{{tx.native_amount.amount.replace('-','')}}
{{tx.native_amount.currency}}
</div>
</div>
<div class="m20b box-notification" ng-show="tx.error">
<ul class="no-bullet m0 text-warning size-12">
<li ng-repeat="err in tx.error.errors" ng-bind-html="err.message"></li>
</ul>
</div>
<ul class="no-bullet size-14">
<li ng-show="tx.details && tx.status != 'pending'" class="line-b p10 oh">
<span class="text-gray">{{tx.details.title}}</span>
<span class="right">{{tx.details.subtitle}}</span>
</li>
<li class="line-b p10 oh">
<span class="text-gray">Status</span>
<span class="text-success right" ng-if="tx.status == 'completed'">Completed</span>
<span class="text-info right" ng-if="tx.status == 'pending'">Pending</span>
<span class="text-warning right" ng-if="tx.status == 'error'">Error</span>
</li>
<li ng-show="tx.created_at" class="line-b p10 oh">
<span class="text-gray">Date</span>
<span class="right">{{tx.created_at | amCalendar}}</span>
</li>
<li ng-show="tx.price_sensitivity" class="line-b p10 oh">
<span class="text-gray">Price Sensitivity</span>
<span class="right">{{tx.price_sensitivity.name}}</span>
</li>
<li ng-show="tx.sell_price_amount" class="line-b p10 oh">
<span class="text-gray">Sell Price</span>
<span class="right">{{tx.sell_price_amount}} {{tx.sell_price_currency}}</span>
</li>
<li ng-show="tx.description" class="line-b p10 oh">
<span class="text-gray" ng-show="tx.from && tx.type == 'send'">Sent bitcoin from</span>
<span class="text-gray" ng-show="tx.to && tx.type == 'send'">Receive bitcoin in</span>
<span class="right text-bold">{{tx.description}}</span>
</li>
</ul>
<div class="row m20t p20t line-t" ng-show="tx.status == 'error'">
<div class="columns">
<p class="text-center size-12 text-gray">
This action will remove the transaction.
</p>
<button class="button outline round dark-gray expand tiny"
ng-click="remove();"
ng-disabled="loading">
<i class="fi-x"></i>
Remove
</button>
</div>
</div>
<div class="extra-margin-bottom"></div>
</div>
<div ng-show="tx.status == 'completed'">
<span ng-show="tx.type == 'buy' || tx.type == 'send'">Bought</span>
<span ng-show="tx.type == 'sell'">Sold</span>
</div>
<div ng-show="tx.type == 'send' && (tx.to || tx.from) && tx.status != 'completed'">
<span ng-show="tx.to">Receiving purchased bitcoin</span>
<span ng-show="tx.from">Sending bitcoin to sell</span>
</div>
<div ng-show="(tx.type == 'sell' || tx.type == 'buy') && tx.status != 'completed'">
<span ng-show="tx.type == 'buy'">Buying bitcoin</span>
<span ng-show="tx.type == 'sell'">Selling bitcoin</span>
</div>
<div class="size-24 text-bold">
<span ng-if="tx.type == 'sell' || (tx.type == 'send' && tx.from)">-</span>{{tx.amount.amount.replace('-','')}}
{{tx.amount.currency}}
</div>
<div class="label gray radius m10b">
<span ng-if="tx.type == 'sell' || (tx.type == 'send' && tx.from)">-</span>{{tx.native_amount.amount.replace('-','')}}
{{tx.native_amount.currency}}
</div>
</div>
<div class="m20b box-notification" ng-show="tx.error">
<ul class="no-bullet m0 text-warning size-12">
<li ng-repeat="err in tx.error.errors" ng-bind-html="err.message"></li>
</ul>
</div>
<ul class="no-bullet size-14">
<li ng-show="tx.details && tx.status != 'pending'" class="line-b p10 oh">
<span class="text-gray">{{tx.details.title}}</span>
<span class="right">{{tx.details.subtitle}}</span>
</li>
<li class="line-b p10 oh">
<span class="text-gray">Status</span>
<span class="text-success right" ng-if="tx.status == 'completed'">Completed</span>
<span class="text-info right" ng-if="tx.status == 'pending'">Pending</span>
<span class="text-warning right" ng-if="tx.status == 'error'">Error</span>
</li>
<li ng-show="tx.created_at" class="line-b p10 oh">
<span class="text-gray">Date</span>
<span class="right">{{tx.created_at | amCalendar}}</span>
</li>
<li ng-show="tx.price_sensitivity" class="line-b p10 oh">
<span class="text-gray">Price Sensitivity</span>
<span class="right">{{tx.price_sensitivity.name}}</span>
</li>
<li ng-show="tx.sell_price_amount" class="line-b p10 oh">
<span class="text-gray">Sell Price</span>
<span class="right">{{tx.sell_price_amount}} {{tx.sell_price_currency}}</span>
</li>
<li ng-show="tx.description" class="line-b p10 oh">
<span class="text-gray" ng-show="tx.from && tx.type == 'send'">Sent bitcoin from</span>
<span class="text-gray" ng-show="tx.to && tx.type == 'send'">Receive bitcoin in</span>
<span class="right text-bold">{{tx.description}}</span>
</li>
</ul>
<div class="row m20t p20t line-t" ng-show="tx.status == 'error'">
<div class="columns">
<p class="text-center size-12 text-gray">
This action will remove the transaction.
</p>
<button class="button outline round dark-gray expand tiny"
ng-click="remove(tx);"
ng-disabled="loading">
<i class="fi-x"></i>
Remove
</button>
</div>
</div>
<div class="extra-margin-bottom"></div>
</div>
</ion-content>
</ion-modal-view>

View file

@ -1,16 +1,18 @@
<div class="m20tp text-center">
<div class="row">
<h1 class="text-center m20b p20">{{title|translate}}</h1>
<div class="large-6 medium-6 small-6 columns">
<button class="button warning expand round" ng-disabled="loading" ng-click="ok()">
<i class="fi-trash"></i> <span translate>Yes</span>
</button>
<ion-modal-view ng-controller="confirmationController">
<div class="m20tp text-center">
<div class="row">
<h1 class="text-center m20b p20">{{title|translate}}</h1>
<div class="large-6 medium-6 small-6 columns">
<button class="button warning expand round" ng-disabled="loading" ng-click="ok()">
<i class="fi-trash"></i> <span translate>Yes</span>
</button>
</div>
<div class="large-6 medium-6 small-6 columns">
<button class="button light-gray expand outline round" ng-disabled="loading"
ng-click="cancel()">
<i class="fi-x"></i> <span class="tu" translate>Cancel</span>
</button>
</div>
</div>
<div class="large-6 medium-6 small-6 columns">
<button class="button light-gray expand outline round" ng-disabled="loading"
ng-click="cancel()">
<i class="fi-x"></i> <span class="tu" translate>Cancel</span>
</button>
</div>
</div>
</div>
</ion-modal-view>

View file

@ -1,16 +1,18 @@
<div class="m20tp text-center">
<div class="row">
<h1 class="text-center m20b p20h">Are you sure you would like to log out of your Glidera account?</h1>
<p class="text-gray p20h">You will need to log back in to buy or sell bitcoin in Copay.</p>
<div class="large-6 medium-6 small-6 columns">
<button class="button light-gray expand outline round" ng-click="cancel()">
<i class="fi-arrow-left"></i> <span class="tu">Back</span>
</button>
<ion-modal-view ng-controller="glideraConfirmationController">
<div class="m20tp text-center">
<div class="row">
<h1 class="text-center m20b p20h">Are you sure you would like to log out of your Glidera account?</h1>
<p class="text-gray p20h">You will need to log back in to buy or sell bitcoin in Copay.</p>
<div class="large-6 medium-6 small-6 columns">
<button class="button light-gray expand outline round" ng-click="cancel()">
<i class="fi-arrow-left"></i> <span class="tu">Back</span>
</button>
</div>
<div class="large-6 medium-6 small-6 columns">
<button class="button warning expand round" ng-click="ok()">
<span>Log out</span>
</button>
</div>
</div>
</div>
<div class="large-6 medium-6 small-6 columns">
<button class="button warning expand round" ng-click="ok()">
<span>Log out</span>
</button>
</div>
</div>
</div>
</ion-modal-view>

View file

@ -1,68 +1,70 @@
<nav class="tab-bar">
<section class="left-small">
<a ng-click="cancel()">
<i class="icon-arrow-left3 icon-back"></i>
<span class="text-back">Back</span>
</a>
</section>
<section class="middle tab-bar-section">
<h1 class="title ellipsis">
Details
</h1>
</section>
</nav>
<ion-modal-view ng-controller="glideraTxDetailsController">
<nav class="tab-bar">
<section class="left-small">
<a ng-click="cancel()">
<i class="icon-arrow-left3 icon-back"></i>
<span class="text-back">Back</span>
</a>
</section>
<section class="middle tab-bar-section">
<h1 class="title ellipsis">
Details
</h1>
</section>
</nav>
<div class="modal-content fix-modals-touch"
ng-swipe-disable-mouse
ng-swipe-right="cancel()">
<div class="header-modal bg-gray text-center">
<div class="p20">
<img src="img/bought.svg" alt="bought" width="80" ng-show="tx.type == 'BUY' && tx.status == 'COMPLETE'">
<img src="img/bought-pending.svg" alt="bought" width="65" ng-show="tx.type == 'BUY' && tx.status == 'PROCESSING'">
<img src="img/sold.svg" alt="bought" width="80" ng-show="tx.type == 'SELL' && tx.status == 'COMPLETE'">
<img src="img/sold-pending.svg" alt="bought" width="65" ng-show="tx.type == 'SELL' && tx.status == 'PROCESSING'">
<ion-content overflow-scroll="true">
<div class="modal-content fix-modals-touch">
<div class="header-modal bg-gray text-center">
<div class="p20">
<img src="img/bought.svg" alt="bought" width="80" ng-show="tx.type == 'BUY' && tx.status == 'COMPLETE'">
<img src="img/bought-pending.svg" alt="bought" width="65" ng-show="tx.type == 'BUY' && tx.status == 'PROCESSING'">
<img src="img/sold.svg" alt="bought" width="80" ng-show="tx.type == 'SELL' && tx.status == 'COMPLETE'">
<img src="img/sold-pending.svg" alt="bought" width="65" ng-show="tx.type == 'SELL' && tx.status == 'PROCESSING'">
</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>
</div>
<ul class="no-bullet size-14">
<li class="line-b p10 oh">
<span class="text-gray">Status</span>
<span class="text-success right" ng-if="tx.status == 'COMPLETE'">Completed</span>
<span class="text-info right" ng-if="tx.status == 'PROCESSING'">Processing</span>
<span class="text-warning right" ng-if="tx.status == 'ERROR'">Error</span>
</li>
<li ng-show="tx.transactionDate" class="line-b p10 oh">
<span class="text-gray">Date</span>
<span class="right">{{tx.transactionDate | amCalendar}}</span>
</li>
<li ng-show="tx.price" class="line-b p10 oh">
<span class="text-gray">Exchange rate</span>
<span class="right">{{tx.price|currency:'':2}} {{tx.currency}}/BTC</span>
</li>
<li ng-show="tx.subtotal" class="line-b p10 oh">
<span class="text-gray">Subtotal</span>
<span class="right">{{tx.subtotal|currency:'':2}} {{tx.currency}}</span>
</li>
<li ng-show="tx.fees" class="line-b p10 oh">
<span class="text-gray">Fees</span>
<span class="right">{{tx.fees|currency:'':2}} {{tx.currency}}</span>
</li>
<li ng-show="tx.total" class="line-b p10 oh text-bold">
<span class="text-gray">Total</span>
<span class="right">{{tx.total|currency:'':2}} {{tx.currency}}</span>
</li>
</ul>
<div class="extra-margin-bottom"></div>
</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>
</div>
<ul class="no-bullet size-14">
<li class="line-b p10 oh">
<span class="text-gray">Status</span>
<span class="text-success right" ng-if="tx.status == 'COMPLETE'">Completed</span>
<span class="text-info right" ng-if="tx.status == 'PROCESSING'">Processing</span>
<span class="text-warning right" ng-if="tx.status == 'ERROR'">Error</span>
</li>
<li ng-show="tx.transactionDate" class="line-b p10 oh">
<span class="text-gray">Date</span>
<span class="right">{{tx.transactionDate | amCalendar}}</span>
</li>
<li ng-show="tx.price" class="line-b p10 oh">
<span class="text-gray">Exchange rate</span>
<span class="right">{{tx.price|currency:'':2}} {{tx.currency}}/BTC</span>
</li>
<li ng-show="tx.subtotal" class="line-b p10 oh">
<span class="text-gray">Subtotal</span>
<span class="right">{{tx.subtotal|currency:'':2}} {{tx.currency}}</span>
</li>
<li ng-show="tx.fees" class="line-b p10 oh">
<span class="text-gray">Fees</span>
<span class="right">{{tx.fees|currency:'':2}} {{tx.currency}}</span>
</li>
<li ng-show="tx.total" class="line-b p10 oh text-bold">
<span class="text-gray">Total</span>
<span class="right">{{tx.total|currency:'':2}} {{tx.currency}}</span>
</li>
</ul>
<div class="extra-margin-bottom"></div>
</div>
</ion-content>
</ion-modal-view>

View file

@ -1,42 +1,50 @@
<nav class="tab-bar">
<section class="left-small">
<a ng-click="cancel()" class="p10">
<span class="text-close">Close</span>
</a>
</section>
<ion-modal-view ng-controller="walletsController">
<nav class="tab-bar">
<section class="left-small">
<a ng-click="cancel()" class="p10">
<span class="text-close">Close</span>
</a>
</section>
<section class="middle tab-bar-section">
<h1 class="title ellipsis">
<span ng-show="type == 'BUY' || type == 'RECEIVE'">Choose your destination wallet</span>
<span ng-show="type == 'SELL' || type == 'SEND'">Choose your source wallet</span>
</h1>
</section>
</nav>
<section class="middle tab-bar-section">
<h1 class="title ellipsis">
<span ng-show="type == 'BUY' || type == 'RECEIVE'">Choose your destination wallet</span>
<span ng-show="type == 'SELL' || type == 'SEND'">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>
<ion-content class="m20t" overflow-scroll="true">
<div class="modal-content m20t">
<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>
<div class="size-10 m5t">
Notice: only 1-1 (single signature) wallets can be used for sell bitcoin
<div ng-show="type != 'SELL'">
<h4 class="title m0 oh">
</h4>
</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}">
<i class="icon-wallet size-21"></i>
</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>
<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}">
<i class="icon-wallet size-21"></i>
</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>
</ion-content>
</ion-modal-view>

View file

@ -24,7 +24,7 @@
</div>
</div>
<div class="row m20t"
<div class="row m20ti"
ng-show="index.coinbaseAccount && !sell.sellInfo && !sell.sendInfo">
<div class="columns">
<form
@ -141,7 +141,7 @@
</div>
</div>
<div class="m20t row" ng-show="sell.sendInfo && !sell.sellInfo && !sell.success">
<div class="m20ti row" ng-show="sell.sendInfo && !sell.sellInfo && !sell.success">
<div class="columns">
<h1>Funds sent to Coinbase Account</h1>
<p class="size-12 text-gray">

View file

@ -1,8 +1,8 @@
'use strict';
angular.module('copayApp.controllers').controller('buyCoinbaseController',
function($scope, $modal, $log, $timeout, lodash, profileService, coinbaseService, animationService, bwsError, addressService) {
angular.module('copayApp.controllers').controller('buyCoinbaseController',
function($scope, $modal, $log, $ionicModal, $timeout, lodash, profileService, coinbaseService, bwsError, addressService) {
window.ignoreMobilePause = true;
var self = this;
var fc;
@ -31,7 +31,7 @@ angular.module('copayApp.controllers').controller('buyCoinbaseController',
});
} catch (e) {
$log.debug(e);
};
};
};
this.getPaymentMethods = function(token) {
@ -62,48 +62,20 @@ angular.module('copayApp.controllers').controller('buyCoinbaseController',
$scope.openWalletsModal = function(wallets) {
self.error = null;
var ModalInstanceCtrl = function($scope, $modalInstance) {
$scope.type = 'BUY';
$scope.wallets = wallets;
$scope.noColor = true;
$scope.cancel = function() {
$modalInstance.dismiss('cancel');
};
self.selectedWalletId = null;
self.selectedWalletName = null;
$scope.selectWallet = function(walletId, walletName) {
var client = profileService.getClient(walletId);
profileService.isReady(client, function(err) {
if (err) {
self.error = {errors: [{ message: err }]};
$modalInstance.dismiss('cancel');
} else {
$modalInstance.close({
'walletId': walletId,
'walletName': walletName,
});
}
});
};
};
$scope.type = 'BUY';
$scope.wallets = wallets;
$scope.noColor = true;
$scope.self = self;
var modalInstance = $modal.open({
templateUrl: 'views/modals/wallets.html',
windowClass: animationService.modalAnimated.slideUp,
controller: ModalInstanceCtrl,
});
modalInstance.result.finally(function() {
var m = angular.element(document.getElementsByClassName('reveal-modal'));
m.addClass(animationService.modalAnimated.slideOutDown);
});
modalInstance.result.then(function(obj) {
$timeout(function() {
self.selectedWalletId = obj.walletId;
self.selectedWalletName = obj.walletName;
fc = profileService.getClient(obj.walletId);
$scope.$apply();
}, 100);
$ionicModal.fromTemplateUrl('views/modals/wallets.html', {
scope: $scope,
animation: 'slide-in-up'
}).then(function(modal) {
$scope.walletsModal = modal;
$scope.walletsModal.show();
});
};
@ -147,9 +119,13 @@ angular.module('copayApp.controllers').controller('buyCoinbaseController',
coinbaseService.getTransaction(token, accountId, tx.id, function(err, updatedTx) {
if (err) $log.debug(err);
addressService.getAddress(self.selectedWalletId, false, function(err, addr) {
if (err) {
if (err) {
self.loading = null;
self.error = {errors: [{ message: 'Could not create address' }]};
self.error = {
errors: [{
message: 'Could not create address'
}]
};
return;
}
updatedTx.data['toAddr'] = addr;
@ -190,7 +166,9 @@ angular.module('copayApp.controllers').controller('buyCoinbaseController',
self.receiveInfo = res.data;
if (!res.data.id) return;
coinbaseService.getTransaction(token, accountId, res.data.id, function(err, sendTx) {
coinbaseService.savePendingTransaction(tx, {remove: true}, function(err) {
coinbaseService.savePendingTransaction(tx, {
remove: true
}, function(err) {
coinbaseService.savePendingTransaction(sendTx.data, {}, function(err) {
$timeout(function() {
$scope.$emit('Local/CoinbaseTx');

View file

@ -1,13 +1,13 @@
'use strict';
angular.module('copayApp.controllers').controller('buyGlideraController',
function($scope, $timeout, $modal, profileService, addressService, glideraService, bwsError, lodash, animationService) {
angular.module('copayApp.controllers').controller('buyGlideraController',
function($scope, $timeout, $modal, $ionicModal, profileService, addressService, glideraService, bwsError, lodash) {
var self = this;
this.show2faCodeInput = null;
this.error = null;
this.success = null;
this.loading = null;
this.loading = null;
window.ignoreMobilePause = true;
@ -32,7 +32,7 @@ angular.module('copayApp.controllers').controller('buyGlideraController',
}, 100);
}
});
} catch(e) {
} catch (e) {
$log.debug(e);
};
};
@ -41,47 +41,18 @@ angular.module('copayApp.controllers').controller('buyGlideraController',
self.error = null;
self.selectedWalletId = null;
self.selectedWalletName = null;
var ModalInstanceCtrl = function($scope, $modalInstance) {
$scope.type = 'BUY';
$scope.wallets = wallets;
$scope.noColor = true;
$scope.cancel = function() {
$modalInstance.dismiss('cancel');
};
$scope.selectWallet = function(walletId, walletName) {
var client = profileService.getClient(walletId);
profileService.isReady(client, function(err) {
if (err) {
self.error = err;
$modalInstance.dismiss('cancel');
return;
}
$modalInstance.close({
'walletId': walletId,
'walletName': walletName,
});
});
};
};
$scope.type = 'BUY';
$scope.wallets = wallets;
$scope.noColor = true;
$scope.self = self;
var modalInstance = $modal.open({
templateUrl: 'views/modals/wallets.html',
windowClass: animationService.modalAnimated.slideUp,
controller: ModalInstanceCtrl,
});
modalInstance.result.finally(function() {
var m = angular.element(document.getElementsByClassName('reveal-modal'));
m.addClass(animationService.modalAnimated.slideOutDown);
});
modalInstance.result.then(function(obj) {
$timeout(function() {
self.selectedWalletId = obj.walletId;
self.selectedWalletName = obj.walletName;
$scope.$apply();
}, 100);
$ionicModal.fromTemplateUrl('views/modals/wallets.html', {
scope: $scope,
animation: 'slide-in-up'
}).then(function(modal) {
$scope.walletsModal = modal;
$scope.walletsModal.show();
});
};
@ -100,7 +71,7 @@ angular.module('copayApp.controllers').controller('buyGlideraController',
return;
}
self.buyPrice = buyPrice;
});
});
};
this.get2faCode = function(token) {
@ -134,7 +105,7 @@ angular.module('copayApp.controllers').controller('buyGlideraController',
qty: self.buyPrice.qty,
priceUuid: self.buyPrice.priceUuid,
useCurrentPrice: false,
ip: null
ip: null
};
glideraService.buy(token, twoFaCode, data, function(err, data) {
self.loading = null;

View file

@ -1,11 +1,11 @@
'use strict';
angular.module('copayApp.controllers').controller('coinbaseController',
function($rootScope, $scope, $timeout, $modal, profileService, configService, storageService, coinbaseService, animationService, lodash, platformInfo) {
angular.module('copayApp.controllers').controller('coinbaseController',
function($rootScope, $scope, $timeout, $modal, $ionicModal, profileService, configService, storageService, coinbaseService, lodash, platformInfo) {
var isNW = platformInfo.isNW;
window.ignoreMobilePause = true;
this.openAuthenticateWindow = function() {
var oauthUrl = this.getAuthenticateUrl();
if (!isNW) {
@ -17,7 +17,7 @@ angular.module('copayApp.controllers').controller('coinbaseController',
focus: true,
position: 'center'
});
win.on ('loaded', function(){
win.on('loaded', function() {
var title = win.title;
if (title.indexOf('Coinbase') == -1) {
$scope.code = title;
@ -46,8 +46,7 @@ angular.module('copayApp.controllers').controller('coinbaseController',
$timeout(function() {
$scope.$apply();
}, 100);
}
else if (data && data.access_token && data.refresh_token) {
} else if (data && data.access_token && data.refresh_token) {
storageService.setCoinbaseToken(network, data.access_token, function() {
storageService.setCoinbaseRefreshToken(network, data.refresh_token, function() {
$scope.$emit('Local/CoinbaseUpdated', data.access_token);
@ -62,44 +61,14 @@ angular.module('copayApp.controllers').controller('coinbaseController',
};
this.openTxModal = function(tx) {
$rootScope.modalOpened = true;
var self = this;
var config = configService.getSync().wallet.settings;
var fc = profileService.focusedClient;
var ModalInstanceCtrl = function($scope, $modalInstance) {
$scope.tx = tx;
$scope.settings = config;
$scope.color = fc.backgroundColor;
$scope.noColor = true;
$scope.tx = tx;
$scope.remove = function() {
coinbaseService.savePendingTransaction($scope.tx, {remove: true}, function(err) {
$rootScope.$emit('Local/CoinbaseTx');
$scope.cancel();
});
};
$scope.cancel = lodash.debounce(function() {
$modalInstance.dismiss('cancel');
}, 0, 1000);
};
var modalInstance = $modal.open({
templateUrl: 'views/modals/coinbase-tx-details.html',
windowClass: animationService.modalAnimated.slideRight,
controller: ModalInstanceCtrl,
});
var disableCloseModal = $rootScope.$on('closeModal', function() {
modalInstance.dismiss('cancel');
});
modalInstance.result.finally(function() {
$rootScope.modalOpened = false;
disableCloseModal();
var m = angular.element(document.getElementsByClassName('reveal-modal'));
m.addClass(animationService.modalAnimated.slideOutRight);
$ionicModal.fromTemplateUrl('views/modals/coinbase-tx-details.html', {
scope: $scope,
animation: 'slide-in-up'
}).then(function(modal) {
$scope.coinbaseTxDetailsModal = modal;
$scope.coinbaseTxDetailsModal.show();
});
};

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('copayersController',
function($scope, $rootScope, $timeout, $log, $modal, profileService, go, notification, platformInfo, gettext, gettextCatalog, animationService) {
function($scope, $rootScope, $timeout, $log, $modal, $ionicModal, profileService, go, notification, platformInfo, gettext, gettextCatalog) {
var self = this;
var isCordova = platformInfo.isCordova;
var isWP = platformInfo.isWP;
@ -27,35 +27,19 @@ angular.module('copayApp.controllers').controller('copayersController',
};
var _modalDeleteWallet = function() {
var ModalInstanceCtrl = function($scope, $modalInstance, gettext) {
$scope.title = delete_msg;
$scope.loading = false;
$scope.title = delete_msg;
$scope.accept_msg = accept_msg;
$scope.cancel_msg = cancel_msg;
$scope.confirm_msg = confirm_msg;
$scope.okAction = doDeleteWallet;
$scope.loading = false;
$scope.ok = function() {
$scope.loading = true;
$modalInstance.close(accept_msg);
};
$scope.cancel = function() {
$modalInstance.dismiss(cancel_msg);
};
};
var modalInstance = $modal.open({
templateUrl: 'views/modals/confirmation.html',
windowClass: animationService.modalAnimated.slideUp,
controller: ModalInstanceCtrl
});
modalInstance.result.finally(function() {
var m = angular.element(document.getElementsByClassName('reveal-modal'));
m.addClass(animationService.modalAnimated.slideOutDown);
});
modalInstance.result.then(function(ok) {
if (ok) {
doDeleteWallet();
}
$ionicModal.fromTemplateUrl('views/modals/confirmation.html', {
scope: $scope,
animation: 'slide-in-up'
}).then(function(modal) {
$scope.confirmationModal = modal;
$scope.confirmationModal.show();
});
};

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('glideraController',
function($rootScope, $scope, $timeout, $modal, profileService, configService, storageService, glideraService, animationService, lodash) {
angular.module('copayApp.controllers').controller('glideraController',
function($rootScope, $scope, $timeout, $modal, $ionicModal, profileService, configService, storageService, glideraService, lodash) {
this.getAuthenticateUrl = function() {
return glideraService.getOauthCodeUrl();
@ -19,10 +19,9 @@ angular.module('copayApp.controllers').controller('glideraController',
if (err) {
self.error = err;
$timeout(function() {
$scope.$apply();
}, 100);
}
else if (data && data.access_token) {
$scope.$apply();
}, 100);
} else if (data && data.access_token) {
storageService.setGlideraToken(network, data.access_token, function() {
$scope.$emit('Local/GlideraUpdated', data.access_token);
$timeout(function() {
@ -35,41 +34,23 @@ angular.module('copayApp.controllers').controller('glideraController',
};
this.openTxModal = function(token, tx) {
$rootScope.modalOpened = true;
var self = this;
var config = configService.getSync().wallet.settings;
var fc = profileService.focusedClient;
var ModalInstanceCtrl = function($scope, $modalInstance) {
$scope.self = self;
$scope.tx = tx;
glideraService.getTransaction(token, tx.transactionUuid, function(error, tx) {
$scope.tx = tx;
$scope.settings = config;
$scope.color = fc.backgroundColor;
$scope.noColor = true;
glideraService.getTransaction(token, tx.transactionUuid, function(error, tx) {
$scope.tx = tx;
});
$scope.cancel = lodash.debounce(function() {
$modalInstance.dismiss('cancel');
}, 0, 1000);
};
var modalInstance = $modal.open({
templateUrl: 'views/modals/glidera-tx-details.html',
windowClass: animationService.modalAnimated.slideRight,
controller: ModalInstanceCtrl,
});
var disableCloseModal = $rootScope.$on('closeModal', function() {
modalInstance.dismiss('cancel');
});
modalInstance.result.finally(function() {
$rootScope.modalOpened = false;
disableCloseModal();
var m = angular.element(document.getElementsByClassName('reveal-modal'));
m.addClass(animationService.modalAnimated.slideOutRight);
$ionicModal.fromTemplateUrl('views/modals/glidera-tx-details.html', {
scope: $scope,
backdropClickToClose: false,
hardwareBackButtonClose: false,
animation: 'slide-in-up'
}).then(function(modal) {
$scope.glideraTxDetailsModal = modal;
$scope.glideraTxDetailsModal.show();
});
};

View file

@ -0,0 +1,20 @@
'use strict';
angular.module('copayApp.controllers').controller('coinbaseConfirmationController', function($scope, $timeout, coinbaseService, applicationService) {
$scope.ok = function() {
coinbaseService.logout($scope.network, function() {
$timeout(function() {
applicationService.restart();
}, 1000);
});
$scope.cancel();
};
$scope.cancel = function() {
$scope.coinbaseConfirmationModal.hide();
};
});

View file

@ -0,0 +1,18 @@
'use strict';
angular.module('copayApp.controllers').controller('coinbaseTxDetailsController', function($scope, coinbaseService) {
$scope.remove = function() {
coinbaseService.savePendingTransaction($scope.tx, {
remove: true
}, function(err) {
$rootScope.$emit('Local/CoinbaseTx');
$scope.cancel();
});
};
$scope.cancel = function() {
$scope.coinbaseTxDetailsModal.hide();
};
});

View file

@ -0,0 +1,15 @@
'use strict';
angular.module('copayApp.controllers').controller('confirmationController', function($scope) {
$scope.ok = function() {
$scope.loading = true;
$scope.okAction();
$scope.cancel();
};
$scope.cancel = function() {
$scope.confirmationModal.hide();
};
});

View file

@ -0,0 +1,18 @@
'use strict';
angular.module('copayApp.controllers').controller('glideraConfirmationController', function($scope, $timeout, storageService, applicationService) {
$scope.ok = function() {
storageService.removeGlideraToken($scope.network, function() {
$timeout(function() {
applicationService.restart();
}, 100);
});
$scope.cancel();
};
$scope.cancel = function() {
$scope.glideraConfirmationModal.hide();
};
});

View file

@ -0,0 +1,9 @@
'use strict';
angular.module('copayApp.controllers').controller('glideraTxDetailsController', function($scope) {
$scope.cancel = function() {
$scope.glideraTxDetailsModal.hide();
};
});

View file

@ -0,0 +1,30 @@
'use strict';
angular.module('copayApp.controllers').controller('walletsController', function($scope, bwsError, profileService) {
var self = $scope.self;
$scope.selectWallet = function(walletId, walletName) {
if (!profileService.getClient(walletId).isComplete()) {
self.error = bwsError.msg({
'code': 'WALLET_NOT_COMPLETE'
}, 'Could not choose the wallet');
self.error = {
errors: [{
message: 'The Wallet could not be selected'
}]
};
$scope.cancel();
return;
}
self.selectedWalletId = walletId;
self.selectedWalletName = walletName;
self.fc = profileService.getClient(self.selectedWalletId);
$scope.cancel();
};
$scope.cancel = function() {
$scope.walletsModal.hide();
};
});

View file

@ -1,38 +1,17 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesCoinbaseController',
function($scope, $modal, $timeout, applicationService, coinbaseService, animationService) {
angular.module('copayApp.controllers').controller('preferencesCoinbaseController',
function($scope, $modal, $timeout, $ionicModal, applicationService, coinbaseService) {
this.revokeToken = function(testnet) {
var network = testnet ? 'testnet' : 'livenet';
var ModalInstanceCtrl = function($scope, $modalInstance) {
$scope.ok = function() {
$modalInstance.close(true);
};
$scope.cancel = function() {
$modalInstance.dismiss();
};
};
$scope.network = testnet ? 'testnet' : 'livenet';
var modalInstance = $modal.open({
templateUrl: 'views/modals/coinbase-confirmation.html',
windowClass: animationService.modalAnimated.slideRight,
controller: ModalInstanceCtrl
});
modalInstance.result.then(function(ok) {
if (ok) {
coinbaseService.logout(network, function() {
$timeout(function() {
applicationService.restart();
}, 1000);
});
}
});
modalInstance.result.finally(function() {
var m = angular.element(document.getElementsByClassName('reveal-modal'));
m.addClass(animationService.modalAnimated.slideOutRight);
$ionicModal.fromTemplateUrl('views/modals/coinbase-confirmation.html', {
scope: $scope,
animation: 'slide-in-up'
}).then(function(modal) {
$scope.coinbaseConfirmationModal = modal;
$scope.coinbaseConfirmationModal.show();
});
};

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesDeleteWalletController',
function($scope, $rootScope, $filter, $timeout, $modal, $log, storageService, notification, profileService, platformInfo, go, gettext, gettextCatalog, animationService, applicationService) {
function($scope, $rootScope, $filter, $timeout, $modal, $log, $ionicModal, storageService, notification, profileService, platformInfo, go, gettext, gettextCatalog, applicationService) {
var isCordova = platformInfo.isCordova;
this.isCordova = isCordova;
this.error = null;
@ -13,35 +13,19 @@ angular.module('copayApp.controllers').controller('preferencesDeleteWalletContro
var confirm_msg = gettextCatalog.getString('Confirm');
var _modalDeleteWallet = function() {
var ModalInstanceCtrl = function($scope, $modalInstance, gettext) {
$scope.title = delete_msg;
$scope.loading = false;
$scope.title = delete_msg;
$scope.accept_msg = accept_msg;
$scope.cancel_msg = cancel_msg;
$scope.confirm_msg = confirm_msg;
$scope.okAction = doDeleteWallet;
$scope.loading = false;
$scope.ok = function() {
$scope.loading = true;
$modalInstance.close(accept_msg);
};
$scope.cancel = function() {
$modalInstance.dismiss(cancel_msg);
};
};
var modalInstance = $modal.open({
templateUrl: 'views/modals/confirmation.html',
windowClass: animationService.modalAnimated.slideUp,
controller: ModalInstanceCtrl
});
modalInstance.result.finally(function() {
var m = angular.element(document.getElementsByClassName('reveal-modal'));
m.addClass(animationService.modalAnimated.slideOutDown);
});
modalInstance.result.then(function(ok) {
if (ok) {
doDeleteWallet();
}
$ionicModal.fromTemplateUrl('views/modals/confirmation.html', {
scope: $scope,
animation: 'slide-in-up'
}).then(function(modal) {
$scope.confirmationModal = modal;
$scope.confirmationModal.show();
});
};

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesGlideraController',
function($scope, $modal, $timeout, profileService, applicationService, glideraService, storageService, animationService) {
angular.module('copayApp.controllers').controller('preferencesGlideraController',
function($scope, $modal, $timeout, $ionicModal, profileService, applicationService, glideraService, storageService) {
this.getEmail = function(token) {
var self = this;
@ -32,35 +32,15 @@ angular.module('copayApp.controllers').controller('preferencesGlideraController'
};
this.revokeToken = function(testnet) {
var network = testnet ? 'testnet' : 'livenet';
var ModalInstanceCtrl = function($scope, $modalInstance) {
$scope.ok = function() {
$modalInstance.close(true);
};
$scope.cancel = function() {
$modalInstance.dismiss();
};
};
$scope.network = testnet ? 'testnet' : 'livenet';
$scope.loading = false;
var modalInstance = $modal.open({
templateUrl: 'views/modals/glidera-confirmation.html',
windowClass: animationService.modalAnimated.slideRight,
controller: ModalInstanceCtrl
});
modalInstance.result.then(function(ok) {
if (ok) {
storageService.removeGlideraToken(network, function() {
$timeout(function() {
applicationService.restart();
}, 100);
});
}
});
modalInstance.result.finally(function() {
var m = angular.element(document.getElementsByClassName('reveal-modal'));
m.addClass(animationService.modalAnimated.slideOutRight);
$ionicModal.fromTemplateUrl('views/modals/glidera-confirmation.html', {
scope: $scope,
animation: 'slide-in-up'
}).then(function(modal) {
$scope.glideraConfirmationModal = modal;
$scope.glideraConfirmationModal.show();
});
};

View file

@ -1,31 +1,31 @@
'use strict';
angular.module('copayApp.controllers').controller('sellCoinbaseController',
function($rootScope, $scope, $modal, $log, $timeout, lodash, profileService, coinbaseService, animationService, bwsError, configService, walletService, fingerprintService) {
angular.module('copayApp.controllers').controller('sellCoinbaseController',
function($rootScope, $scope, $modal, $log, $timeout, $ionicModal, lodash, profileService, coinbaseService, bwsError, configService, walletService, fingerprintService) {
window.ignoreMobilePause = true;
var self = this;
var fc;
$scope.priceSensitivity = [
{
value : 0.5,
value: 0.5,
name: '0.5%'
},
{
value : 1,
value: 1,
name: '1%'
},
{
value : 2,
value: 2,
name: '2%'
},
{
value : 5,
value: 5,
name: '5%'
},
{
value : 10,
value: 10,
name: '10%'
}
];
@ -63,7 +63,7 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
});
} catch (e) {
$log.debug(e);
};
};
};
this.getPaymentMethods = function(token) {
@ -94,47 +94,20 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
$scope.openWalletsModal = function(wallets) {
self.error = null;
var ModalInstanceCtrl = function($scope, $modalInstance) {
$scope.type = 'SELL';
$scope.wallets = wallets;
$scope.noColor = true;
$scope.cancel = function() {
$modalInstance.dismiss('cancel');
};
self.selectedWalletId = null;
self.selectedWalletName = null;
$scope.selectWallet = function(walletId, walletName) {
if (!profileService.getClient(walletId).isComplete()) {
self.error = bwsError.msg({
'code': 'WALLET_NOT_COMPLETE'
}, 'Could not choose the wallet');
$modalInstance.dismiss('cancel');
return;
}
$modalInstance.close({
'walletId': walletId,
'walletName': walletName,
});
};
};
$scope.type = 'SELL';
$scope.wallets = wallets;
$scope.noColor = true;
$scope.self = self;
var modalInstance = $modal.open({
templateUrl: 'views/modals/wallets.html',
windowClass: animationService.modalAnimated.slideUp,
controller: ModalInstanceCtrl,
});
modalInstance.result.finally(function() {
var m = angular.element(document.getElementsByClassName('reveal-modal'));
m.addClass(animationService.modalAnimated.slideOutDown);
});
modalInstance.result.then(function(obj) {
$timeout(function() {
self.selectedWalletId = obj.walletId;
self.selectedWalletName = obj.walletName;
fc = profileService.getClient(obj.walletId);
$scope.$apply();
}, 100);
$ionicModal.fromTemplateUrl('views/modals/wallets.html', {
scope: $scope,
animation: 'slide-in-up'
}).then(function(modal) {
$scope.walletsModal = modal;
$scope.walletsModal.show();
});
};
@ -185,7 +158,9 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
self.error = null;
var accountId = account.id;
var dataSrc = { name : 'Received from Copay: ' + self.selectedWalletName };
var dataSrc = {
name: 'Received from Copay: ' + self.selectedWalletName
};
var outputs = [];
var config = configService.getSync();
var configWallet = config.wallet;
@ -213,7 +188,7 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
'amount': amount,
'message': comment
});
var txp = {
toAddress: address,
amount: amount,
@ -228,16 +203,24 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
if (err) {
$log.debug(err);
self.loading = null;
self.error = {errors: [{ message: 'Could not create transaction: ' + err.message }]};
self.error = {
errors: [{
message: 'Could not create transaction: ' + err.message
}]
};
$scope.$apply();
return;
}
$scope.$emit('Local/NeedsConfirmation', createdTxp, function(accept) {
self.loading = null;
if (accept) {
if (accept) {
self.confirmTx(createdTxp, function(err, tx) {
if (err) {
self.error = {errors: [{ message: 'Could not create transaction: ' + err.message }]};
if (err) {
self.error = {
errors: [{
message: 'Could not create transaction: ' + err.message
}]
};
return;
}
self.loading = 'Checking transaction...';
@ -296,7 +279,11 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
if (err) {
self.loading = null;
$log.debug(err);
return cb({errors: [{ message: 'Transaction could not be published: ' + err.message }]});
return cb({
errors: [{
message: 'Transaction could not be published: ' + err.message
}]
});
}
walletService.signTx(fc, publishedTxp, function(err, signedTxp) {
@ -307,7 +294,11 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
walletService.removeTx(fc, signedTxp, function(err) {
if (err) $log.debug(err);
});
return cb({errors: [{ message: 'The payment was created but could not be completed: ' + err.message }]});
return cb({
errors: [{
message: 'The payment was created but could not be completed: ' + err.message
}]
});
}
walletService.broadcastTx(fc, signedTxp, function(err, broadcastedTxp) {
@ -317,7 +308,11 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
walletService.removeTx(fc, broadcastedTxp, function(err) {
if (err) $log.debug(err);
});
return cb({errors: [{ message: 'The payment was created but could not be broadcasted: ' + err.message }]});
return cb({
errors: [{
message: 'The payment was created but could not be broadcasted: ' + err.message
}]
});
}
$timeout(function() {
self.loading = null;

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('sellGlideraController',
function($rootScope, $scope, $timeout, $log, $modal, configService, profileService, addressService, feeService, glideraService, bwsError, lodash, animationService, walletService, fingerprintService) {
function($rootScope, $scope, $timeout, $ionicModal, $log, $modal, configService, profileService, addressService, feeService, glideraService, bwsError, lodash, walletService, fingerprintService) {
var self = this;
var config = configService.getSync();
@ -53,47 +53,18 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
self.error = null;
self.selectedWalletId = null;
self.selectedWalletName = null;
var ModalInstanceCtrl = function($scope, $modalInstance) {
$scope.type = 'SELL';
$scope.wallets = wallets;
$scope.noColor = true;
$scope.cancel = function() {
$modalInstance.dismiss('cancel');
};
$scope.selectWallet = function(walletId, walletName) {
if (!profileService.getClient(walletId).isComplete()) {
self.error = bwsError.msg({
'code': 'WALLET_NOT_COMPLETE'
}, 'Could not choose the wallet');
$modalInstance.dismiss('cancel');
return;
}
$modalInstance.close({
'walletId': walletId,
'walletName': walletName,
});
};
};
$scope.type = 'SELL';
$scope.wallets = wallets;
$scope.noColor = true;
$scope.self = self;
var modalInstance = $modal.open({
templateUrl: 'views/modals/wallets.html',
windowClass: animationService.modalAnimated.slideUp,
controller: ModalInstanceCtrl,
});
modalInstance.result.finally(function() {
var m = angular.element(document.getElementsByClassName('reveal-modal'));
m.addClass(animationService.modalAnimated.slideOutDown);
});
modalInstance.result.then(function(obj) {
$timeout(function() {
self.selectedWalletId = obj.walletId;
self.selectedWalletName = obj.walletName;
fc = profileService.getClient(obj.walletId);
$scope.$apply();
}, 100);
$ionicModal.fromTemplateUrl('views/modals/wallets.html', {
scope: $scope,
animation: 'slide-in-up'
}).then(function(modal) {
$scope.walletsModal = modal;
$scope.walletsModal.show();
});
};
@ -136,7 +107,7 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
var outputs = [];
var configWallet = config.wallet;
var walletSettings = configWallet.settings;
addressService.getAddress(fc.credentials.walletId, null, function(err, refundAddress) {
if (!refundAddress) {
self.loading = null;
@ -157,7 +128,7 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
'amount': amount,
'message': comment
});
var txp = {
toAddress: sellAddress,
amount: amount,
@ -175,20 +146,20 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
walletService.createTx(fc, txp, function(err, createdTxp) {
self.loading = null;
if (err) {
self.error = err.message || bwsError.msg(err);
self.error = err.message ||  bwsError.msg(err);
return;
}
$scope.$emit('Local/NeedsConfirmation', createdTxp, function(accept) {
if (accept) {
fingerprintService.check(fc, function(err) {
if (err) {
self.error = err.message || bwsError.msg(err);
self.error = err.message ||  bwsError.msg(err);
return;
}
handleEncryptedWallet(fc, function(err) {
if (err) {
self.error = err.message || bwsError.msg(err);
self.error = err.message ||  bwsError.msg(err);
return;
}
@ -197,7 +168,7 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
walletService.publishTx(fc, createdTxp, function(err, publishedTxp) {
if (err) {
self.loading = null;
self.error = err.message || bwsError.msg(err);
self.error = err.message ||  bwsError.msg(err);
}
walletService.signTx(fc, publishedTxp, function(err, signedTxp) {
@ -207,7 +178,7 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
});
if (err) {
self.loading = null;
self.error = err.message || bwsError.msg(err);
self.error = err.message ||  bwsError.msg(err);
return;
}
var rawTx = signedTxp.raw;
@ -222,7 +193,7 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
glideraService.sell(token, twoFaCode, data, function(err, data) {
self.loading = null;
if (err) {
self.error = err.message || bwsError.msg(err);
self.error = err.message ||  bwsError.msg(err);
$timeout(function() {
$scope.$emit('Local/GlideraError');
}, 100);

View file

@ -1,75 +0,0 @@
'use strict';
angular.module('copayApp.controllers').controller('txController',
function($rootScope, $scope, $timeout, $filter, lodash, profileService, platformInfo, nodeWebkit, configService, animationService, gettextCatalog) {
var isCordova = platformInfo.isCordova;
var fc = profileService.focusedClient;
var config = configService.getSync();
var configWallet = config.wallet;
var walletSettings = configWallet.settings;
var m = angular.element(document.getElementsByClassName('txModal'));
m.addClass(animationService.modalAnimated.slideRight);
this.alternativeIsoCode = walletSettings.alternativeIsoCode;
this.color = fc.backgroundColor;
this.copayerId = fc.credentials.copayerId;
this.isShared = fc.credentials.n > 1;
if (isCordova) {
$rootScope.modalOpened = true;
var self = this;
var disableCloseModal = $rootScope.$on('closeModal', function() {
self.cancel();
});
}
this.getAlternativeAmount = function(btx) {
var self = this;
var satToBtc = 1 / 100000000;
fc.getFiatRate({
code: self.alternativeIsoCode,
ts: btx.time * 1000
}, function(err, res) {
if (err) {
$log.debug('Could not get historic rate');
return;
}
if (res && res.rate) {
var alternativeAmountBtc = (btx.amount * satToBtc).toFixed(8);
$scope.rateDate = res.fetchedOn;
$scope.rateStr = res.rate + ' ' + self.alternativeIsoCode;
$scope.alternativeAmountStr = $filter('noFractionNumber')(alternativeAmountBtc * res.rate, 2) + ' ' + self.alternativeIsoCode;
$scope.$apply();
}
});
};
this.getShortNetworkName = function() {
var n = fc.credentials.network;
return n.substring(0, 4);
};
this.copyToClipboard = function(value) {
if (isCordova) {
window.cordova.plugins.clipboard.copy(value);
window.plugins.toast.showShortCenter(gettextCatalog.getString('Copied to clipboard'));
} else if (platformInfo.isNW) {
nodeWebkit.writeToClipboard(value);
}
};
this.cancel = lodash.debounce(function() {
m.addClass(animationService.modalAnimated.slideOutRight);
if (isCordova) {
$rootScope.modalOpened = false;
disableCloseModal();
$timeout(function() {
$rootScope.$emit('Local/TxModal', null);
}, 350);
} else {
$rootScope.$emit('Local/TxModal', null);
}
}, 0, 1000);
});

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('walletHomeController', function($scope, $rootScope, $interval, $timeout, $filter, $modal, $log, $ionicModal, notification, txStatus, profileService, lodash, configService, rateService, storageService, bitcore, gettext, gettextCatalog, platformInfo, addressService, ledger, bwsError, confirmDialog, txFormatService, animationService, addressbookService, go, feeService, walletService, fingerprintService, nodeWebkit) {
angular.module('copayApp.controllers').controller('walletHomeController', function($scope, $rootScope, $interval, $timeout, $filter, $modal, $log, $ionicModal, notification, txStatus, profileService, lodash, configService, rateService, storageService, bitcore, gettext, gettextCatalog, platformInfo, addressService, ledger, bwsError, confirmDialog, txFormatService, addressbookService, go, feeService, walletService, fingerprintService, nodeWebkit) {
var isCordova = platformInfo.isCordova;
var isWP = platformInfo.isWP;

View file

@ -630,6 +630,10 @@ ul.manage li {
margin-top: 20px;
}
.m20ti {
margin-top: 20px !important;
}
.m20tp {
margin-top: 20%;
}