new onGoingProcess

This commit is contained in:
Matias Alejo Garcia 2016-06-13 15:25:40 -03:00
commit 90dad5b2a8
No known key found for this signature in database
GPG key ID: 02470DB551277AB3
33 changed files with 200 additions and 267 deletions

View file

@ -19,13 +19,6 @@
</section>
</nav>
<div class="onGoingProcess" ng-show="wordsC.loading">
<div class="onGoingProcess-content" ng-style="{'background-color':index.backgroundColor}">
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
<span translate>Validating recovery phrase...</span>
</div>
</div>
<div class="box-notification" ng-show="wordsC.error">
<span class="text-warning">
{{wordsC.error|translate}}

View file

@ -7,13 +7,6 @@
<div class="content coinbase" ng-controller="buyCoinbaseController as buy">
<div class="onGoingProcess" ng-show="buy.loading">
<div class="onGoingProcess-content" ng-style="{'background-color': '#2b71b1'}">
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
<span>{{buy.loading}}</span>
</div>
</div>
<div class="row m20t" ng-show="buy.error || index.coinbaseError" ng-click="buy.error = null">
<div class="columns">
<div class="box-notification">

View file

@ -7,13 +7,6 @@
<div class="content glidera" ng-controller="buyGlideraController as buy">
<div class="onGoingProcess" ng-show="buy.loading">
<div class="onGoingProcess-content" ng-style="{'background-color':index.backgroundColor}">
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
<span>{{buy.loading}}</span>
</div>
</div>
<div ng-show="index.glideraLimits && !buy.show2faCodeInput && !buy.success">
<h4 class="title m0 text-left">
<span class="text-light">Daily buy limit</span>:

View file

@ -25,15 +25,6 @@
</div>
<div class="content coinbase p20b" ng-controller="coinbaseController as coinbase">
<div class="onGoingProcess" ng-show="coinbase.loading || index.coinbaseLoading">
<div class="onGoingProcess-content" ng-style="{'background-color': '#2b71b1'}">
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
<span ng-show="coinbase.loading">Connecting to Coinbase...</span>
<span ng-show="index.coinbaseLoading">{{index.coinbaseLoading}}</span>
</div>
</div>
<div class="row" ng-show="index.coinbaseError || (index.coinbaseToken && !index.coinbaseAccount)">
<div class="m20b box-notification" ng-show="index.coinbaseError">
<ul class="no-bullet m0 text-warning size-12">
@ -57,7 +48,7 @@
</div>
</div>
<div ng-if="!index.coinbaseToken && !index.coinbaseLoading && !index.coinbaseError" class="row">
<div ng-if="!index.coinbaseToken && !index.coinbaseError" class="row">
<div class="box-notification text-center size-12 text-warning" ng-show="index.coinbaseTestnet">
<i class="fi-info"></i>
Testnet wallets only work with Coinbase Sandbox Accounts

View file

@ -6,13 +6,6 @@
<div class="content coinbase" ng-controller="coinbaseUriController as coinbase" ng-init="coinbase.checkCode()">
<div class="onGoingProcess" ng-show="coinbase.loading">
<div class="onGoingProcess-content" ng-style="{'background-color':index.backgroundColor}">
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
<span ng-show="coinbase.loading">Connecting to Coinbase...</span>
</div>
</div>
<div class="row m20t">
<div class="large-12 columns">
<div class="text-center">

View file

@ -8,21 +8,6 @@
<ion-content overflow-scroll="true" class="content p20b" ng-controller="createController as create" ng-init="create.setTotalCopayers(1)">
<div class="onGoingProcess" ng-show="create.loading && !create.hwWallet">
<div class="onGoingProcess-content" ng-style="{'background-color':'#222'}">
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
<span translate>Creating Wallet...</span>
</div>
</div>
<div class="onGoingProcess" ng-show="create.hwWallet">
<div class="onGoingProcess-content" ng-style="{'background-color':'#222'}" style="max-height:6.5em" >
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
<span translate>Connecting to {{create.hwWallet}} Wallet...</span>
<span ng-show="create.hwWallet=='Trezor'" translate>Please accept to export two public keys from the Trezor app</span>
</div>
</div>
<div class="create-tab small-only-text-center" ng-hide="create.hideTabs">
<div class="row">
<div class="tab-container small-6 medium-3 large-2" ng-class="{'selected': totalCopayers == 1}">
@ -170,11 +155,11 @@
</div> <!-- columns -->
</div> <!-- advanced -->
<button type="submit" class="button round black expand" ng-show="totalCopayers != 1" ng-disabled="setupForm.$invalid || create.loading || create.hwWallet">
<button type="submit" class="button round black expand" ng-show="totalCopayers != 1" ng-disabled="setupForm.$invalid">
<span translate>Create {{requiredCopayers}}-of-{{totalCopayers}} wallet</span>
</button>
<button type="submit" class="button round black expand" ng-show="totalCopayers == 1" ng-disabled="setupForm.$invalid || create.loading || create.hwWallet">
<button type="submit" class="button round black expand" ng-show="totalCopayers == 1" ng-disabled="setupForm.$invalid">
<span translate>Create new wallet</span>
</button>

View file

@ -25,14 +25,8 @@
</div>
<div class="row">
<div class="onGoingProcess" ng-show="disclaimer.creatingProfile">
<div class="onGoingProcess-content" ng-style="{'background-color':'#222'}">
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
<span translate>Creating Wallet...</span>
</div>
</div>
<div class="start-button columns button-box">
<button ng-disabled="disclaimer.creatingProfile" ng-click="disclaimer.accept()" class="button black expand round size-12 text-spacing m0" translate>
<button ng-click="disclaimer.accept()" class="button black expand round size-12 text-spacing m0" translate>
I AGREE. GET STARTED
</button>
</div>

View file

@ -8,14 +8,6 @@
<div class="content glidera p20b" ng-controller="glideraController as glidera">
<div class="onGoingProcess" ng-show="glidera.loading || index.glideraLoading">
<div class="onGoingProcess-content" ng-style="{'background-color':index.backgroundColor}">
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
<span ng-show="glidera.loading">Connecting to Glidera...</span>
<span ng-show="index.glideraLoading">{{index.glideraLoading}}</span>
</div>
</div>
<div class="row">
<div class="m20b box-notification" ng-if="index.glideraError">
<div class="text-warning">
@ -42,7 +34,7 @@
</div>
</div>
<div ng-if="!index.glideraToken && !index.glideraLoading && !index.glideraError"
<div ng-if="!index.glideraToken && !index.glideraError"
class="row">
<div class="box-notification text-center size-12 text-warning" ng-show="index.glideraTestnet">
<i class="fi-info"></i>
@ -164,7 +156,7 @@
<div ng-show="index.glideraPermissions.transaction_history">
<h4>Activity</h4>
<div ng-show="index.glideraTxs.length == 0 && !index.glideraLoadingHistory"
<div ng-show="index.glideraTxs.length == 0 "
class="size-12 p10 text-center text-gray">
No activity in your account
</div>

View file

@ -6,13 +6,6 @@
<div class="content glidera" ng-controller="glideraUriController as glidera" ng-init="glidera.checkCode()">
<div class="onGoingProcess" ng-show="glidera.loading">
<div class="onGoingProcess-content" ng-style="{'background-color':index.backgroundColor}">
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
<span ng-show="glidera.loading">Connecting to Glidera...</span>
</div>
</div>
<div class="row m20t">
<div class="large-12 columns">
<div class="text-center">

View file

@ -5,19 +5,6 @@
</div>
<ion-content overflow-scroll="true" class="content p20b" ng-controller="importController as import" ng-init="type='12'">
<div class="onGoingProcess" ng-show="import.loading && !import.hwWallet">
<div class="onGoingProcess-content" ng-style="{'background-color':'#222'}">
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
<span translate>Importing wallet...</span>
</div>
</div>
<div class="onGoingProcess" ng-show="import.hwWallet">
<div class="onGoingProcess-content" ng-style="{'background-color':'#222'}">
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
<span translate>Connecting to {{import.hwWallet}} Wallet...</span>
</div>
</div>
<div class="create-tab pr small-only-text-center" ng-hide="create.hideTabs">
<div class="row">
<div class="tab-container small-4 medium-4 large-4" ng-class="{'selected': type =='12'}">
@ -99,7 +86,7 @@
</div>
<button translate type="submit" class="button round expand black m10t"
ng-disabled="importForm12.$invalid || import.loading">
ng-disabled="importForm12.$invalid ">
Import
</button>
</form>
@ -157,7 +144,7 @@
</div>
<button translate type="submit" class="button round expand black"
ng-disabled="importForm.$invalid || !import.password || import.loading">
ng-disabled="importForm.$invalid || !import.password ">
Import backup
</button>
</form>
@ -221,8 +208,7 @@
</div>
<button translate type="submit" class="button round expand black"
ng-disabled="import.loading || import.ledger">
<button translate type="submit" class="button round expand black">
Import
</button>
</div> <!-- seedoptions show -->

View file

@ -6,21 +6,6 @@
<ion-content overflow-scroll="true" class="content p20v" ng-controller="joinController as join">
<div class="onGoingProcess" ng-show="join.loading && !join.hwWallet">
<div class="onGoingProcess-content" ng-style="{'background-color':'#222'}">
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
<span translate>Joining Wallet...</span>
</div>
</div>
<div class="onGoingProcess" ng-show="join.hwWallet">
<div class="onGoingProcess-content" ng-style="{'background-color':'#222'}" style="max-height:6.5em">
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
<span translate>Connecting to {{join.hwWallet}} Wallet...</span>
<span ng-show="join.hwWallet=='Trezor'" translate>Please accept to export two public keys from the Trezor app</span>
</div>
</div>
<form name="joinForm" ng-submit="join.join(joinForm)" novalidate>
<div class="box-notification m20b" ng-show="join.error">
<span class="text-warning">
@ -137,7 +122,7 @@
</div> <!-- advanced -->
<button translate type="submit" class="button expand black m0 round"
ng-disabled="joinForm.$invalid || join.loading">Join</button>
ng-disabled="joinForm.$invalid">Join</button>
</div> <!-- large-12 columns -->
</div> <!-- row -->
</form>

View file

@ -6,13 +6,6 @@
<div class="content preferences" ng-controller="paperWalletController as paperWallet">
<h4 ng-show="!paperWallet.error"></h4>
<div class="onGoingProcess" ng-show="paperWallet.scanning || paperWallet.sending">
<div class="onGoingProcess-content" ng-style="{'background-color':index.backgroundColor}">
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
<span ng-show="paperWallet.scanning" translate>Scanning wallet funds...</span>
<span ng-show="paperWallet.sending" translate>Sending funds...</span>
</div>
</div>
<div class="box-notification m20b" ng-show="paperWallet.error">
<span classs="text-warning">{{paperWallet.error|translate}}</span>
</div>

View file

@ -6,20 +6,13 @@
<div class="content preferences" ng-controller="preferencesDeleteWalletController as preferences">
<div class="onGoingProcess" ng-show="isDeletingWallet">
<div class="onGoingProcess-content" ng-style="{'background-color':index.backgroundColor}">
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
<span translate>Deleting Wallet...</span>
</div>
</div>
<div class="text-center text-gray m20t size-12">
<div class="text-warning size-18 m10b" translate>Warning!</div>
<div class="m20b" translate>Permanently delete this wallet. THIS ACTION CANNOT BE REVERSED</div>
</div>
<ul class="no-bullet m0">
<li ng-click="preferences.deleteWallet()">
<div class="right" ng-style="{'color':index.backgroundColor}" ng-show="!isDeletingWallet">
<div class="right" ng-style="{'color':index.backgroundColor}">
{{index.walletName}} <span ng-show="index.alias">({{index.alias}})</span>
</div>
<div translate>Delete wallet</div>

View file

@ -9,13 +9,6 @@
<div class="content preferences" ng-controller="preferencesEmailController as prefEmail">
<h4></h4>
<div class="onGoingProcess" ng-show="prefEmail.saving && !index.isOffline">
<div class="onGoingProcess-content" ng-style="{'background-color':index.backgroundColor}">
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
<span translate>Saving preferences...</span>
</div>
</div>
<form name="emailForm" ng-submit="prefEmail.save(emailForm)" class="columns" novalidate ng-init="prefEmail.email = index.preferences.email">
<div class="box-notification" ng-show="prefEmail.error">

View file

@ -7,13 +7,6 @@
<div class="content coinbase" ng-controller="sellCoinbaseController as sell">
<div class="onGoingProcess" ng-show="sell.loading">
<div class="onGoingProcess-content" ng-style="{'background-color': '#2b71b1'}">
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
<span>{{sell.loading}}</span>
</div>
</div>
<div class="row m20t" ng-show="sell.error || index.coinbaseError" ng-click="sell.error = null">
<div class="columns">
<div class="box-notification">
@ -64,11 +57,11 @@
<input ng-show="!showAlternative" type="number" id="amount"
name="amount" ng-attr-placeholder="{{'Amount in ' + (showAlternative ? 'USD' : 'BTC')}}"
ng-minlength="0.00000001" ng-maxlength="10000000000"
ng-model="amount" autocomplete="off" ng-disabled="sell.loading">
ng-model="amount" autocomplete="off">
<input ng-show="showAlternative" type="number" id="fiat"
name="fiat" ng-attr-placeholder="{{'Amount in ' + (showAlternative ? 'USD' : 'BTC')}}"
ng-model="fiat" autocomplete="off" ng-disabled="sell.loading">
ng-model="fiat" autocomplete="off">
<a ng-show="!showAlternative" class="postfix button"
ng-click="showAlternative = true; amount = null">BTC</a>
@ -101,7 +94,7 @@
</div>
<div class="input m20t">
<a href class="button black expand round"
ng-disabled="sell.loading || (!amount && !fiat)"
ng-disabled=" (!amount && !fiat)"
ng-style="{'background-color': '#2b71b1'}"
ng-click="showPriceSensitivity = true">Continue</a>
</div>
@ -131,7 +124,7 @@
</div>
<div class="columns large-6 medium-6 small-6">
<input class="button black expand round"
ng-disabled="sell.loading || (!amount && !fiat)"
ng-disabled="(!amount && !fiat)"
ng-style="{'background-color': '#2b71b1'}"
type="submit" value="Confirm">
</div>
@ -187,7 +180,7 @@
<button class="button black round expand"
ng-style="{'background-color': '#2b71b1'}"
ng-click="sell.confirmSell(index.coinbaseToken, index.coinbaseAccount, sell.sellInfo)"
ng-disabled="sell.loading">
>
Sell
</button>
</div>

View file

@ -7,13 +7,6 @@
<div class="content glidera" ng-controller="sellGlideraController as sell">
<div class="onGoingProcess" ng-show="sell.loading">
<div class="onGoingProcess-content" ng-style="{'background-color':index.backgroundColor}">
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
<span>{{sell.loading}}</span>
</div>
</div>
<div ng-show="index.glideraLimits && !sell.show2faCodeInput && !sell.success">
<h4 class="title m0 text-left">
<span class="text-light">Daily sell limit</span>:
@ -88,7 +81,7 @@
ng-style="{'background-color':index.backgroundColor}"
type="submit" value="{{'Continue'}}"
ng-disabled="index.glideraLimits.transactDisabledPendingFirstTransaction || !sell.sellPrice.qty ||
!sell.selectedWalletId || sell.loading">
!sell.selectedWalletId ">
</div>
</form>
</div>
@ -104,7 +97,7 @@
<input type="number" ng-model="twoFaCode" required>
<input class="button black expand round"
ng-style="{'background-color':index.backgroundColor}"
type="submit" value="{{'Sell'}}" ng-disabled="sellForm.$invalid || sell.loading">
type="submit" value="{{'Sell'}}" ng-disabled="sellForm.$invalid ">
</form>
<p class="m10t size-12 text-gray">
Bitcoins will be immediately sent from your wallet to Glidera. Fiat will be deposited in your bank account in 4-6 business days.

View file

@ -1,11 +1,10 @@
'use strict';
angular.module('copayApp.controllers').controller('backupController',
function($rootScope, $scope, $timeout, $log, lodash, profileService, gettext, bwcService, bwsError, walletService) {
function($rootScope, $scope, $timeout, $log, lodash, profileService, gettext, bwcService, bwsError, walletService, ongoingProcess) {
var self = this;
var fc = profileService.focusedClient;
self.loading = false;
self.customWords = [];
self.walletName = fc.credentials.walletName;
@ -59,9 +58,9 @@ angular.module('copayApp.controllers').controller('backupController',
finalStep();
function finalStep() {
self.loading = true;
ongoingProcess.set('validatingWords', true);
confirm(function(err) {
self.loading = false;
ongoingProcess.set('validatingWords', false);
if (err) {
backupError(err);
}
@ -144,7 +143,6 @@ angular.module('copayApp.controllers').controller('backupController',
};
$scope.removeButton = function(index, item) {
if (self.loading) return;
self.customWords.splice(index, 1);
self.shuffledMnemonicWords[item.prevIndex].selected = false;
self.shouldContinue();
@ -194,7 +192,7 @@ angular.module('copayApp.controllers').controller('backupController',
};
function backupError(err) {
self.loading = false;
ongoingProcess.set('validatingWords', false);
$log.debug('Failed to verify backup: ', err);
self.backupError = true;

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('buyCoinbaseController',
function($scope, $modal, $log, $ionicModal, $timeout, lodash, profileService, coinbaseService, bwsError, addressService) {
function($scope, $modal, $log, $ionicModal, $timeout, lodash, profileService, coinbaseService, bwsError, addressService, ongoingProcess) {
var self = this;
this.init = function(testnet) {
@ -73,9 +73,9 @@ angular.module('copayApp.controllers').controller('buyCoinbaseController',
currency: currency,
payment_method: $scope.selectedPaymentMethod.id || null
};
this.loading = 'Sending request...';
ongoingProcess.set('Sending request...', true);
coinbaseService.buyRequest(token, accountId, dataSrc, function(err, data) {
self.loading = null;
ongoingProcess.set('Sending request...', false);
if (err) {
self.error = err;
return;
@ -88,9 +88,9 @@ angular.module('copayApp.controllers').controller('buyCoinbaseController',
self.error = null;
var accountId = account.id;
var buyId = buy.id;
this.loading = 'Buying bitcoin...';
ongoingProcess.set('Buying Bitcoin...', true);
coinbaseService.buyCommit(token, accountId, buyId, function(err, b) {
self.loading = null;
ongoingProcess.set('Buying Bitcoin...', false);
if (err) {
self.error = err;
return;
@ -98,12 +98,12 @@ angular.module('copayApp.controllers').controller('buyCoinbaseController',
var tx = b.data.transaction;
if (!tx) return;
self.loading = 'Getting transaction...';
ongoingProcess.set('Fetching transaction...', true);
coinbaseService.getTransaction(token, accountId, tx.id, function(err, updatedTx) {
ongoingProcess.set('Fetching transaction...', false);
if (err) $log.debug(err);
addressService.getAddress(self.selectedWalletId, false, function(err, addr) {
if (err) {
self.loading = null;
self.error = {
errors: [{
message: 'Could not create address'
@ -113,7 +113,6 @@ angular.module('copayApp.controllers').controller('buyCoinbaseController',
}
updatedTx.data['toAddr'] = addr;
coinbaseService.savePendingTransaction(updatedTx.data, {}, function(err) {
self.loading = null;
if (err) $log.debug(err);
if (updatedTx.data.status == 'completed') {
self.sendToCopay(token, account, updatedTx.data);
@ -134,7 +133,7 @@ angular.module('copayApp.controllers').controller('buyCoinbaseController',
self.error = null;
var accountId = account.id;
self.loading = 'Sending funds to Copay...';
ongoingProcess.set('Sending funds to Copay...', true);
var data = {
to: tx.toAddr,
amount: tx.amount.amount,
@ -142,7 +141,7 @@ angular.module('copayApp.controllers').controller('buyCoinbaseController',
description: 'Copay Wallet: ' + self.selectedWalletName
};
coinbaseService.sendTo(token, accountId, data, function(err, res) {
self.loading = null;
ongoingProcess.set('Sending funds to Copay...', false);
if (err) {
self.error = err;
} else {

View file

@ -1,13 +1,12 @@
'use strict';
angular.module('copayApp.controllers').controller('buyGlideraController',
function($scope, $timeout, $modal, $ionicModal, profileService, addressService, glideraService, bwsError, lodash) {
function($scope, $timeout, $modal, $ionicModal, profileService, addressService, glideraService, bwsError, lodash, ongoingProcess) {
var self = this;
this.show2faCodeInput = null;
this.error = null;
this.success = null;
this.loading = null;
this.init = function(testnet) {
self.allWallets = profileService.getWallets(testnet ? 'testnet' : 'livenet', 1)
@ -62,10 +61,10 @@ angular.module('copayApp.controllers').controller('buyGlideraController',
this.get2faCode = function(token) {
var self = this;
self.error = null;
self.loading = 'Sending 2FA code...';
ongoingProcess.set('Sending 2FA code...', true);
$timeout(function() {
glideraService.get2faCode(token, function(err, sent) {
self.loading = null;
ongoingProcess.set('Sending 2FA code...', false);
if (err) {
self.error = 'Could not send confirmation code to your phone';
return;
@ -78,10 +77,11 @@ angular.module('copayApp.controllers').controller('buyGlideraController',
this.sendRequest = function(token, permissions, twoFaCode) {
var self = this;
self.error = null;
self.loading = 'Buying bitcoin...';
ongoingProcess.set('Buying Bitcoin...', true);
$timeout(function() {
addressService.getAddress(self.selectedWalletId, false, function(err, walletAddr) {
if (err) {
ongoingProcess.set('Buying Bitcoin...', false);
self.error = bwsError.cb(err, 'Could not create address');
return;
}
@ -93,7 +93,7 @@ angular.module('copayApp.controllers').controller('buyGlideraController',
ip: null
};
glideraService.buy(token, twoFaCode, data, function(err, data) {
self.loading = null;
ongoingProcess.set('Buying Bitcoin...', false);
if (err) {
self.error = err;
return;

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('coinbaseController',
function($rootScope, $scope, $timeout, $modal, $ionicModal, profileService, configService, storageService, coinbaseService, lodash, platformInfo) {
function($rootScope, $scope, $timeout, $modal, $ionicModal, profileService, configService, storageService, coinbaseService, lodash, platformInfo, ongoingProcess) {
var isNW = platformInfo.isNW;
@ -35,11 +35,11 @@ angular.module('copayApp.controllers').controller('coinbaseController',
var self = this;
var coinbaseTestnet = configService.getSync().coinbase.testnet;
var network = coinbaseTestnet ? 'testnet' : 'livenet';
this.loading = true;
ongoingProcess.set('connectingCoinbase', true);
this.error = null;
$timeout(function() {
coinbaseService.getToken(code, function(err, data) {
self.loading = null;
ongoingProcess.set('connectingCoinbase', false);
if (err) {
self.error = err;
$timeout(function() {

View file

@ -1,16 +1,16 @@
'use strict';
angular.module('copayApp.controllers').controller('coinbaseUriController',
function($scope, $stateParams, $timeout, profileService, configService, coinbaseService, storageService, go) {
function($scope, $stateParams, $timeout, profileService, configService, coinbaseService, storageService, go, ongoingProcess) {
this.submitOauthCode = function(code) {
var self = this;
var coinbaseTestnet = configService.getSync().coinbase.testnet;
var network = coinbaseTestnet ? 'testnet' : 'livenet';
this.loading = true;
ongoingProcess.set('connectingCoinbase', true);
this.error = null;
$timeout(function() {
coinbaseService.getToken(code, function(err, data) {
self.loading = null;
ongoingProcess.set('connectingCoinbase', false);
if (err) {
self.error = err;
$timeout(function() {

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('createController',
function($scope, $ionicScrollDelegate, $rootScope, $timeout, $log, lodash, go, profileService, configService, gettext, ledger, trezor, platformInfo, derivationPathHelper) {
function($scope, $ionicScrollDelegate, $rootScope, $timeout, $log, lodash, go, profileService, configService, gettext, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess) {
var isChromeApp = platformInfo.isChromeApp;
var isCordova = platformInfo.isCordova;
@ -147,11 +147,12 @@ angular.module('copayApp.controllers').controller('createController',
account = account - 1;
opts.account = account;
self.hwWallet = self.seedSourceId == 'ledger' ? 'Ledger' : 'Trezor';
ongoingProcess.set('connecting' + self.seedSourceId, true);
var src = self.seedSourceId == 'ledger' ? ledger : trezor;
src.getInfoForNewWallet(opts.n > 1, account, function(err, lopts) {
self.hwWallet = false;
ongoingProcess.set('connecting' + self.seedSourceId, false);
if (err) {
self.error = err;
$ionicScrollDelegate.scrollTop();
@ -167,11 +168,11 @@ angular.module('copayApp.controllers').controller('createController',
};
this._create = function(opts) {
self.loading = true;
ongoingProcess.set('creatingWallet', true);
$timeout(function() {
profileService.createWallet(opts, function(err) {
self.loading = false;
ongoingProcess.set('creatingWallet', false);
if (err) {
$log.warn(err);
self.error = err;

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('glideraController',
function($rootScope, $scope, $timeout, $modal, $ionicModal, profileService, configService, storageService, glideraService, lodash) {
function($rootScope, $scope, $timeout, $modal, $ionicModal, profileService, configService, storageService, glideraService, lodash, ongoingProcess) {
this.getAuthenticateUrl = function() {
return glideraService.getOauthCodeUrl();
@ -11,11 +11,11 @@ angular.module('copayApp.controllers').controller('glideraController',
var self = this;
var glideraTestnet = configService.getSync().glidera.testnet;
var network = glideraTestnet ? 'testnet' : 'livenet';
this.loading = true;
ongoingProcess.set('connectingGlidera', true);
this.error = null;
$timeout(function() {
glideraService.getToken(code, function(err, data) {
self.loading = null;
ongoingProcess.set('connectingGlidera', false);
if (err) {
self.error = err;
$timeout(function() {

View file

@ -1,17 +1,17 @@
'use strict';
angular.module('copayApp.controllers').controller('glideraUriController',
function($scope, $log, $stateParams, $timeout, profileService, configService, glideraService, storageService, go) {
function($scope, $log, $stateParams, $timeout, profileService, configService, glideraService, storageService, go, ongoingProcess) {
this.submitOauthCode = function(code) {
$log.debug('Glidera Oauth Code:' + code);
var self = this;
var glideraTestnet = configService.getSync().glidera.testnet;
var network = glideraTestnet ? 'testnet' : 'livenet';
this.loading = true;
ongoingProcess.set('connectingGlidera', true);
this.error = null;
$timeout(function() {
glideraService.getToken(code, function(err, data) {
self.loading = null;
ongoingProcess.set('connectingGlidera', false);
if (err) {
self.error = err;
$timeout(function() {

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('importController',
function($scope, $rootScope, $ionicScrollDelegate, $timeout, $log, profileService, configService, notification, go, sjcl, gettext, lodash, ledger, trezor, derivationPathHelper, platformInfo, bwsError, bwcService) {
function($scope, $rootScope, $ionicScrollDelegate, $timeout, $log, profileService, configService, notification, go, sjcl, gettext, lodash, ledger, trezor, derivationPathHelper, platformInfo, bwsError, bwcService, ongoingProcess) {
var isChromeApp = platformInfo.isChromeApp;
var isDevel = platformInfo.isDevel;
@ -60,13 +60,13 @@ angular.module('copayApp.controllers').controller('importController',
return;
}
self.loading = true;
ongoingProcess.set('importingWallet', true);
opts.compressed = null;
opts.password = null;
$timeout(function() {
profileService.importWallet(str2, opts, function(err, walletId) {
self.loading = false;
ongoingProcess.set('importingWallet', false);
if (err) {
self.error = err;
$ionicScrollDelegate.scrollTop();
@ -80,11 +80,10 @@ angular.module('copayApp.controllers').controller('importController',
};
var _importExtendedPrivateKey = function(xPrivKey, opts) {
self.loading = true;
ongoingProcess.set('importingWallet', true);
$timeout(function() {
profileService.importExtendedPrivateKey(xPrivKey, opts, function(err, walletId) {
self.loading = false;
ongoingProcess.set('importingWallet', false);
if (err) {
if (err instanceof errors.NOT_AUTHORIZED) {
self.importErr = true;
@ -105,11 +104,11 @@ angular.module('copayApp.controllers').controller('importController',
};
var _importMnemonic = function(words, opts) {
self.loading = true;
ongoingProcess.set('importingWallet', true);
$timeout(function() {
profileService.importMnemonic(words, opts, function(err, walletId) {
self.loading = false;
ongoingProcess.set('importingWallet', false);
if (err) {
if (err instanceof errors.NOT_AUTHORIZED) {
@ -232,7 +231,7 @@ angular.module('copayApp.controllers').controller('importController',
this.importTrezor = function(account, isMultisig) {
var self = this;
trezor.getInfoForNewWallet(isMultisig, account, function(err, lopts) {
self.hwWallet = false;
ongoingProcess.clear();
if (err) {
self.error = err;
$ionicScrollDelegate.scrollTop();
@ -242,11 +241,11 @@ angular.module('copayApp.controllers').controller('importController',
lopts.externalSource = 'trezor';
lopts.bwsurl = $scope.bwsurl;
self.loading = true;
ongoingProcess.set('importingWallet', true);
$log.debug('Import opts', lopts);
profileService.importExtendedPublicKey(lopts, function(err, walletId) {
self.loading = false;
ongoingProcess.set('importingWallet', false);
if (err) {
self.error = err;
$ionicScrollDelegate.scrollTop();
@ -287,11 +286,11 @@ angular.module('copayApp.controllers').controller('importController',
switch (self.seedSourceId) {
case ('ledger'):
self.hwWallet = 'Ledger';
ongoingProcess.set('connectingledger', true);
self.importLedger(account);
break;
case ('trezor'):
self.hwWallet = 'Trezor';
ongoingProcess.set('connectingtrezor', true);
self.importTrezor(account, isMultisig);
break;
default:
@ -311,7 +310,7 @@ angular.module('copayApp.controllers').controller('importController',
this.importLedger = function(account) {
var self = this;
ledger.getInfoForNewWallet(true, account, function(err, lopts) {
self.hwWallet = false;
ongoingProcess.clear();
if (err) {
self.error = err;
$ionicScrollDelegate.scrollTop();
@ -321,11 +320,11 @@ angular.module('copayApp.controllers').controller('importController',
lopts.externalSource = 'ledger';
lopts.bwsurl = $scope.bwsurl;
self.loading = true;
ongoingProcess.set('importingWallet', true);
$log.debug('Import opts', lopts);
profileService.importExtendedPublicKey(lopts, function(err, walletId) {
self.loading = false;
ongoingProcess.set('importingWallet', false);
if (err) {
self.error = err;
$ionicScrollDelegate.scrollTop();

View file

@ -1057,9 +1057,9 @@ angular.module('copayApp.controllers').controller('indexController', function($r
getToken(function(err, accessToken) {
if (err || !accessToken) return;
else {
self.glideraLoading = 'Connecting to Glidera...';
ongoingProcess.set('connectingGlidera', true);
glideraService.getAccessTokenPermissions(accessToken, function(err, p) {
self.glideraLoading = null;
ongoingProcess.set('connectingGlidera', false);
if (err) {
self.glideraError = err;
} else {
@ -1090,24 +1090,24 @@ angular.module('copayApp.controllers').controller('indexController', function($r
});
if (permissions.transaction_history) {
self.glideraLoadingHistory = 'Getting Glidera transactions...';
ongoingProcess.set('Fetching Glidera Transactions', true);
glideraService.getTransactions(accessToken, function(err, data) {
self.glideraLoadingHistory = null;
ongoingProcess.set('Fetching Glidera Transactions', false);
self.glideraTxs = data;
});
}
if (permissions.view_email_address && opts.fullUpdate) {
self.glideraLoadingEmail = 'Getting Glidera Email...';
ongoingProcess.set('connectingGlidera', true);
glideraService.getEmail(accessToken, function(err, data) {
self.glideraLoadingEmail = null;
ongoingProcess.set('connectingGlidera', false);
self.glideraEmail = data.email;
});
}
if (permissions.personal_info && opts.fullUpdate) {
self.glideraLoadingPersonalInfo = 'Getting Glidera Personal Information...';
ongoingProcess.set('connectingGlidera', true);
glideraService.getPersonalInfo(accessToken, function(err, data) {
self.glideraLoadingPersonalInfo = null;
ongoingProcess.set('connectingGlidera', false);
self.glideraPersonalInfo = data;
});
}
@ -1142,9 +1142,9 @@ angular.module('copayApp.controllers').controller('indexController', function($r
getToken(function(err, accessToken) {
if (err || !accessToken) return;
else {
self.coinbaseLoading = 'Getting primary account...';
ongoingProcess.set('Getting primary account...', true);
coinbaseService.getAccounts(accessToken, function(err, a) {
self.coinbaseLoading = null;
ongoingProcess.set('Getting primary account...', false);
if (err) {
self.coinbaseError = err;
if (err.errors[0] && err.errors[0].id == 'expired_token') {

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('joinController',
function($scope, $rootScope, $timeout, $ionicScrollDelegate, go, notification, profileService, configService, storageService, applicationService, $modal, gettext, lodash, ledger, trezor, platformInfo, derivationPathHelper) {
function($scope, $rootScope, $timeout, $ionicScrollDelegate, go, notification, profileService, configService, storageService, applicationService, $modal, gettext, lodash, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess) {
var isChromeApp = platformInfo.isChromeApp;
var isDevel = platformInfo.isDevel;
@ -108,11 +108,11 @@ angular.module('copayApp.controllers').controller('joinController',
account = account - 1;
opts.account = account;
self.hwWallet = self.seedSourceId == 'ledger' ? 'Ledger' : 'Trezor';
ongoingProcess.set('connecting' + self.seedSourceId, true);
var src = self.seedSourceId == 'ledger' ? ledger : trezor;
src.getInfoForNewWallet(true, account, function(err, lopts) {
self.hwWallet = false;
ongoingProcess.set('connecting' + self.seedSourceId, false);
if (err) {
self.error = err;
$ionicScrollDelegate.scrollTop();
@ -129,11 +129,11 @@ angular.module('copayApp.controllers').controller('joinController',
};
this._join = function(opts) {
self.loading = true;
ongoingProcess.set('joiningWallet', true);
$timeout(function() {
profileService.joinWallet(opts, function(err) {
if (err) {
self.loading = false;
ongoingProcess.set('joiningWallet', false);
self.error = err;
$ionicScrollDelegate.scrollTop();
$rootScope.$apply();

View file

@ -1,5 +1,5 @@
angular.module('copayApp.controllers').controller('paperWalletController',
function($scope, $http, $timeout, $log, configService, profileService, go, addressService, txStatus, bitcore) {
function($scope, $http, $timeout, $log, configService, profileService, go, addressService, txStatus, bitcore, ongoingProcess) {
var self = this;
var fc = profileService.focusedClient;
var rawTx;
@ -46,14 +46,14 @@ angular.module('copayApp.controllers').controller('paperWalletController',
}
self.scanFunds = function() {
self.scanning = true;
self.privateKey = '';
self.balanceSat = 0;
self.error = '';
ongoingProcess.set('scanning', true);
$timeout(function() {
self._scanFunds(function(err, privateKey, balance) {
self.scanning = false;
ongoingProcess.set('scanning', false);
if (err) {
$log.error(err);
self.error = err.message || err.toString();
@ -88,12 +88,13 @@ angular.module('copayApp.controllers').controller('paperWalletController',
};
self.sweepWallet = function() {
ongoingProcess.set('sweepingWallet', true);
self.sending = true;
self.error = '';
$timeout(function() {
self._sweepWallet(function(err, destinationAddress, txid) {
self.sending = false;
ongoingProcess.set('sweepingWallet', false);
if (err) {
self.error = err.message || err.toString();

View file

@ -1,11 +1,10 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesDeleteWalletController',
function($scope, $rootScope, $filter, $timeout, $modal, $log, $ionicModal, storageService, notification, profileService, platformInfo, go, gettext, gettextCatalog, applicationService) {
function($scope, $rootScope, $filter, $timeout, $modal, $log, $ionicModal, storageService, notification, profileService, platformInfo, go, gettext, gettextCatalog, applicationService, ongoingProcess) {
var isCordova = platformInfo.isCordova;
this.isCordova = isCordova;
this.error = null;
$scope.isDeletingWallet = false;
var delete_msg = gettextCatalog.getString('Are you sure you want to delete this wallet?');
var accept_msg = gettextCatalog.getString('Accept');
@ -30,14 +29,14 @@ angular.module('copayApp.controllers').controller('preferencesDeleteWalletContro
};
var doDeleteWallet = function() {
$scope.isDeletingWallet = true;
ongoingProcess.set('deletingWallet', true);
var fc = profileService.focusedClient;
var name = fc.credentials.walletName;
var walletName = (fc.alias || '') + ' [' + name + ']';
var self = this;
profileService.deleteWalletClient(fc, function(err) {
$scope.isDeletingWallet = false;
ongoingProcess.set('deletingWallet', false);
if (err) {
self.error = err.message || err;
} else {
@ -50,7 +49,6 @@ angular.module('copayApp.controllers').controller('preferencesDeleteWalletContro
};
this.deleteWallet = function() {
if ($scope.isDeletingWallet) return;
if (isCordova) {
navigator.notification.confirm(
delete_msg,

View file

@ -7,17 +7,14 @@ angular.module('copayApp.controllers').controller('preferencesEmailController',
this.error = null;
var fc = profileService.focusedClient;
this.saving = true;
var email = self.email || '';
walletService.updateRemotePreferences(fc, {
email: email,
}, function(err) {
if (!err)
$rootScope.$emit('Local/EmailUpdated', email);
self.saving = false;
go.path('preferences');
});
};

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('sellCoinbaseController',
function($rootScope, $scope, $modal, $log, $timeout, $ionicModal, lodash, profileService, coinbaseService, bwsError, configService, walletService, fingerprintService) {
function($rootScope, $scope, $modal, $log, $timeout, $ionicModal, lodash, profileService, coinbaseService, bwsError, configService, walletService, fingerprintService, ongoingProcess) {
var self = this;
var client;
@ -112,9 +112,9 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
var accountId = account.id;
var data = ctx.amount;
data['payment_method'] = $scope.selectedPaymentMethod.id || null;
this.loading = 'Sending request...';
ongoingProcess.set('Sending request...', true);
coinbaseService.sellRequest(token, accountId, data, function(err, sell) {
self.loading = null;
ongoingProcess.set('Sending request...', false);
if (err) {
self.error = err;
return;
@ -127,9 +127,9 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
self.error = null;
var accountId = account.id;
var sellId = sell.id;
this.loading = 'Selling bitcoin...';
ongoingProcess.set('Selling Bitcoin...', true);
coinbaseService.sellCommit(token, accountId, sellId, function(err, data) {
self.loading = null;
ongoingProcess.set('Selling Bitcoin...', false);
if (err) {
self.error = err;
return;
@ -157,12 +157,12 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
var walletSettings = configWallet.settings;
self.loading = 'Creating transaction...';
ongoingProcess.set('Creating Transaction...', true);
$timeout(function() {
coinbaseService.createAddress(token, accountId, dataSrc, function(err, data) {
if (err) {
self.loading = null;
ongoingProcess.set('Creating Transaction...', false);
self.error = err;
return;
}
@ -192,7 +192,7 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
walletService.createTx(client, txp, function(err, createdTxp) {
if (err) {
$log.debug(err);
self.loading = null;
ongoingProcess.set('Creating Transaction...', false);
self.error = {
errors: [{
message: 'Could not create transaction: ' + err.message
@ -201,8 +201,8 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
$scope.$apply();
return;
}
ongoingProcess.set('Creating Transaction...', false);
$scope.$emit('Local/NeedsConfirmation', createdTxp, function(accept) {
self.loading = null;
if (accept) {
self.confirmTx(createdTxp, function(err, tx) {
if (err) {
@ -213,7 +213,7 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
};
return;
}
self.loading = 'Checking transaction...';
ongoingProcess.set('Checking Transaction...', false);
coinbaseService.getTransactions(token, accountId, function(err, ctxs) {
if (err) {
$log.debug(err);
@ -225,7 +225,7 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
self.sellRequest(token, account, ctx);
} else {
// Save to localstorage
self.loading = null;
ongoingProcess.clear();
ctx['price_sensitivity'] = $scope.selectedPriceSensitivity;
ctx['sell_price_amount'] = self.sellPrice.amount;
ctx['sell_price_currency'] = self.sellPrice.currency;
@ -264,10 +264,10 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
return cb(err);
}
self.loading = 'Sending bitcoin to Coinbase...';
ongoingProcess.set('Sending Bitcoin to Coinbase...', true);
walletService.publishTx(client, txp, function(err, publishedTxp) {
if (err) {
self.loading = null;
ongoingProcess.set('Sending Bitcoin to Coinbase...', false);
$log.debug(err);
return cb({
errors: [{
@ -279,7 +279,7 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
walletService.signTx(client, publishedTxp, function(err, signedTxp) {
walletService.lock(client);
if (err) {
self.loading = null;
ongoingProcess.set('Sending Bitcoin to Coinbase...', false);
$log.debug(err);
walletService.removeTx(client, signedTxp, function(err) {
if (err) $log.debug(err);
@ -292,8 +292,8 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
}
walletService.broadcastTx(client, signedTxp, function(err, broadcastedTxp) {
ongoingProcess.set('Sending Bitcoin to Coinbase...', false);
if (err) {
self.loading = null;
$log.debug(err);
walletService.removeTx(client, broadcastedTxp, function(err) {
if (err) $log.debug(err);
@ -305,7 +305,6 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
});
}
$timeout(function() {
self.loading = null;
return cb(null, broadcastedTxp);
}, 5000);
});

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('sellGlideraController',
function($rootScope, $scope, $timeout, $ionicModal, $log, $modal, configService, profileService, addressService, feeService, glideraService, bwsError, lodash, walletService, fingerprintService) {
function($rootScope, $scope, $timeout, $ionicModal, $log, $modal, configService, profileService, addressService, feeService, glideraService, bwsError, lodash, walletService, fingerprintService, ongoingProcess) {
var self = this;
var config = configService.getSync();
@ -9,7 +9,6 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
this.show2faCodeInput = null;
this.success = null;
this.error = null;
this.loading = null;
var client;
var handleEncryptedWallet = function(client, cb) {
@ -74,10 +73,10 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
this.get2faCode = function(token) {
var self = this;
self.loading = 'Sending 2FA code...';
ongoingProcess.set('Sending 2FA code...', true);
$timeout(function() {
glideraService.get2faCode(token, function(err, sent) {
self.loading = null;
ongoingProcess.set('Sending 2FA code...', false);
if (err) {
self.error = 'Could not send confirmation code to your phone';
} else {
@ -99,15 +98,17 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
return;
}
ongoingProcess.set('creatingTx', true);
addressService.getAddress(client.credentials.walletId, null, function(err, refundAddress) {
if (!refundAddress) {
self.loading = null;
ongoingProcess.clear();
self.error = bwsError.msg(err, 'Could not create address');
return;
}
glideraService.getSellAddress(token, function(error, sellAddress) {
if (!sellAddress) {
self.loading = null;
ongoingProcess.clear();
self.error = 'Could not get the destination bitcoin address';
return;
}
@ -133,9 +134,8 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
}
};
self.loading = 'Creating transaction...';
walletService.createTx(client, txp, function(err, createdTxp) {
self.loading = null;
ongoingProcess.clear();
if (err) {
self.error = err.message ||  bwsError.msg(err);
return;
@ -154,11 +154,10 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
return;
}
self.loading = 'Signing transaction...';
ongoingProcess.set('signingTx', true);
walletService.publishTx(client, createdTxp, function(err, publishedTxp) {
if (err) {
self.loading = null;
ongoingProcess.clear();
self.error = err.message ||  bwsError.msg(err);
}
@ -167,8 +166,8 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
walletService.removeTx(client, signedTxp, function(err) {
if (err) $log.debug(err);
});
ongoingProcess.clear();
if (err) {
self.loading = null;
self.error = err.message ||  bwsError.msg(err);
return;
}
@ -180,9 +179,9 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
useCurrentPrice: self.sellPrice.priceUuid ? false : true,
ip: null
};
self.loading = 'Selling bitcoin...';
ongoingProcess.set('Seling Bitcoin', true);
glideraService.sell(token, twoFaCode, data, function(err, data) {
self.loading = null;
ongoingProcess.clear();
if (err) {
self.error = err.message ||  bwsError.msg(err);
$timeout(function() {

View file

@ -0,0 +1,79 @@
'use strict';
angular.module('copayApp.services').factory('ongoingProcess', function($log, $timeout, lodash, $ionicLoading, gettextCatalog, platformInfo) {
var root = {};
var isCordova = platformInfo.isCordova;
var ongoingProcess = {};
var processNames = {
'openingWallet': 'Updating Wallet...',
'updatingStatus': 'Updating Wallet...',
'updatingBalance': 'Updating Wallet...',
'updatingPendingTxps': 'Updating Wallet...',
'scanning': 'Scanning Wallet funds...',
'recreating': 'Recreating Wallet...',
'generatingCSV': 'Generating .csv file...',
'creatingTx': 'Creating transaction',
'sendingTx': 'Sending transaction',
'signingTx': 'Signing transaction',
'broadcastingTx': 'Broadcasting transaction',
'fetchingPayPro': 'Fetching Payment Information',
'calculatingFee': 'Calculating fee',
'joiningWallet': 'Joining Wallet...',
'retrivingInputs': 'Retrieving inputs information',
'creatingWallet': 'Creating Wallet...',
'validationWallet': 'Validating wallet integrity...',
'connectingledger': 'Waiting for Ledger...',
'connectingtrezor': 'Waiting for Trezor...',
'validatingWords': 'Validating recovery phrase...',
'connectingCoinbase': 'Connecting to Coinbase...',
'connectingGlidera': 'Connecting to Glidera...',
'importingWallet': 'Importing Wallet...',
'sweepingWallet': 'Sweeping Wallet...',
'deletingWallet': 'Deleting Wallet...',
};
lodash.each(processNames, function(k, v) {
processNames[k] = gettextCatalog.getString(v);
});
root.clear = function() {
ongoingProcess = {};
};
root.set = function(processName, isOn) {
$log.debug('ongoingProcess', processName, isOn);
root[processName] = isOn;
ongoingProcess[processName] = isOn;
var name;
root.any = lodash.any(ongoingProcess, function(isOn, processName) {
if (isOn)
name = name || processName;
return isOn;
});
// The first one
root.onGoingProcessName = name;
var showName = processNames[name] || gettextCatalog.getString(name);
if (root.onGoingProcessName) {
if (isCordova) {
window.plugins.spinnerDialog.show(null, showName, true);
} else {
$ionicLoading.show({
template: showName,
});
}
} else {
if (isCordova) {
window.plugins.spinnerDialog.hide();
} else {
$ionicLoading.hide();
}
}
};
return root;
});