Merge branch 'ref/design' of https://github.com/bitpay/bitpay-wallet into feature/get_started_flow

This commit is contained in:
Jamal Jackson 2016-08-30 11:23:37 -04:00
commit b24110cf01
65 changed files with 507 additions and 790 deletions

View file

@ -42,7 +42,7 @@
"url": "https://github.com/bitpay/copay/issues" "url": "https://github.com/bitpay/copay/issues"
}, },
"dependencies": { "dependencies": {
"bitcore-wallet-client": "2.11.0", "bitcore-wallet-client": "4.0.0",
"coveralls": "^2.11.9", "coveralls": "^2.11.9",
"express": "^4.11.2", "express": "^4.11.2",
"fs": "0.0.2", "fs": "0.0.2",

View file

@ -45,7 +45,7 @@
"url": "https://github.com/bitpay/copay/issues" "url": "https://github.com/bitpay/copay/issues"
}, },
"dependencies": { "dependencies": {
"bitcore-wallet-client": "2.11.0", "bitcore-wallet-client": "4.0.0",
"coveralls": "^2.11.9", "coveralls": "^2.11.9",
"express": "^4.11.2", "express": "^4.11.2",
"fs": "0.0.2", "fs": "0.0.2",

View file

@ -30,10 +30,10 @@
</div> </div>
<div class="item item-text-wrap item-button-right"> <div class="item item-text-wrap item-button-right">
<button class="button black" ng-click="toggleAlternative()" ng-show="showAlternativeAmount">{{alternativeIsoCode}}</button> <a class="postfix" ng-click="toggleAlternative()" ng-show="showAlternativeAmount">{{alternativeIsoCode}}</a>
<button class="button transform-none" ng-click="toggleAlternative()" ng-show="!showAlternativeAmount">{{unitName}}</button> <a class="postfix" ng-click="toggleAlternative()" ng-show="!showAlternativeAmount">{{unitName}}</a>
<div class="text-light text-black m15b" ng-class="{'size-28': smallFont, 'size-36': !smallFont}"> <span> {{amount || "0.00" }}</div> <div class="text-light text-black m15b" ng-class="{'size-28': smallFont, 'size-36': !smallFont}"> <span> {{amount || "0.00" }}</div>
<div class="text-light text-black" ng-class="{'size-16': smallFont, 'size-17': !smallFont}" ng-show="!showAlternativeAmount"> <div class="text-light text-black" ng-class="{'size-16': smallFont, 'size-17': !smallFont}" ng-show="!showAlternativeAmount">

View file

@ -1,12 +1,15 @@
<ion-view ng-controller="backupController" ng-init="init()"> <ion-view>
<ion-nav-bar class="bar-stable"> <ion-nav-bar>
<ion-nav-buttons side="primary"> <ion-nav-back-button>
 <button class="button no-border" ng-click="goBack()"> {{'Back' | translate}}
     <i class="icon ion-chevron-left"></i>Back </ion-nav-back-button>
   </button>
  </ion-nav-buttons>
</ion-nav-bar> </ion-nav-bar>
<ion-content>
<ion-content ng-controller="backupController" ng-init="init()">
<div ng-show="deleted">
<span translate>Wallet recovery phrase not available. You can still export it from Advanced &gt; Export.</span>
</div>
<!-- <!--
## STEP 1 ## STEP 1
--> -->

View file

@ -15,7 +15,7 @@
<ion-content ng-controller="bitpayCardController as bitpayCard" ng-init="bitpayCard.init()"> <ion-content ng-controller="bitpayCardController as bitpayCard" ng-init="bitpayCard.init()">
<div class="text-center size-12" ng-show="network == 'testnet'"> <div class="box-notification warning" ng-show="network == 'testnet'">
Sandbox version. Only for testing purpose Sandbox version. Only for testing purpose
</div> </div>
@ -31,7 +31,7 @@
<span ng-show="!bitpayCard.bitpayCardTwoFactorPending">Login to your account</span> <span ng-show="!bitpayCard.bitpayCardTwoFactorPending">Login to your account</span>
<span ng-show="bitpayCard.bitpayCardTwoFactorPending">2-Step Verification</span> <span ng-show="bitpayCard.bitpayCardTwoFactorPending">2-Step Verification</span>
</h4> </h4>
<div class="m10b size-12" <div class="box-notification error"
ng-show="bitpayCard.error" ng-show="bitpayCard.error"
ng-click="bitpayCard.error = null"> ng-click="bitpayCard.error = null">
{{bitpayCard.error}} {{bitpayCard.error}}
@ -63,7 +63,7 @@
</label> </label>
</div> </div>
<input class="button button-block button-positive" <input class="button button-block"
type="submit" type="submit"
ng-disabled="!authenticateForm.$valid || bitpayCard.authenticating" ng-disabled="!authenticateForm.$valid || bitpayCard.authenticating"
value="Login"> value="Login">
@ -90,7 +90,7 @@
</label> </label>
</div> </div>
<input class="button button-block button-positive" <input class="button button-block"
type="submit" type="submit"
ng-disabled="!authenticate2FAForm.$valid || bitpayCard.authenticating" ng-disabled="!authenticate2FAForm.$valid || bitpayCard.authenticating"
value="Login"> value="Login">
@ -121,7 +121,7 @@
<option value="all">All Activity</option> <option value="all">All Activity</option>
</select> </select>
<div class="m20v size-12 text-center text-warning" <div class="box-notification error"
ng-show="bitpayCard.error"> ng-show="bitpayCard.error">
{{bitpayCard.error}} {{bitpayCard.error}}
</div> </div>
@ -176,7 +176,7 @@
</div> </div>
<div ng-show="bitpayCard.bitpayCardAuthenticated && !bitpayCard.visaCardActivated && addFunds"> <div ng-show="bitpayCard.bitpayCardAuthenticated && !bitpayCard.visaCardActivated && addFunds">
<div class="m10b box-notification size-12 text-warning" <div class="box-notification error"
ng-show="bitpayCard.error" ng-show="bitpayCard.error"
ng-click="bitpayCard.error = null"> ng-click="bitpayCard.error = null">
{{bitpayCard.error}} {{bitpayCard.error}}
@ -199,25 +199,11 @@
ng-model="fiat" ng-model="fiat"
autocomplete="off" autocomplete="off"
required> required>
<a class="postfix button black">USD</a> <a class="postfix">USD</a>
</label> </label>
<label class="item item-input item-stacked-label"> <wallets ng-if="wallets[0]" wallets="wallets"></wallets>
<span class="input-label">Add From Copay Wallet</span>
<input
type="text"
id="address"
name="address"
ng-disabled="bitpayCard.selectedWalletId"
ng-attr-placeholder="{{'Choose your source wallet'}}"
ng-model="bitpayCard.selectedWalletName" required>
<a
class="postfix size-12 m0 text-gray"
ng-style="{'color': '#293C92'}"
on-tap="openWalletsModal(bitpayCard.allWallets)">
<i class="icon-wallet size-18"></i>
</a>
</label>
</div> </div>
<p class="size-12 text-warning" ng-show="bitpayCard.isMultisigWallet"> <p class="size-12 text-warning" ng-show="bitpayCard.isMultisigWallet">
@ -234,8 +220,8 @@
</button> </button>
</div> </div>
<div class="col"> <div class="col">
<button class="button button-block button-positive" <button class="button button-block"
ng-disabled="!bitpayCard.selectedWalletId || !fiat" ng-disabled="!fiat"
type="submit"> type="submit">
Send Send
</button> </button>

View file

@ -50,7 +50,7 @@
max="500" max="500"
ng-model="fiat" ng-model="fiat"
autocomplete="off" ignore-mouse-wheel required> autocomplete="off" ignore-mouse-wheel required>
<a class="postfix">USD</a>
</label> </label>
<wallets ng-if="wallets[0]" wallets="wallets"></wallets> <wallets ng-if="wallets[0]" wallets="wallets"></wallets>

View file

@ -13,7 +13,7 @@
</div> </div>
<div ng-if="type == 'created'" class="popup-txsigned m30tp"> <div ng-if="type == 'created'" class="popup-txsigned text-center m30tp">
<i class="icon ion-checkmark-round"></i> <i class="icon ion-checkmark-round"></i>
<div class="text-center size-18 tu text-bold m20t"> <div class="text-center size-18 tu text-bold m20t">
<span translate>Payment Proposal Created</span> <span translate>Payment Proposal Created</span>
@ -25,7 +25,7 @@
<div ng-if="type == 'accepted'" class="popup-txsigned m30tp"> <div ng-if="type == 'accepted'" class="popup-txsigned text-center m30tp">
<i class="icon ion-checkmark-round"></i> <i class="icon ion-checkmark-round"></i>
<div class="text-center size-18 tu text-bold m20t"> <div class="text-center size-18 tu text-bold m20t">
<span translate>Payment Accepted</span> <span translate>Payment Accepted</span>
@ -35,7 +35,7 @@
</div> </div>
</div> </div>
<div ng-if="type=='rejected'" class="popup-txrejected m30tp"> <div ng-if="type=='rejected'" class="popup-txrejected text-center m30tp">
<i class="icon ion-close-round"></i> <i class="icon ion-close-round"></i>
<div class="text-center size-18 tu text-bold m20t"> <div class="text-center size-18 tu text-bold m20t">
<span translate>Payment Rejected</span> <span translate>Payment Rejected</span>

View file

@ -1,7 +1,7 @@
<ion-view ng-controller="collectEmailController" ng-init="init()"> <ion-view ng-controller="collectEmailController">
<ion-nav-bar class="bar-stable"> <ion-nav-bar class="bar-stable">
<ion-nav-buttons side="secondary"> <ion-nav-buttons side="secondary">
<button class="button no-border" href ui-sref="onboarding.notifications"> <button class="button no-border" ng-click="skip()">
Skip Skip
</button> </button>
</ion-nav-buttons> </ion-nav-buttons>

View file

@ -1,5 +1,5 @@
<ion-view> <ion-view>
<ion-content ng-controller="notificationsController" > <ion-content ng-controller="notificationsController">
<div class="text-center"> <div class="text-center">
<h1 translate> <h1 translate>
Push Notifications Push Notifications

View file

@ -1,13 +1,10 @@
<ion-view> <ion-view>
<ion-nav-bar class="bar-stable"> <ion-nav-bar>
<ion-nav-title>Wallet Settings</ion-nav-title> <ion-nav-back-button>
<ion-nav-buttons side="primary"> {{'Back' | translate}}
<button class="button no-border" ui-sref="wallet.details"> </ion-nav-back-button>
<i class="icon ion-chevron-left"></i> Back
</button>
</ion-nav-buttons>
</ion-nav-bar> </ion-nav-bar>
<ion-content ng-controller="preferencesController" ng-init="init()"> <ion-content ng-controller="preferencesController" ng-init="init()">
<div class="list"> <div class="list">
<div class="item item-divider"> <div class="item item-divider">
Preferences Preferences
@ -20,18 +17,12 @@
<i class="icon ion-ios-arrow-right"></i> <i class="icon ion-ios-arrow-right"></i>
</div> </div>
<div class="item"> <div class="item">
<span translate>Devices</span> <span translate>Wallet Type</span>
<span class="item-note"> <span class="item-note">
1 {{wallet.m}}-of-{{wallet.n}}
</span> </span>
</div> </div>
<div class="item"> <div class="item" ng-show="wallet.isPrivKeyExternal()">
<span translate>Required number of signatures</span>
<span class="item-note">
1
</span>
</div>
<div class="item" ng-show="index.isPrivKeyExternal">
<span translate>Hardware wallet</span> <span translate>Hardware wallet</span>
<span class="item-note"> <span class="item-note">
{{wallet.externalSource}} {{wallet.externalSource}}
@ -56,15 +47,20 @@
<div class="item item-divider"> <div class="item item-divider">
Security Security
</div> </div>
<div class="item item-icon-right" href ui-sref="wallet.backup" ng-hide="index.isPrivKeyExternal"> <div class="item item-icon-right" href ui-sref="wallet.backup" ng-hide="wallet.isPrivKeyExternal()">
<span translate>Backup</span> <span translate>Backup</span>
<i class="icon ion-ios-arrow-right"></i> <i class="icon ion-ios-arrow-right"></i>
</div> </div>
<div ng-show="!index.noFocusedWallet && index.canSign"> <div ng-show="wallet.canSign()">
<ion-toggle ng-model="encryptEnabled" toggle-class="toggle-balanced" ng-change="encryptChange()"> <ion-toggle ng-model="encryptEnabled" toggle-class="toggle-balanced" ng-change="encryptChange()">
<span class="toggle-label" translate>Request Spending Password</span> <span class="toggle-label" translate>Request Spending Password</span>
</ion-toggle> </ion-toggle>
</div> </div>
<div ng-show="wallet.canSign() && touchIdAvailable">
<ion-toggle ng-model="touchIdEnabled" toggle-class="toggle-balanced" ng-change="touchIdChange()">
<span class="toggle-label" translate>Request Fingerprint</span>
</ion-toggle>
</div>
<div class="item item-icon-right" href ui-sref="wallet.deleteWords" ng-show ="!deleted"> <div class="item item-icon-right" href ui-sref="wallet.deleteWords" ng-show ="!deleted">
<span translate>Delete recovery phrase</span> <span translate>Delete recovery phrase</span>
<i class="icon ion-ios-arrow-right"></i> <i class="icon ion-ios-arrow-right"></i>

View file

@ -1,13 +1,12 @@
<ion-view> <ion-view>
<ion-nav-bar class="bar-stable"> <ion-nav-bar>
<ion-nav-title>About Copay</ion-nav-title>
<ion-nav-buttons side="primary"> <ion-nav-buttons side="primary">
<button class="button no-border" ui-sref="tabs.settings"> <button class="button button-stable no-border" ui-sref="tabs.settings">
<i class="icon ion-chevron-left"></i> Back <i class="icon ion-chevron-left"></i> {{'Back' | translate}}
</button> </button>
</ion-nav-buttons> </ion-nav-buttons>
</ion-nav-bar> </ion-nav-bar>
<ion-content ng-controller="preferencesAbout" > <ion-content ng-controller="preferencesAbout">
<div class="item item-divider"> <div class="item item-divider">
Release information Release information
</div> </div>

View file

@ -1,11 +1,9 @@
<ion-view > <ion-view >
<ion-nav-bar class="bar-stable"> <ion-nav-bar>
<ion-nav-title>Advanced Preferences</ion-nav-title> <ion-nav-title>{{'Advanced Preferences' | translate}}</ion-nav-title>
<ion-nav-buttons side="primary"> <ion-nav-back-button>
<button class="button no-border" ui-sref="wallet.preferences"> {{'Back' | translate}}
<i class="icon ion-chevron-left"></i> Back </ion-nav-back-button>
</button>
</ion-nav-buttons>
</ion-nav-bar> </ion-nav-bar>
<ion-content> <ion-content>
<div class="list"> <div class="list">

View file

@ -1,11 +1,8 @@
<ion-view> <ion-view>
<ion-nav-bar class="bar-stable"> <ion-nav-bar>
<ion-nav-title>Alias</ion-nav-title> <ion-nav-back-button>
<ion-nav-buttons side="primary"> {{'Back' | translate}}
<button class="button no-border" ui-sref="wallet.preferences"> </ion-nav-back-button>
<i class="icon ion-chevron-left"></i> Back
</button>
</ion-nav-buttons>
</ion-nav-bar> </ion-nav-bar>
<ion-content ng-controller="preferencesAliasController" > <ion-content ng-controller="preferencesAliasController" >
<form name="aliasForm" ng-submit="save(aliasForm)" novalidate> <form name="aliasForm" ng-submit="save(aliasForm)" novalidate>

View file

@ -1,11 +1,8 @@
<ion-view> <ion-view>
<ion-nav-bar class="bar-stable"> <ion-nav-bar>
<ion-nav-title>Alternative Currency</ion-nav-title> <ion-nav-back-button>
<ion-nav-buttons side="primary"> {{'Back' | translate}}
<button class="button no-border" ui-sref="tabs.settings"> </ion-nav-back-button>
<i class="icon ion-chevron-left"></i> Back
</button>
</ion-nav-buttons>
</ion-nav-bar> </ion-nav-bar>
<ion-content ng-controller="preferencesAltCurrencyController" ng-init="init()" > <ion-content ng-controller="preferencesAltCurrencyController" ng-init="init()" >
<ion-radio ng-repeat="altCurrency in altCurrencyList" ng-value="altCurrency.isoCode" ng-model="currentCurrency" <ion-radio ng-repeat="altCurrency in altCurrencyList" ng-value="altCurrency.isoCode" ng-model="currentCurrency"

View file

@ -1,11 +1,8 @@
<ion-view> <ion-view>
<ion-nav-bar class="bar-stable"> <ion-nav-bar>
<ion-nav-title>Wallet Service URL</ion-nav-title> <ion-nav-back-button>
<ion-nav-buttons side="primary"> {{'Back' | translate}}
<button class="button no-border" ui-sref="wallet.preferencesAdvanced"> </ion-nav-back-button>
<i class="icon ion-chevron-left"></i> Back
</button>
</ion-nav-buttons>
</ion-nav-bar> </ion-nav-bar>
<ion-content ng-controller="preferencesBwsUrlController" > <ion-content ng-controller="preferencesBwsUrlController" >
<form name="settingsBwsUrlForm" ng-submit="save(settingsBwsUrlForm)" novalidate> <form name="settingsBwsUrlForm" ng-submit="save(settingsBwsUrlForm)" novalidate>

View file

@ -1,11 +1,8 @@
<ion-view> <ion-view>
<ion-nav-bar class="bar-stable"> <ion-nav-bar>
<ion-nav-title>Color</ion-nav-title> <ion-nav-back-button>
<ion-nav-buttons side="primary"> {{'Back' | translate}}
<button class="button no-border" ui-sref="wallet.preferences"> </ion-nav-back-button>
<i class="icon ion-chevron-left"></i> Back
</button>
</ion-nav-buttons>
</ion-nav-bar> </ion-nav-bar>
<ion-content ng-controller="preferencesColorController" > <ion-content ng-controller="preferencesColorController" >
<ion-radio ng-repeat="c in colorList" ng-value="c" ng-model="currentColor" ng-click="save(c)"> <ion-radio ng-repeat="c in colorList" ng-value="c" ng-model="currentColor" ng-click="save(c)">

View file

@ -1,11 +1,8 @@
<ion-view> <ion-view>
<ion-nav-bar class="bar-stable"> <ion-nav-bar>
<ion-nav-title>Delete Wallet</ion-nav-title> <ion-nav-back-button>
<ion-nav-buttons side="primary"> {{'Back' | translate}}
<button class="button no-border" ui-sref="wallet.preferencesAdvanced"> </ion-nav-back-button>
<i class="icon ion-chevron-left"></i> Back
</button>
</ion-nav-buttons>
</ion-nav-bar> </ion-nav-bar>
<ion-content class="has-header" ng-controller="preferencesDeleteWalletController" > <ion-content class="has-header" ng-controller="preferencesDeleteWalletController" >
<div translate>Warning!</div> <div translate>Warning!</div>

View file

@ -1,11 +1,8 @@
<ion-view> <ion-view>
<ion-nav-bar class="bar-stable"> <ion-nav-bar>
<ion-nav-title>Delete Recovery Phrase</ion-nav-title> <ion-nav-back-button>
<ion-nav-buttons side="primary"> {{'Back' | translate}}
<button class="button no-border" ui-sref="wallet.preferences"> </ion-nav-back-button>
<i class="icon ion-chevron-left"></i> Back
</button>
</ion-nav-buttons>
</ion-nav-bar> </ion-nav-bar>
<ion-content ng-controller="preferencesDeleteWordsController" > <ion-content ng-controller="preferencesDeleteWordsController" >
<div ng-show="!deleted"> <div ng-show="!deleted">

View file

@ -1,11 +1,8 @@
<ion-view> <ion-view>
<ion-nav-bar class="bar-stable"> <ion-nav-bar>
<ion-nav-title>Email Notifications</ion-nav-title> <ion-nav-back-button>
<ion-nav-buttons side="primary"> {{'Back' | translate}}
<button class="button no-border" ui-sref="wallet.preferences"> </ion-nav-back-button>
<i class="icon ion-chevron-left"></i> Back
</button>
</ion-nav-buttons>
</ion-nav-bar> </ion-nav-bar>
<ion-content ng-controller="preferencesEmailController" > <ion-content ng-controller="preferencesEmailController" >
<form name="emailForm" ng-submit="save(emailForm)" novalidate> <form name="emailForm" ng-submit="save(emailForm)" novalidate>

View file

@ -1,11 +1,8 @@
<ion-view> <ion-view>
<ion-nav-bar class="bar-stable"> <ion-nav-bar>
<ion-nav-title>Preferences fee</ion-nav-title> <ion-nav-back-button>
<ion-nav-buttons side="primary"> {{'Back' | translate}}
<button class="button no-border" ui-sref="tabs.settings"> </ion-nav-back-button>
<i class="icon ion-chevron-left"></i> Back
</button>
</ion-nav-buttons>
</ion-nav-bar> </ion-nav-bar>
<ion-content ng-controller="preferencesFeeController" ng-init="init()"> <ion-content ng-controller="preferencesFeeController" ng-init="init()">

View file

@ -1,13 +1,10 @@
<ion-view> <ion-view>
<ion-nav-bar class="bar-stable"> <ion-nav-bar>
<ion-nav-title>Transaction History</ion-nav-title> <ion-nav-back-button>
<ion-nav-buttons side="primary"> {{'Back' | translate}}
<button class="button no-border" ui-sref="wallet.preferencesAdvanced"> </ion-nav-back-button>
<i class="icon ion-chevron-left"></i> Back
</button>
</ion-nav-buttons>
</ion-nav-bar> </ion-nav-bar>
<ion-content ng-controller="preferencesHistory" ng-init="index.updatingTxHistory ? null : csvHistory()"> <ion-content ng-controller="preferencesHistory" ng-init="index.updatingTxHistory ? null : csvHistory()">
<div class="item item-divider"></div> <div class="item item-divider"></div>
<div class="item" ng-show="csvReady && !index.isCordova" ng-csv="csvContent" csv-header="csvHeader" filename="Copay-{{index.alias || index.walletName}}.csv"> <div class="item" ng-show="csvReady && !index.isCordova" ng-csv="csvContent" csv-header="csvHeader" filename="Copay-{{index.alias || index.walletName}}.csv">
<span translate>Export to file</span> <span translate>Export to file</span>

View file

@ -1,11 +1,8 @@
<ion-view> <ion-view>
<ion-nav-bar class="bar-stable"> <ion-nav-bar>
<ion-nav-title>Wallet Information</ion-nav-title> <ion-nav-back-button>
<ion-nav-buttons side="primary"> {{'Back' | translate}}
<button class="button no-border" ui-sref="wallet.preferencesAdvanced"> </ion-nav-back-button>
<i class="icon ion-chevron-left"></i> Back
</button>
</ion-nav-buttons>
</ion-nav-bar> </ion-nav-bar>
<ion-content ng-controller="preferencesInformation" ng-init="init()"> <ion-content ng-controller="preferencesInformation" ng-init="init()">
<div class="list"> <div class="list">

View file

@ -1,11 +1,8 @@
<ion-view> <ion-view>
<ion-nav-bar class="bar-stable"> <ion-nav-bar>
<ion-nav-title>Languages</ion-nav-title> <ion-nav-back-button>
<ion-nav-buttons side="primary"> {{'Back' | translate}}
<button class="button no-border" ui-sref="tabs.settings"> </ion-nav-back-button>
<i class="icon ion-chevron-left"></i> Back
</button>
</ion-nav-buttons>
</ion-nav-bar> </ion-nav-bar>
<ion-content ng-controller="preferencesLanguageController" ng-init="init()" > <ion-content ng-controller="preferencesLanguageController" ng-init="init()" >
<ion-radio ng-repeat="lang in availableLanguages" ng-value="lang.isoCode" ng-model="currentLanguage" <ion-radio ng-repeat="lang in availableLanguages" ng-value="lang.isoCode" ng-model="currentLanguage"

View file

@ -1,11 +1,8 @@
<ion-view> <ion-view>
<ion-nav-bar class="bar-stable"> <ion-nav-bar>
<ion-nav-title>Session log</ion-nav-title> <ion-nav-back-button>
<ion-nav-buttons side="primary"> {{'Back' | translate}}
<button class="button no-border" ui-sref="settings.about"> </ion-nav-back-button>
<i class="icon ion-chevron-left"></i> Back
</button>
</ion-nav-buttons>
</ion-nav-bar> </ion-nav-bar>
<ion-content ng-controller="preferencesLogs" ng-init="init()" > <ion-content ng-controller="preferencesLogs" ng-init="init()" >
<button ng-show="isCordova" ng-click="logs.sendLogs()"><i class="fi-mail"></i> <button ng-show="isCordova" ng-click="logs.sendLogs()"><i class="fi-mail"></i>

View file

@ -1,12 +1,9 @@
<ion-view> <ion-view>
<ion-nav-bar class="bar-stable"> <ion-nav-bar>
<ion-nav-title>Unit</ion-nav-title> <ion-nav-back-button>
<ion-nav-buttons side="primary"> {{'Back' | translate}}
<button class="button no-border" ui-sref="tabs.settings"> </ion-nav-back-button>
<i class="icon ion-chevron-left"></i> Back </ion-nav-bar>
</button>
</ion-nav-buttons>
</ion-nav-bar class="bar-stable">
<ion-content ng-controller="preferencesUnitController" ng-init="init()" > <ion-content ng-controller="preferencesUnitController" ng-init="init()" >
<ion-radio ng-repeat="unit in unitList" ng-value="unit.code" ng-model="currentUnit" <ion-radio ng-repeat="unit in unitList" ng-value="unit.code" ng-model="currentUnit"
ng-click="save(unit)">{{unit.shortName}} ng-click="save(unit)">{{unit.shortName}}

View file

@ -22,7 +22,7 @@
<a class="item text-center" ui-sref="activity" ng-show="notificationsMore"> <a class="item text-center" ui-sref="activity" ng-show="notificationsMore">
<span translate>More</span> ({{notificationsMore}}) <span translate>More</span> ({{notificationsMore}})
(ToDo: 1-1 no here yet) <span style="font-size:12px;color:gray">(ToDo: Cache, refresh & seft not. 1-1 no here yet)</span>
</a> </a>
<div class="item" ng-show="!notifications[0]"> <div class="item" ng-show="!notifications[0]">

View file

@ -1,12 +1,10 @@
<ion-view> <ion-view>
<ion-nav-bar class="bar-stable"> <ion-nav-bar>
<ion-nav-title>Terms of Use</ion-nav-title> <ion-nav-back-button>
<ion-nav-buttons side="primary"> {{'Back' | translate}}
<button class="button no-border" ui-sref="settings.about"> </ion-nav-back-button>
<i class="icon ion-chevron-left"></i> Back
</button>
</ion-nav-buttons>
</ion-nav-bar> </ion-nav-bar>
<ion-content ng-controller="termOfUseController" cache-view="false"> <ion-content ng-controller="termOfUseController" cache-view="false">
<p> <p>
<div ng-include="'views/includes/terms.html'"></div> <div ng-include="'views/includes/terms.html'"></div>

View file

@ -1,11 +1,9 @@
<ion-view> <ion-view>
<ion-nav-bar class="bar-stable"> <ion-nav-bar>
<ion-nav-title>Translators</ion-nav-title> <ion-nav-title>{{'Translators' | translate}}</ion-nav-title>
<ion-nav-buttons side="primary"> <ion-nav-back-button>
<button class="button no-border" ui-sref="settings.about"> {{'Back' | translate}}
<i class="icon ion-chevron-left"></i> Back </ion-nav-back-button>
</button>
</ion-nav-buttons>
</ion-nav-bar> </ion-nav-bar>
<ion-content> <ion-content>
<h4 translate>Translation Credits</h4> <h4 translate>Translation Credits</h4>

View file

@ -1,50 +1,36 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('backupController', angular.module('copayApp.controllers').controller('backupController',
function($rootScope, $scope, $timeout, $log, $state, $stateParams, $ionicPopup, uxLanguage, lodash, fingerprintService, platformInfo, configService, profileService, gettext, bwcService, walletService, ongoingProcess) { function($rootScope, $scope, $timeout, $log, $state, $stateParams, $ionicPopup, $ionicNavBarDelegate, uxLanguage, lodash, fingerprintService, platformInfo, configService, profileService, bwcService, walletService, ongoingProcess) {
var wallet = profileService.getWallet($stateParams.walletId); var wallet = profileService.getWallet($stateParams.walletId);
$scope.walletName = wallet.credentials.walletName; $ionicNavBarDelegate.title(wallet.credentials.walletName);
$scope.n = wallet.n; $scope.n = wallet.n;
var keys;
$scope.credentialsEncrypted = wallet.isPrivKeyEncrypted; $scope.credentialsEncrypted = wallet.isPrivKeyEncrypted();
var isDeletedSeed = function() { var isDeletedSeed = function() {
if (lodash.isEmpty(wallet.credentials.mnemonic) && lodash.isEmpty(wallet.credentials.mnemonicEncrypted)) if (!wallet.credentials.mnemonic && !wallet.credentials.mnemonicEncrypted)
return true; return true;
return false; return false;
}; };
var handleEncryptedWallet = function(client, cb) {
if (!walletService.isEncrypted(client)) {
return cb();
}
$rootScope.$emit('Local/NeedsPassword', false, function(err, password) {
if (err) return cb(err);
return cb(walletService.unlock(client, password));
});
};
$scope.init = function() { $scope.init = function() {
$scope.deleted = isDeletedSeed(); $scope.deleted = isDeletedSeed();
if ($scope.deleted) return; if ($scope.deleted) {
$log.debug('no mnemonics');
return;
}
fingerprintService.check(wallet, function(err) { walletService.getKeys(wallet, function(err, k) {
if (err) { if (err || !k) {
$state.go('preferences'); $state.go('wallet.preferences');
return; return;
} }
$scope.credentialsEncrypted = false;
handleEncryptedWallet(wallet, function(err) { keys = k;
if (err) { $scope.initFlow();
$log.warn('Error decrypting credentials:', $scope.error);
$state.go('preferences');
return;
}
$scope.credentialsEncrypted = false;
$scope.initFlow();
});
}); });
}; };
@ -60,8 +46,10 @@ angular.module('copayApp.controllers').controller('backupController',
}; };
$scope.initFlow = function() { $scope.initFlow = function() {
var words = wallet.getMnemonic(); if (!keys) return;
$scope.xPrivKey = wallet.credentials.xPrivKey;
var words = keys.mnemonic;
$scope.mnemonicWords = words.split(/[\u3000\s]+/); $scope.mnemonicWords = words.split(/[\u3000\s]+/);
$scope.shuffledMnemonicWords = shuffledWords($scope.mnemonicWords); $scope.shuffledMnemonicWords = shuffledWords($scope.mnemonicWords);
$scope.mnemonicHasPassphrase = wallet.mnemonicHasPassphrase(); $scope.mnemonicHasPassphrase = wallet.mnemonicHasPassphrase();
@ -72,6 +60,7 @@ angular.module('copayApp.controllers').controller('backupController',
$scope.selectComplete = false; $scope.selectComplete = false;
$scope.backupError = false; $scope.backupError = false;
words = lodash.repeat('x', 300);
$timeout(function() { $timeout(function() {
$scope.$apply(); $scope.$apply();
}, 10); }, 10);
@ -81,8 +70,7 @@ angular.module('copayApp.controllers').controller('backupController',
if ($scope.step == 1) { if ($scope.step == 1) {
if ($stateParams.fromOnboarding) $state.go('onboarding.backupRequest'); if ($stateParams.fromOnboarding) $state.go('onboarding.backupRequest');
else $state.go('wallet.preferences'); else $state.go('wallet.preferences');
} } else {
else {
$scope.goToStep($scope.step - 1); $scope.goToStep($scope.step - 1);
} }
}; };
@ -108,8 +96,7 @@ angular.module('copayApp.controllers').controller('backupController',
confirmBackupPopup.close(); confirmBackupPopup.close();
if ($stateParams.fromOnboarding) $state.go('onboarding.disclaimer'); if ($stateParams.fromOnboarding) $state.go('onboarding.disclaimer');
else $state.go('tabs.home') else $state.go('tabs.home')
} } else {
else {
confirmBackupPopup.close(); confirmBackupPopup.close();
$scope.goToStep(1); $scope.goToStep(1);
} }
@ -139,10 +126,12 @@ angular.module('copayApp.controllers').controller('backupController',
account: wallet.credentials.account account: wallet.credentials.account
}); });
} catch (err) { } catch (err) {
walletClient.credentials.xPrivKey = lodash.repeat('x', 64);
return cb(err); return cb(err);
} }
if (walletClient.credentials.xPrivKey != $scope.xPrivKey) { if (walletClient.credentials.xPrivKey.substr(walletClient.credentials.xPrivKey) != keys.xPrivKey) {
delete walletClient.credentials;
return cb('Private key mismatch'); return cb('Private key mismatch');
} }
} }
@ -205,9 +194,4 @@ angular.module('copayApp.controllers').controller('backupController',
$scope.selectComplete = false; $scope.selectComplete = false;
}; };
$scope.$on('$destroy', function() {
walletService.lock(wallet);
});
}); });

View file

@ -1,6 +1,6 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('bitpayCardController', function($scope, $rootScope, $timeout, $log, $ionicModal, lodash, bitpayCardService, configService, profileService, walletService, fingerprintService, ongoingProcess, bwcError, bitcore, pbkdf2Service, moment, platformInfo) { angular.module('copayApp.controllers').controller('bitpayCardController', function($scope, $rootScope, $timeout, $log, $ionicModal, lodash, bitpayCardService, configService, profileService, walletService, ongoingProcess, pbkdf2Service, moment, platformInfo) {
var self = this; var self = this;
var wallet; var wallet;
@ -9,6 +9,15 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
StatusBar.backgroundColorByHexString("#293C92"); StatusBar.backgroundColorByHexString("#293C92");
} }
$scope.$on('Wallet/Changed', function(event, w) {
if (lodash.isEmpty(w)) {
$log.debug('No wallet provided');
return;
}
wallet = w;
$log.debug('Wallet changed: ' + w.name);
});
var processTransactions = function(invoices, history) { var processTransactions = function(invoices, history) {
for (var i = 0; i < invoices.length; i++) { for (var i = 0; i < invoices.length; i++) {
var matched = false; var matched = false;
@ -63,7 +72,6 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
bitpayCardService.isAuthenticated(function(err, bpSession) { bitpayCardService.isAuthenticated(function(err, bpSession) {
self.loadingSession = false; self.loadingSession = false;
if (err) { if (err) {
self.error = err.data.error || 'Incorrect email or password';
return; return;
} }
@ -79,7 +87,7 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
bitpayCardService.transactionHistory(dateRange, function(err, history) { bitpayCardService.transactionHistory(dateRange, function(err, history) {
$scope.loadingHistory = false; $scope.loadingHistory = false;
if (err) { if (err) {
self.error = err.error || err; self.error = 'Error getting transactions';
return; return;
} }
@ -98,60 +106,24 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
$scope.dateRange = 'last30Days'; $scope.dateRange = 'last30Days';
$scope.network = bitpayCardService.getEnvironment(); $scope.network = bitpayCardService.getEnvironment();
self.allWallets = profileService.getWallets({ $scope.wallets = profileService.getWallets({
network: $scope.network, network: $scope.network,
n: 1,
onlyComplete: true onlyComplete: true
}); });
self.update(); self.update();
if (lodash.isEmpty(self.allWallets)) return; wallet = $scope.wallets[0];
wallet = self.allWallets[0]; if (wallet && wallet.credentials.n > 1)
if (wallet.credentials.n > 1)
self.isMultisigWallet = true; self.isMultisigWallet = true;
$timeout(function() {
self.selectedWalletId = wallet.credentials.walletId;
self.selectedWalletName = wallet.credentials.walletName;
$scope.$apply();
}, 100);
};
$scope.openWalletsModal = function(wallets) {
self.error = null;
$scope.wallets = wallets;
$scope.noColor = true;
$scope.self = self;
$ionicModal.fromTemplateUrl('views/modals/wallets.html', {
scope: $scope,
animation: 'slide-in-up'
}).then(function(modal) {
$scope.walletsModal = modal;
$scope.walletsModal.show();
});
$scope.$on('walletSelected', function(ev, walletId) {
$timeout(function() {
wallet = profileService.getClient(walletId);
self.isMultisigWallet = false;
self.selectedWalletId = walletId;
self.selectedWalletName = wallet.credentials.walletName;
if (wallet.credentials.n > 1)
self.isMultisigWallet = true;
$scope.$apply();
}, 100);
$scope.walletsModal.hide();
});
}; };
this.sendFunds = function() { this.sendFunds = function() {
self.error = null; self.error = null;
if (lodash.isEmpty(wallet)) return;
if (!wallet.canSign() && !wallet.isPrivKeyExternal()) { if (!wallet.canSign() && !wallet.isPrivKeyExternal()) {
$log.info('No signing proposal: No private key'); $log.info('No signing proposal: No private key');
self.error = bwcError.msg('MISSING_PRIVATE_KEY'); self.error = bwcError.msg('MISSING_PRIVATE_KEY');
@ -205,7 +177,6 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
}; };
walletService.createTx(wallet, txp, function(err, createdTxp) { walletService.createTx(wallet, txp, function(err, createdTxp) {
ongoingProcess.set('Processing Transaction...', false);
if (err) { if (err) {
self.error = bwcError.msg(err); self.error = bwcError.msg(err);
$timeout(function() { $timeout(function() {
@ -213,10 +184,9 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
}); });
return; return;
} }
self.confirmTx(createdTxp, function(err, tx) { walletService.publishAndSign(wallet, createdTxp, function(err, tx) {
ongoingProcess.set('Processing Transaction...', false);
if (err) { if (err) {
self.error = bwcError.msg(err); self.error = err;
$timeout(function() { $timeout(function() {
$scope.$digest(); $scope.$digest();
}); });
@ -234,55 +204,6 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
}, 100); }, 100);
}; };
this.confirmTx = function(txp, cb) {
fingerprintService.check(wallet, function(err) {
if (err) {
$log.debug(err);
return cb(err);
}
walletService.handleEncryptedWallet(wallet, function(err) {
if (err) {
$log.debug(err);
return bwcError.cb(err, null, cb);
}
ongoingProcess.set('Processing Transaction...', true);
walletService.publishTx(wallet, txp, function(err, publishedTxp) {
if (err) {
$log.debug(err);
return bwcError.cb(err, null, cb);
}
walletService.signTx(wallet, publishedTxp, function(err, signedTxp) {
walletService.lock(wallet);
if (err) {
$log.debug(err);
walletService.removeTx(wallet, signedTxp, function(err) {
if (err) $log.debug(err);
});
return bwcError.cb(err, null, cb);
}
walletService.broadcastTx(wallet, signedTxp, function(err, broadcastedTxp) {
if (err) {
$log.debug(err);
walletService.removeTx(wallet, broadcastedTxp, function(err) {
if (err) $log.debug(err);
});
return bwcError.cb(err, null, cb);
}
$timeout(function() {
return cb(null, broadcastedTxp);
}, 5000);
});
});
});
});
});
};
this.authenticate = function() { this.authenticate = function() {
self.error = null; self.error = null;
@ -297,8 +218,8 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
self.authenticating = true; self.authenticating = true;
bitpayCardService.authenticate(data, function(err, auth) { bitpayCardService.authenticate(data, function(err, auth) {
self.authenticating = false; self.authenticating = false;
if (err && !err.data.error.twoFactorPending) { if (err && err.data && err.data.error && !err.data.error.twoFactorPending) {
self.error = 'Authentiation error'; self.error = err.statusText || err.data.error || 'Authentiation error';
return; return;
} }

View file

@ -139,10 +139,13 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
}); });
return; return;
} }
self.confirmTx(createdTxp, function(err, tx) { walletService.publishAndSign(wallet, createdTxp, function(err, tx) {
if (err) { if (err) {
ongoingProcess.set('Processing Transaction...', false); ongoingProcess.set('Processing Transaction...', false);
self.error = bwcError.msg(err); self.error = bwcError.msg(err);
walletService.removeTx(wallet, tx, function(err) {
if (err) $log.debug(err);
});
$timeout(function() { $timeout(function() {
$scope.$digest(); $scope.$digest();
}); });
@ -223,57 +226,4 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
}); });
}; };
this.confirmTx = function(txp, cb) {
fingerprintService.check(wallet, function(err) {
if (err) {
$log.debug(err);
return cb(err);
}
walletService.handleEncryptedWallet(wallet, function(err) {
if (err) {
$log.debug(err);
return bwcError.cb(err, null, cb);
}
ongoingProcess.set('Processing Transaction...', true);
walletService.publishTx(wallet, txp, function(err, publishedTxp) {
if (err) {
$log.debug(err);
return bwcError.cb(err, null, cb);
}
walletService.signTx(wallet, publishedTxp, function(err, signedTxp) {
walletService.lock(wallet);
if (err) {
$log.debug(err);
walletService.removeTx(wallet, signedTxp, function(err) {
if (err) $log.debug(err);
});
return bwcError.cb(err, null, cb);
}
if (signedTxp.status == 'accepted') {
walletService.broadcastTx(wallet, signedTxp, function(err, broadcastedTxp) {
if (err) {
$log.debug(err);
walletService.removeTx(wallet, broadcastedTxp, function(err) {
if (err) $log.debug(err);
});
return bwcError.cb(err, null, cb);
}
$timeout(function() {
return cb(null, broadcastedTxp);
}, 5000);
});
} else {
$timeout(function() {
return cb(null, signedTxp);
}, 5000);
}
});
});
});
});
};
}); });

View file

@ -189,7 +189,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
}; };
var setSendError = function(msg) { var setSendError = function(msg) {
showAlert(gettext('Error creating transaction'), msg); showAlert(gettext('Error at confirm:'), msg);
}; };
function apply(txp) { function apply(txp) {

View file

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('exportController', angular.module('copayApp.controllers').controller('exportController',
function($rootScope, $scope, $timeout, $log, lodash, backupService, walletService, storageService, profileService, platformInfo, notification, gettext, gettextCatalog, $state, $stateParams) { function($rootScope, $scope, $timeout, $log, lodash, backupService, walletService, storageService, profileService, platformInfo, gettext, gettextCatalog, $state, $stateParams) {
var prevState; var prevState;
var isWP = platformInfo.isWP; var isWP = platformInfo.isWP;
var isAndroid = platformInfo.isAndroid; var isAndroid = platformInfo.isAndroid;
@ -21,7 +21,7 @@ angular.module('copayApp.controllers').controller('exportController',
$scope.canSign = wallet.canSign(); $scope.canSign = wallet.canSign();
walletService.getEncodedWalletInfo(wallet, function(err, code) { walletService.getEncodedWalletInfo(wallet, function(err, code) {
if (err) { if (err || !code) {
$log.warn(err); $log.warn(err);
return $state.go('wallet.preferencesAdvanced') return $state.go('wallet.preferencesAdvanced')
} }
@ -48,10 +48,6 @@ angular.module('copayApp.controllers').controller('exportController',
}; };
*/ */
$scope.$on('$destroy', function() {
walletService.lock(wallet);
});
$scope.downloadWalletBackup = function() { $scope.downloadWalletBackup = function() {
$scope.getAddressbook(function(err, localAddressBook) { $scope.getAddressbook(function(err, localAddressBook) {
if (err) { if (err) {
@ -68,7 +64,6 @@ angular.module('copayApp.controllers').controller('exportController',
$scope.error = true; $scope.error = true;
return; return;
} }
notification.success(gettext('Success'), gettext('Encrypted export file saved'));
$state.go('tabs.home'); $state.go('tabs.home');
}); });
}); });

View file

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('importController', angular.module('copayApp.controllers').controller('importController',
function($scope, $rootScope, $timeout, $log, $state, $stateParams, profileService, configService, sjcl, gettext, ledger, trezor, derivationPathHelper, platformInfo, bwcService, ongoingProcess, walletService) { function($scope, $rootScope, $timeout, $log, $state, $stateParams, $ionicHistory, profileService, configService, sjcl, gettext, ledger, trezor, derivationPathHelper, platformInfo, bwcService, ongoingProcess, walletService) {
var isChromeApp = platformInfo.isChromeApp; var isChromeApp = platformInfo.isChromeApp;
var isDevel = platformInfo.isDevel; var isDevel = platformInfo.isDevel;
@ -15,6 +15,10 @@ angular.module('copayApp.controllers').controller('importController',
$scope.account = 1; $scope.account = 1;
$scope.importErr = false; $scope.importErr = false;
$scope.goBack = function() {
$ionicHistory.goBack();
};
var updateSeedSourceSelect = function() { var updateSeedSourceSelect = function() {
$scope.seedOptions = []; $scope.seedOptions = [];

View file

@ -48,10 +48,6 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
}, 10); }, 10);
}; };
$scope.$on('$destroy', function() {
walletService.lock($scope.wallet);
});
$scope.reject = function(txp) { $scope.reject = function(txp) {
$scope.loading = true; $scope.loading = true;
$scope.error = null; $scope.error = null;

View file

@ -1,6 +1,6 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('backupRequestController', function($rootScope, $scope, $state, $ionicPopup, $stateParams, profileService, walletService) { angular.module('copayApp.controllers').controller('backupRequestController', function($scope, $state, $ionicPopup) {
$scope.openPopup = function() { $scope.openPopup = function() {
var backupLaterPopup = $ionicPopup.show({ var backupLaterPopup = $ionicPopup.show({

View file

@ -1,6 +1,6 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('backupWarningController', function($rootScope, $scope, $state, $ionicPopup, $stateParams, profileService, walletService) { angular.module('copayApp.controllers').controller('backupWarningController', function($scope, $state, $ionicPopup, profileService) {
$scope.openPopup = function() { $scope.openPopup = function() {
var backupWarningPopup = $ionicPopup.show({ var backupWarningPopup = $ionicPopup.show({

View file

@ -1,6 +1,15 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('collectEmailController', function($rootScope, $scope, $state, $stateParams, $timeout, $ionicModal, profileService, walletService) { angular.module('copayApp.controllers').controller('collectEmailController', function($scope, $state, $stateParams, profileService, walletService, platformInfo) {
var isCordova = platformInfo.isCordova;
var isWP = platformInfo.isWP;
var usePushNotifications = isCordova && !isWP;
$scope.skip = function() {
if (!usePushNotifications) $state.go('onboarding.backupRequest');
else $state.go('onboarding.notifications');
}
$scope.save = function(form) { $scope.save = function(form) {
var wallet = profileService.getWallet($stateParams.walletId); var wallet = profileService.getWallet($stateParams.walletId);
@ -10,7 +19,8 @@ angular.module('copayApp.controllers').controller('collectEmailController', func
email: email, email: email,
}, function(err) { }, function(err) {
if (err) $log.warn(err); if (err) $log.warn(err);
$state.go('onboarding.notifications'); if (!usePushNotifications) $state.go('onboarding.backupRequest');
else $state.go('onboarding.notifications');
}); });
}; };

View file

@ -1,11 +1,9 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('notificationsController', function($scope, $state, platformInfo) { angular.module('copayApp.controllers').controller('notificationsController', function($scope, $state, profileService) {
if (!platformInfo.isCordova) $state.go('onboarding.backupRequest');
$scope.allowNotif = function() { $scope.allowNotif = function() {
// T O D O profileService.pushNotificationsInit();
$state.go('onboarding.backupRequest'); $state.go('onboarding.backupRequest');
} }

View file

@ -1,6 +1,6 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('tourController', angular.module('copayApp.controllers').controller('tourController',
function($scope, $stateParams, $state, $log, $timeout, ongoingProcess, storageService, profileService) { function($scope, $state, $log, $timeout, ongoingProcess, profileService) {
$scope.init = function() { $scope.init = function() {

View file

@ -1,8 +1,8 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('preferencesController', angular.module('copayApp.controllers').controller('preferencesController',
function($scope, $rootScope, $timeout, $log, $stateParams, configService, profileService, fingerprintService, walletService) { function($scope, $rootScope, $timeout, $log, $stateParams, $ionicHistory, $ionicNavBarDelegate, gettextCatalog, configService, profileService, fingerprintService, walletService) {
$ionicNavBarDelegate.title(gettextCatalog.getString('Preferences'));
var wallet = profileService.getWallet($stateParams.walletId); var wallet = profileService.getWallet($stateParams.walletId);
var walletId = wallet.credentials.walletId; var walletId = wallet.credentials.walletId;
$scope.wallet = wallet; $scope.wallet = wallet;
@ -10,22 +10,20 @@ angular.module('copayApp.controllers').controller('preferencesController',
$scope.init = function() { $scope.init = function() {
$scope.externalSource = null; $scope.externalSource = null;
if (wallet) { if (!wallet)
var config = configService.getSync(); return $ionicHistory.goBack();
config.aliasFor = config.aliasFor || {};
$scope.alias = config.aliasFor[walletId] || wallet.credentials.walletName;
$scope.color = config.colorFor[walletId] || '#4A90E2';
$scope.encryptEnabled = walletService.isEncrypted(wallet); var config = configService.getSync();
if (wallet.isPrivKeyExternal) config.aliasFor = config.aliasFor || {};
$scope.externalSource = wallet.getPrivKeyExternalSourceName() == 'ledger' ? 'Ledger' : 'Trezor'; $scope.alias = config.aliasFor[walletId] || wallet.credentials.walletName;
$scope.color = config.colorFor[walletId] || '#4A90E2';
// TODO externalAccount $scope.encryptEnabled = walletService.isEncrypted(wallet);
//this.externalIndex = wallet.getExternalIndex(); if (wallet.isPrivKeyExternal)
} $scope.externalSource = wallet.getPrivKeyExternalSourceName() == 'ledger' ? 'Ledger' : 'Trezor';
$scope.touchidAvailable = fingerprintService.isAvailable(); $scope.touchIdAvailable = fingerprintService.isAvailable();
$scope.touchidEnabled = config.touchIdFor ? config.touchIdFor[walletId] : null; $scope.touchIdEnabled = config.touchIdFor ? config.touchIdFor[walletId] : null;
$scope.deleted = false; $scope.deleted = false;
if (wallet.credentials && !wallet.credentials.mnemonicEncrypted && !wallet.credentials.mnemonic) { if (wallet.credentials && !wallet.credentials.mnemonicEncrypted && !wallet.credentials.mnemonic) {
@ -33,97 +31,51 @@ angular.module('copayApp.controllers').controller('preferencesController',
} }
}; };
var handleEncryptedWallet = function(cb) {
$rootScope.$emit('Local/NeedsPassword', false, function(err, password) {
if (err) return cb(err);
return cb(walletService.unlock(wallet, password));
});
};
$scope.encryptChange = function() { $scope.encryptChange = function() {
if (!wallet) return; if (!wallet) return;
var val = $scope.encryptEnabled; var val = $scope.encryptEnabled;
var setPrivateKeyEncryption = function(password, cb) {
$log.debug('Encrypting private key for', wallet.credentials.walletName);
wallet.setPrivateKeyEncryption(password);
wallet.lock();
profileService.updateCredentials(JSON.parse(wallet.export()), function() {
$log.debug('Wallet encrypted');
return cb();
});
};
var disablePrivateKeyEncryption = function(cb) {
$log.debug('Disabling private key encryption for', wallet.credentials.walletName);
try {
wallet.disablePrivateKeyEncryption();
} catch (e) {
return cb(e);
}
profileService.updateCredentials(JSON.parse(wallet.export()), function() {
$log.debug('Wallet encryption disabled');
return cb();
});
};
if (val && !walletService.isEncrypted(wallet)) { if (val && !walletService.isEncrypted(wallet)) {
$rootScope.$emit('Local/NeedsPassword', true, function(err, password) { $log.debug('Encrypting private key for', wallet.name);
if (err || !password) { walletService.encrypt(wallet, function(err) {
if (err) {
$log.warn(err);
// ToDo show error?
$scope.encryptEnabled = false; $scope.encryptEnabled = false;
return; return;
} }
setPrivateKeyEncryption(password, function() { profileService.updateCredentials(JSON.parse(wallet.export()), function() {
$rootScope.$emit('Local/NewEncryptionSetting'); $log.debug('Wallet encrypted');
return;
});
})
} else if (!val && walletService.isEncrypted(wallet)) {
walletService.decrypt(wallet, function(err) {
if (err) {
$log.warn(err);
// ToDo show error?
$scope.encryptEnabled = true; $scope.encryptEnabled = true;
return;
}
profileService.updateCredentials(JSON.parse(wallet.export()), function() {
$log.debug('Wallet decrypted');
return;
}); });
}); })
} else {
if (!val && walletService.isEncrypted(wallet)) {
handleEncryptedWallet(function(err) {
if (err) {
$scope.encryptEnabled = true;
return;
}
disablePrivateKeyEncryption(function(err) {
$rootScope.$emit('Local/NewEncryptionSetting');
if (err) {
$scope.encryptEnabled = true;
$log.error(err);
return;
}
$scope.encryptEnabled = false;
});
});
}
} }
}; };
$scope.touchidChange = function() { $scope.touchIdChange = function() {
var newStatus = $scope.touchIdEnabled;
var opts = { walletService.setTouchId(wallet, newStatus, function(err) {
touchIdFor: {}
};
opts.touchIdFor[walletId] = $scope.touchidEnabled;
fingerprintService.check(wallet, function(err) {
if (err) { if (err) {
$log.debug(err); $log.warn(err);
$timeout(function() { $scope.touchIdEnabled = !newStatus;
$scope.touchidError = true;
$scope.touchidEnabled = true;
}, 100);
return; return;
} }
configService.set(opts, function(err) { $log.debug('Touch Id status changed: ' + newStatus);
if (err) {
$log.debug(err);
$scope.touchidError = true;
$scope.touchidEnabled = false;
}
});
}); });
}; };
}); });

View file

@ -1,4 +1,6 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('preferencesAbout', angular.module('copayApp.controllers').controller('preferencesAbout',
function() {}); function($ionicNavBarDelegate, gettextCatalog) {
$ionicNavBarDelegate.title(gettextCatalog.getString('About Copay'));
});

View file

@ -1,8 +1,8 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('preferencesAliasController', angular.module('copayApp.controllers').controller('preferencesAliasController',
function($scope, $timeout, $stateParams, $state, configService, profileService, walletService) { function($scope, $timeout, $stateParams, $ionicHistory, $ionicNavBarDelegate, gettextCatalog, configService, profileService, walletService) {
$ionicNavBarDelegate.title(gettextCatalog.getString('Alias'));
var wallet = profileService.getWallet($stateParams.walletId); var wallet = profileService.getWallet($stateParams.walletId);
$scope.wallet = wallet; $scope.wallet = wallet;
var walletId = wallet.credentials.walletId; var walletId = wallet.credentials.walletId;
@ -20,7 +20,7 @@ angular.module('copayApp.controllers').controller('preferencesAliasController',
configService.set(opts, function(err) { configService.set(opts, function(err) {
if (err) $log.warn(err); if (err) $log.warn(err);
$state.go('wallet.preferences') $ionicHistory.goBack();
}); });
}; };
}); });

View file

@ -1,7 +1,8 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('preferencesAltCurrencyController', angular.module('copayApp.controllers').controller('preferencesAltCurrencyController',
function($scope, $log, $state, $timeout, configService, rateService, lodash, profileService, walletService) { function($scope, $log, $timeout, $ionicNavBarDelegate, $ionicHistory, gettextCatalog, configService, rateService, lodash, profileService, walletService) {
$ionicNavBarDelegate.title(gettextCatalog.getString('Alternative Currency'));
var next = 10; var next = 10;
var completeAlternativeList; var completeAlternativeList;
@ -42,8 +43,8 @@ angular.module('copayApp.controllers').controller('preferencesAltCurrencyControl
configService.set(opts, function(err) { configService.set(opts, function(err) {
if (err) $log.warn(err); if (err) $log.warn(err);
$state.go('tabs.settings');
$ionicHistory.goBack();
walletService.updateRemotePreferences(profileService.getWallets(), {}, function() { walletService.updateRemotePreferences(profileService.getWallets(), {}, function() {
$log.debug('Remote preferences saved'); $log.debug('Remote preferences saved');
}); });

View file

@ -1,7 +1,8 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('preferencesBwsUrlController', angular.module('copayApp.controllers').controller('preferencesBwsUrlController',
function($scope, $log, $stateParams, configService, applicationService, profileService, storageService) { function($scope, $log, $stateParams, $ionicNavBarDelegate, configService, applicationService, profileService, storageService) {
$ionicNavBarDelegate.title('Wallet Service URL');
$scope.error = null; $scope.error = null;
$scope.success = null; $scope.success = null;

View file

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('preferencesColorController', function($scope, $log, $stateParams, $state, configService, profileService) { angular.module('copayApp.controllers').controller('preferencesColorController', function($scope, $log, $stateParams, $ionicHistory, $ionicNavBarDelegate, gettextCatalog, configService, profileService) {
$ionicNavBarDelegate.title(gettextCatalog.getString('Color'));
$scope.colorList = [ $scope.colorList = [
'#DD4B39', '#DD4B39',
'#F38F12', '#F38F12',
@ -35,7 +35,7 @@ angular.module('copayApp.controllers').controller('preferencesColorController',
configService.set(opts, function(err) { configService.set(opts, function(err) {
if (err) $log.warn(err); if (err) $log.warn(err);
$state.go('wallet.preferences'); $ionicHistory.goBack();
}); });
}; };
}); });

View file

@ -1,12 +1,12 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('preferencesDeleteWalletController', angular.module('copayApp.controllers').controller('preferencesDeleteWalletController',
function($scope, $ionicPopup, $stateParams, lodash, profileService, $state, gettextCatalog, ongoingProcess) { function($scope, $ionicPopup, $stateParams, $ionicNavBarDelegate, gettextCatalog, lodash, profileService, $state, ongoingProcess) {
$ionicNavBarDelegate.title(gettextCatalog.getString('Delete Wallet'));
var wallet = profileService.getWallet($stateParams.walletId); var wallet = profileService.getWallet($stateParams.walletId);
$scope.alias = lodash.isEqual(wallet.name, wallet.credentials.walletName) ? null : wallet.name + ' '; $scope.alias = lodash.isEqual(wallet.name, wallet.credentials.walletName) ? null : wallet.name + ' ';
$scope.walletName = '[' + wallet.credentials.walletName + ']'; $scope.walletName = '[' + wallet.credentials.walletName + ']';
$scope.error = null; $scope.error = null;
var walletName = $scope.alias || $scope.walletName;
$scope.showDeletePopup = function() { $scope.showDeletePopup = function() {
var popup = $ionicPopup.show({ var popup = $ionicPopup.show({

View file

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('preferencesDeleteWordsController', function($scope, $state, $stateParams, confirmDialog, lodash, notification, profileService, walletService, gettext) { angular.module('copayApp.controllers').controller('preferencesDeleteWordsController', function($scope, $ionicHistory, $stateParams, $ionicNavBarDelegate, gettextCatalog, confirmDialog, lodash, profileService, walletService, gettext) {
$ionicNavBarDelegate.title(gettextCatalog.getString('Delete recovery phrase'));
var wallet = profileService.getWallet($stateParams.walletId); var wallet = profileService.getWallet($stateParams.walletId);
var msg = gettext('Are you sure you want to delete the recovery phrase?'); var msg = gettext('Are you sure you want to delete the recovery phrase?');
var successMsg = gettext('Recovery phrase deleted'); var successMsg = gettext('Recovery phrase deleted');
@ -17,8 +17,7 @@ angular.module('copayApp.controllers').controller('preferencesDeleteWordsControl
if (ok) { if (ok) {
wallet.clearMnemonic(); wallet.clearMnemonic();
profileService.updateCredentials(JSON.parse(wallet.export()), function() { profileService.updateCredentials(JSON.parse(wallet.export()), function() {
notification.success(successMsg); $ionicHistory.goBack();
$state.go('wallet.details');
}); });
} }
}); });

View file

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('preferencesEmailController', function($rootScope, $scope, $state, $stateParams, profileService, walletService) { angular.module('copayApp.controllers').controller('preferencesEmailController', function($rootScope, $scope, $ionicHistory, $stateParams, $ionicNavBarDelegate, gettextCatalog, profileService, walletService) {
$ionicNavBarDelegate.title(gettextCatalog.getString('Email Notifications'));
$scope.save = function(form) { $scope.save = function(form) {
var wallet = profileService.getWallet($stateParams.walletId); var wallet = profileService.getWallet($stateParams.walletId);
var email = $scope.email || ''; var email = $scope.email || '';
@ -10,7 +10,7 @@ angular.module('copayApp.controllers').controller('preferencesEmailController',
email: email, email: email,
}, function(err) { }, function(err) {
if (err) $log.warn(err); if (err) $log.warn(err);
$state.go('wallet.preferences'); $ionicHistory.goBack();
}); });
}; };

View file

@ -1,6 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('preferencesFeeController', function($scope, $timeout, configService, feeService) { angular.module('copayApp.controllers').controller('preferencesFeeController', function($scope, $timeout, $ionicHistory, $ionicNavBarDelegate, gettextCatalog, configService, feeService) {
$ionicNavBarDelegate.title(gettextCatalog.getString('Preferences fee'));
$scope.init = function() { $scope.init = function() {
$scope.loading = true; $scope.loading = true;
@ -25,6 +26,7 @@ angular.module('copayApp.controllers').controller('preferencesFeeController', fu
configService.set(opts, function(err) { configService.set(opts, function(err) {
if (err) $log.debug(err); if (err) $log.debug(err);
$scope.currentFeeLevel = newFee.level; $scope.currentFeeLevel = newFee.level;
$ionicHistory.goBack();
$timeout(function() { $timeout(function() {
$scope.$apply(); $scope.$apply();
}, 10); }, 10);

View file

@ -1,8 +1,8 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('preferencesHistory', angular.module('copayApp.controllers').controller('preferencesHistory',
function($scope, $log, $stateParams, $timeout, storageService, $state, profileService, lodash) { function($scope, $log, $stateParams, $timeout, $ionicNavBarDelegate, gettextCatalog, storageService, $state, profileService, lodash) {
$ionicNavBarDelegate.title(gettextCatalog.getString('Transaction History'));
var wallet = profileService.getWallet($stateParams.walletId); var wallet = profileService.getWallet($stateParams.walletId);
var c = wallet.credentials; var c = wallet.credentials;
$scope.csvReady = false; $scope.csvReady = false;

View file

@ -1,7 +1,8 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('preferencesInformation', angular.module('copayApp.controllers').controller('preferencesInformation',
function($scope, $log, $timeout, platformInfo, gettextCatalog, lodash, profileService, configService, $stateParams, walletService, $state) { function($scope, $log, $timeout, $ionicNavBarDelegate, platformInfo, gettextCatalog, lodash, profileService, configService, $stateParams, walletService, $state) {
$ionicNavBarDelegate.title(gettextCatalog.getString('Wallet Information'));
var base = 'xpub'; var base = 'xpub';
var wallet = profileService.getWallet($stateParams.walletId); var wallet = profileService.getWallet($stateParams.walletId);
var walletId = wallet.id; var walletId = wallet.id;
@ -12,7 +13,7 @@ angular.module('copayApp.controllers').controller('preferencesInformation',
config.colorFor = config.colorFor || {}; config.colorFor = config.colorFor || {};
$scope.init = function() { $scope.init = function() {
var c =wallet.credentials; var c = wallet.credentials;
var basePath = c.getBaseAddressDerivationPath(); var basePath = c.getBaseAddressDerivationPath();
$scope.wallet = wallet; $scope.wallet = wallet;

View file

@ -1,7 +1,8 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('preferencesLanguageController', angular.module('copayApp.controllers').controller('preferencesLanguageController',
function($scope, $log, $state, configService, profileService, uxLanguage, walletService) { function($scope, $log, $ionicNavBarDelegate, $ionicHistory, gettextCatalog, configService, profileService, uxLanguage, walletService) {
$ionicNavBarDelegate.title(gettextCatalog.getString('Language'));
$scope.init = function() { $scope.init = function() {
$scope.availableLanguages = uxLanguage.getLanguages(); $scope.availableLanguages = uxLanguage.getLanguages();
@ -20,7 +21,7 @@ angular.module('copayApp.controllers').controller('preferencesLanguageController
configService.set(opts, function(err) { configService.set(opts, function(err) {
if (err) $log.warn(err); if (err) $log.warn(err);
$state.go('tabs.settings') $ionicHistory.goBack();
uxLanguage.update(function() { uxLanguage.update(function() {
walletService.updateRemotePreferences(profileService.getWallets(), {}, function() { walletService.updateRemotePreferences(profileService.getWallets(), {}, function() {
$log.debug('Remote preferences saved'); $log.debug('Remote preferences saved');

View file

@ -1,7 +1,8 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('preferencesLogs', angular.module('copayApp.controllers').controller('preferencesLogs',
function($scope, historicLog) { function($scope, historicLog, $ionicNavBarDelegate, gettextCatalog) {
$ionicNavBarDelegate.title(gettextCatalog.getString('Session Log'));
$scope.init = function() { $scope.init = function() {
$scope.logs = historicLog.get(); $scope.logs = historicLog.get();

View file

@ -1,6 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('preferencesUnitController', function($scope, $log, configService, $state, walletService, profileService) { angular.module('copayApp.controllers').controller('preferencesUnitController', function($scope, $log, configService, $ionicNavBarDelegate, $ionicHistory, gettextCatalog, walletService, profileService) {
$ionicNavBarDelegate.title(gettextCatalog.getString('Unit'));
$scope.init = function() { $scope.init = function() {
var config = configService.getSync(); var config = configService.getSync();
@ -36,7 +37,7 @@ angular.module('copayApp.controllers').controller('preferencesUnitController', f
configService.set(opts, function(err) { configService.set(opts, function(err) {
if (err) $log.warn(err); if (err) $log.warn(err);
$state.go('tabs.settings'); $ionicHistory.goBack();
walletService.updateRemotePreferences(profileService.getWallets(), {}, function() { walletService.updateRemotePreferences(profileService.getWallets(), {}, function() {
$log.debug('Remote preferences saved'); $log.debug('Remote preferences saved');
}); });

View file

@ -30,14 +30,6 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
]; ];
$scope.selectedPriceSensitivity = $scope.priceSensitivity[1]; $scope.selectedPriceSensitivity = $scope.priceSensitivity[1];
var handleEncryptedWallet = function(client, cb) {
if (!walletService.isEncrypted(client)) return cb();
$rootScope.$emit('Local/NeedsPassword', false, function(err, password) {
if (err) return cb(err);
return cb(walletService.unlock(client, password));
});
};
this.init = function(testnet) { this.init = function(testnet) {
self.allWallets = profileService.getWallets(testnet ? 'testnet' : 'livenet', 1); self.allWallets = profileService.getWallets(testnet ? 'testnet' : 'livenet', 1);
@ -263,66 +255,7 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
this.confirmTx = function(txp, cb) { this.confirmTx = function(txp, cb) {
fingerprintService.check(client, function(err) { // TODO see walletService createAndPublish
if (err) {
$log.debug(err);
return cb(err);
}
handleEncryptedWallet(client, function(err) {
if (err) {
$log.debug(err);
return cb(err);
}
ongoingProcess.set('Sending Bitcoin to Coinbase...', true);
walletService.publishTx(client, txp, function(err, publishedTxp) {
if (err) {
ongoingProcess.set('Sending Bitcoin to Coinbase...', false);
$log.debug(err);
return cb({
errors: [{
message: 'Transaction could not be published: ' + err.message
}]
});
}
walletService.signTx(client, publishedTxp, function(err, signedTxp) {
walletService.lock(client);
if (err) {
ongoingProcess.set('Sending Bitcoin to Coinbase...', false);
$log.debug(err);
walletService.removeTx(client, signedTxp, function(err) {
if (err) $log.debug(err);
});
return cb({
errors: [{
message: 'The payment was created but could not be completed: ' + err.message
}]
});
}
walletService.broadcastTx(client, signedTxp, function(err, broadcastedTxp) {
if (err) {
ongoingProcess.set('Sending Bitcoin to Coinbase...', false);
$log.debug(err);
walletService.removeTx(client, broadcastedTxp, function(err) {
if (err) $log.debug(err);
});
return cb({
errors: [{
message: 'The payment was created but could not be broadcasted: ' + err.message
}]
});
}
$timeout(function() {
return cb(null, broadcastedTxp);
}, 5000);
});
});
});
});
});
}; };
}); });

View file

@ -208,53 +208,44 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
self.error = err.message ||  bwcError.msg(err); self.error = err.message ||  bwcError.msg(err);
return; return;
} }
fingerprintService.check(wallet, function(err) { walletService.prepare(wallet, txp, function(err, password) {
if (err) { if (err) {
self.error = err.message ||  bwcError.msg(err); self.error = err.message ||  bwcError.msg(err);
return; return;
} }
ongoingProcess.set('signingTx', true);
walletService.handleEncryptedWallet(wallet, function(err) { walletService.publishTx(wallet, createdTxp, function(err, publishedTxp) {
if (err) { if (err) {
ongoingProcess.clear();
self.error = err.message ||  bwcError.msg(err); self.error = err.message ||  bwcError.msg(err);
return;
} }
ongoingProcess.set('signingTx', true); walletService.signTx(wallet, publishedTxp, function(err, password, signedTxp) {
walletService.publishTx(wallet, createdTxp, function(err, publishedTxp) { walletService.removeTx(wallet, signedTxp, function(err) {
if (err) $log.debug(err);
});
ongoingProcess.clear();
if (err) { if (err) {
ongoingProcess.clear();
self.error = err.message ||  bwcError.msg(err); self.error = err.message ||  bwcError.msg(err);
return;
} }
var rawTx = signedTxp.raw;
walletService.signTx(wallet, publishedTxp, function(err, signedTxp) { var data = {
walletService.lock(wallet); refundAddress: refundAddress,
walletService.removeTx(wallet, signedTxp, function(err) { signedTransaction: rawTx,
if (err) $log.debug(err); priceUuid: self.sellPrice.priceUuid,
}); useCurrentPrice: self.sellPrice.priceUuid ? false : true,
ip: null
};
ongoingProcess.set('Seling Bitcoin', true);
glideraService.sell(token, twoFaCode, data, function(err, data) {
ongoingProcess.clear(); ongoingProcess.clear();
if (err) { if (err) {
self.error = err.message ||  bwcError.msg(err); self.error = err.message ||  bwcError.msg(err);
return; return;
} }
var rawTx = signedTxp.raw; self.success = data;
var data = { $scope.update();
refundAddress: refundAddress,
signedTransaction: rawTx,
priceUuid: self.sellPrice.priceUuid,
useCurrentPrice: self.sellPrice.priceUuid ? false : true,
ip: null
};
ongoingProcess.set('Seling Bitcoin', true);
glideraService.sell(token, twoFaCode, data, function(err, data) {
ongoingProcess.clear();
if (err) {
self.error = err.message ||  bwcError.msg(err);
return;
}
self.success = data;
$scope.update();
});
}); });
}); });
}); });

View file

@ -37,7 +37,6 @@ angular.module('copayApp.controllers').controller('tabHomeController',
walletService.getNotifications(wallet, { walletService.getNotifications(wallet, {
timeSpan: timeSpan timeSpan: timeSpan
}, function(err, n) { }, function(err, n) {
console.log('[tab-home.js.39]', wallet.name, n); //TODO
if (err) { if (err) {
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
return; return;

View file

@ -1,8 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('termOfUseController', angular.module('copayApp.controllers').controller('termOfUseController',
function($scope, uxLanguage) { function($scope, uxLanguage, $ionicNavBarDelegate, gettextCatalog) {
$ionicNavBarDelegate.title(gettextCatalog.getString('About Copay'));
$scope.lang = uxLanguage.currentLanguage; $scope.lang = uxLanguage.currentLanguage;
}); });

View file

@ -29,6 +29,10 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
$ionicConfigProvider.navBar.positionPrimaryButtons('left'); $ionicConfigProvider.navBar.positionPrimaryButtons('left');
$ionicConfigProvider.navBar.positionSecondaryButtons('right'); $ionicConfigProvider.navBar.positionSecondaryButtons('right');
// NAV BACK-BUTTON TEXT/ICON
$ionicConfigProvider.backButton.icon('ion-chevron-left');
$ionicConfigProvider.backButton.previousTitleText(false);
$logProvider.debugEnabled(true); $logProvider.debugEnabled(true);
$provide.decorator('$log', ['$delegate', 'platformInfo', $provide.decorator('$log', ['$delegate', 'platformInfo',
function($delegate, platformInfo) { function($delegate, platformInfo) {
@ -95,7 +99,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
* *
*/ */
.state('unsupported', { .state('unsupported', {
url: '/unsupported', url: '/unsupported',
templateUrl: 'views/unsupported.html' templateUrl: 'views/unsupported.html'
}) })

View file

@ -19,6 +19,11 @@ angular.module('copayApp.services').factory('bitpayCardService', function($http,
}; };
}; };
var _setError = function(msg, e) {
$log.error(msg);
return e;
};
var _getUser = function(cb) { var _getUser = function(cb) {
_setCredentials(); _setCredentials();
storageService.getBitpayCard(credentials.NETWORK, function(err, user) { storageService.getBitpayCard(credentials.NETWORK, function(err, user) {
@ -53,8 +58,7 @@ angular.module('copayApp.services').factory('bitpayCardService', function($http,
bpSession = data.data.data; bpSession = data.data.data;
return cb(null, bpSession); return cb(null, bpSession);
}, function(data) { }, function(data) {
$log.error('BitPay Get Session: ERROR ' + data.data.error); return cb(_setError('BitPay Card Error: Get Session', data));
return cb(data.data.error);
}); });
}; };
@ -97,8 +101,7 @@ angular.module('copayApp.services').factory('bitpayCardService', function($http,
$log.info('BitPay TopUp: SUCCESS'); $log.info('BitPay TopUp: SUCCESS');
return cb(null, data.data.data.invoice); return cb(null, data.data.data.invoice);
}, function(data) { }, function(data) {
$log.error('BitPay TopUp: ERROR ' + data.data.error); return cb(_setError('BitPay Card Error: TopUp', data));
return cb(data.data.error);
}); });
}; };
@ -113,8 +116,7 @@ angular.module('copayApp.services').factory('bitpayCardService', function($http,
$log.info('BitPay Get Transaction History: SUCCESS'); $log.info('BitPay Get Transaction History: SUCCESS');
return cb(null, data.data.data); return cb(null, data.data.data);
}, function(data) { }, function(data) {
$log.error('BitPay Get Transaction History: ERROR ' + data.data); return cb(_setError('BitPay Card Error: Get Transaction History', data));
return cb(data.data);
}); });
}; };
@ -123,8 +125,7 @@ angular.module('copayApp.services').factory('bitpayCardService', function($http,
$log.info('BitPay Get Invoice History: SUCCESS'); $log.info('BitPay Get Invoice History: SUCCESS');
return cb(null, data.data.data); return cb(null, data.data.data);
}, function(data) { }, function(data) {
$log.error('BitPay Get Invoice History: ERROR ' + data.data); return cb(_setError('BitPay Card Error: Get Invoice History', data));
return cb(data.data);
}); });
}; };
@ -133,8 +134,7 @@ angular.module('copayApp.services').factory('bitpayCardService', function($http,
$log.info('BitPay Get Invoice: SUCCESS'); $log.info('BitPay Get Invoice: SUCCESS');
return cb(null, data.data.data); return cb(null, data.data.data);
}, function(data) { }, function(data) {
$log.error('BitPay Get Invoice: ERROR ' + data.data.error); return cb(_setError('BitPay Card Error: Get Invoice', data));
return cb(data.data.error);
}); });
}; };
@ -147,8 +147,8 @@ angular.module('copayApp.services').factory('bitpayCardService', function($http,
return cb(null, session); return cb(null, session);
}); });
}, function(data) { }, function(data) {
$log.error('BitPay Authenticate: ERROR'); if (data && data.data && data.data.error.twoFactorPending) {
if (data.data.error.twoFactorPending) { $log.error('BitPay Card needs 2FA Authentication');
_getSession(function(err, session) { _getSession(function(err, session) {
if (err) return cb(err); if (err) return cb(err);
return cb(null, session); return cb(null, session);
@ -165,8 +165,7 @@ angular.module('copayApp.services').factory('bitpayCardService', function($http,
$log.info('BitPay 2FA: SUCCESS'); $log.info('BitPay 2FA: SUCCESS');
return cb(null, data); return cb(null, data);
}, function(data) { }, function(data) {
$log.error('BitPay 2FA: ERROR'); return cb(_setError('BitPay Card Error: 2FA', data));
return cb(data);
}); });
}; };
@ -195,8 +194,7 @@ angular.module('copayApp.services').factory('bitpayCardService', function($http,
$log.info('BitPay Logout: SUCCESS'); $log.info('BitPay Logout: SUCCESS');
return cb(data); return cb(data);
}, function(data) { }, function(data) {
$log.error('BitPay Logout: ERROR ' + data.data.error); return cb(_setError('BitPay Card Error: Logout ', data));
return cb(data.data.error);
}); });
}); });
}; };

View file

@ -17,18 +17,22 @@ angular.module('copayApp.services')
root.profile = null; root.profile = null;
Object.defineProperty(root, "focusedClient", { Object.defineProperty(root, "focusedClient", {
get: function () { throw "focusedClient is not used any more" }, get: function() {
set: function () { throw "focusedClient is not used any more" } throw "focusedClient is not used any more"
},
set: function() {
throw "focusedClient is not used any more"
}
}); });
root.wallet = {}; // decorated version of client root.wallet = {}; // decorated version of client
root.updateWalletSettings = function(wallet) { root.updateWalletSettings = function(wallet) {
var defaults = configService.getDefaults(); var defaults = configService.getDefaults();
var config = configService.getSync(); var config = configService.getSync();
wallet.usingCustomBWS = config.bwsFor[wallet.id] && (config.bwsFor[wallet.id] != defaults.bws.url); wallet.usingCustomBWS = config.bwsFor[wallet.id] && (config.bwsFor[wallet.id] != defaults.bws.url);
wallet.name = config.aliasFor[wallet.id] || wallet.credentials.walletName; wallet.name = config.aliasFor[wallet.id] || wallet.credentials.walletName;
wallet.color = config.colorFor[wallet.id] || '#4A90E2'; wallet.color = config.colorFor[wallet.id] || '#4A90E2';
@ -69,7 +73,7 @@ angular.module('copayApp.services')
// notification? // notification?
// TODO (put this in wallet ViewModel) // TODO (put this in wallet ViewModel)
if (wallet.cachedStatus) if (wallet.cachedStatus)
wallet.cachedStatus.isValid = false; wallet.cachedStatus.isValid = false;
@ -87,11 +91,6 @@ angular.module('copayApp.services')
}); });
}); });
if (wallet.hasPrivKeyEncrypted() && !wallet.isPrivKeyEncrypted()) {
$log.warn('Auto locking unlocked wallet:' + walletId);
wallet.lock();
}
wallet.initialize({}, function(err) { wallet.initialize({}, function(err) {
if (err) { if (err) {
$log.error('Could not init notifications err:', err); $log.error('Could not init notifications err:', err);
@ -107,7 +106,7 @@ angular.module('copayApp.services')
$rootScope.$on('Local/SettingsUpdated', function(e, walletId) { $rootScope.$on('Local/SettingsUpdated', function(e, walletId) {
if (!walletId || walletId == wallet.id) { if (!walletId || walletId == wallet.id) {
$log.debug('Updating settings for wallet:' + wallet.id); $log.debug('Updating settings for wallet:' + wallet.id);
root.updateWalletSettings(wallet); root.updateWalletSettings(wallet);
} }
}); });
@ -159,7 +158,7 @@ angular.module('copayApp.services')
if (!credentials.walletId || !credentials.m) if (!credentials.walletId || !credentials.m)
return cb('bindWallet should receive credentials JSON'); return cb('bindWallet should receive credentials JSON');
// Create the client // Create the client
var getBWSURL = function(walletId) { var getBWSURL = function(walletId) {
var config = configService.getSync(); var config = configService.getSync();
var defaults = configService.getDefaults(); var defaults = configService.getDefaults();
@ -206,9 +205,6 @@ angular.module('copayApp.services')
} }
bindWallets(function() { bindWallets(function() {
if (usePushNotifications)
root.pushNotificationsInit();
root.isBound = true; root.isBound = true;
lodash.each(root._queue, function(x) { lodash.each(root._queue, function(x) {
@ -224,6 +220,8 @@ angular.module('copayApp.services')
if (!val) { if (!val) {
return cb(new Error('NONAGREEDDISCLAIMER: Non agreed disclaimer')); return cb(new Error('NONAGREEDDISCLAIMER: Non agreed disclaimer'));
} }
if (usePushNotifications)
root.pushNotificationsInit();
$rootScope.$emit('disclaimerAccepted'); $rootScope.$emit('disclaimerAccepted');
return cb(); return cb();
}); });
@ -548,14 +546,6 @@ angular.module('copayApp.services')
return cb(gettext('Could not import. Check input file and spending password')); return cb(gettext('Could not import. Check input file and spending password'));
} }
if (walletClient.hasPrivKeyEncrypted()) {
try {
walletClient.disablePrivateKeyEncryption();
} catch (e) {
$log.warn(e);
}
}
str = JSON.parse(str); str = JSON.parse(str);
var addressBook = str.addressBook || {}; var addressBook = str.addressBook || {};
@ -716,10 +706,11 @@ angular.module('copayApp.services')
ret = lodash.filter(ret, function(w) { ret = lodash.filter(ret, function(w) {
return w.isComplete(); return w.isComplete();
}); });
} else { } else {}
}
return lodash.sortBy(ret, [ function(x) { return x.isComplete(); }, 'createdOn']); return lodash.sortBy(ret, [function(x) {
return x.isComplete();
}, 'createdOn']);
}; };
return root; return root;

View file

@ -547,27 +547,6 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
return isEncrypted; return isEncrypted;
}; };
root.lock = function(wallet) {
try {
wallet.lock();
} catch (e) {
$log.warn('Encrypting wallet:', e);
};
};
root.unlock = function(wallet, password) {
if (lodash.isEmpty(wallet))
return 'MISSING_PARAMETER';
if (lodash.isEmpty(password))
return 'NO_PASSWORD_GIVEN';
try {
wallet.unlock(password);
} catch (e) {
$log.warn('Decrypting wallet:', e);
return 'PASSWORD_INCORRECT';
}
};
root.createTx = function(wallet, txp, cb) { root.createTx = function(wallet, txp, cb) {
if (lodash.isEmpty(txp) || lodash.isEmpty(wallet)) if (lodash.isEmpty(txp) || lodash.isEmpty(wallet))
return cb('MISSING_PARAMETER'); return cb('MISSING_PARAMETER');
@ -578,28 +557,12 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
else return cb(null, createdTxp); else return cb(null, createdTxp);
}); });
} else { } else {
wallet.getFeeLevels(wallet.credentials.network, function(err, levels) { wallet.createTxProposal(txp, function(err, createdTxp) {
if (err) return cb(err); if (err) return cb(err);
else {
var feeLevelValue = lodash.find(levels, { $log.debug('Transaction created');
level: txp.feeLevel return cb(null, createdTxp);
}); }
if (!feeLevelValue || !feeLevelValue.feePerKB)
return cb({
message: 'Could not get dynamic fee for level: ' + feeLevel
});
$log.debug('Dynamic fee: ' + txp.feeLevel + ' ' + feeLevelValue.feePerKB + ' SAT');
txp.feePerKb = feeLevelValue.feePerKB;
wallet.createTxProposal(txp, function(err, createdTxp) {
if (err) return cb(err);
else {
$log.debug('Transaction created');
return cb(null, createdTxp);
}
});
}); });
} }
}; };
@ -619,8 +582,8 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
}); });
}; };
root.signTx = function(wallet, txp, cb) { root.signTx = function(wallet, txp, password, cb) {
if (lodash.isEmpty(txp) || lodash.isEmpty(wallet)) if (!wallet || !txp || !cb)
return cb('MISSING_PARAMETER'); return cb('MISSING_PARAMETER');
if (wallet.isPrivKeyExternal()) { if (wallet.isPrivKeyExternal()) {
@ -637,8 +600,8 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
} else { } else {
try { try {
wallet.signTxProposal(txp, function(err, signedTxp) { wallet.signTxProposal(txp, password, function(err, signedTxp) {
$log.debug('Transaction signed'); $log.debug('Transaction signed err:' + err);
return cb(err, signedTxp); return cb(err, signedTxp);
}); });
} catch (e) { } catch (e) {
@ -861,12 +824,12 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
// An alert dialog // An alert dialog
var askPassword = function(name, cb) { var askPassword = function(name, title, cb) {
var scope = $rootScope.$new(true); var scope = $rootScope.$new(true);
scope.data = []; scope.data = [];
var pass = $ionicPopup.show({ var pass = $ionicPopup.show({
template: '<input type="password" ng-model="data.pass">', template: '<input type="password" ng-model="data.pass">',
title: 'Enter Spending Password', title: title,
subTitle: name, subTitle: name,
scope: scope, scope: scope,
buttons: [{ buttons: [{
@ -891,12 +854,42 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
}); });
}; };
root.encrypt = function(wallet, cb) {
askPassword(wallet.name, gettext('Enter new spending password'), function(password) {
if (!password) return cb('no password');
askPassword(wallet.name, gettext('Confirm you new spending password'), function(password2) {
if (!password2 || password != password2)
return cb('password mismatch');
wallet.encryptPrivateKey(password);
return cb();
});
});
};
root.decrypt = function(wallet, cb) {
$log.debug('Disabling private key encryption for' + wallet.name);
askPassword(wallet.name, gettext('Enter Spending Password'), function(password) {
if (!password) return cb('no password');
try {
wallet.decryptPrivateKey(password);
} catch (e) {
return cb(e);
}
return cb();
});
};
root.handleEncryptedWallet = function(wallet, cb) { root.handleEncryptedWallet = function(wallet, cb) {
if (!root.isEncrypted(wallet)) return cb(); if (!root.isEncrypted(wallet)) return cb();
askPassword(wallet.name, function(password) { askPassword(wallet.name, gettext('Enter Spending Password'), function(password) {
if (!password) return cb('no password'); if (!password) return cb('no password');
return cb(root.unlock(wallet, password));
return cb(null, password);
}); });
}; };
@ -932,6 +925,19 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
}); });
}; };
root.prepare = function(wallet, cb) {
fingerprintService.check(wallet, function(err) {
if (err) return cb(err);
root.handleEncryptedWallet(wallet, function(err, password) {
if (err) return cb(err);
return cb(null, password);
});
});
};
root.publishAndSign = function(wallet, txp, cb) { root.publishAndSign = function(wallet, txp, cb) {
var publishFn = root.publishTx; var publishFn = root.publishTx;
@ -943,56 +949,51 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
}; };
} }
fingerprintService.check(wallet, function(err) { root.prepare(wallet, function(err, password) {
if (err) return cb(err); if (err) return cb('Prepare error: ' + err);
root.handleEncryptedWallet(wallet, function(err) { ongoingProcess.set('sendingTx', true);
if (err) return cb(err); publishFn(wallet, txp, function(err, publishedTxp) {
ongoingProcess.set('sendingTx', false);
if (err) return cb('Send Error: ' + err);
ongoingProcess.set('sendingTx', true); ongoingProcess.set('signingTx', true);
publishFn(wallet, txp, function(err, publishedTxp) { root.signTx(wallet, publishedTxp, password, function(err, signedTxp) {
ongoingProcess.set('sendingTx', false); ongoingProcess.set('signingTx', false);
if (err) return cb(err); root.invalidateCache(wallet);
ongoingProcess.set('signingTx', true);
root.signTx(wallet, publishedTxp, function(err, signedTxp) {
root.lock(wallet);
ongoingProcess.set('signingTx', false);
root.invalidateCache(wallet);
if (err) { if (err) {
// TODO? $log.warn('sign error:' + err);
var msg = err.message ? // TODO?
err.message : var msg = err.message ?
gettext('The payment was created but could not be completed. Please try again from home screen'); err.message :
$rootScope.$emit('Local/TxAction', wallet.id); gettext('The payment was created but could not be completed. Please try again from home screen');
return cb(err); $rootScope.$emit('Local/TxAction', wallet.id);
} return cb(msg);
}
if (signedTxp.status == 'accepted') { if (signedTxp.status == 'accepted') {
ongoingProcess.set('broadcastingTx', true); ongoingProcess.set('broadcastingTx', true);
root.broadcastTx(wallet, signedTxp, function(err, broadcastedTxp) { root.broadcastTx(wallet, signedTxp, function(err, broadcastedTxp) {
ongoingProcess.set('broadcastingTx', false); ongoingProcess.set('broadcastingTx', false);
if (err) return cb(err); if (err) return cb('sign error' + err);
var type = txStatus.notify(broadcastedTxp); var type = txStatus.notify(broadcastedTxp);
root.openStatusModal(type, broadcastedTxp, function() { root.openStatusModal(type, broadcastedTxp, function() {
$rootScope.$emit('Local/TxAction', wallet.id);
});
return cb(null, broadcastedTxp)
});
} else {
var type = txStatus.notify(signedTxp);
root.openStatusModal(type, signedTxp, function() {
root.invalidateCache(wallet);
$rootScope.$emit('Local/TxAction', wallet.id); $rootScope.$emit('Local/TxAction', wallet.id);
}); });
return cb(null, signedTxp);
} return cb(null, broadcastedTxp)
}); });
} else {
var type = txStatus.notify(signedTxp);
root.openStatusModal(type, signedTxp, function() {
root.invalidateCache(wallet);
$rootScope.$emit('Local/TxAction', wallet.id);
});
return cb(null, signedTxp);
}
}); });
}); });
}); });
@ -1004,7 +1005,7 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
if (err) return cb(err); if (err) return cb(err);
notifications = lodash.filter(notifications, function(x) { notifications = lodash.filter(notifications, function(x) {
return x.type != 'NewBlock' && x.type != 'BalanceUpdated' && x.type !='NewOutgoingTxByThirdParty'; return x.type != 'NewBlock' && x.type != 'BalanceUpdated' && x.type != 'NewOutgoingTxByThirdParty';
}); });
var idToName = {}; var idToName = {};
@ -1027,42 +1028,34 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
root.getEncodedWalletInfo = function(wallet, cb) { root.getEncodedWalletInfo = function(wallet, cb) {
var getCode = function() { var derivationPath = wallet.credentials.getBaseAddressDerivationPath();
var derivationPath = wallet.credentials.getBaseAddressDerivationPath(); var encodingType = {
var encodingType = { mnemonic: 1,
mnemonic: 1, xpriv: 2,
xpriv: 2, xpub: 3
xpub: 3 };
}; var info;
var info;
// not supported yet // not supported yet
if (wallet.credentials.derivationStrategy != 'BIP44' || !wallet.canSign()) if (wallet.credentials.derivationStrategy != 'BIP44' || !wallet.canSign())
return null; return null;
if (wallet.credentials.mnemonic) { root.getKeys(wallet, function(err, keys){
if (err || !keys) return cb(err);
if (keys.mnemonic) {
info = { info = {
type: encodingType.mnemonic, type: encodingType.mnemonic,
data: wallet.credentials.mnemonic, data: keys.mnemonic,
} }
} else { } else {
info = { info = {
type: encodingType.xpriv, type: encodingType.xpriv,
data: wallet.credentials.xPrivKey data: keys.xPrivKey
} }
} }
return info.type + '|' + info.data + '|' + wallet.credentials.network.toLowerCase() + '|' + derivationPath + '|' + (wallet.credentials.mnemonicHasPassphrase); return cb(null, info.type + '|' + info.data + '|' + wallet.credentials.network.toLowerCase() + '|' + derivationPath + '|' + (wallet.credentials.mnemonicHasPassphrase));
};
fingerprintService.check(wallet, function(err) {
if (err) return cb(err);
root.handleEncryptedWallet(wallet, function(err) {
if (err) return cb(err);
var code = getCode();
return cb(null, code);
});
}); });
}; };
@ -1110,7 +1103,7 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
} }
}); });
// messsages... // messages...
var u = bwcService.getUtils(); var u = bwcService.getUtils();
lodash.each(finale, function(x) { lodash.each(finale, function(x) {
@ -1124,6 +1117,31 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
}; };
root.setTouchId = function(wallet, enabled, cb) {
fingerprintService.check(wallet, function(err) {
if (err) return cb(err); {
$log.debug(err);
return;
}
configService.set(opts, cb);
});
};
root.getKeys = function(wallet, cb) {
root.prepare(wallet, function(err, password) {
if (err) return cb(err);
var keys;
try {
keys = wallet.getKeys(password);
} catch (e) {
return cb(err);
}
return cb(null, keys);
});
};
return root; return root;
}); });

View file

@ -426,6 +426,21 @@ ul.wallet-selection.wallets {
} }
} }
// POSTFIX
.postfix {
position: absolute;
right: 10px;
background-color: #f8f8f8;
color: #444;
border-radius: 4px;
padding: 2px 10px;
cursor: pointer;
label &{
top: 38px;
padding: 0 5px;
}
}
// QR Code // QR Code
@ -850,6 +865,7 @@ ul.wallet-selection.wallets {
.no-border { .no-border {
border-style: none; border-style: none;
background-color: transparent !important;
} }
input[type=file] { input[type=file] {
@ -874,6 +890,16 @@ input[type=file] {
.wallets { .wallets {
height: 90px; height: 90px;
} }
.bar .button.back-button {
color: #444;
font-size: 14px;
}
.bar .button.button-clear .icon:before {
font-size: 16px;
}
/* /*
* Calculator * Calculator
*/ */