Merge pull request #4372 from matiu/ref/ongoingProcesses
Ref/ongoing processes
This commit is contained in:
commit
6ae228018f
40 changed files with 487 additions and 627 deletions
|
|
@ -19,13 +19,6 @@
|
|||
</section>
|
||||
</nav>
|
||||
|
||||
<div class="onGoingProcess" ng-show="wordsC.loading">
|
||||
<div class="onGoingProcess-content" ng-style="{'background-color':index.backgroundColor}">
|
||||
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
|
||||
<span translate>Validating recovery phrase...</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="box-notification" ng-show="wordsC.error">
|
||||
<span class="text-warning">
|
||||
{{wordsC.error|translate}}
|
||||
|
|
|
|||
|
|
@ -7,13 +7,6 @@
|
|||
|
||||
<div class="content coinbase" ng-controller="buyCoinbaseController as buy">
|
||||
|
||||
<div class="onGoingProcess" ng-show="buy.loading">
|
||||
<div class="onGoingProcess-content" ng-style="{'background-color': '#2b71b1'}">
|
||||
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
|
||||
<span>{{buy.loading}}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row m20t" ng-show="buy.error || index.coinbaseError" ng-click="buy.error = null">
|
||||
<div class="columns">
|
||||
<div class="box-notification">
|
||||
|
|
|
|||
|
|
@ -7,13 +7,6 @@
|
|||
|
||||
<div class="content glidera" ng-controller="buyGlideraController as buy">
|
||||
|
||||
<div class="onGoingProcess" ng-show="buy.loading">
|
||||
<div class="onGoingProcess-content" ng-style="{'background-color':index.backgroundColor}">
|
||||
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
|
||||
<span>{{buy.loading}}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-show="index.glideraLimits && !buy.show2faCodeInput && !buy.success">
|
||||
<h4 class="title m0 text-left">
|
||||
<span class="text-light">Daily buy limit</span>:
|
||||
|
|
|
|||
|
|
@ -25,15 +25,6 @@
|
|||
</div>
|
||||
|
||||
<div class="content coinbase p20b" ng-controller="coinbaseController as coinbase">
|
||||
|
||||
<div class="onGoingProcess" ng-show="coinbase.loading || index.coinbaseLoading">
|
||||
<div class="onGoingProcess-content" ng-style="{'background-color': '#2b71b1'}">
|
||||
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
|
||||
<span ng-show="coinbase.loading">Connecting to Coinbase...</span>
|
||||
<span ng-show="index.coinbaseLoading">{{index.coinbaseLoading}}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" ng-show="index.coinbaseError || (index.coinbaseToken && !index.coinbaseAccount)">
|
||||
<div class="m20b box-notification" ng-show="index.coinbaseError">
|
||||
<ul class="no-bullet m0 text-warning size-12">
|
||||
|
|
@ -57,7 +48,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-if="!index.coinbaseToken && !index.coinbaseLoading && !index.coinbaseError" class="row">
|
||||
<div ng-if="!index.coinbaseToken && !index.coinbaseError" class="row">
|
||||
<div class="box-notification text-center size-12 text-warning" ng-show="index.coinbaseTestnet">
|
||||
<i class="fi-info"></i>
|
||||
Testnet wallets only work with Coinbase Sandbox Accounts
|
||||
|
|
|
|||
|
|
@ -6,13 +6,6 @@
|
|||
|
||||
<div class="content coinbase" ng-controller="coinbaseUriController as coinbase" ng-init="coinbase.checkCode()">
|
||||
|
||||
<div class="onGoingProcess" ng-show="coinbase.loading">
|
||||
<div class="onGoingProcess-content" ng-style="{'background-color':index.backgroundColor}">
|
||||
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
|
||||
<span ng-show="coinbase.loading">Connecting to Coinbase...</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row m20t">
|
||||
<div class="large-12 columns">
|
||||
<div class="text-center">
|
||||
|
|
|
|||
|
|
@ -8,21 +8,6 @@
|
|||
|
||||
<ion-content overflow-scroll="true" class="content p20b" ng-controller="createController as create" ng-init="create.setTotalCopayers(1)">
|
||||
|
||||
<div class="onGoingProcess" ng-show="create.loading && !create.hwWallet">
|
||||
<div class="onGoingProcess-content" ng-style="{'background-color':'#222'}">
|
||||
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
|
||||
<span translate>Creating Wallet...</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="onGoingProcess" ng-show="create.hwWallet">
|
||||
<div class="onGoingProcess-content" ng-style="{'background-color':'#222'}" style="max-height:6.5em" >
|
||||
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
|
||||
<span translate>Connecting to {{create.hwWallet}} Wallet...</span>
|
||||
<span ng-show="create.hwWallet=='Trezor'" translate>Please accept to export two public keys from the Trezor app</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="create-tab small-only-text-center" ng-hide="create.hideTabs">
|
||||
<div class="row">
|
||||
<div class="tab-container small-6 medium-3 large-2" ng-class="{'selected': totalCopayers == 1}">
|
||||
|
|
@ -170,11 +155,11 @@
|
|||
</div> <!-- columns -->
|
||||
</div> <!-- advanced -->
|
||||
|
||||
<button type="submit" class="button round black expand" ng-show="totalCopayers != 1" ng-disabled="setupForm.$invalid || create.loading || create.hwWallet">
|
||||
<button type="submit" class="button round black expand" ng-show="totalCopayers != 1" ng-disabled="setupForm.$invalid">
|
||||
<span translate>Create {{requiredCopayers}}-of-{{totalCopayers}} wallet</span>
|
||||
</button>
|
||||
|
||||
<button type="submit" class="button round black expand" ng-show="totalCopayers == 1" ng-disabled="setupForm.$invalid || create.loading || create.hwWallet">
|
||||
<button type="submit" class="button round black expand" ng-show="totalCopayers == 1" ng-disabled="setupForm.$invalid">
|
||||
<span translate>Create new wallet</span>
|
||||
</button>
|
||||
|
||||
|
|
|
|||
|
|
@ -25,14 +25,8 @@
|
|||
</div>
|
||||
<div class="row">
|
||||
|
||||
<div class="onGoingProcess" ng-show="disclaimer.creatingProfile">
|
||||
<div class="onGoingProcess-content" ng-style="{'background-color':'#222'}">
|
||||
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
|
||||
<span translate>Creating Wallet...</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="start-button columns button-box">
|
||||
<button ng-disabled="disclaimer.creatingProfile" ng-click="disclaimer.accept()" class="button black expand round size-12 text-spacing m0" translate>
|
||||
<button ng-click="disclaimer.accept()" class="button black expand round size-12 text-spacing m0" translate>
|
||||
I AGREE. GET STARTED
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -8,14 +8,6 @@
|
|||
|
||||
<div class="content glidera p20b" ng-controller="glideraController as glidera">
|
||||
|
||||
<div class="onGoingProcess" ng-show="glidera.loading || index.glideraLoading">
|
||||
<div class="onGoingProcess-content" ng-style="{'background-color':index.backgroundColor}">
|
||||
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
|
||||
<span ng-show="glidera.loading">Connecting to Glidera...</span>
|
||||
<span ng-show="index.glideraLoading">{{index.glideraLoading}}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="m20b box-notification" ng-if="index.glideraError">
|
||||
<div class="text-warning">
|
||||
|
|
@ -42,7 +34,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-if="!index.glideraToken && !index.glideraLoading && !index.glideraError"
|
||||
<div ng-if="!index.glideraToken && !index.glideraError"
|
||||
class="row">
|
||||
<div class="box-notification text-center size-12 text-warning" ng-show="index.glideraTestnet">
|
||||
<i class="fi-info"></i>
|
||||
|
|
@ -164,7 +156,7 @@
|
|||
|
||||
<div ng-show="index.glideraPermissions.transaction_history">
|
||||
<h4>Activity</h4>
|
||||
<div ng-show="index.glideraTxs.length == 0 && !index.glideraLoadingHistory"
|
||||
<div ng-show="index.glideraTxs.length == 0 "
|
||||
class="size-12 p10 text-center text-gray">
|
||||
No activity in your account
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -6,13 +6,6 @@
|
|||
|
||||
<div class="content glidera" ng-controller="glideraUriController as glidera" ng-init="glidera.checkCode()">
|
||||
|
||||
<div class="onGoingProcess" ng-show="glidera.loading">
|
||||
<div class="onGoingProcess-content" ng-style="{'background-color':index.backgroundColor}">
|
||||
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
|
||||
<span ng-show="glidera.loading">Connecting to Glidera...</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row m20t">
|
||||
<div class="large-12 columns">
|
||||
<div class="text-center">
|
||||
|
|
|
|||
|
|
@ -5,19 +5,6 @@
|
|||
</div>
|
||||
|
||||
<ion-content overflow-scroll="true" class="content p20b" ng-controller="importController as import" ng-init="type='12'">
|
||||
<div class="onGoingProcess" ng-show="import.loading && !import.hwWallet">
|
||||
<div class="onGoingProcess-content" ng-style="{'background-color':'#222'}">
|
||||
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
|
||||
<span translate>Importing wallet...</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="onGoingProcess" ng-show="import.hwWallet">
|
||||
<div class="onGoingProcess-content" ng-style="{'background-color':'#222'}">
|
||||
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
|
||||
<span translate>Connecting to {{import.hwWallet}} Wallet...</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="create-tab pr small-only-text-center" ng-hide="create.hideTabs">
|
||||
<div class="row">
|
||||
<div class="tab-container small-4 medium-4 large-4" ng-class="{'selected': type =='12'}">
|
||||
|
|
@ -99,7 +86,7 @@
|
|||
</div>
|
||||
|
||||
<button translate type="submit" class="button round expand black m10t"
|
||||
ng-disabled="importForm12.$invalid || import.loading">
|
||||
ng-disabled="importForm12.$invalid ">
|
||||
Import
|
||||
</button>
|
||||
</form>
|
||||
|
|
@ -157,7 +144,7 @@
|
|||
</div>
|
||||
|
||||
<button translate type="submit" class="button round expand black"
|
||||
ng-disabled="importForm.$invalid || !import.password || import.loading">
|
||||
ng-disabled="importForm.$invalid || !import.password ">
|
||||
Import backup
|
||||
</button>
|
||||
</form>
|
||||
|
|
@ -221,8 +208,7 @@
|
|||
</div>
|
||||
|
||||
|
||||
<button translate type="submit" class="button round expand black"
|
||||
ng-disabled="import.loading || import.ledger">
|
||||
<button translate type="submit" class="button round expand black">
|
||||
Import
|
||||
</button>
|
||||
</div> <!-- seedoptions show -->
|
||||
|
|
|
|||
|
|
@ -6,21 +6,6 @@
|
|||
|
||||
|
||||
<ion-content overflow-scroll="true" class="content p20v" ng-controller="joinController as join">
|
||||
<div class="onGoingProcess" ng-show="join.loading && !join.hwWallet">
|
||||
<div class="onGoingProcess-content" ng-style="{'background-color':'#222'}">
|
||||
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
|
||||
<span translate>Joining Wallet...</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="onGoingProcess" ng-show="join.hwWallet">
|
||||
<div class="onGoingProcess-content" ng-style="{'background-color':'#222'}" style="max-height:6.5em">
|
||||
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
|
||||
<span translate>Connecting to {{join.hwWallet}} Wallet...</span>
|
||||
<span ng-show="join.hwWallet=='Trezor'" translate>Please accept to export two public keys from the Trezor app</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form name="joinForm" ng-submit="join.join(joinForm)" novalidate>
|
||||
<div class="box-notification m20b" ng-show="join.error">
|
||||
<span class="text-warning">
|
||||
|
|
@ -137,7 +122,7 @@
|
|||
</div> <!-- advanced -->
|
||||
|
||||
<button translate type="submit" class="button expand black m0 round"
|
||||
ng-disabled="joinForm.$invalid || join.loading">Join</button>
|
||||
ng-disabled="joinForm.$invalid">Join</button>
|
||||
</div> <!-- large-12 columns -->
|
||||
</div> <!-- row -->
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -6,13 +6,6 @@
|
|||
|
||||
<div class="content preferences" ng-controller="paperWalletController as paperWallet">
|
||||
<h4 ng-show="!paperWallet.error"></h4>
|
||||
<div class="onGoingProcess" ng-show="paperWallet.scanning || paperWallet.sending">
|
||||
<div class="onGoingProcess-content" ng-style="{'background-color':index.backgroundColor}">
|
||||
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
|
||||
<span ng-show="paperWallet.scanning" translate>Scanning wallet funds...</span>
|
||||
<span ng-show="paperWallet.sending" translate>Sending funds...</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-notification m20b" ng-show="paperWallet.error">
|
||||
<span classs="text-warning">{{paperWallet.error|translate}}</span>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -6,20 +6,13 @@
|
|||
|
||||
|
||||
<div class="content preferences" ng-controller="preferencesDeleteWalletController as preferences">
|
||||
<div class="onGoingProcess" ng-show="isDeletingWallet">
|
||||
<div class="onGoingProcess-content" ng-style="{'background-color':index.backgroundColor}">
|
||||
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
|
||||
<span translate>Deleting Wallet...</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="text-center text-gray m20t size-12">
|
||||
<div class="text-warning size-18 m10b" translate>Warning!</div>
|
||||
<div class="m20b" translate>Permanently delete this wallet. THIS ACTION CANNOT BE REVERSED</div>
|
||||
</div>
|
||||
<ul class="no-bullet m0">
|
||||
<li ng-click="preferences.deleteWallet()">
|
||||
<div class="right" ng-style="{'color':index.backgroundColor}" ng-show="!isDeletingWallet">
|
||||
<div class="right" ng-style="{'color':index.backgroundColor}">
|
||||
{{index.walletName}} <span ng-show="index.alias">({{index.alias}})</span>
|
||||
</div>
|
||||
<div translate>Delete wallet</div>
|
||||
|
|
|
|||
|
|
@ -9,13 +9,6 @@
|
|||
<div class="content preferences" ng-controller="preferencesEmailController as prefEmail">
|
||||
|
||||
<h4></h4>
|
||||
<div class="onGoingProcess" ng-show="prefEmail.saving && !index.isOffline">
|
||||
<div class="onGoingProcess-content" ng-style="{'background-color':index.backgroundColor}">
|
||||
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
|
||||
<span translate>Saving preferences...</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<form name="emailForm" ng-submit="prefEmail.save(emailForm)" class="columns" novalidate ng-init="prefEmail.email = index.preferences.email">
|
||||
<div class="box-notification" ng-show="prefEmail.error">
|
||||
|
|
|
|||
|
|
@ -7,13 +7,6 @@
|
|||
|
||||
<div class="content coinbase" ng-controller="sellCoinbaseController as sell">
|
||||
|
||||
<div class="onGoingProcess" ng-show="sell.loading">
|
||||
<div class="onGoingProcess-content" ng-style="{'background-color': '#2b71b1'}">
|
||||
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
|
||||
<span>{{sell.loading}}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row m20t" ng-show="sell.error || index.coinbaseError" ng-click="sell.error = null">
|
||||
<div class="columns">
|
||||
<div class="box-notification">
|
||||
|
|
@ -64,11 +57,11 @@
|
|||
<input ng-show="!showAlternative" type="number" id="amount"
|
||||
name="amount" ng-attr-placeholder="{{'Amount in ' + (showAlternative ? 'USD' : 'BTC')}}"
|
||||
ng-minlength="0.00000001" ng-maxlength="10000000000"
|
||||
ng-model="amount" autocomplete="off" ng-disabled="sell.loading">
|
||||
ng-model="amount" autocomplete="off">
|
||||
|
||||
<input ng-show="showAlternative" type="number" id="fiat"
|
||||
name="fiat" ng-attr-placeholder="{{'Amount in ' + (showAlternative ? 'USD' : 'BTC')}}"
|
||||
ng-model="fiat" autocomplete="off" ng-disabled="sell.loading">
|
||||
ng-model="fiat" autocomplete="off">
|
||||
|
||||
<a ng-show="!showAlternative" class="postfix button"
|
||||
ng-click="showAlternative = true; amount = null">BTC</a>
|
||||
|
|
@ -101,7 +94,7 @@
|
|||
</div>
|
||||
<div class="input m20t">
|
||||
<a href class="button black expand round"
|
||||
ng-disabled="sell.loading || (!amount && !fiat)"
|
||||
ng-disabled=" (!amount && !fiat)"
|
||||
ng-style="{'background-color': '#2b71b1'}"
|
||||
ng-click="showPriceSensitivity = true">Continue</a>
|
||||
</div>
|
||||
|
|
@ -131,7 +124,7 @@
|
|||
</div>
|
||||
<div class="columns large-6 medium-6 small-6">
|
||||
<input class="button black expand round"
|
||||
ng-disabled="sell.loading || (!amount && !fiat)"
|
||||
ng-disabled="(!amount && !fiat)"
|
||||
ng-style="{'background-color': '#2b71b1'}"
|
||||
type="submit" value="Confirm">
|
||||
</div>
|
||||
|
|
@ -187,7 +180,7 @@
|
|||
<button class="button black round expand"
|
||||
ng-style="{'background-color': '#2b71b1'}"
|
||||
ng-click="sell.confirmSell(index.coinbaseToken, index.coinbaseAccount, sell.sellInfo)"
|
||||
ng-disabled="sell.loading">
|
||||
>
|
||||
Sell
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -7,13 +7,6 @@
|
|||
|
||||
<div class="content glidera" ng-controller="sellGlideraController as sell">
|
||||
|
||||
<div class="onGoingProcess" ng-show="sell.loading">
|
||||
<div class="onGoingProcess-content" ng-style="{'background-color':index.backgroundColor}">
|
||||
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
|
||||
<span>{{sell.loading}}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-show="index.glideraLimits && !sell.show2faCodeInput && !sell.success">
|
||||
<h4 class="title m0 text-left">
|
||||
<span class="text-light">Daily sell limit</span>:
|
||||
|
|
@ -88,7 +81,7 @@
|
|||
ng-style="{'background-color':index.backgroundColor}"
|
||||
type="submit" value="{{'Continue'}}"
|
||||
ng-disabled="index.glideraLimits.transactDisabledPendingFirstTransaction || !sell.sellPrice.qty ||
|
||||
!sell.selectedWalletId || sell.loading">
|
||||
!sell.selectedWalletId ">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
@ -104,7 +97,7 @@
|
|||
<input type="number" ng-model="twoFaCode" required>
|
||||
<input class="button black expand round"
|
||||
ng-style="{'background-color':index.backgroundColor}"
|
||||
type="submit" value="{{'Sell'}}" ng-disabled="sellForm.$invalid || sell.loading">
|
||||
type="submit" value="{{'Sell'}}" ng-disabled="sellForm.$invalid ">
|
||||
</form>
|
||||
<p class="m10t size-12 text-gray">
|
||||
Bitcoins will be immediately sent from your wallet to Glidera. Fiat will be deposited in your bank account in 4-6 business days.
|
||||
|
|
|
|||
|
|
@ -16,35 +16,6 @@
|
|||
</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">
|
||||
|
||||
<!--
|
||||
|
|
@ -63,7 +34,7 @@
|
|||
</ion-refresher>
|
||||
<div class="oh pr">
|
||||
<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})'>
|
||||
<span class="size-12 db m10b">{{index.updateError|translate}}</span>
|
||||
<button class="outline white tiny round" translate>Tap to retry</button>
|
||||
|
|
@ -89,12 +60,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-if="index.anyOnGoingProcess">
|
||||
<div class="size-36">
|
||||
<strong>...</strong>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- amount -->
|
||||
|
||||
<div class="wallet-info">
|
||||
|
|
@ -114,7 +79,7 @@
|
|||
</span>
|
||||
</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">
|
||||
<i class="fi-alert"></i>
|
||||
<span translate>
|
||||
|
|
@ -335,7 +300,7 @@
|
|||
<div class="large-12 columns">
|
||||
<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>
|
||||
<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 class="line-t size-10 text-gray m10b p10t" ng-show="index.isSingleAddress">
|
||||
<span translate> Share this wallet address to receive payments</span>.
|
||||
|
|
@ -357,10 +322,10 @@
|
|||
<h4 class="title m0">
|
||||
<available-balance ng-show="!index.shouldHideBalance"></available-balance>
|
||||
<span
|
||||
ng-show="home.lockedCurrentFeePerKb || home.blockUx || home.lockAmount"
|
||||
ng-show="home.lockedCurrentFeePerKb || home.lockAmount"
|
||||
class="text-gray" translate>Send Max</span>
|
||||
<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)"
|
||||
translate>Send Max
|
||||
</a>
|
||||
|
|
@ -380,7 +345,7 @@
|
|||
</div>
|
||||
<div class="row m20t">
|
||||
<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 class="row collapse">
|
||||
|
|
@ -399,7 +364,7 @@
|
|||
</div>
|
||||
|
||||
<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">
|
||||
{{index.addressbook[_address] || _address}}
|
||||
</div>
|
||||
|
|
@ -441,7 +406,7 @@
|
|||
<span translate>Amount</span>
|
||||
</label>
|
||||
<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">
|
||||
<a class="postfix button" ng-style="{'background-color':index.backgroundColor}" ng-click="home.showAlternative()">{{home.unitName}}</a>
|
||||
</div>
|
||||
|
|
@ -450,7 +415,7 @@
|
|||
<label for="alternative"><span translate>Amount</span> [{{ home.alternativeIsoCode }}]
|
||||
</label>
|
||||
<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">
|
||||
<a class="postfix button black" ng-click="home.hideAlternative()"> {{ home.alternativeIsoCode }}</a>
|
||||
</div>
|
||||
|
|
@ -464,19 +429,19 @@
|
|||
<small translate class="has-error" ng-show="sendForm.comment.$invalid && !sendForm.comment.$pristine">too long!</small>
|
||||
</label>
|
||||
<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-blur="home.formFocus(false)"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" ng-show="!home.onGoingProcess">
|
||||
<div class="large-6 medium-6 small-6 columns" ng-show="!home.blockUx && (home._paypro || home.lockAddress || home.lockAmount)">
|
||||
<div class="row">
|
||||
<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>
|
||||
</div>
|
||||
<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>
|
||||
Send
|
||||
</button>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('backupController',
|
||||
function($rootScope, $scope, $timeout, $log, lodash, profileService, gettext, bwcService, bwsError, walletService) {
|
||||
function($rootScope, $scope, $timeout, $log, lodash, profileService, gettext, bwcService, bwsError, walletService, ongoingProcess) {
|
||||
|
||||
var self = this;
|
||||
var fc = profileService.focusedClient;
|
||||
self.loading = false;
|
||||
self.customWords = [];
|
||||
self.walletName = fc.credentials.walletName;
|
||||
|
||||
|
|
@ -59,9 +58,9 @@ angular.module('copayApp.controllers').controller('backupController',
|
|||
finalStep();
|
||||
|
||||
function finalStep() {
|
||||
self.loading = true;
|
||||
ongoingProcess.set('validatingWords', true);
|
||||
confirm(function(err) {
|
||||
self.loading = false;
|
||||
ongoingProcess.set('validatingWords', false);
|
||||
if (err) {
|
||||
backupError(err);
|
||||
}
|
||||
|
|
@ -144,7 +143,6 @@ angular.module('copayApp.controllers').controller('backupController',
|
|||
};
|
||||
|
||||
$scope.removeButton = function(index, item) {
|
||||
if (self.loading) return;
|
||||
self.customWords.splice(index, 1);
|
||||
self.shuffledMnemonicWords[item.prevIndex].selected = false;
|
||||
self.shouldContinue();
|
||||
|
|
@ -194,7 +192,7 @@ angular.module('copayApp.controllers').controller('backupController',
|
|||
};
|
||||
|
||||
function backupError(err) {
|
||||
self.loading = false;
|
||||
ongoingProcess.set('validatingWords', false);
|
||||
$log.debug('Failed to verify backup: ', err);
|
||||
self.backupError = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('buyCoinbaseController',
|
||||
function($scope, $modal, $log, $ionicModal, $timeout, lodash, profileService, coinbaseService, bwsError, addressService) {
|
||||
function($scope, $modal, $log, $ionicModal, $timeout, lodash, profileService, coinbaseService, bwsError, addressService, ongoingProcess) {
|
||||
var self = this;
|
||||
|
||||
this.init = function(testnet) {
|
||||
|
|
@ -73,9 +73,9 @@ angular.module('copayApp.controllers').controller('buyCoinbaseController',
|
|||
currency: currency,
|
||||
payment_method: $scope.selectedPaymentMethod.id || null
|
||||
};
|
||||
this.loading = 'Sending request...';
|
||||
ongoingProcess.set('Sending request...', true);
|
||||
coinbaseService.buyRequest(token, accountId, dataSrc, function(err, data) {
|
||||
self.loading = null;
|
||||
ongoingProcess.set('Sending request...', false);
|
||||
if (err) {
|
||||
self.error = err;
|
||||
return;
|
||||
|
|
@ -88,9 +88,9 @@ angular.module('copayApp.controllers').controller('buyCoinbaseController',
|
|||
self.error = null;
|
||||
var accountId = account.id;
|
||||
var buyId = buy.id;
|
||||
this.loading = 'Buying bitcoin...';
|
||||
ongoingProcess.set('Buying Bitcoin...', true);
|
||||
coinbaseService.buyCommit(token, accountId, buyId, function(err, b) {
|
||||
self.loading = null;
|
||||
ongoingProcess.set('Buying Bitcoin...', false);
|
||||
if (err) {
|
||||
self.error = err;
|
||||
return;
|
||||
|
|
@ -98,12 +98,12 @@ angular.module('copayApp.controllers').controller('buyCoinbaseController',
|
|||
var tx = b.data.transaction;
|
||||
if (!tx) return;
|
||||
|
||||
self.loading = 'Getting transaction...';
|
||||
ongoingProcess.set('Fetching transaction...', true);
|
||||
coinbaseService.getTransaction(token, accountId, tx.id, function(err, updatedTx) {
|
||||
ongoingProcess.set('Fetching transaction...', false);
|
||||
if (err) $log.debug(err);
|
||||
addressService.getAddress(self.selectedWalletId, false, function(err, addr) {
|
||||
if (err) {
|
||||
self.loading = null;
|
||||
self.error = {
|
||||
errors: [{
|
||||
message: 'Could not create address'
|
||||
|
|
@ -113,7 +113,6 @@ angular.module('copayApp.controllers').controller('buyCoinbaseController',
|
|||
}
|
||||
updatedTx.data['toAddr'] = addr;
|
||||
coinbaseService.savePendingTransaction(updatedTx.data, {}, function(err) {
|
||||
self.loading = null;
|
||||
if (err) $log.debug(err);
|
||||
if (updatedTx.data.status == 'completed') {
|
||||
self.sendToCopay(token, account, updatedTx.data);
|
||||
|
|
@ -134,7 +133,7 @@ angular.module('copayApp.controllers').controller('buyCoinbaseController',
|
|||
self.error = null;
|
||||
var accountId = account.id;
|
||||
|
||||
self.loading = 'Sending funds to Copay...';
|
||||
ongoingProcess.set('Sending funds to Copay...', true);
|
||||
var data = {
|
||||
to: tx.toAddr,
|
||||
amount: tx.amount.amount,
|
||||
|
|
@ -142,7 +141,7 @@ angular.module('copayApp.controllers').controller('buyCoinbaseController',
|
|||
description: 'Copay Wallet: ' + self.selectedWalletName
|
||||
};
|
||||
coinbaseService.sendTo(token, accountId, data, function(err, res) {
|
||||
self.loading = null;
|
||||
ongoingProcess.set('Sending funds to Copay...', false);
|
||||
if (err) {
|
||||
self.error = err;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1,13 +1,12 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('buyGlideraController',
|
||||
function($scope, $timeout, $modal, $ionicModal, profileService, addressService, glideraService, bwsError, lodash) {
|
||||
function($scope, $timeout, $modal, $ionicModal, profileService, addressService, glideraService, bwsError, lodash, ongoingProcess) {
|
||||
|
||||
var self = this;
|
||||
this.show2faCodeInput = null;
|
||||
this.error = null;
|
||||
this.success = null;
|
||||
this.loading = null;
|
||||
|
||||
this.init = function(testnet) {
|
||||
self.allWallets = profileService.getWallets(testnet ? 'testnet' : 'livenet', 1)
|
||||
|
|
@ -62,10 +61,10 @@ angular.module('copayApp.controllers').controller('buyGlideraController',
|
|||
this.get2faCode = function(token) {
|
||||
var self = this;
|
||||
self.error = null;
|
||||
self.loading = 'Sending 2FA code...';
|
||||
ongoingProcess.set('Sending 2FA code...', true);
|
||||
$timeout(function() {
|
||||
glideraService.get2faCode(token, function(err, sent) {
|
||||
self.loading = null;
|
||||
ongoingProcess.set('Sending 2FA code...', false);
|
||||
if (err) {
|
||||
self.error = 'Could not send confirmation code to your phone';
|
||||
return;
|
||||
|
|
@ -78,10 +77,11 @@ angular.module('copayApp.controllers').controller('buyGlideraController',
|
|||
this.sendRequest = function(token, permissions, twoFaCode) {
|
||||
var self = this;
|
||||
self.error = null;
|
||||
self.loading = 'Buying bitcoin...';
|
||||
ongoingProcess.set('Buying Bitcoin...', true);
|
||||
$timeout(function() {
|
||||
addressService.getAddress(self.selectedWalletId, false, function(err, walletAddr) {
|
||||
if (err) {
|
||||
ongoingProcess.set('Buying Bitcoin...', false);
|
||||
self.error = bwsError.cb(err, 'Could not create address');
|
||||
return;
|
||||
}
|
||||
|
|
@ -93,7 +93,7 @@ angular.module('copayApp.controllers').controller('buyGlideraController',
|
|||
ip: null
|
||||
};
|
||||
glideraService.buy(token, twoFaCode, data, function(err, data) {
|
||||
self.loading = null;
|
||||
ongoingProcess.set('Buying Bitcoin...', false);
|
||||
if (err) {
|
||||
self.error = err;
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('coinbaseController',
|
||||
function($rootScope, $scope, $timeout, $modal, $ionicModal, profileService, configService, storageService, coinbaseService, lodash, platformInfo) {
|
||||
function($rootScope, $scope, $timeout, $modal, $ionicModal, profileService, configService, storageService, coinbaseService, lodash, platformInfo, ongoingProcess) {
|
||||
|
||||
var isNW = platformInfo.isNW;
|
||||
|
||||
|
|
@ -35,11 +35,11 @@ angular.module('copayApp.controllers').controller('coinbaseController',
|
|||
var self = this;
|
||||
var coinbaseTestnet = configService.getSync().coinbase.testnet;
|
||||
var network = coinbaseTestnet ? 'testnet' : 'livenet';
|
||||
this.loading = true;
|
||||
ongoingProcess.set('connectingCoinbase', true);
|
||||
this.error = null;
|
||||
$timeout(function() {
|
||||
coinbaseService.getToken(code, function(err, data) {
|
||||
self.loading = null;
|
||||
ongoingProcess.set('connectingCoinbase', false);
|
||||
if (err) {
|
||||
self.error = err;
|
||||
$timeout(function() {
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
'use strict';
|
||||
angular.module('copayApp.controllers').controller('coinbaseUriController',
|
||||
function($scope, $stateParams, $timeout, profileService, configService, coinbaseService, storageService, go) {
|
||||
function($scope, $stateParams, $timeout, profileService, configService, coinbaseService, storageService, go, ongoingProcess) {
|
||||
|
||||
this.submitOauthCode = function(code) {
|
||||
var self = this;
|
||||
var coinbaseTestnet = configService.getSync().coinbase.testnet;
|
||||
var network = coinbaseTestnet ? 'testnet' : 'livenet';
|
||||
this.loading = true;
|
||||
ongoingProcess.set('connectingCoinbase', true);
|
||||
this.error = null;
|
||||
$timeout(function() {
|
||||
coinbaseService.getToken(code, function(err, data) {
|
||||
self.loading = null;
|
||||
ongoingProcess.set('connectingCoinbase', false);
|
||||
if (err) {
|
||||
self.error = err;
|
||||
$timeout(function() {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('createController',
|
||||
function($scope, $ionicScrollDelegate, $rootScope, $timeout, $log, lodash, go, profileService, configService, gettext, ledger, trezor, platformInfo, derivationPathHelper) {
|
||||
function($scope, $ionicScrollDelegate, $rootScope, $timeout, $log, lodash, go, profileService, configService, gettext, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess) {
|
||||
|
||||
var isChromeApp = platformInfo.isChromeApp;
|
||||
var isCordova = platformInfo.isCordova;
|
||||
|
|
@ -147,11 +147,12 @@ angular.module('copayApp.controllers').controller('createController',
|
|||
account = account - 1;
|
||||
|
||||
opts.account = account;
|
||||
self.hwWallet = self.seedSourceId == 'ledger' ? 'Ledger' : 'Trezor';
|
||||
ongoingProcess.set('connecting' + self.seedSourceId, true);
|
||||
|
||||
var src = self.seedSourceId == 'ledger' ? ledger : trezor;
|
||||
|
||||
src.getInfoForNewWallet(opts.n > 1, account, function(err, lopts) {
|
||||
self.hwWallet = false;
|
||||
ongoingProcess.set('connecting' + self.seedSourceId, false);
|
||||
if (err) {
|
||||
self.error = err;
|
||||
$ionicScrollDelegate.scrollTop();
|
||||
|
|
@ -167,11 +168,11 @@ angular.module('copayApp.controllers').controller('createController',
|
|||
};
|
||||
|
||||
this._create = function(opts) {
|
||||
self.loading = true;
|
||||
ongoingProcess.set('creatingWallet', true);
|
||||
$timeout(function() {
|
||||
|
||||
profileService.createWallet(opts, function(err) {
|
||||
self.loading = false;
|
||||
ongoingProcess.set('creatingWallet', false);
|
||||
if (err) {
|
||||
$log.warn(err);
|
||||
self.error = err;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
'use strict';
|
||||
|
||||
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;
|
||||
self.tries = 0;
|
||||
self.creatingProfile = true;
|
||||
var isCordova = platformInfo.isCordova;
|
||||
|
||||
ongoingProcess.set('creatingWallet', true);
|
||||
|
||||
var create = function(opts) {
|
||||
opts = opts || {};
|
||||
|
|
@ -30,7 +32,7 @@ angular.module('copayApp.controllers').controller('disclaimerController',
|
|||
};
|
||||
|
||||
$scope.error = "";
|
||||
self.creatingProfile = false;
|
||||
ongoingProcess.set('creatingWallet', false);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -43,7 +45,7 @@ angular.module('copayApp.controllers').controller('disclaimerController',
|
|||
create(opts);
|
||||
} else {
|
||||
$log.info('There is already a profile');
|
||||
self.creatingProfile = false;
|
||||
ongoingProcess.set('creatingWallet', false);
|
||||
profileService.bindProfile(profile, function(err) {
|
||||
if (!err || !err.message || !err.message.match('NONAGREEDDISCLAIMER')) {
|
||||
$log.debug('Disclaimer already accepted at #disclaimer. Redirect to Wallet Home.');
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('glideraController',
|
||||
function($rootScope, $scope, $timeout, $modal, $ionicModal, profileService, configService, storageService, glideraService, lodash) {
|
||||
function($rootScope, $scope, $timeout, $modal, $ionicModal, profileService, configService, storageService, glideraService, lodash, ongoingProcess) {
|
||||
|
||||
this.getAuthenticateUrl = function() {
|
||||
return glideraService.getOauthCodeUrl();
|
||||
|
|
@ -11,11 +11,11 @@ angular.module('copayApp.controllers').controller('glideraController',
|
|||
var self = this;
|
||||
var glideraTestnet = configService.getSync().glidera.testnet;
|
||||
var network = glideraTestnet ? 'testnet' : 'livenet';
|
||||
this.loading = true;
|
||||
ongoingProcess.set('connectingGlidera', true);
|
||||
this.error = null;
|
||||
$timeout(function() {
|
||||
glideraService.getToken(code, function(err, data) {
|
||||
self.loading = null;
|
||||
ongoingProcess.set('connectingGlidera', false);
|
||||
if (err) {
|
||||
self.error = err;
|
||||
$timeout(function() {
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
'use strict';
|
||||
angular.module('copayApp.controllers').controller('glideraUriController',
|
||||
function($scope, $log, $stateParams, $timeout, profileService, configService, glideraService, storageService, go) {
|
||||
function($scope, $log, $stateParams, $timeout, profileService, configService, glideraService, storageService, go, ongoingProcess) {
|
||||
|
||||
this.submitOauthCode = function(code) {
|
||||
$log.debug('Glidera Oauth Code:' + code);
|
||||
var self = this;
|
||||
var glideraTestnet = configService.getSync().glidera.testnet;
|
||||
var network = glideraTestnet ? 'testnet' : 'livenet';
|
||||
this.loading = true;
|
||||
ongoingProcess.set('connectingGlidera', true);
|
||||
this.error = null;
|
||||
$timeout(function() {
|
||||
glideraService.getToken(code, function(err, data) {
|
||||
self.loading = null;
|
||||
ongoingProcess.set('connectingGlidera', false);
|
||||
if (err) {
|
||||
self.error = err;
|
||||
$timeout(function() {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('importController',
|
||||
function($scope, $rootScope, $ionicScrollDelegate, $timeout, $log, profileService, configService, notification, go, sjcl, gettext, lodash, ledger, trezor, derivationPathHelper, platformInfo, bwsError, bwcService) {
|
||||
function($scope, $rootScope, $ionicScrollDelegate, $timeout, $log, profileService, configService, notification, go, sjcl, gettext, lodash, ledger, trezor, derivationPathHelper, platformInfo, bwsError, bwcService, ongoingProcess) {
|
||||
|
||||
var isChromeApp = platformInfo.isChromeApp;
|
||||
var isDevel = platformInfo.isDevel;
|
||||
|
|
@ -60,13 +60,13 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
return;
|
||||
}
|
||||
|
||||
self.loading = true;
|
||||
ongoingProcess.set('importingWallet', true);
|
||||
opts.compressed = null;
|
||||
opts.password = null;
|
||||
|
||||
$timeout(function() {
|
||||
profileService.importWallet(str2, opts, function(err, walletId) {
|
||||
self.loading = false;
|
||||
ongoingProcess.set('importingWallet', false);
|
||||
if (err) {
|
||||
self.error = err;
|
||||
$ionicScrollDelegate.scrollTop();
|
||||
|
|
@ -80,11 +80,10 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
};
|
||||
|
||||
var _importExtendedPrivateKey = function(xPrivKey, opts) {
|
||||
self.loading = true;
|
||||
|
||||
ongoingProcess.set('importingWallet', true);
|
||||
$timeout(function() {
|
||||
profileService.importExtendedPrivateKey(xPrivKey, opts, function(err, walletId) {
|
||||
self.loading = false;
|
||||
ongoingProcess.set('importingWallet', false);
|
||||
if (err) {
|
||||
if (err instanceof errors.NOT_AUTHORIZED) {
|
||||
self.importErr = true;
|
||||
|
|
@ -105,11 +104,11 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
};
|
||||
|
||||
var _importMnemonic = function(words, opts) {
|
||||
self.loading = true;
|
||||
ongoingProcess.set('importingWallet', true);
|
||||
|
||||
$timeout(function() {
|
||||
profileService.importMnemonic(words, opts, function(err, walletId) {
|
||||
self.loading = false;
|
||||
ongoingProcess.set('importingWallet', false);
|
||||
|
||||
if (err) {
|
||||
if (err instanceof errors.NOT_AUTHORIZED) {
|
||||
|
|
@ -232,7 +231,7 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
this.importTrezor = function(account, isMultisig) {
|
||||
var self = this;
|
||||
trezor.getInfoForNewWallet(isMultisig, account, function(err, lopts) {
|
||||
self.hwWallet = false;
|
||||
ongoingProcess.clear();
|
||||
if (err) {
|
||||
self.error = err;
|
||||
$ionicScrollDelegate.scrollTop();
|
||||
|
|
@ -242,11 +241,11 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
|
||||
lopts.externalSource = 'trezor';
|
||||
lopts.bwsurl = $scope.bwsurl;
|
||||
self.loading = true;
|
||||
ongoingProcess.set('importingWallet', true);
|
||||
$log.debug('Import opts', lopts);
|
||||
|
||||
profileService.importExtendedPublicKey(lopts, function(err, walletId) {
|
||||
self.loading = false;
|
||||
ongoingProcess.set('importingWallet', false);
|
||||
if (err) {
|
||||
self.error = err;
|
||||
$ionicScrollDelegate.scrollTop();
|
||||
|
|
@ -287,11 +286,11 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
|
||||
switch (self.seedSourceId) {
|
||||
case ('ledger'):
|
||||
self.hwWallet = 'Ledger';
|
||||
ongoingProcess.set('connectingledger', true);
|
||||
self.importLedger(account);
|
||||
break;
|
||||
case ('trezor'):
|
||||
self.hwWallet = 'Trezor';
|
||||
ongoingProcess.set('connectingtrezor', true);
|
||||
self.importTrezor(account, isMultisig);
|
||||
break;
|
||||
default:
|
||||
|
|
@ -311,7 +310,7 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
this.importLedger = function(account) {
|
||||
var self = this;
|
||||
ledger.getInfoForNewWallet(true, account, function(err, lopts) {
|
||||
self.hwWallet = false;
|
||||
ongoingProcess.clear();
|
||||
if (err) {
|
||||
self.error = err;
|
||||
$ionicScrollDelegate.scrollTop();
|
||||
|
|
@ -321,11 +320,11 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
|
||||
lopts.externalSource = 'ledger';
|
||||
lopts.bwsurl = $scope.bwsurl;
|
||||
self.loading = true;
|
||||
ongoingProcess.set('importingWallet', true);
|
||||
$log.debug('Import opts', lopts);
|
||||
|
||||
profileService.importExtendedPublicKey(lopts, function(err, walletId) {
|
||||
self.loading = false;
|
||||
ongoingProcess.set('importingWallet', false);
|
||||
if (err) {
|
||||
self.error = err;
|
||||
$ionicScrollDelegate.scrollTop();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'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 SOFT_CONFIRMATION_LIMIT = 12;
|
||||
var errors = bwcService.getErrors();
|
||||
|
|
@ -14,7 +14,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
ret.isChromeApp = isChromeApp;
|
||||
ret.isSafari = platformInfo.isSafari;
|
||||
ret.isWindowsPhoneApp = platformInfo.isWP;
|
||||
ret.onGoingProcess = {};
|
||||
ret.historyShowLimit = 10;
|
||||
ret.historyShowMoreLimit = 10;
|
||||
ret.isSearching = false;
|
||||
|
|
@ -81,24 +80,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
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() {
|
||||
$log.debug('Cleaning Index Instance');
|
||||
lodash.each(self, function(v, k) {
|
||||
|
|
@ -125,16 +106,17 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
var fc = profileService.focusedClient;
|
||||
if (!fc) return;
|
||||
|
||||
ongoingProcess.clear();
|
||||
self.cleanInstance();
|
||||
self.loadingWallet = true;
|
||||
self.setSpendUnconfirmed();
|
||||
|
||||
$timeout(function() {
|
||||
$rootScope.$apply();
|
||||
|
||||
self.hasProfile = true;
|
||||
self.isSingleAddress = false;
|
||||
self.noFocusedWallet = false;
|
||||
self.onGoingProcess = {};
|
||||
|
||||
// Credentials Shortcuts
|
||||
self.m = fc.credentials.m;
|
||||
|
|
@ -303,7 +285,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
} else {
|
||||
self.isSingleAddress = !!ret.wallet.singleAddress;
|
||||
if (!opts.quiet)
|
||||
self.setOngoingProcess('scanning', ret.wallet.scanStatus == 'running');
|
||||
ongoingProcess.set('scanning', ret.wallet.scanStatus == 'running');
|
||||
}
|
||||
return cb(err, ret);
|
||||
});
|
||||
|
|
@ -320,7 +302,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
$timeout(function() {
|
||||
|
||||
if (!opts.quiet)
|
||||
self.setOngoingProcess('updatingStatus', true);
|
||||
ongoingProcess.set('updatingStatus', true);
|
||||
|
||||
$log.debug('Updating Status:', fc.credentials.walletName, tries);
|
||||
get(function(err, walletStatus) {
|
||||
|
|
@ -340,8 +322,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
if (walletId != profileService.focusedClient.credentials.walletId)
|
||||
return;
|
||||
|
||||
if (!opts.quiet)
|
||||
self.setOngoingProcess('updatingStatus', false);
|
||||
ongoingProcess.set('updatingStatus', false);
|
||||
|
||||
|
||||
if (err) {
|
||||
|
|
@ -389,10 +370,10 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
self.updateBalance = function() {
|
||||
var fc = profileService.focusedClient;
|
||||
$timeout(function() {
|
||||
self.setOngoingProcess('updatingBalance', true);
|
||||
ongoingProcess.set('updatingBalance', true);
|
||||
$log.debug('Updating Balance');
|
||||
fc.getBalance(function(err, balance) {
|
||||
self.setOngoingProcess('updatingBalance', false);
|
||||
ongoingProcess.set('updatingBalance', false);
|
||||
if (err) {
|
||||
self.handleError(err);
|
||||
return;
|
||||
|
|
@ -406,10 +387,10 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
self.updatePendingTxps = function() {
|
||||
var fc = profileService.focusedClient;
|
||||
$timeout(function() {
|
||||
self.setOngoingProcess('updatingPendingTxps', true);
|
||||
ongoingProcess.set('updatingPendingTxps', true);
|
||||
$log.debug('Updating PendingTxps');
|
||||
fc.getTxProposals({}, function(err, txps) {
|
||||
self.setOngoingProcess('updatingPendingTxps', false);
|
||||
ongoingProcess.set('updatingPendingTxps', false);
|
||||
if (err) {
|
||||
self.handleError(err);
|
||||
} else {
|
||||
|
|
@ -445,10 +426,10 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
var fc = profileService.focusedClient;
|
||||
$timeout(function() {
|
||||
$rootScope.$apply();
|
||||
self.setOngoingProcess('openingWallet', true);
|
||||
ongoingProcess.set('openingWallet', true);
|
||||
self.updateError = false;
|
||||
fc.openWallet(function(err, walletStatus) {
|
||||
self.setOngoingProcess('openingWallet', false);
|
||||
ongoingProcess.set('openingWallet', false);
|
||||
if (err) {
|
||||
self.updateError = true;
|
||||
self.handleError(err);
|
||||
|
|
@ -997,10 +978,10 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
|
||||
self.recreate = function(cb) {
|
||||
var fc = profileService.focusedClient;
|
||||
self.setOngoingProcess('recreating', true);
|
||||
ongoingProcess.set('recreating', true);
|
||||
fc.recreateWallet(function(err) {
|
||||
self.notAuthorized = false;
|
||||
self.setOngoingProcess('recreating', false);
|
||||
ongoingProcess.set('recreating', false);
|
||||
|
||||
if (err) {
|
||||
self.handleError(err);
|
||||
|
|
@ -1034,13 +1015,13 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
if (!c.isComplete()) return;
|
||||
|
||||
if (self.walletId == walletId)
|
||||
self.setOngoingProcess('scanning', true);
|
||||
ongoingProcess.set('scanning', true);
|
||||
|
||||
c.startScan({
|
||||
includeCopayerBranches: true,
|
||||
}, function(err) {
|
||||
if (err && self.walletId == walletId) {
|
||||
self.setOngoingProcess('scanning', false);
|
||||
ongoingProcess.set('scanning', false);
|
||||
self.handleError(err);
|
||||
$rootScope.$apply();
|
||||
}
|
||||
|
|
@ -1076,9 +1057,9 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
getToken(function(err, accessToken) {
|
||||
if (err || !accessToken) return;
|
||||
else {
|
||||
self.glideraLoading = 'Connecting to Glidera...';
|
||||
ongoingProcess.set('connectingGlidera', true);
|
||||
glideraService.getAccessTokenPermissions(accessToken, function(err, p) {
|
||||
self.glideraLoading = null;
|
||||
ongoingProcess.set('connectingGlidera', false);
|
||||
if (err) {
|
||||
self.glideraError = err;
|
||||
} else {
|
||||
|
|
@ -1109,24 +1090,24 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
});
|
||||
|
||||
if (permissions.transaction_history) {
|
||||
self.glideraLoadingHistory = 'Getting Glidera transactions...';
|
||||
ongoingProcess.set('Fetching Glidera Transactions', true);
|
||||
glideraService.getTransactions(accessToken, function(err, data) {
|
||||
self.glideraLoadingHistory = null;
|
||||
ongoingProcess.set('Fetching Glidera Transactions', false);
|
||||
self.glideraTxs = data;
|
||||
});
|
||||
}
|
||||
|
||||
if (permissions.view_email_address && opts.fullUpdate) {
|
||||
self.glideraLoadingEmail = 'Getting Glidera Email...';
|
||||
ongoingProcess.set('connectingGlidera', true);
|
||||
glideraService.getEmail(accessToken, function(err, data) {
|
||||
self.glideraLoadingEmail = null;
|
||||
ongoingProcess.set('connectingGlidera', false);
|
||||
self.glideraEmail = data.email;
|
||||
});
|
||||
}
|
||||
if (permissions.personal_info && opts.fullUpdate) {
|
||||
self.glideraLoadingPersonalInfo = 'Getting Glidera Personal Information...';
|
||||
ongoingProcess.set('connectingGlidera', true);
|
||||
glideraService.getPersonalInfo(accessToken, function(err, data) {
|
||||
self.glideraLoadingPersonalInfo = null;
|
||||
ongoingProcess.set('connectingGlidera', false);
|
||||
self.glideraPersonalInfo = data;
|
||||
});
|
||||
}
|
||||
|
|
@ -1161,9 +1142,9 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
getToken(function(err, accessToken) {
|
||||
if (err || !accessToken) return;
|
||||
else {
|
||||
self.coinbaseLoading = 'Getting primary account...';
|
||||
ongoingProcess.set('Getting primary account...', true);
|
||||
coinbaseService.getAccounts(accessToken, function(err, a) {
|
||||
self.coinbaseLoading = null;
|
||||
ongoingProcess.set('Getting primary account...', false);
|
||||
if (err) {
|
||||
self.coinbaseError = err;
|
||||
if (err.errors[0] && err.errors[0].id == 'expired_token') {
|
||||
|
|
@ -1428,16 +1409,11 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
});
|
||||
|
||||
$rootScope.$on('Local/ValidatingWallet', function() {
|
||||
if (isCordova) {
|
||||
window.plugins.spinnerDialog.hide();
|
||||
window.plugins.spinnerDialog.show(null, gettext('Validating wallet integrity...'), true);
|
||||
}
|
||||
ongoingProcess.set('validatingWallet', true);
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/ProfileBound', function() {
|
||||
if (isCordova) {
|
||||
window.plugins.spinnerDialog.hide();
|
||||
}
|
||||
ongoingProcess.set('validatingWallet', false);
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/ClearHistory', function(event) {
|
||||
|
|
@ -1519,93 +1495,49 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
}
|
||||
};
|
||||
|
||||
$rootScope.$on('Local/Resume', function(event) {
|
||||
$log.debug('### Resume event');
|
||||
profileService.isDisclaimerAccepted(function(v) {
|
||||
if (!v) {
|
||||
$log.debug('Disclaimer not accepted, resume to home');
|
||||
go.path('disclaimer');
|
||||
}
|
||||
$rootScope.$on('Local/Resume', function(event) {
|
||||
$log.debug('### Resume event');
|
||||
profileService.isDisclaimerAccepted(function(v) {
|
||||
if (!v) {
|
||||
$log.debug('Disclaimer not accepted, resume to home');
|
||||
go.path('disclaimer');
|
||||
}
|
||||
});
|
||||
self.debouncedUpdate();
|
||||
});
|
||||
self.debouncedUpdate();
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/BackupDone', function(event, walletId) {
|
||||
self.needsBackup = false;
|
||||
$log.debug('Backup done');
|
||||
storageService.setBackupFlag(walletId || self.walletId, function(err) {
|
||||
$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('Local/BackupDone', function(event, walletId) {
|
||||
self.needsBackup = false;
|
||||
$log.debug('Backup done');
|
||||
storageService.setBackupFlag(walletId || self.walletId, function(err) {
|
||||
$log.debug('Backup stored');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$rootScope.$on('NewIncomingTx', function() {
|
||||
self.newTx = true;
|
||||
self.updateAll({
|
||||
walletStatus: null,
|
||||
untilItChanges: true,
|
||||
triggerTxUpdate: true,
|
||||
$rootScope.$on('Local/DeviceError', function(event, err) {
|
||||
self.showErrorPopup(err, function() {
|
||||
if (isCordova && navigator && navigator.app) {
|
||||
navigator.app.exitApp();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$rootScope.$on('NewBlock', function() {
|
||||
if (self.glideraEnabled) {
|
||||
$timeout(function() {
|
||||
self.updateGlidera();
|
||||
$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);
|
||||
});
|
||||
});
|
||||
}
|
||||
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) {
|
||||
$rootScope.$on('NewIncomingTx', function() {
|
||||
self.newTx = true;
|
||||
self.updateAll({
|
||||
walletStatus: null,
|
||||
|
|
@ -1613,200 +1545,245 @@ lodash.each(['NewOutgoingTx', 'NewOutgoingTxByThirdParty'], function(eventName)
|
|||
triggerTxUpdate: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
//untilItChange FALSE
|
||||
lodash.each(['NewTxProposal', 'TxProposalFinallyRejected', 'TxProposalRemoved', 'NewOutgoingTxByThirdParty',
|
||||
'Local/GlideraTx'
|
||||
], function(eventName) {
|
||||
$rootScope.$on(eventName, function(event) {
|
||||
|
||||
$rootScope.$on('NewBlock', function() {
|
||||
if (self.glideraEnabled) {
|
||||
$timeout(function() {
|
||||
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({
|
||||
walletStatus: null,
|
||||
untilItChanges: null,
|
||||
untilItChanges: untilItChanges,
|
||||
triggerTxUpdate: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
//untilItChange Maybe
|
||||
$rootScope.$on('Local/TxProposalAction', function(event, untilItChanges) {
|
||||
self.newTx = untilItChanges;
|
||||
self.updateAll({
|
||||
walletStatus: null,
|
||||
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,
|
||||
$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) {
|
||||
$rootScope.$on(eventName, function() {
|
||||
var f = function() {
|
||||
if (self.updatingStatus) {
|
||||
return $timeout(f, 200);
|
||||
lodash.each(['TxProposalRejectedBy', 'TxProposalAcceptedBy'], function(eventName) {
|
||||
$rootScope.$on(eventName, function() {
|
||||
var f = function() {
|
||||
if (self.updatingStatus) {
|
||||
return $timeout(f, 200);
|
||||
};
|
||||
self.updatePendingTxps();
|
||||
};
|
||||
self.updatePendingTxps();
|
||||
};
|
||||
f();
|
||||
f();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/NoWallets', function(event) {
|
||||
$timeout(function() {
|
||||
self.hasProfile = true;
|
||||
self.noFocusedWallet = true;
|
||||
self.isComplete = null;
|
||||
self.walletName = null;
|
||||
$rootScope.$on('Local/NoWallets', function(event) {
|
||||
$timeout(function() {
|
||||
self.hasProfile = true;
|
||||
self.noFocusedWallet = true;
|
||||
self.isComplete = null;
|
||||
self.walletName = null;
|
||||
uxLanguage.update();
|
||||
|
||||
profileService.isDisclaimerAccepted(function(v) {
|
||||
if (v) {
|
||||
go.path('import');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/NewFocusedWallet', function() {
|
||||
uxLanguage.update();
|
||||
self.setFocusedWallet();
|
||||
self.updateHistory();
|
||||
storageService.getCleanAndScanAddresses(function(err, walletId) {
|
||||
|
||||
profileService.isDisclaimerAccepted(function(v) {
|
||||
if (v) {
|
||||
go.path('import');
|
||||
if (walletId && profileService.walletClients[walletId]) {
|
||||
$log.debug('Clear last address cache and Scan ', walletId);
|
||||
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() {
|
||||
uxLanguage.update();
|
||||
self.setFocusedWallet();
|
||||
self.updateHistory();
|
||||
storageService.getCleanAndScanAddresses(function(err, walletId) {
|
||||
$rootScope.$on('Local/SetTab', function(event, tab, reset) {
|
||||
self.setTab(tab, reset);
|
||||
});
|
||||
|
||||
if (walletId && profileService.walletClients[walletId]) {
|
||||
$log.debug('Clear last address cache and Scan ', walletId);
|
||||
addressService.expireAddress(walletId, function(err) {
|
||||
self.startScan(walletId);
|
||||
$rootScope.$on('Local/NeedsConfirmation', function(event, txp, cb) {
|
||||
|
||||
function openConfirmationPopup(txp, cb) {
|
||||
|
||||
$scope.tx = txFormatService.processTx(txp);
|
||||
|
||||
self.confirmationPopup = $ionicPopup.show({
|
||||
templateUrl: 'views/includes/confirm-tx.html',
|
||||
scope: $scope,
|
||||
});
|
||||
storageService.removeCleanAndScanAddresses(function() {
|
||||
$rootScope.$emit('Local/NewFocusedWalletReady');
|
||||
});
|
||||
} else {
|
||||
$rootScope.$emit('Local/NewFocusedWalletReady');
|
||||
|
||||
$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/SetTab', function(event, tab, reset) {
|
||||
self.setTab(tab, reset);
|
||||
});
|
||||
$rootScope.$on('Local/NeedsPassword', function(event, isSetup, cb) {
|
||||
|
||||
$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({
|
||||
templateUrl: 'views/includes/confirm-tx.html',
|
||||
scope: $scope,
|
||||
$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);
|
||||
});
|
||||
|
||||
$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) {
|
||||
$scope.data = {};
|
||||
$scope.data.password = null;
|
||||
$scope.isSetup = isSetup;
|
||||
$scope.isVerification = false;
|
||||
$scope.loading = false;
|
||||
var pass = null;
|
||||
|
||||
self.passwordPopup = $ionicPopup.show({
|
||||
templateUrl: 'views/includes/password.html',
|
||||
scope: $scope,
|
||||
lodash.each(['NewCopayer', 'CopayerUpdated'], function(eventName) {
|
||||
$rootScope.$on(eventName, function() {
|
||||
// Re try to open wallet (will triggers)
|
||||
self.setFocusedWallet();
|
||||
});
|
||||
|
||||
$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/EmailUpdated', function(event, email) {
|
||||
self.preferences.email = email;
|
||||
});
|
||||
|
||||
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();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/NewEncryptionSetting', function() {
|
||||
var fc = profileService.focusedClient;
|
||||
self.isPrivKeyEncrypted = fc.isPrivKeyEncrypted();
|
||||
$timeout(function() {
|
||||
$rootScope.$apply();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
/* Start setup */
|
||||
lodash.assign(self, vanillaScope); openURLService.init();
|
||||
/* Start setup */
|
||||
lodash.assign(self, vanillaScope);
|
||||
openURLService.init();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('joinController',
|
||||
function($scope, $rootScope, $timeout, $ionicScrollDelegate, go, notification, profileService, configService, storageService, applicationService, $modal, gettext, lodash, ledger, trezor, platformInfo, derivationPathHelper) {
|
||||
function($scope, $rootScope, $timeout, $ionicScrollDelegate, go, notification, profileService, configService, storageService, applicationService, $modal, gettext, lodash, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess) {
|
||||
|
||||
var isChromeApp = platformInfo.isChromeApp;
|
||||
var isDevel = platformInfo.isDevel;
|
||||
|
|
@ -108,11 +108,11 @@ angular.module('copayApp.controllers').controller('joinController',
|
|||
account = account - 1;
|
||||
|
||||
opts.account = account;
|
||||
self.hwWallet = self.seedSourceId == 'ledger' ? 'Ledger' : 'Trezor';
|
||||
ongoingProcess.set('connecting' + self.seedSourceId, true);
|
||||
var src = self.seedSourceId == 'ledger' ? ledger : trezor;
|
||||
|
||||
src.getInfoForNewWallet(true, account, function(err, lopts) {
|
||||
self.hwWallet = false;
|
||||
ongoingProcess.set('connecting' + self.seedSourceId, false);
|
||||
if (err) {
|
||||
self.error = err;
|
||||
$ionicScrollDelegate.scrollTop();
|
||||
|
|
@ -129,11 +129,11 @@ angular.module('copayApp.controllers').controller('joinController',
|
|||
};
|
||||
|
||||
this._join = function(opts) {
|
||||
self.loading = true;
|
||||
ongoingProcess.set('joiningWallet', true);
|
||||
$timeout(function() {
|
||||
profileService.joinWallet(opts, function(err) {
|
||||
if (err) {
|
||||
self.loading = false;
|
||||
ongoingProcess.set('joiningWallet', false);
|
||||
self.error = err;
|
||||
$ionicScrollDelegate.scrollTop();
|
||||
$rootScope.$apply();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
angular.module('copayApp.controllers').controller('paperWalletController',
|
||||
function($scope, $http, $timeout, $log, configService, profileService, go, addressService, txStatus, bitcore) {
|
||||
function($scope, $http, $timeout, $log, configService, profileService, go, addressService, txStatus, bitcore, ongoingProcess) {
|
||||
var self = this;
|
||||
var fc = profileService.focusedClient;
|
||||
var rawTx;
|
||||
|
|
@ -46,14 +46,14 @@ angular.module('copayApp.controllers').controller('paperWalletController',
|
|||
}
|
||||
|
||||
self.scanFunds = function() {
|
||||
self.scanning = true;
|
||||
self.privateKey = '';
|
||||
self.balanceSat = 0;
|
||||
self.error = '';
|
||||
|
||||
ongoingProcess.set('scanning', true);
|
||||
$timeout(function() {
|
||||
self._scanFunds(function(err, privateKey, balance) {
|
||||
self.scanning = false;
|
||||
ongoingProcess.set('scanning', false);
|
||||
if (err) {
|
||||
$log.error(err);
|
||||
self.error = err.message || err.toString();
|
||||
|
|
@ -88,12 +88,13 @@ angular.module('copayApp.controllers').controller('paperWalletController',
|
|||
};
|
||||
|
||||
self.sweepWallet = function() {
|
||||
ongoingProcess.set('sweepingWallet', true);
|
||||
self.sending = true;
|
||||
self.error = '';
|
||||
|
||||
$timeout(function() {
|
||||
self._sweepWallet(function(err, destinationAddress, txid) {
|
||||
self.sending = false;
|
||||
ongoingProcess.set('sweepingWallet', false);
|
||||
|
||||
if (err) {
|
||||
self.error = err.message || err.toString();
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesDeleteWalletController',
|
||||
function($scope, $rootScope, $filter, $timeout, $modal, $log, $ionicModal, storageService, notification, profileService, platformInfo, go, gettext, gettextCatalog, applicationService) {
|
||||
function($scope, $rootScope, $filter, $timeout, $modal, $log, $ionicModal, storageService, notification, profileService, platformInfo, go, gettext, gettextCatalog, applicationService, ongoingProcess) {
|
||||
var isCordova = platformInfo.isCordova;
|
||||
this.isCordova = isCordova;
|
||||
this.error = null;
|
||||
$scope.isDeletingWallet = false;
|
||||
|
||||
var delete_msg = gettextCatalog.getString('Are you sure you want to delete this wallet?');
|
||||
var accept_msg = gettextCatalog.getString('Accept');
|
||||
|
|
@ -30,14 +29,14 @@ angular.module('copayApp.controllers').controller('preferencesDeleteWalletContro
|
|||
};
|
||||
|
||||
var doDeleteWallet = function() {
|
||||
$scope.isDeletingWallet = true;
|
||||
ongoingProcess.set('deletingWallet', true);
|
||||
var fc = profileService.focusedClient;
|
||||
var name = fc.credentials.walletName;
|
||||
var walletName = (fc.alias || '') + ' [' + name + ']';
|
||||
var self = this;
|
||||
|
||||
profileService.deleteWalletClient(fc, function(err) {
|
||||
$scope.isDeletingWallet = false;
|
||||
ongoingProcess.set('deletingWallet', false);
|
||||
if (err) {
|
||||
self.error = err.message || err;
|
||||
} else {
|
||||
|
|
@ -50,7 +49,6 @@ angular.module('copayApp.controllers').controller('preferencesDeleteWalletContro
|
|||
};
|
||||
|
||||
this.deleteWallet = function() {
|
||||
if ($scope.isDeletingWallet) return;
|
||||
if (isCordova) {
|
||||
navigator.notification.confirm(
|
||||
delete_msg,
|
||||
|
|
|
|||
|
|
@ -7,17 +7,14 @@ angular.module('copayApp.controllers').controller('preferencesEmailController',
|
|||
this.error = null;
|
||||
|
||||
var fc = profileService.focusedClient;
|
||||
this.saving = true;
|
||||
var email = self.email || '';
|
||||
|
||||
walletService.updateRemotePreferences(fc, {
|
||||
email: email,
|
||||
}, function(err) {
|
||||
|
||||
if (!err)
|
||||
$rootScope.$emit('Local/EmailUpdated', email);
|
||||
|
||||
self.saving = false;
|
||||
go.path('preferences');
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('sellCoinbaseController',
|
||||
function($rootScope, $scope, $modal, $log, $timeout, $ionicModal, lodash, profileService, coinbaseService, bwsError, configService, walletService, fingerprintService) {
|
||||
function($rootScope, $scope, $modal, $log, $timeout, $ionicModal, lodash, profileService, coinbaseService, bwsError, configService, walletService, fingerprintService, ongoingProcess) {
|
||||
|
||||
var self = this;
|
||||
var client;
|
||||
|
|
@ -112,9 +112,9 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
|
|||
var accountId = account.id;
|
||||
var data = ctx.amount;
|
||||
data['payment_method'] = $scope.selectedPaymentMethod.id || null;
|
||||
this.loading = 'Sending request...';
|
||||
ongoingProcess.set('Sending request...', true);
|
||||
coinbaseService.sellRequest(token, accountId, data, function(err, sell) {
|
||||
self.loading = null;
|
||||
ongoingProcess.set('Sending request...', false);
|
||||
if (err) {
|
||||
self.error = err;
|
||||
return;
|
||||
|
|
@ -127,9 +127,9 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
|
|||
self.error = null;
|
||||
var accountId = account.id;
|
||||
var sellId = sell.id;
|
||||
this.loading = 'Selling bitcoin...';
|
||||
ongoingProcess.set('Selling Bitcoin...', true);
|
||||
coinbaseService.sellCommit(token, accountId, sellId, function(err, data) {
|
||||
self.loading = null;
|
||||
ongoingProcess.set('Selling Bitcoin...', false);
|
||||
if (err) {
|
||||
self.error = err;
|
||||
return;
|
||||
|
|
@ -157,12 +157,12 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
|
|||
var walletSettings = configWallet.settings;
|
||||
|
||||
|
||||
self.loading = 'Creating transaction...';
|
||||
ongoingProcess.set('Creating Transaction...', true);
|
||||
$timeout(function() {
|
||||
|
||||
coinbaseService.createAddress(token, accountId, dataSrc, function(err, data) {
|
||||
if (err) {
|
||||
self.loading = null;
|
||||
ongoingProcess.set('Creating Transaction...', false);
|
||||
self.error = err;
|
||||
return;
|
||||
}
|
||||
|
|
@ -192,7 +192,7 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
|
|||
walletService.createTx(client, txp, function(err, createdTxp) {
|
||||
if (err) {
|
||||
$log.debug(err);
|
||||
self.loading = null;
|
||||
ongoingProcess.set('Creating Transaction...', false);
|
||||
self.error = {
|
||||
errors: [{
|
||||
message: 'Could not create transaction: ' + err.message
|
||||
|
|
@ -201,8 +201,8 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
|
|||
$scope.$apply();
|
||||
return;
|
||||
}
|
||||
ongoingProcess.set('Creating Transaction...', false);
|
||||
$scope.$emit('Local/NeedsConfirmation', createdTxp, function(accept) {
|
||||
self.loading = null;
|
||||
if (accept) {
|
||||
self.confirmTx(createdTxp, function(err, tx) {
|
||||
if (err) {
|
||||
|
|
@ -213,7 +213,7 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
|
|||
};
|
||||
return;
|
||||
}
|
||||
self.loading = 'Checking transaction...';
|
||||
ongoingProcess.set('Checking Transaction...', false);
|
||||
coinbaseService.getTransactions(token, accountId, function(err, ctxs) {
|
||||
if (err) {
|
||||
$log.debug(err);
|
||||
|
|
@ -225,7 +225,7 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
|
|||
self.sellRequest(token, account, ctx);
|
||||
} else {
|
||||
// Save to localstorage
|
||||
self.loading = null;
|
||||
ongoingProcess.clear();
|
||||
ctx['price_sensitivity'] = $scope.selectedPriceSensitivity;
|
||||
ctx['sell_price_amount'] = self.sellPrice.amount;
|
||||
ctx['sell_price_currency'] = self.sellPrice.currency;
|
||||
|
|
@ -264,10 +264,10 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
|
|||
return cb(err);
|
||||
}
|
||||
|
||||
self.loading = 'Sending bitcoin to Coinbase...';
|
||||
ongoingProcess.set('Sending Bitcoin to Coinbase...', true);
|
||||
walletService.publishTx(client, txp, function(err, publishedTxp) {
|
||||
if (err) {
|
||||
self.loading = null;
|
||||
ongoingProcess.set('Sending Bitcoin to Coinbase...', false);
|
||||
$log.debug(err);
|
||||
return cb({
|
||||
errors: [{
|
||||
|
|
@ -279,7 +279,7 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
|
|||
walletService.signTx(client, publishedTxp, function(err, signedTxp) {
|
||||
walletService.lock(client);
|
||||
if (err) {
|
||||
self.loading = null;
|
||||
ongoingProcess.set('Sending Bitcoin to Coinbase...', false);
|
||||
$log.debug(err);
|
||||
walletService.removeTx(client, signedTxp, function(err) {
|
||||
if (err) $log.debug(err);
|
||||
|
|
@ -292,8 +292,8 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
|
|||
}
|
||||
|
||||
walletService.broadcastTx(client, signedTxp, function(err, broadcastedTxp) {
|
||||
ongoingProcess.set('Sending Bitcoin to Coinbase...', false);
|
||||
if (err) {
|
||||
self.loading = null;
|
||||
$log.debug(err);
|
||||
walletService.removeTx(client, broadcastedTxp, function(err) {
|
||||
if (err) $log.debug(err);
|
||||
|
|
@ -305,7 +305,6 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
|
|||
});
|
||||
}
|
||||
$timeout(function() {
|
||||
self.loading = null;
|
||||
return cb(null, broadcastedTxp);
|
||||
}, 5000);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('sellGlideraController',
|
||||
function($rootScope, $scope, $timeout, $ionicModal, $log, $modal, configService, profileService, addressService, feeService, glideraService, bwsError, lodash, walletService, fingerprintService) {
|
||||
function($rootScope, $scope, $timeout, $ionicModal, $log, $modal, configService, profileService, addressService, feeService, glideraService, bwsError, lodash, walletService, fingerprintService, ongoingProcess) {
|
||||
|
||||
var self = this;
|
||||
var config = configService.getSync();
|
||||
|
|
@ -9,7 +9,6 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
|
|||
this.show2faCodeInput = null;
|
||||
this.success = null;
|
||||
this.error = null;
|
||||
this.loading = null;
|
||||
var client;
|
||||
|
||||
var handleEncryptedWallet = function(client, cb) {
|
||||
|
|
@ -74,10 +73,10 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
|
|||
|
||||
this.get2faCode = function(token) {
|
||||
var self = this;
|
||||
self.loading = 'Sending 2FA code...';
|
||||
ongoingProcess.set('Sending 2FA code...', true);
|
||||
$timeout(function() {
|
||||
glideraService.get2faCode(token, function(err, sent) {
|
||||
self.loading = null;
|
||||
ongoingProcess.set('Sending 2FA code...', false);
|
||||
if (err) {
|
||||
self.error = 'Could not send confirmation code to your phone';
|
||||
} else {
|
||||
|
|
@ -99,15 +98,17 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
|
|||
return;
|
||||
}
|
||||
|
||||
ongoingProcess.set('creatingTx', true);
|
||||
addressService.getAddress(client.credentials.walletId, null, function(err, refundAddress) {
|
||||
if (!refundAddress) {
|
||||
self.loading = null;
|
||||
|
||||
ongoingProcess.clear();
|
||||
self.error = bwsError.msg(err, 'Could not create address');
|
||||
return;
|
||||
}
|
||||
glideraService.getSellAddress(token, function(error, sellAddress) {
|
||||
if (!sellAddress) {
|
||||
self.loading = null;
|
||||
ongoingProcess.clear();
|
||||
self.error = 'Could not get the destination bitcoin address';
|
||||
return;
|
||||
}
|
||||
|
|
@ -133,9 +134,8 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
|
|||
}
|
||||
};
|
||||
|
||||
self.loading = 'Creating transaction...';
|
||||
walletService.createTx(client, txp, function(err, createdTxp) {
|
||||
self.loading = null;
|
||||
ongoingProcess.clear();
|
||||
if (err) {
|
||||
self.error = err.message || bwsError.msg(err);
|
||||
return;
|
||||
|
|
@ -154,11 +154,10 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
|
|||
return;
|
||||
}
|
||||
|
||||
self.loading = 'Signing transaction...';
|
||||
|
||||
ongoingProcess.set('signingTx', true);
|
||||
walletService.publishTx(client, createdTxp, function(err, publishedTxp) {
|
||||
if (err) {
|
||||
self.loading = null;
|
||||
ongoingProcess.clear();
|
||||
self.error = err.message || bwsError.msg(err);
|
||||
}
|
||||
|
||||
|
|
@ -167,8 +166,8 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
|
|||
walletService.removeTx(client, signedTxp, function(err) {
|
||||
if (err) $log.debug(err);
|
||||
});
|
||||
ongoingProcess.clear();
|
||||
if (err) {
|
||||
self.loading = null;
|
||||
self.error = err.message || bwsError.msg(err);
|
||||
return;
|
||||
}
|
||||
|
|
@ -180,9 +179,9 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
|
|||
useCurrentPrice: self.sellPrice.priceUuid ? false : true,
|
||||
ip: null
|
||||
};
|
||||
self.loading = 'Selling bitcoin...';
|
||||
ongoingProcess.set('Seling Bitcoin', true);
|
||||
glideraService.sell(token, twoFaCode, data, function(err, data) {
|
||||
self.loading = null;
|
||||
ongoingProcess.clear();
|
||||
if (err) {
|
||||
self.error = err.message || bwsError.msg(err);
|
||||
$timeout(function() {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('walletHomeController', function($scope, $rootScope, $interval, $timeout, $filter, $modal, $log, $ionicModal, notification, txStatus, profileService, lodash, configService, rateService, storageService, bitcore, gettext, gettextCatalog, platformInfo, addressService, ledger, bwsError, confirmDialog, txFormatService, 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 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() {
|
||||
disableAddrListener();
|
||||
disableScannerListener();
|
||||
|
|
@ -104,7 +100,6 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
disableTabListener();
|
||||
disableFocusListener();
|
||||
disableResumeListener();
|
||||
disableOngoingProcessListener();
|
||||
$rootScope.shouldHideMenuBar = false;
|
||||
});
|
||||
|
||||
|
|
@ -398,26 +393,6 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
}, 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() {
|
||||
if (!$scope._amount || !$scope._address) return;
|
||||
var client = profileService.focusedClient;
|
||||
|
|
@ -473,9 +448,9 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
txp.excludeUnconfirmedUtxos = configWallet.spendUnconfirmed ? false : true;
|
||||
txp.feeLevel = walletSettings.feeLevel || 'normal';
|
||||
|
||||
self.setOngoingProcess(gettextCatalog.getString('Creating transaction'));
|
||||
ongoingProcess.set('creatingTx', true);
|
||||
walletService.createTx(client, txp, function(err, createdTxp) {
|
||||
self.setOngoingProcess();
|
||||
ongoingProcess.set('creatingTx', false);
|
||||
if (err) {
|
||||
return self.setSendError(err);
|
||||
}
|
||||
|
|
@ -511,16 +486,16 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
return self.setSendError(err);
|
||||
}
|
||||
|
||||
self.setOngoingProcess(gettextCatalog.getString('Sending transaction'));
|
||||
ongoingProcess.set('sendingTx', true);
|
||||
walletService.publishTx(client, txp, function(err, publishedTxp) {
|
||||
if (err) {
|
||||
self.setOngoingProcess();
|
||||
ongoingProcess.set('sendingTx', false);
|
||||
return self.setSendError(err);
|
||||
}
|
||||
|
||||
self.setOngoingProcess(gettextCatalog.getString('Signing transaction'));
|
||||
ongoingProcess.set('signingTx', true);
|
||||
walletService.signTx(client, publishedTxp, function(err, signedTxp) {
|
||||
self.setOngoingProcess();
|
||||
ongoingProcess.set('signingTx', false);
|
||||
walletService.lock(client);
|
||||
if (err) {
|
||||
$scope.$emit('Local/TxProposalAction');
|
||||
|
|
@ -531,9 +506,9 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
}
|
||||
|
||||
if (signedTxp.status == 'accepted') {
|
||||
self.setOngoingProcess(gettextCatalog.getString('Broadcasting transaction'));
|
||||
ongoingProcess.set('broadcastingTx', true);
|
||||
walletService.broadcastTx(client, signedTxp, function(err, broadcastedTxp) {
|
||||
self.setOngoingProcess();
|
||||
ongoingProcess.set('broadcastingTx', false);
|
||||
if (err) {
|
||||
return self.setSendError(err);
|
||||
}
|
||||
|
|
@ -652,14 +627,14 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
var satToUnit = 1 / this.unitToSatoshi;
|
||||
var self = this;
|
||||
/// 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);
|
||||
$timeout(function() {
|
||||
fc.fetchPayPro({
|
||||
payProUrl: uri,
|
||||
}, function(err, paypro) {
|
||||
self.setOngoingProcess();
|
||||
ongoingProcess.set('fetchingPayPro', false);
|
||||
|
||||
if (err) {
|
||||
$log.warn('Could not fetch payment request:', err);
|
||||
|
|
@ -836,11 +811,11 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
var self = this;
|
||||
var fc = profileService.focusedClient;
|
||||
this.error = null;
|
||||
this.setOngoingProcess(gettextCatalog.getString('Calculating fee'));
|
||||
ongoingProcess.set('calculatingFee', true);
|
||||
|
||||
feeService.getCurrentFeeValue(function(err, feePerKb) {
|
||||
ongoingProcess.set('calculatingFee', false);
|
||||
if (err || !lodash.isNumber(feePerKb)) {
|
||||
self.setOngoingProcess();
|
||||
self.error = gettext('Could not get fee value');
|
||||
return;
|
||||
}
|
||||
|
|
@ -850,10 +825,11 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
opts.returnInputs = true;
|
||||
var config = configService.getSync();
|
||||
opts.excludeUnconfirmedUtxos = !config.wallet.spendUnconfirmed;
|
||||
self.setOngoingProcess(gettextCatalog.getString('Retrieving inputs information'));
|
||||
ongoingProcess.set('retrivingInputs', true);
|
||||
|
||||
fc.getSendMaxInfo(opts, function(err, resp) {
|
||||
self.setOngoingProcess();
|
||||
ongoingProcess.set('retrivingInputs', false);
|
||||
|
||||
if (err) {
|
||||
self.error = err;
|
||||
$scope.$apply();
|
||||
|
|
|
|||
75
src/js/services/onGoingProcess.js
Normal file
75
src/js/services/onGoingProcess.js
Normal 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;
|
||||
});
|
||||
|
|
@ -329,7 +329,7 @@ angular.module('copayApp.services')
|
|||
return cb(null, walletClient, secret);
|
||||
});
|
||||
});
|
||||
}, 5);
|
||||
}, 50);
|
||||
};
|
||||
|
||||
// Creates the default Copay profile and its wallet
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@ describe('createController', function() {
|
|||
it('should create a 1-1 wallet from mnemonic', function(done) {
|
||||
var fakeForm = {};
|
||||
|
||||
console.log('[create.test.js.119]'); //TODO
|
||||
// FROM DATA
|
||||
scope.seedSource = {
|
||||
id: 'set'
|
||||
|
|
@ -131,8 +132,12 @@ describe('createController', function() {
|
|||
scope._walletPrivKey = 'Kz4CFSTgLzoYfMkt97BTBotUbZYXjMts6Ej9HbVfCf5oLmun1BXy';
|
||||
|
||||
ctrl.setSeedSource();
|
||||
|
||||
console.log('[create.test.js.135]'); //TODO
|
||||
ctrl.create(fakeForm);
|
||||
|
||||
console.log('[create.test.js.138]'); //TODO
|
||||
|
||||
should.not.exist(ctrl.error);
|
||||
mocks.go.walletHome.calledOnce.should.equal(true);
|
||||
//
|
||||
|
|
|
|||
|
|
@ -74,7 +74,8 @@ describe('disclaimerController', function() {
|
|||
mnemonic: 'tunnel fork scare industry noble snow tank bullet over gesture nuclear next',
|
||||
});
|
||||
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();
|
||||
}, 100);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -42,6 +42,10 @@ mocks.$timeout = function(cb) {
|
|||
};
|
||||
|
||||
mocks.modal = function() {};
|
||||
mocks.ongoingProcess = {
|
||||
set: sinon.stub(),
|
||||
clear: sinon.stub(),
|
||||
};
|
||||
|
||||
|
||||
mocks.setProfile = function(profile) {};
|
||||
|
|
@ -192,6 +196,7 @@ mocks.init = function(fixtures, controllerName, opts, done) {
|
|||
ctrl = $controller(controllerName, {
|
||||
$scope: scope,
|
||||
$modal: mocks.modal,
|
||||
ongoingProcess: mocks.ongoingProcess,
|
||||
notification: mocks.notification,
|
||||
configService: _configService_,
|
||||
profileService: _profileService_,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue