Merge pull request #4372 from matiu/ref/ongoingProcesses

Ref/ongoing processes
This commit is contained in:
Gustavo Maximiliano Cortez 2016-06-13 17:37:15 -03:00 committed by GitHub
commit 6ae228018f
40 changed files with 487 additions and 627 deletions

View file

@ -19,13 +19,6 @@
</section> </section>
</nav> </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"> <div class="box-notification" ng-show="wordsC.error">
<span class="text-warning"> <span class="text-warning">
{{wordsC.error|translate}} {{wordsC.error|translate}}

View file

@ -7,13 +7,6 @@
<div class="content coinbase" ng-controller="buyCoinbaseController as buy"> <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="row m20t" ng-show="buy.error || index.coinbaseError" ng-click="buy.error = null">
<div class="columns"> <div class="columns">
<div class="box-notification"> <div class="box-notification">

View file

@ -7,13 +7,6 @@
<div class="content glidera" ng-controller="buyGlideraController as buy"> <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"> <div ng-show="index.glideraLimits && !buy.show2faCodeInput && !buy.success">
<h4 class="title m0 text-left"> <h4 class="title m0 text-left">
<span class="text-light">Daily buy limit</span>: <span class="text-light">Daily buy limit</span>:

View file

@ -25,15 +25,6 @@
</div> </div>
<div class="content coinbase p20b" ng-controller="coinbaseController as coinbase"> <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="row" ng-show="index.coinbaseError || (index.coinbaseToken && !index.coinbaseAccount)">
<div class="m20b box-notification" ng-show="index.coinbaseError"> <div class="m20b box-notification" ng-show="index.coinbaseError">
<ul class="no-bullet m0 text-warning size-12"> <ul class="no-bullet m0 text-warning size-12">
@ -57,7 +48,7 @@
</div> </div>
</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"> <div class="box-notification text-center size-12 text-warning" ng-show="index.coinbaseTestnet">
<i class="fi-info"></i> <i class="fi-info"></i>
Testnet wallets only work with Coinbase Sandbox Accounts 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="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="row m20t">
<div class="large-12 columns"> <div class="large-12 columns">
<div class="text-center"> <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)"> <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="create-tab small-only-text-center" ng-hide="create.hideTabs">
<div class="row"> <div class="row">
<div class="tab-container small-6 medium-3 large-2" ng-class="{'selected': totalCopayers == 1}"> <div class="tab-container small-6 medium-3 large-2" ng-class="{'selected': totalCopayers == 1}">
@ -170,11 +155,11 @@
</div> <!-- columns --> </div> <!-- columns -->
</div> <!-- advanced --> </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> <span translate>Create {{requiredCopayers}}-of-{{totalCopayers}} wallet</span>
</button> </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> <span translate>Create new wallet</span>
</button> </button>

View file

@ -25,14 +25,8 @@
</div> </div>
<div class="row"> <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"> <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 I AGREE. GET STARTED
</button> </button>
</div> </div>

View file

@ -8,14 +8,6 @@
<div class="content glidera p20b" ng-controller="glideraController as glidera"> <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="row">
<div class="m20b box-notification" ng-if="index.glideraError"> <div class="m20b box-notification" ng-if="index.glideraError">
<div class="text-warning"> <div class="text-warning">
@ -42,7 +34,7 @@
</div> </div>
</div> </div>
<div ng-if="!index.glideraToken && !index.glideraLoading && !index.glideraError" <div ng-if="!index.glideraToken && !index.glideraError"
class="row"> class="row">
<div class="box-notification text-center size-12 text-warning" ng-show="index.glideraTestnet"> <div class="box-notification text-center size-12 text-warning" ng-show="index.glideraTestnet">
<i class="fi-info"></i> <i class="fi-info"></i>
@ -164,7 +156,7 @@
<div ng-show="index.glideraPermissions.transaction_history"> <div ng-show="index.glideraPermissions.transaction_history">
<h4>Activity</h4> <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"> class="size-12 p10 text-center text-gray">
No activity in your account No activity in your account
</div> </div>

View file

@ -6,13 +6,6 @@
<div class="content glidera" ng-controller="glideraUriController as glidera" ng-init="glidera.checkCode()"> <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="row m20t">
<div class="large-12 columns"> <div class="large-12 columns">
<div class="text-center"> <div class="text-center">

View file

@ -5,19 +5,6 @@
</div> </div>
<ion-content overflow-scroll="true" class="content p20b" ng-controller="importController as import" ng-init="type='12'"> <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="create-tab pr small-only-text-center" ng-hide="create.hideTabs">
<div class="row"> <div class="row">
<div class="tab-container small-4 medium-4 large-4" ng-class="{'selected': type =='12'}"> <div class="tab-container small-4 medium-4 large-4" ng-class="{'selected': type =='12'}">
@ -99,7 +86,7 @@
</div> </div>
<button translate type="submit" class="button round expand black m10t" <button translate type="submit" class="button round expand black m10t"
ng-disabled="importForm12.$invalid || import.loading"> ng-disabled="importForm12.$invalid ">
Import Import
</button> </button>
</form> </form>
@ -157,7 +144,7 @@
</div> </div>
<button translate type="submit" class="button round expand black" <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 Import backup
</button> </button>
</form> </form>
@ -221,8 +208,7 @@
</div> </div>
<button translate type="submit" class="button round expand black" <button translate type="submit" class="button round expand black">
ng-disabled="import.loading || import.ledger">
Import Import
</button> </button>
</div> <!-- seedoptions show --> </div> <!-- seedoptions show -->

View file

@ -6,21 +6,6 @@
<ion-content overflow-scroll="true" class="content p20v" ng-controller="joinController as join"> <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> <form name="joinForm" ng-submit="join.join(joinForm)" novalidate>
<div class="box-notification m20b" ng-show="join.error"> <div class="box-notification m20b" ng-show="join.error">
<span class="text-warning"> <span class="text-warning">
@ -137,7 +122,7 @@
</div> <!-- advanced --> </div> <!-- advanced -->
<button translate type="submit" class="button expand black m0 round" <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> <!-- large-12 columns -->
</div> <!-- row --> </div> <!-- row -->
</form> </form>

View file

@ -6,13 +6,6 @@
<div class="content preferences" ng-controller="paperWalletController as paperWallet"> <div class="content preferences" ng-controller="paperWalletController as paperWallet">
<h4 ng-show="!paperWallet.error"></h4> <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"> <div class="box-notification m20b" ng-show="paperWallet.error">
<span classs="text-warning">{{paperWallet.error|translate}}</span> <span classs="text-warning">{{paperWallet.error|translate}}</span>
</div> </div>

View file

@ -6,20 +6,13 @@
<div class="content preferences" ng-controller="preferencesDeleteWalletController as preferences"> <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-center text-gray m20t size-12">
<div class="text-warning size-18 m10b" translate>Warning!</div> <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 class="m20b" translate>Permanently delete this wallet. THIS ACTION CANNOT BE REVERSED</div>
</div> </div>
<ul class="no-bullet m0"> <ul class="no-bullet m0">
<li ng-click="preferences.deleteWallet()"> <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> {{index.walletName}} <span ng-show="index.alias">({{index.alias}})</span>
</div> </div>
<div translate>Delete wallet</div> <div translate>Delete wallet</div>

View file

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

View file

@ -7,13 +7,6 @@
<div class="content glidera" ng-controller="sellGlideraController as sell"> <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"> <div ng-show="index.glideraLimits && !sell.show2faCodeInput && !sell.success">
<h4 class="title m0 text-left"> <h4 class="title m0 text-left">
<span class="text-light">Daily sell limit</span>: <span class="text-light">Daily sell limit</span>:
@ -88,7 +81,7 @@
ng-style="{'background-color':index.backgroundColor}" ng-style="{'background-color':index.backgroundColor}"
type="submit" value="{{'Continue'}}" type="submit" value="{{'Continue'}}"
ng-disabled="index.glideraLimits.transactDisabledPendingFirstTransaction || !sell.sellPrice.qty || ng-disabled="index.glideraLimits.transactDisabledPendingFirstTransaction || !sell.sellPrice.qty ||
!sell.selectedWalletId || sell.loading"> !sell.selectedWalletId ">
</div> </div>
</form> </form>
</div> </div>
@ -104,7 +97,7 @@
<input type="number" ng-model="twoFaCode" required> <input type="number" ng-model="twoFaCode" required>
<input class="button black expand round" <input class="button black expand round"
ng-style="{'background-color':index.backgroundColor}" ng-style="{'background-color':index.backgroundColor}"
type="submit" value="{{'Sell'}}" ng-disabled="sellForm.$invalid || sell.loading"> type="submit" value="{{'Sell'}}" ng-disabled="sellForm.$invalid ">
</form> </form>
<p class="m10t size-12 text-gray"> <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. 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

@ -16,35 +16,6 @@
</div> </div>
</div> </div>
<div class="onGoingProcess" ng-show="index.isOffline">
<div class="onGoingProcess-content" ng-style="{'background-color':'#222'}">
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
<span translate>Reconnecting to Wallet Service...</span>
</div>
</div>
<div class="onGoingProcess" ng-show="index.anyOnGoingProcess && !index.isOffline">
<div class="onGoingProcess-content" ng-style="{'background-color':index.backgroundColor}">
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
<span translate ng-show="
index.onGoingProcessName == 'openingWallet'
|| index.onGoingProcessName == 'updatingStatus'
|| index.onGoingProcessName == 'updatingBalance'
|| index.onGoingProcessName == 'updatingPendingTxps'
"> Updating Wallet... </span>
<span translate ng-show="index.onGoingProcessName == 'scanning'">Scanning Wallet funds...</span>
<span translate ng-show="index.onGoingProcessName == 'recreating'">Recreating Wallet...</span>
<span translate ng-show="index.onGoingProcessName == 'generatingCSV'">Generating .csv file...</span>
</div>
</div>
<div class="onGoingProcess" ng-show="home.onGoingProcess && !index.anyOnGoingProces && !index.isOffline">
<div class="onGoingProcess-content" ng-style="{'background-color':index.backgroundColor}">
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
{{home.onGoingProcess}}...
</div>
</div>
<div class="oh" ng-show="!index.noFocusedWallet"> <div class="oh" ng-show="!index.noFocusedWallet">
<!-- <!--
@ -63,7 +34,7 @@
</ion-refresher> </ion-refresher>
<div class="oh pr"> <div class="oh pr">
<div ng-style="{'background-color':index.backgroundColor}" class="amount"> <div ng-style="{'background-color':index.backgroundColor}" class="amount">
<div ng-if="!index.anyOnGoingProcess && !index.notAuthorized"> <div ng-if="!index.notAuthorized">
<div class="m15t" ng-show="index.updateError" ng-click='index.updateAll({triggerTxUpdate: true})'> <div class="m15t" ng-show="index.updateError" ng-click='index.updateAll({triggerTxUpdate: true})'>
<span class="size-12 db m10b">{{index.updateError|translate}}</span> <span class="size-12 db m10b">{{index.updateError|translate}}</span>
<button class="outline white tiny round" translate>Tap to retry</button> <button class="outline white tiny round" translate>Tap to retry</button>
@ -89,12 +60,6 @@
</div> </div>
</div> </div>
</div> </div>
<div ng-if="index.anyOnGoingProcess">
<div class="size-36">
<strong>...</strong>
</div>
</div>
</div> <!-- amount --> </div> <!-- amount -->
<div class="wallet-info"> <div class="wallet-info">
@ -114,7 +79,7 @@
</span> </span>
</div> </div>
</div> </div>
<div class="oh pr m20t" ng-show="index.notAuthorized && !index.anyOnGoingProcess"> <div class="oh pr m20t" ng-show="index.notAuthorized">
<div class="text-center text-warning"> <div class="text-center text-warning">
<i class="fi-alert"></i> <i class="fi-alert"></i>
<span translate> <span translate>
@ -335,7 +300,7 @@
<div class="large-12 columns"> <div class="large-12 columns">
<div class="line-t size-10 text-gray m10b p10t" ng-show="!index.isSingleAddress"> <div class="line-t size-10 text-gray m10b p10t" ng-show="!index.isSingleAddress">
<span translate> Share this wallet address to receive payments. To protect your privacy, new addresses are generated automatically once you use them.</span> <span translate> Share this wallet address to receive payments. To protect your privacy, new addresses are generated automatically once you use them.</span>
<a ng-show="!home.blockUx && !home.generatingAddress" ng-click="home.setAddress(true)" translate>Generate new address</a> <a ng-show="!home.generatingAddress" ng-click="home.setAddress(true)" translate>Generate new address</a>
</div> </div>
<div class="line-t size-10 text-gray m10b p10t" ng-show="index.isSingleAddress"> <div class="line-t size-10 text-gray m10b p10t" ng-show="index.isSingleAddress">
<span translate> Share this wallet address to receive payments</span>. <span translate> Share this wallet address to receive payments</span>.
@ -357,10 +322,10 @@
<h4 class="title m0"> <h4 class="title m0">
<available-balance ng-show="!index.shouldHideBalance"></available-balance> <available-balance ng-show="!index.shouldHideBalance"></available-balance>
<span <span
ng-show="home.lockedCurrentFeePerKb || home.blockUx || home.lockAmount" ng-show="home.lockedCurrentFeePerKb || home.lockAmount"
class="text-gray" translate>Send Max</span> class="text-gray" translate>Send Max</span>
<a <a
ng-show="index.availableBalanceSat > 0 && !home.lockedCurrentFeePerKb && !home.blockUx && !home.lockAmount" ng-show="index.availableBalanceSat > 0 && !home.lockedCurrentFeePerKb && !home.lockAmount"
ng-click="home.sendMax(index.availableBalanceSat)" ng-click="home.sendMax(index.availableBalanceSat)"
translate>Send Max translate>Send Max
</a> </a>
@ -380,7 +345,7 @@
</div> </div>
<div class="row m20t"> <div class="row m20t">
<div class="large-12 large-centered columns"> <div class="large-12 large-centered columns">
<form name="sendForm" ng-disabled="home.blockUx || home.onGoingProcess" novalidate> <form name="sendForm" novalidate>
<div ng-hide="home._paypro || home.hideAddress"> <div ng-hide="home._paypro || home.hideAddress">
<div class="row collapse"> <div class="row collapse">
@ -399,7 +364,7 @@
</div> </div>
<div class="input"> <div class="input">
<input ng-show="sendForm.address.$invalid" class="m0" type="text" id="address" name="address" ng-disabled="home.blockUx || home.lockAddress" ng-attr-placeholder="{{'Bitcoin address'|translate}}" ng-model="_address" valid-address required ng-focus="home.formFocus('address')" ng-blur="home.formFocus(false)"> <input ng-show="sendForm.address.$invalid" class="m0" type="text" id="address" name="address" ng-disabled=" home.lockAddress" ng-attr-placeholder="{{'Bitcoin address'|translate}}" ng-model="_address" valid-address required ng-focus="home.formFocus('address')" ng-blur="home.formFocus(false)">
<div class="addressbook-input" ng-show="!sendForm.address.$invalid && _address"> <div class="addressbook-input" ng-show="!sendForm.address.$invalid && _address">
{{index.addressbook[_address] || _address}} {{index.addressbook[_address] || _address}}
</div> </div>
@ -441,7 +406,7 @@
<span translate>Amount</span> <span translate>Amount</span>
</label> </label>
<div class="input"> <div class="input">
<input type="number" id="amount" ng-disabled="home.blockUx || home.lockAmount" name="amount" ng-attr-placeholder="{{'Amount in'|translate}} {{home.unitName}}" ng-minlength="0.00000001" ng-maxlength="10000000000" ng-model="_amount" valid-amount required autocomplete="off" ng-focus="home.formFocus('amount')" ng-blur="home.formFocus(false)"> <input type="number" id="amount" ng-disabled=" home.lockAmount" name="amount" ng-attr-placeholder="{{'Amount in'|translate}} {{home.unitName}}" ng-minlength="0.00000001" ng-maxlength="10000000000" ng-model="_amount" valid-amount required autocomplete="off" ng-focus="home.formFocus('amount')" ng-blur="home.formFocus(false)">
<input type="number" id="alternative" name="alternative" ng-model="_alternative" style="display:none"> <input type="number" id="alternative" name="alternative" ng-model="_alternative" style="display:none">
<a class="postfix button" ng-style="{'background-color':index.backgroundColor}" ng-click="home.showAlternative()">{{home.unitName}}</a> <a class="postfix button" ng-style="{'background-color':index.backgroundColor}" ng-click="home.showAlternative()">{{home.unitName}}</a>
</div> </div>
@ -450,7 +415,7 @@
<label for="alternative"><span translate>Amount</span> [{{ home.alternativeIsoCode }}] <label for="alternative"><span translate>Amount</span> [{{ home.alternativeIsoCode }}]
</label> </label>
<div class="input"> <div class="input">
<input type="number" id="alternative" ng-disabled="home.blockUx || !home.isRateAvailable || home.lockAmount" name="alternative" ng-attr-placeholder="{{'Amount in'|translate}} {{ home.alternativeName }}" ng-model="_alternative" required autocomplete="off" ng-focus="home.formFocus('amount')" ng-blur="home.formFocus(false)"> <input type="number" id="alternative" ng-disabled="!home.isRateAvailable || home.lockAmount" name="alternative" ng-attr-placeholder="{{'Amount in'|translate}} {{ home.alternativeName }}" ng-model="_alternative" required autocomplete="off" ng-focus="home.formFocus('amount')" ng-blur="home.formFocus(false)">
<input type="number" id="amount" name="amount" ng-model="_amount" style="display:none"> <input type="number" id="amount" name="amount" ng-model="_amount" style="display:none">
<a class="postfix button black" ng-click="home.hideAlternative()"> {{ home.alternativeIsoCode }}</a> <a class="postfix button black" ng-click="home.hideAlternative()"> {{ home.alternativeIsoCode }}</a>
</div> </div>
@ -464,19 +429,19 @@
<small translate class="has-error" ng-show="sendForm.comment.$invalid && !sendForm.comment.$pristine">too long!</small> <small translate class="has-error" ng-show="sendForm.comment.$invalid && !sendForm.comment.$pristine">too long!</small>
</label> </label>
<div class="input"> <div class="input">
<textarea id="comment" ng-disabled="home.blockUx" name="comment" <textarea id="comment" name="comment"
ng-maxlength="500" ng-model="_comment" ng-focus="home.formFocus('msg')" ng-maxlength="500" ng-model="_comment" ng-focus="home.formFocus('msg')"
ng-blur="home.formFocus(false)"></textarea> ng-blur="home.formFocus(false)"></textarea>
</div> </div>
</div> </div>
</div> </div>
<div class="row" ng-show="!home.onGoingProcess"> <div class="row">
<div class="large-6 medium-6 small-6 columns" ng-show="!home.blockUx && (home._paypro || home.lockAddress || home.lockAmount)"> <div class="large-6 medium-6 small-6 columns" ng-show="(home._paypro || home.lockAddress || home.lockAmount)">
<a ng-click="home.resetForm(sendForm)" class="button expand outline dark-gray round" translate>Cancel</a> <a ng-click="home.resetForm(sendForm)" class="button expand outline dark-gray round" translate>Cancel</a>
</div> </div>
<div class="columns" ng-class="{'small-6 medium-6 large-6':(home._paypro || home.lockAddress || home.lockAmount)}"> <div class="columns" ng-class="{'small-6 medium-6 large-6':(home._paypro || home.lockAddress || home.lockAmount)}">
<button class="button black round expand" ng-disabled="sendForm.$invalid || home.blockUx || index.isOffline || home.paymentExpired" <button class="button black round expand" ng-disabled="sendForm.$invalid || home.paymentExpired"
ng-style="{'background-color':index.backgroundColor}" ng-click="home.submitForm()" translate> ng-style="{'background-color':index.backgroundColor}" ng-click="home.submitForm()" translate>
Send Send
</button> </button>

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,10 +1,12 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('disclaimerController', angular.module('copayApp.controllers').controller('disclaimerController',
function($scope, $timeout, $log, $ionicSideMenuDelegate, profileService, applicationService, gettextCatalog, uxLanguage, go, storageService) { function($scope, $timeout, $log, $ionicSideMenuDelegate, profileService, applicationService, gettextCatalog, uxLanguage, go, storageService, gettext, platformInfo, ongoingProcess) {
var self = this; var self = this;
self.tries = 0; self.tries = 0;
self.creatingProfile = true; var isCordova = platformInfo.isCordova;
ongoingProcess.set('creatingWallet', true);
var create = function(opts) { var create = function(opts) {
opts = opts || {}; opts = opts || {};
@ -30,7 +32,7 @@ angular.module('copayApp.controllers').controller('disclaimerController',
}; };
$scope.error = ""; $scope.error = "";
self.creatingProfile = false; ongoingProcess.set('creatingWallet', false);
}); });
}; };
@ -43,7 +45,7 @@ angular.module('copayApp.controllers').controller('disclaimerController',
create(opts); create(opts);
} else { } else {
$log.info('There is already a profile'); $log.info('There is already a profile');
self.creatingProfile = false; ongoingProcess.set('creatingWallet', false);
profileService.bindProfile(profile, function(err) { profileService.bindProfile(profile, function(err) {
if (!err || !err.message || !err.message.match('NONAGREEDDISCLAIMER')) { if (!err || !err.message || !err.message.match('NONAGREEDDISCLAIMER')) {
$log.debug('Disclaimer already accepted at #disclaimer. Redirect to Wallet Home.'); $log.debug('Disclaimer already accepted at #disclaimer. Redirect to Wallet Home.');

View file

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

View file

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

View file

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

View file

@ -1,6 +1,6 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('indexController', function($rootScope, $scope, $log, $filter, $timeout, $ionicScrollDelegate, $ionicPopup, latestReleaseService, feeService, bwcService, pushNotificationsService, lodash, go, profileService, configService, rateService, storageService, addressService, gettext, gettextCatalog, amMoment, addonManager, bwsError, txFormatService, uxLanguage, glideraService, coinbaseService, platformInfo, addressbookService, openURLService) { angular.module('copayApp.controllers').controller('indexController', function($rootScope, $scope, $log, $filter, $timeout, $ionicScrollDelegate, $ionicPopup, latestReleaseService, feeService, bwcService, pushNotificationsService, lodash, go, profileService, configService, rateService, storageService, addressService, gettext, gettextCatalog, amMoment, addonManager, bwsError, txFormatService, uxLanguage, glideraService, coinbaseService, platformInfo, addressbookService, openURLService, ongoingProcess) {
var self = this; var self = this;
var SOFT_CONFIRMATION_LIMIT = 12; var SOFT_CONFIRMATION_LIMIT = 12;
var errors = bwcService.getErrors(); var errors = bwcService.getErrors();
@ -14,7 +14,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
ret.isChromeApp = isChromeApp; ret.isChromeApp = isChromeApp;
ret.isSafari = platformInfo.isSafari; ret.isSafari = platformInfo.isSafari;
ret.isWindowsPhoneApp = platformInfo.isWP; ret.isWindowsPhoneApp = platformInfo.isWP;
ret.onGoingProcess = {};
ret.historyShowLimit = 10; ret.historyShowLimit = 10;
ret.historyShowMoreLimit = 10; ret.historyShowMoreLimit = 10;
ret.isSearching = false; ret.isSearching = false;
@ -81,24 +80,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
storageService.setHideBalanceFlag(self.walletId, self.shouldHideBalance, function() {}); storageService.setHideBalanceFlag(self.walletId, self.shouldHideBalance, function() {});
} }
self.setOngoingProcess = function(processName, isOn) {
$log.debug('onGoingProcess', processName, isOn);
self[processName] = isOn;
self.onGoingProcess[processName] = isOn;
var name;
self.anyOnGoingProcess = lodash.any(self.onGoingProcess, function(isOn, processName) {
if (isOn)
name = name || processName;
return isOn;
});
// The first one
self.onGoingProcessName = name;
$timeout(function() {
$rootScope.$apply();
});
};
self.cleanInstance = function() { self.cleanInstance = function() {
$log.debug('Cleaning Index Instance'); $log.debug('Cleaning Index Instance');
lodash.each(self, function(v, k) { lodash.each(self, function(v, k) {
@ -125,16 +106,17 @@ angular.module('copayApp.controllers').controller('indexController', function($r
var fc = profileService.focusedClient; var fc = profileService.focusedClient;
if (!fc) return; if (!fc) return;
ongoingProcess.clear();
self.cleanInstance(); self.cleanInstance();
self.loadingWallet = true; self.loadingWallet = true;
self.setSpendUnconfirmed(); self.setSpendUnconfirmed();
$timeout(function() { $timeout(function() {
$rootScope.$apply(); $rootScope.$apply();
self.hasProfile = true; self.hasProfile = true;
self.isSingleAddress = false; self.isSingleAddress = false;
self.noFocusedWallet = false; self.noFocusedWallet = false;
self.onGoingProcess = {};
// Credentials Shortcuts // Credentials Shortcuts
self.m = fc.credentials.m; self.m = fc.credentials.m;
@ -303,7 +285,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
} else { } else {
self.isSingleAddress = !!ret.wallet.singleAddress; self.isSingleAddress = !!ret.wallet.singleAddress;
if (!opts.quiet) if (!opts.quiet)
self.setOngoingProcess('scanning', ret.wallet.scanStatus == 'running'); ongoingProcess.set('scanning', ret.wallet.scanStatus == 'running');
} }
return cb(err, ret); return cb(err, ret);
}); });
@ -320,7 +302,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
$timeout(function() { $timeout(function() {
if (!opts.quiet) if (!opts.quiet)
self.setOngoingProcess('updatingStatus', true); ongoingProcess.set('updatingStatus', true);
$log.debug('Updating Status:', fc.credentials.walletName, tries); $log.debug('Updating Status:', fc.credentials.walletName, tries);
get(function(err, walletStatus) { get(function(err, walletStatus) {
@ -340,8 +322,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
if (walletId != profileService.focusedClient.credentials.walletId) if (walletId != profileService.focusedClient.credentials.walletId)
return; return;
if (!opts.quiet) ongoingProcess.set('updatingStatus', false);
self.setOngoingProcess('updatingStatus', false);
if (err) { if (err) {
@ -389,10 +370,10 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.updateBalance = function() { self.updateBalance = function() {
var fc = profileService.focusedClient; var fc = profileService.focusedClient;
$timeout(function() { $timeout(function() {
self.setOngoingProcess('updatingBalance', true); ongoingProcess.set('updatingBalance', true);
$log.debug('Updating Balance'); $log.debug('Updating Balance');
fc.getBalance(function(err, balance) { fc.getBalance(function(err, balance) {
self.setOngoingProcess('updatingBalance', false); ongoingProcess.set('updatingBalance', false);
if (err) { if (err) {
self.handleError(err); self.handleError(err);
return; return;
@ -406,10 +387,10 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.updatePendingTxps = function() { self.updatePendingTxps = function() {
var fc = profileService.focusedClient; var fc = profileService.focusedClient;
$timeout(function() { $timeout(function() {
self.setOngoingProcess('updatingPendingTxps', true); ongoingProcess.set('updatingPendingTxps', true);
$log.debug('Updating PendingTxps'); $log.debug('Updating PendingTxps');
fc.getTxProposals({}, function(err, txps) { fc.getTxProposals({}, function(err, txps) {
self.setOngoingProcess('updatingPendingTxps', false); ongoingProcess.set('updatingPendingTxps', false);
if (err) { if (err) {
self.handleError(err); self.handleError(err);
} else { } else {
@ -445,10 +426,10 @@ angular.module('copayApp.controllers').controller('indexController', function($r
var fc = profileService.focusedClient; var fc = profileService.focusedClient;
$timeout(function() { $timeout(function() {
$rootScope.$apply(); $rootScope.$apply();
self.setOngoingProcess('openingWallet', true); ongoingProcess.set('openingWallet', true);
self.updateError = false; self.updateError = false;
fc.openWallet(function(err, walletStatus) { fc.openWallet(function(err, walletStatus) {
self.setOngoingProcess('openingWallet', false); ongoingProcess.set('openingWallet', false);
if (err) { if (err) {
self.updateError = true; self.updateError = true;
self.handleError(err); self.handleError(err);
@ -997,10 +978,10 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.recreate = function(cb) { self.recreate = function(cb) {
var fc = profileService.focusedClient; var fc = profileService.focusedClient;
self.setOngoingProcess('recreating', true); ongoingProcess.set('recreating', true);
fc.recreateWallet(function(err) { fc.recreateWallet(function(err) {
self.notAuthorized = false; self.notAuthorized = false;
self.setOngoingProcess('recreating', false); ongoingProcess.set('recreating', false);
if (err) { if (err) {
self.handleError(err); self.handleError(err);
@ -1034,13 +1015,13 @@ angular.module('copayApp.controllers').controller('indexController', function($r
if (!c.isComplete()) return; if (!c.isComplete()) return;
if (self.walletId == walletId) if (self.walletId == walletId)
self.setOngoingProcess('scanning', true); ongoingProcess.set('scanning', true);
c.startScan({ c.startScan({
includeCopayerBranches: true, includeCopayerBranches: true,
}, function(err) { }, function(err) {
if (err && self.walletId == walletId) { if (err && self.walletId == walletId) {
self.setOngoingProcess('scanning', false); ongoingProcess.set('scanning', false);
self.handleError(err); self.handleError(err);
$rootScope.$apply(); $rootScope.$apply();
} }
@ -1076,9 +1057,9 @@ angular.module('copayApp.controllers').controller('indexController', function($r
getToken(function(err, accessToken) { getToken(function(err, accessToken) {
if (err || !accessToken) return; if (err || !accessToken) return;
else { else {
self.glideraLoading = 'Connecting to Glidera...'; ongoingProcess.set('connectingGlidera', true);
glideraService.getAccessTokenPermissions(accessToken, function(err, p) { glideraService.getAccessTokenPermissions(accessToken, function(err, p) {
self.glideraLoading = null; ongoingProcess.set('connectingGlidera', false);
if (err) { if (err) {
self.glideraError = err; self.glideraError = err;
} else { } else {
@ -1109,24 +1090,24 @@ angular.module('copayApp.controllers').controller('indexController', function($r
}); });
if (permissions.transaction_history) { if (permissions.transaction_history) {
self.glideraLoadingHistory = 'Getting Glidera transactions...'; ongoingProcess.set('Fetching Glidera Transactions', true);
glideraService.getTransactions(accessToken, function(err, data) { glideraService.getTransactions(accessToken, function(err, data) {
self.glideraLoadingHistory = null; ongoingProcess.set('Fetching Glidera Transactions', false);
self.glideraTxs = data; self.glideraTxs = data;
}); });
} }
if (permissions.view_email_address && opts.fullUpdate) { if (permissions.view_email_address && opts.fullUpdate) {
self.glideraLoadingEmail = 'Getting Glidera Email...'; ongoingProcess.set('connectingGlidera', true);
glideraService.getEmail(accessToken, function(err, data) { glideraService.getEmail(accessToken, function(err, data) {
self.glideraLoadingEmail = null; ongoingProcess.set('connectingGlidera', false);
self.glideraEmail = data.email; self.glideraEmail = data.email;
}); });
} }
if (permissions.personal_info && opts.fullUpdate) { if (permissions.personal_info && opts.fullUpdate) {
self.glideraLoadingPersonalInfo = 'Getting Glidera Personal Information...'; ongoingProcess.set('connectingGlidera', true);
glideraService.getPersonalInfo(accessToken, function(err, data) { glideraService.getPersonalInfo(accessToken, function(err, data) {
self.glideraLoadingPersonalInfo = null; ongoingProcess.set('connectingGlidera', false);
self.glideraPersonalInfo = data; self.glideraPersonalInfo = data;
}); });
} }
@ -1161,9 +1142,9 @@ angular.module('copayApp.controllers').controller('indexController', function($r
getToken(function(err, accessToken) { getToken(function(err, accessToken) {
if (err || !accessToken) return; if (err || !accessToken) return;
else { else {
self.coinbaseLoading = 'Getting primary account...'; ongoingProcess.set('Getting primary account...', true);
coinbaseService.getAccounts(accessToken, function(err, a) { coinbaseService.getAccounts(accessToken, function(err, a) {
self.coinbaseLoading = null; ongoingProcess.set('Getting primary account...', false);
if (err) { if (err) {
self.coinbaseError = err; self.coinbaseError = err;
if (err.errors[0] && err.errors[0].id == 'expired_token') { if (err.errors[0] && err.errors[0].id == 'expired_token') {
@ -1428,16 +1409,11 @@ angular.module('copayApp.controllers').controller('indexController', function($r
}); });
$rootScope.$on('Local/ValidatingWallet', function() { $rootScope.$on('Local/ValidatingWallet', function() {
if (isCordova) { ongoingProcess.set('validatingWallet', true);
window.plugins.spinnerDialog.hide();
window.plugins.spinnerDialog.show(null, gettext('Validating wallet integrity...'), true);
}
}); });
$rootScope.$on('Local/ProfileBound', function() { $rootScope.$on('Local/ProfileBound', function() {
if (isCordova) { ongoingProcess.set('validatingWallet', false);
window.plugins.spinnerDialog.hide();
}
}); });
$rootScope.$on('Local/ClearHistory', function(event) { $rootScope.$on('Local/ClearHistory', function(event) {
@ -1519,93 +1495,49 @@ angular.module('copayApp.controllers').controller('indexController', function($r
} }
}; };
$rootScope.$on('Local/Resume', function(event) { $rootScope.$on('Local/Resume', function(event) {
$log.debug('### Resume event'); $log.debug('### Resume event');
profileService.isDisclaimerAccepted(function(v) { profileService.isDisclaimerAccepted(function(v) {
if (!v) { if (!v) {
$log.debug('Disclaimer not accepted, resume to home'); $log.debug('Disclaimer not accepted, resume to home');
go.path('disclaimer'); go.path('disclaimer');
} }
});
self.debouncedUpdate();
}); });
self.debouncedUpdate();
});
$rootScope.$on('Local/BackupDone', function(event, walletId) { $rootScope.$on('Local/BackupDone', function(event, walletId) {
self.needsBackup = false; self.needsBackup = false;
$log.debug('Backup done'); $log.debug('Backup done');
storageService.setBackupFlag(walletId || self.walletId, function(err) { storageService.setBackupFlag(walletId || self.walletId, function(err) {
$log.debug('Backup stored'); $log.debug('Backup stored');
});
});
$rootScope.$on('Local/DeviceError', function(event, err) {
self.showErrorPopup(err, function() {
if (isCordova && navigator && navigator.app) {
navigator.app.exitApp();
}
});
});
$rootScope.$on('Local/WalletImported', function(event, walletId) {
self.needsBackup = false;
storageService.setBackupFlag(walletId, function() {
$log.debug('Backup done stored');
addressService.expireAddress(walletId, function(err) {
$timeout(function() {
self.txHistory = self.completeHistory = self.txHistorySearchResults = [];
storageService.removeTxHistory(walletId, function() {
self.startScan(walletId);
});
}, 500);
}); });
}); });
});
$rootScope.$on('NewIncomingTx', function() { $rootScope.$on('Local/DeviceError', function(event, err) {
self.newTx = true; self.showErrorPopup(err, function() {
self.updateAll({ if (isCordova && navigator && navigator.app) {
walletStatus: null, navigator.app.exitApp();
untilItChanges: true, }
triggerTxUpdate: true, });
}); });
});
$rootScope.$on('Local/WalletImported', function(event, walletId) {
$rootScope.$on('NewBlock', function() { self.needsBackup = false;
if (self.glideraEnabled) { storageService.setBackupFlag(walletId, function() {
$timeout(function() { $log.debug('Backup done stored');
self.updateGlidera(); addressService.expireAddress(walletId, function(err) {
$timeout(function() {
self.txHistory = self.completeHistory = self.txHistorySearchResults = [];
storageService.removeTxHistory(walletId, function() {
self.startScan(walletId);
});
}, 500);
});
}); });
} });
if (self.coinbaseEnabled) {
$timeout(function() {
self.updateCoinbase();
});
}
if (self.pendingAmount) {
self.updateAll({
walletStatus: null,
untilItChanges: null,
triggerTxUpdate: true,
});
} else if (self.hasUnsafeConfirmed) {
$log.debug('Wallet has transactions with few confirmations. Updating.')
if (self.network == 'testnet') {
self.throttledUpdateHistory();
} else {
self.debounceUpdateHistory();
}
}
});
$rootScope.$on('BalanceUpdated', function(e, n) { $rootScope.$on('NewIncomingTx', function() {
self.setBalance(n.data);
});
//untilItChange TRUE
lodash.each(['NewOutgoingTx', 'NewOutgoingTxByThirdParty'], function(eventName) {
$rootScope.$on(eventName, function(event) {
self.newTx = true; self.newTx = true;
self.updateAll({ self.updateAll({
walletStatus: null, walletStatus: null,
@ -1613,200 +1545,245 @@ lodash.each(['NewOutgoingTx', 'NewOutgoingTxByThirdParty'], function(eventName)
triggerTxUpdate: true, triggerTxUpdate: true,
}); });
}); });
});
//untilItChange FALSE
lodash.each(['NewTxProposal', 'TxProposalFinallyRejected', 'TxProposalRemoved', 'NewOutgoingTxByThirdParty', $rootScope.$on('NewBlock', function() {
'Local/GlideraTx' if (self.glideraEnabled) {
], function(eventName) { $timeout(function() {
$rootScope.$on(eventName, function(event) { self.updateGlidera();
});
}
if (self.coinbaseEnabled) {
$timeout(function() {
self.updateCoinbase();
});
}
if (self.pendingAmount) {
self.updateAll({
walletStatus: null,
untilItChanges: null,
triggerTxUpdate: true,
});
} else if (self.hasUnsafeConfirmed) {
$log.debug('Wallet has transactions with few confirmations. Updating.')
if (self.network == 'testnet') {
self.throttledUpdateHistory();
} else {
self.debounceUpdateHistory();
}
}
});
$rootScope.$on('BalanceUpdated', function(e, n) {
self.setBalance(n.data);
});
//untilItChange TRUE
lodash.each(['NewOutgoingTx', 'NewOutgoingTxByThirdParty'], function(eventName) {
$rootScope.$on(eventName, function(event) {
self.newTx = true;
self.updateAll({
walletStatus: null,
untilItChanges: true,
triggerTxUpdate: true,
});
});
});
//untilItChange FALSE
lodash.each(['NewTxProposal', 'TxProposalFinallyRejected', 'TxProposalRemoved', 'NewOutgoingTxByThirdParty',
'Local/GlideraTx'
], function(eventName) {
$rootScope.$on(eventName, function(event) {
self.updateAll({
walletStatus: null,
untilItChanges: null,
triggerTxUpdate: true,
});
});
});
//untilItChange Maybe
$rootScope.$on('Local/TxProposalAction', function(event, untilItChanges) {
self.newTx = untilItChanges;
self.updateAll({ self.updateAll({
walletStatus: null, walletStatus: null,
untilItChanges: null, untilItChanges: untilItChanges,
triggerTxUpdate: true, triggerTxUpdate: true,
}); });
}); });
});
$rootScope.$on('ScanFinished', function() {
//untilItChange Maybe $log.debug('Scan Finished. Updating history');
$rootScope.$on('Local/TxProposalAction', function(event, untilItChanges) { storageService.removeTxHistory(self.walletId, function() {
self.newTx = untilItChanges; self.updateAll({
self.updateAll({ walletStatus: null,
walletStatus: null, triggerTxUpdate: true,
untilItChanges: untilItChanges, });
triggerTxUpdate: true,
});
});
$rootScope.$on('ScanFinished', function() {
$log.debug('Scan Finished. Updating history');
storageService.removeTxHistory(self.walletId, function() {
self.updateAll({
walletStatus: null,
triggerTxUpdate: true,
}); });
}); });
});
lodash.each(['TxProposalRejectedBy', 'TxProposalAcceptedBy'], function(eventName) { lodash.each(['TxProposalRejectedBy', 'TxProposalAcceptedBy'], function(eventName) {
$rootScope.$on(eventName, function() { $rootScope.$on(eventName, function() {
var f = function() { var f = function() {
if (self.updatingStatus) { if (self.updatingStatus) {
return $timeout(f, 200); return $timeout(f, 200);
};
self.updatePendingTxps();
}; };
self.updatePendingTxps(); f();
}; });
f();
}); });
});
$rootScope.$on('Local/NoWallets', function(event) { $rootScope.$on('Local/NoWallets', function(event) {
$timeout(function() { $timeout(function() {
self.hasProfile = true; self.hasProfile = true;
self.noFocusedWallet = true; self.noFocusedWallet = true;
self.isComplete = null; self.isComplete = null;
self.walletName = null; self.walletName = null;
uxLanguage.update();
profileService.isDisclaimerAccepted(function(v) {
if (v) {
go.path('import');
}
});
});
});
$rootScope.$on('Local/NewFocusedWallet', function() {
uxLanguage.update(); uxLanguage.update();
self.setFocusedWallet();
self.updateHistory();
storageService.getCleanAndScanAddresses(function(err, walletId) {
profileService.isDisclaimerAccepted(function(v) { if (walletId && profileService.walletClients[walletId]) {
if (v) { $log.debug('Clear last address cache and Scan ', walletId);
go.path('import'); addressService.expireAddress(walletId, function(err) {
self.startScan(walletId);
});
storageService.removeCleanAndScanAddresses(function() {
$rootScope.$emit('Local/NewFocusedWalletReady');
});
} else {
$rootScope.$emit('Local/NewFocusedWalletReady');
} }
}); });
}); });
});
$rootScope.$on('Local/NewFocusedWallet', function() { $rootScope.$on('Local/SetTab', function(event, tab, reset) {
uxLanguage.update(); self.setTab(tab, reset);
self.setFocusedWallet(); });
self.updateHistory();
storageService.getCleanAndScanAddresses(function(err, walletId) {
if (walletId && profileService.walletClients[walletId]) { $rootScope.$on('Local/NeedsConfirmation', function(event, txp, cb) {
$log.debug('Clear last address cache and Scan ', walletId);
addressService.expireAddress(walletId, function(err) { function openConfirmationPopup(txp, cb) {
self.startScan(walletId);
$scope.tx = txFormatService.processTx(txp);
self.confirmationPopup = $ionicPopup.show({
templateUrl: 'views/includes/confirm-tx.html',
scope: $scope,
}); });
storageService.removeCleanAndScanAddresses(function() {
$rootScope.$emit('Local/NewFocusedWalletReady'); $scope.processFee = function(amount, fee) {
}); var walletSettings = configService.getSync().wallet.settings;
} else { var feeAlternativeIsoCode = walletSettings.alternativeIsoCode;
$rootScope.$emit('Local/NewFocusedWalletReady');
$scope.feeLevel = feeService.feeOpts[feeService.getCurrentFeeLevel()];
$scope.feeAlternativeStr = parseFloat((rateService.toFiat(fee, feeAlternativeIsoCode)).toFixed(2), 10) + ' ' + feeAlternativeIsoCode;
$scope.feeRateStr = (fee / (amount + fee) * 100).toFixed(2) + '%';
};
$scope.cancel = function() {
return cb();
};
$scope.accept = function() {
return cb(true);
};
} }
openConfirmationPopup(txp, function(accept) {
self.confirmationPopup.close();
return cb(accept);
});
}); });
});
$rootScope.$on('Local/SetTab', function(event, tab, reset) { $rootScope.$on('Local/NeedsPassword', function(event, isSetup, cb) {
self.setTab(tab, reset);
});
$rootScope.$on('Local/NeedsConfirmation', function(event, txp, cb) { function openPasswordPopup(isSetup, cb) {
$scope.data = {};
$scope.data.password = null;
$scope.isSetup = isSetup;
$scope.isVerification = false;
$scope.loading = false;
var pass = null;
function openConfirmationPopup(txp, cb) { self.passwordPopup = $ionicPopup.show({
templateUrl: 'views/includes/password.html',
scope: $scope,
});
$scope.tx = txFormatService.processTx(txp); $scope.cancel = function() {
return cb('No spending password given');
};
self.confirmationPopup = $ionicPopup.show({ $scope.set = function() {
templateUrl: 'views/includes/confirm-tx.html', $scope.loading = true;
scope: $scope, $scope.error = null;
$timeout(function() {
if (isSetup && !$scope.isVerification) {
$scope.loading = false;
$scope.isVerification = true;
pass = $scope.data.password;
$scope.data.password = null;
return;
}
if (isSetup && pass != $scope.data.password) {
$scope.loading = false;
$scope.error = gettext('Spending Passwords do not match');
$scope.isVerification = false;
$scope.data.password = null;
pass = null;
return;
}
return cb(null, $scope.data.password);
}, 100);
};
};
openPasswordPopup(isSetup, function(err, pass) {
self.passwordPopup.close();
return cb(err, pass);
}); });
$scope.processFee = function(amount, fee) {
var walletSettings = configService.getSync().wallet.settings;
var feeAlternativeIsoCode = walletSettings.alternativeIsoCode;
$scope.feeLevel = feeService.feeOpts[feeService.getCurrentFeeLevel()];
$scope.feeAlternativeStr = parseFloat((rateService.toFiat(fee, feeAlternativeIsoCode)).toFixed(2), 10) + ' ' + feeAlternativeIsoCode;
$scope.feeRateStr = (fee / (amount + fee) * 100).toFixed(2) + '%';
};
$scope.cancel = function() {
return cb();
};
$scope.accept = function() {
return cb(true);
};
}
openConfirmationPopup(txp, function(accept) {
self.confirmationPopup.close();
return cb(accept);
}); });
});
$rootScope.$on('Local/NeedsPassword', function(event, isSetup, cb) { $rootScope.$on('Local/EmailUpdated', function(event, email) {
self.preferences.email = email;
});
function openPasswordPopup(isSetup, cb) { lodash.each(['NewCopayer', 'CopayerUpdated'], function(eventName) {
$scope.data = {}; $rootScope.$on(eventName, function() {
$scope.data.password = null; // Re try to open wallet (will triggers)
$scope.isSetup = isSetup; self.setFocusedWallet();
$scope.isVerification = false;
$scope.loading = false;
var pass = null;
self.passwordPopup = $ionicPopup.show({
templateUrl: 'views/includes/password.html',
scope: $scope,
}); });
$scope.cancel = function() {
return cb('No spending password given');
};
$scope.set = function() {
$scope.loading = true;
$scope.error = null;
$timeout(function() {
if (isSetup && !$scope.isVerification) {
$scope.loading = false;
$scope.isVerification = true;
pass = $scope.data.password;
$scope.data.password = null;
return;
}
if (isSetup && pass != $scope.data.password) {
$scope.loading = false;
$scope.error = gettext('Spending Passwords do not match');
$scope.isVerification = false;
$scope.data.password = null;
pass = null;
return;
}
return cb(null, $scope.data.password);
}, 100);
};
};
openPasswordPopup(isSetup, function(err, pass) {
self.passwordPopup.close();
return cb(err, pass);
}); });
}); $rootScope.$on('Local/NewEncryptionSetting', function() {
var fc = profileService.focusedClient;
$rootScope.$on('Local/EmailUpdated', function(event, email) { self.isPrivKeyEncrypted = fc.isPrivKeyEncrypted();
self.preferences.email = email; $timeout(function() {
}); $rootScope.$apply();
});
lodash.each(['NewCopayer', 'CopayerUpdated'], function(eventName) {
$rootScope.$on(eventName, function() {
// Re try to open wallet (will triggers)
self.setFocusedWallet();
}); });
});
$rootScope.$on('Local/NewEncryptionSetting', function() {
var fc = profileService.focusedClient;
self.isPrivKeyEncrypted = fc.isPrivKeyEncrypted();
$timeout(function() {
$rootScope.$apply();
});
});
/* Start setup */ /* Start setup */
lodash.assign(self, vanillaScope); openURLService.init(); lodash.assign(self, vanillaScope);
openURLService.init();
}); });

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,6 @@
'use strict'; '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, 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, ongoingProcess) {
var isCordova = platformInfo.isCordova; var isCordova = platformInfo.isCordova;
var isWP = platformInfo.isWP; var isWP = platformInfo.isWP;
@ -93,10 +93,6 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
}; };
}); });
var disableOngoingProcessListener = $rootScope.$on('Addon/OngoingProcess', function(e, name) {
self.setOngoingProcess(name);
});
$scope.$on('$destroy', function() { $scope.$on('$destroy', function() {
disableAddrListener(); disableAddrListener();
disableScannerListener(); disableScannerListener();
@ -104,7 +100,6 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
disableTabListener(); disableTabListener();
disableFocusListener(); disableFocusListener();
disableResumeListener(); disableResumeListener();
disableOngoingProcessListener();
$rootScope.shouldHideMenuBar = false; $rootScope.shouldHideMenuBar = false;
}); });
@ -398,26 +393,6 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
}, 1); }, 1);
}; };
// subscription
this.setOngoingProcess = function(name) {
var self = this;
self.blockUx = !!name;
if (isCordova) {
if (name) {
window.plugins.spinnerDialog.hide();
window.plugins.spinnerDialog.show(null, name + '...', true);
} else {
window.plugins.spinnerDialog.hide();
}
} else {
self.onGoingProcess = name;
$timeout(function() {
$rootScope.$apply();
});
};
};
this.submitForm = function() { this.submitForm = function() {
if (!$scope._amount || !$scope._address) return; if (!$scope._amount || !$scope._address) return;
var client = profileService.focusedClient; var client = profileService.focusedClient;
@ -473,9 +448,9 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
txp.excludeUnconfirmedUtxos = configWallet.spendUnconfirmed ? false : true; txp.excludeUnconfirmedUtxos = configWallet.spendUnconfirmed ? false : true;
txp.feeLevel = walletSettings.feeLevel || 'normal'; txp.feeLevel = walletSettings.feeLevel || 'normal';
self.setOngoingProcess(gettextCatalog.getString('Creating transaction')); ongoingProcess.set('creatingTx', true);
walletService.createTx(client, txp, function(err, createdTxp) { walletService.createTx(client, txp, function(err, createdTxp) {
self.setOngoingProcess(); ongoingProcess.set('creatingTx', false);
if (err) { if (err) {
return self.setSendError(err); return self.setSendError(err);
} }
@ -511,16 +486,16 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
return self.setSendError(err); return self.setSendError(err);
} }
self.setOngoingProcess(gettextCatalog.getString('Sending transaction')); ongoingProcess.set('sendingTx', true);
walletService.publishTx(client, txp, function(err, publishedTxp) { walletService.publishTx(client, txp, function(err, publishedTxp) {
if (err) { if (err) {
self.setOngoingProcess(); ongoingProcess.set('sendingTx', false);
return self.setSendError(err); return self.setSendError(err);
} }
self.setOngoingProcess(gettextCatalog.getString('Signing transaction')); ongoingProcess.set('signingTx', true);
walletService.signTx(client, publishedTxp, function(err, signedTxp) { walletService.signTx(client, publishedTxp, function(err, signedTxp) {
self.setOngoingProcess(); ongoingProcess.set('signingTx', false);
walletService.lock(client); walletService.lock(client);
if (err) { if (err) {
$scope.$emit('Local/TxProposalAction'); $scope.$emit('Local/TxProposalAction');
@ -531,9 +506,9 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
} }
if (signedTxp.status == 'accepted') { if (signedTxp.status == 'accepted') {
self.setOngoingProcess(gettextCatalog.getString('Broadcasting transaction')); ongoingProcess.set('broadcastingTx', true);
walletService.broadcastTx(client, signedTxp, function(err, broadcastedTxp) { walletService.broadcastTx(client, signedTxp, function(err, broadcastedTxp) {
self.setOngoingProcess(); ongoingProcess.set('broadcastingTx', false);
if (err) { if (err) {
return self.setSendError(err); return self.setSendError(err);
} }
@ -652,14 +627,14 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
var satToUnit = 1 / this.unitToSatoshi; var satToUnit = 1 / this.unitToSatoshi;
var self = this; var self = this;
/// Get information of payment if using Payment Protocol /// Get information of payment if using Payment Protocol
self.setOngoingProcess(gettextCatalog.getString('Fetching Payment Information')); ongoingProcess.set('fetchingPayPro', true);
$log.debug('Fetch PayPro Request...', uri); $log.debug('Fetch PayPro Request...', uri);
$timeout(function() { $timeout(function() {
fc.fetchPayPro({ fc.fetchPayPro({
payProUrl: uri, payProUrl: uri,
}, function(err, paypro) { }, function(err, paypro) {
self.setOngoingProcess(); ongoingProcess.set('fetchingPayPro', false);
if (err) { if (err) {
$log.warn('Could not fetch payment request:', err); $log.warn('Could not fetch payment request:', err);
@ -836,11 +811,11 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
var self = this; var self = this;
var fc = profileService.focusedClient; var fc = profileService.focusedClient;
this.error = null; this.error = null;
this.setOngoingProcess(gettextCatalog.getString('Calculating fee')); ongoingProcess.set('calculatingFee', true);
feeService.getCurrentFeeValue(function(err, feePerKb) { feeService.getCurrentFeeValue(function(err, feePerKb) {
ongoingProcess.set('calculatingFee', false);
if (err || !lodash.isNumber(feePerKb)) { if (err || !lodash.isNumber(feePerKb)) {
self.setOngoingProcess();
self.error = gettext('Could not get fee value'); self.error = gettext('Could not get fee value');
return; return;
} }
@ -850,10 +825,11 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
opts.returnInputs = true; opts.returnInputs = true;
var config = configService.getSync(); var config = configService.getSync();
opts.excludeUnconfirmedUtxos = !config.wallet.spendUnconfirmed; opts.excludeUnconfirmedUtxos = !config.wallet.spendUnconfirmed;
self.setOngoingProcess(gettextCatalog.getString('Retrieving inputs information')); ongoingProcess.set('retrivingInputs', true);
fc.getSendMaxInfo(opts, function(err, resp) { fc.getSendMaxInfo(opts, function(err, resp) {
self.setOngoingProcess(); ongoingProcess.set('retrivingInputs', false);
if (err) { if (err) {
self.error = err; self.error = err;
$scope.$apply(); $scope.$apply();

View file

@ -0,0 +1,75 @@
'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': gettextCatalog.getString('Updating Wallet...'),
'updatingStatus': gettextCatalog.getString('Updating Wallet...'),
'updatingBalance': gettextCatalog.getString('Updating Wallet...'),
'updatingPendingTxps': gettextCatalog.getString('Updating Wallet...'),
'scanning': gettextCatalog.getString('Scanning Wallet funds...'),
'recreating': gettextCatalog.getString('Recreating Wallet...'),
'generatingCSV': gettextCatalog.getString('Generating .csv file...'),
'creatingTx': gettextCatalog.getString('Creating transaction'),
'sendingTx': gettextCatalog.getString('Sending transaction'),
'signingTx': gettextCatalog.getString('Signing transaction'),
'broadcastingTx': gettextCatalog.getString('Broadcasting transaction'),
'fetchingPayPro': gettextCatalog.getString('Fetching Payment Information'),
'calculatingFee': gettextCatalog.getString('Calculating fee'),
'joiningWallet': gettextCatalog.getString('Joining Wallet...'),
'retrivingInputs': gettextCatalog.getString('Retrieving inputs information'),
'creatingWallet': gettextCatalog.getString('Creating Wallet...'),
'validatingWallet': gettextCatalog.getString('Validating wallet integrity...'),
'connectingledger': gettextCatalog.getString('Waiting for Ledger...'),
'connectingtrezor': gettextCatalog.getString('Waiting for Trezor...'),
'validatingWords': gettextCatalog.getString('Validating recovery phrase...'),
'connectingCoinbase': gettextCatalog.getString('Connecting to Coinbase...'),
'connectingGlidera': gettextCatalog.getString('Connecting to Glidera...'),
'importingWallet': gettextCatalog.getString('Importing Wallet...'),
'sweepingWallet': gettextCatalog.getString('Sweeping Wallet...'),
'deletingWallet': gettextCatalog.getString('Deleting Wallet...'),
};
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;
});

View file

@ -329,7 +329,7 @@ angular.module('copayApp.services')
return cb(null, walletClient, secret); return cb(null, walletClient, secret);
}); });
}); });
}, 5); }, 50);
}; };
// Creates the default Copay profile and its wallet // Creates the default Copay profile and its wallet

View file

@ -117,6 +117,7 @@ describe('createController', function() {
it('should create a 1-1 wallet from mnemonic', function(done) { it('should create a 1-1 wallet from mnemonic', function(done) {
var fakeForm = {}; var fakeForm = {};
console.log('[create.test.js.119]'); //TODO
// FROM DATA // FROM DATA
scope.seedSource = { scope.seedSource = {
id: 'set' id: 'set'
@ -131,8 +132,12 @@ describe('createController', function() {
scope._walletPrivKey = 'Kz4CFSTgLzoYfMkt97BTBotUbZYXjMts6Ej9HbVfCf5oLmun1BXy'; scope._walletPrivKey = 'Kz4CFSTgLzoYfMkt97BTBotUbZYXjMts6Ej9HbVfCf5oLmun1BXy';
ctrl.setSeedSource(); ctrl.setSeedSource();
console.log('[create.test.js.135]'); //TODO
ctrl.create(fakeForm); ctrl.create(fakeForm);
console.log('[create.test.js.138]'); //TODO
should.not.exist(ctrl.error); should.not.exist(ctrl.error);
mocks.go.walletHome.calledOnce.should.equal(true); mocks.go.walletHome.calledOnce.should.equal(true);
// //

View file

@ -74,7 +74,8 @@ describe('disclaimerController', function() {
mnemonic: 'tunnel fork scare industry noble snow tank bullet over gesture nuclear next', mnemonic: 'tunnel fork scare industry noble snow tank bullet over gesture nuclear next',
}); });
setTimeout(function() { setTimeout(function() {
ctrl.creatingProfile.should.equal(false); mocks.ongoingProcess.set.getCall(1).args[0].should.equal('creatingWallet');
mocks.ongoingProcess.set.getCall(1).args[1].should.equal(false);
done(); done();
}, 100); }, 100);
}); });

View file

@ -42,6 +42,10 @@ mocks.$timeout = function(cb) {
}; };
mocks.modal = function() {}; mocks.modal = function() {};
mocks.ongoingProcess = {
set: sinon.stub(),
clear: sinon.stub(),
};
mocks.setProfile = function(profile) {}; mocks.setProfile = function(profile) {};
@ -192,6 +196,7 @@ mocks.init = function(fixtures, controllerName, opts, done) {
ctrl = $controller(controllerName, { ctrl = $controller(controllerName, {
$scope: scope, $scope: scope,
$modal: mocks.modal, $modal: mocks.modal,
ongoingProcess: mocks.ongoingProcess,
notification: mocks.notification, notification: mocks.notification,
configService: _configService_, configService: _configService_,
profileService: _profileService_, profileService: _profileService_,