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"
},
"dependencies": {
"bitcore-wallet-client": "2.11.0",
"bitcore-wallet-client": "4.0.0",
"coveralls": "^2.11.9",
"express": "^4.11.2",
"fs": "0.0.2",

View File

@ -1,6 +1,6 @@
{
{
"//":"PLEASE! Do not edit this file directly",
"//":" Modify it at app-template/",
"//":" Modify it at app-template/",
"manifest_version": 2,
"name": "BitPay",

View File

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

View File

@ -30,10 +30,10 @@
</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>
<button class="button transform-none" ng-click="toggleAlternative()" ng-show="!showAlternativeAmount">{{unitName}}</button>
<a class="postfix" ng-click="toggleAlternative()" ng-show="showAlternativeAmount">{{alternativeIsoCode}}</a>
<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" 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-nav-bar class="bar-stable">
<ion-nav-buttons side="primary">
 <button class="button no-border" ng-click="goBack()">
     <i class="icon ion-chevron-left"></i>Back
   </button>
  </ion-nav-buttons>
<ion-view>
<ion-nav-bar>
<ion-nav-back-button>
{{'Back' | translate}}
</ion-nav-back-button>
</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
-->

View File

@ -15,7 +15,7 @@
<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
</div>
@ -31,7 +31,7 @@
<span ng-show="!bitpayCard.bitpayCardTwoFactorPending">Login to your account</span>
<span ng-show="bitpayCard.bitpayCardTwoFactorPending">2-Step Verification</span>
</h4>
<div class="m10b size-12"
<div class="box-notification error"
ng-show="bitpayCard.error"
ng-click="bitpayCard.error = null">
{{bitpayCard.error}}
@ -63,7 +63,7 @@
</label>
</div>
<input class="button button-block button-positive"
<input class="button button-block"
type="submit"
ng-disabled="!authenticateForm.$valid || bitpayCard.authenticating"
value="Login">
@ -90,7 +90,7 @@
</label>
</div>
<input class="button button-block button-positive"
<input class="button button-block"
type="submit"
ng-disabled="!authenticate2FAForm.$valid || bitpayCard.authenticating"
value="Login">
@ -121,7 +121,7 @@
<option value="all">All Activity</option>
</select>
<div class="m20v size-12 text-center text-warning"
<div class="box-notification error"
ng-show="bitpayCard.error">
{{bitpayCard.error}}
</div>
@ -176,7 +176,7 @@
</div>
<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-click="bitpayCard.error = null">
{{bitpayCard.error}}
@ -199,25 +199,11 @@
ng-model="fiat"
autocomplete="off"
required>
<a class="postfix button black">USD</a>
<a class="postfix">USD</a>
</label>
<label class="item item-input item-stacked-label">
<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>
<wallets ng-if="wallets[0]" wallets="wallets"></wallets>
</div>
<p class="size-12 text-warning" ng-show="bitpayCard.isMultisigWallet">
@ -234,8 +220,8 @@
</button>
</div>
<div class="col">
<button class="button button-block button-positive"
ng-disabled="!bitpayCard.selectedWalletId || !fiat"
<button class="button button-block"
ng-disabled="!fiat"
type="submit">
Send
</button>

View File

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

View File

@ -13,7 +13,7 @@
</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>
<div class="text-center size-18 tu text-bold m20t">
<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>
<div class="text-center size-18 tu text-bold m20t">
<span translate>Payment Accepted</span>
@ -35,7 +35,7 @@
</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>
<div class="text-center size-18 tu text-bold m20t">
<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-buttons side="secondary">
<button class="button no-border" href ui-sref="onboarding.notifications">
<button class="button no-border" ng-click="skip()">
Skip
</button>
</ion-nav-buttons>

View File

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

View File

@ -1,13 +1,10 @@
<ion-view>
<ion-nav-bar class="bar-stable">
<ion-nav-title>Wallet Settings</ion-nav-title>
<ion-nav-buttons side="primary">
<button class="button no-border" ui-sref="wallet.details">
<i class="icon ion-chevron-left"></i> Back
</button>
</ion-nav-buttons>
<ion-nav-bar>
<ion-nav-back-button>
{{'Back' | translate}}
</ion-nav-back-button>
</ion-nav-bar>
<ion-content ng-controller="preferencesController" ng-init="init()">
<ion-content ng-controller="preferencesController" ng-init="init()">
<div class="list">
<div class="item item-divider">
Preferences
@ -20,18 +17,12 @@
<i class="icon ion-ios-arrow-right"></i>
</div>
<div class="item">
<span translate>Devices</span>
<span translate>Wallet Type</span>
<span class="item-note">
1
{{wallet.m}}-of-{{wallet.n}}
</span>
</div>
<div class="item">
<span translate>Required number of signatures</span>
<span class="item-note">
1
</span>
</div>
<div class="item" ng-show="index.isPrivKeyExternal">
<div class="item" ng-show="wallet.isPrivKeyExternal()">
<span translate>Hardware wallet</span>
<span class="item-note">
{{wallet.externalSource}}
@ -56,15 +47,20 @@
<div class="item item-divider">
Security
</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>
<i class="icon ion-ios-arrow-right"></i>
</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()">
<span class="toggle-label" translate>Request Spending Password</span>
</ion-toggle>
</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">
<span translate>Delete recovery phrase</span>
<i class="icon ion-ios-arrow-right"></i>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,13 +1,10 @@
<ion-view>
<ion-nav-bar class="bar-stable">
<ion-nav-title>Transaction History</ion-nav-title>
<ion-nav-buttons side="primary">
<button class="button no-border" ui-sref="wallet.preferencesAdvanced">
<i class="icon ion-chevron-left"></i> Back
</button>
</ion-nav-buttons>
<ion-nav-bar>
<ion-nav-back-button>
{{'Back' | translate}}
</ion-nav-back-button>
</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" ng-show="csvReady && !index.isCordova" ng-csv="csvContent" csv-header="csvHeader" filename="Copay-{{index.alias || index.walletName}}.csv">
<span translate>Export to file</span>

View File

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

View File

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

View File

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

View File

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

View File

@ -22,7 +22,7 @@
<a class="item text-center" ui-sref="activity" ng-show="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>
<div class="item" ng-show="!notifications[0]">

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
'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 wallet;
@ -9,6 +9,15 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
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) {
for (var i = 0; i < invoices.length; i++) {
var matched = false;
@ -63,7 +72,6 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
bitpayCardService.isAuthenticated(function(err, bpSession) {
self.loadingSession = false;
if (err) {
self.error = err.data.error || 'Incorrect email or password';
return;
}
@ -79,7 +87,7 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
bitpayCardService.transactionHistory(dateRange, function(err, history) {
$scope.loadingHistory = false;
if (err) {
self.error = err.error || err;
self.error = 'Error getting transactions';
return;
}
@ -98,60 +106,24 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
$scope.dateRange = 'last30Days';
$scope.network = bitpayCardService.getEnvironment();
self.allWallets = profileService.getWallets({
$scope.wallets = profileService.getWallets({
network: $scope.network,
n: 1,
onlyComplete: true
});
self.update();
if (lodash.isEmpty(self.allWallets)) return;
wallet = $scope.wallets[0];
wallet = self.allWallets[0];
if (wallet.credentials.n > 1)
if (wallet && wallet.credentials.n > 1)
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() {
self.error = null;
if (lodash.isEmpty(wallet)) return;
if (!wallet.canSign() && !wallet.isPrivKeyExternal()) {
$log.info('No signing proposal: No 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) {
ongoingProcess.set('Processing Transaction...', false);
if (err) {
self.error = bwcError.msg(err);
$timeout(function() {
@ -213,10 +184,9 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
});
return;
}
self.confirmTx(createdTxp, function(err, tx) {
ongoingProcess.set('Processing Transaction...', false);
walletService.publishAndSign(wallet, createdTxp, function(err, tx) {
if (err) {
self.error = bwcError.msg(err);
self.error = err;
$timeout(function() {
$scope.$digest();
});
@ -234,55 +204,6 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
}, 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() {
self.error = null;
@ -297,8 +218,8 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
self.authenticating = true;
bitpayCardService.authenticate(data, function(err, auth) {
self.authenticating = false;
if (err && !err.data.error.twoFactorPending) {
self.error = 'Authentiation error';
if (err && err.data && err.data.error && !err.data.error.twoFactorPending) {
self.error = err.statusText || err.data.error || 'Authentiation error';
return;
}

View File

@ -139,10 +139,13 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
});
return;
}
self.confirmTx(createdTxp, function(err, tx) {
walletService.publishAndSign(wallet, createdTxp, function(err, tx) {
if (err) {
ongoingProcess.set('Processing Transaction...', false);
self.error = bwcError.msg(err);
walletService.removeTx(wallet, tx, function(err) {
if (err) $log.debug(err);
});
$timeout(function() {
$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) {
showAlert(gettext('Error creating transaction'), msg);
showAlert(gettext('Error at confirm:'), msg);
};
function apply(txp) {

View File

@ -1,7 +1,7 @@
'use strict';
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 isWP = platformInfo.isWP;
var isAndroid = platformInfo.isAndroid;
@ -21,7 +21,7 @@ angular.module('copayApp.controllers').controller('exportController',
$scope.canSign = wallet.canSign();
walletService.getEncodedWalletInfo(wallet, function(err, code) {
if (err) {
if (err || !code) {
$log.warn(err);
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.getAddressbook(function(err, localAddressBook) {
if (err) {
@ -68,7 +64,6 @@ angular.module('copayApp.controllers').controller('exportController',
$scope.error = true;
return;
}
notification.success(gettext('Success'), gettext('Encrypted export file saved'));
$state.go('tabs.home');
});
});

View File

@ -1,7 +1,7 @@
'use strict';
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 isDevel = platformInfo.isDevel;
@ -15,6 +15,10 @@ angular.module('copayApp.controllers').controller('importController',
$scope.account = 1;
$scope.importErr = false;
$scope.goBack = function() {
$ionicHistory.goBack();
};
var updateSeedSourceSelect = function() {
$scope.seedOptions = [];

View File

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

View File

@ -1,6 +1,6 @@
'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() {
var backupLaterPopup = $ionicPopup.show({

View File

@ -1,6 +1,6 @@
'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() {
var backupWarningPopup = $ionicPopup.show({

View File

@ -1,6 +1,15 @@
'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) {
var wallet = profileService.getWallet($stateParams.walletId);
@ -10,7 +19,8 @@ angular.module('copayApp.controllers').controller('collectEmailController', func
email: email,
}, function(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';
angular.module('copayApp.controllers').controller('notificationsController', function($scope, $state, platformInfo) {
if (!platformInfo.isCordova) $state.go('onboarding.backupRequest');
angular.module('copayApp.controllers').controller('notificationsController', function($scope, $state, profileService) {
$scope.allowNotif = function() {
// T O D O
profileService.pushNotificationsInit();
$state.go('onboarding.backupRequest');
}

View File

@ -1,6 +1,6 @@
'use strict';
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() {

View File

@ -1,8 +1,8 @@
'use strict';
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 walletId = wallet.credentials.walletId;
$scope.wallet = wallet;
@ -10,22 +10,20 @@ angular.module('copayApp.controllers').controller('preferencesController',
$scope.init = function() {
$scope.externalSource = null;
if (wallet) {
var config = configService.getSync();
config.aliasFor = config.aliasFor || {};
$scope.alias = config.aliasFor[walletId] || wallet.credentials.walletName;
$scope.color = config.colorFor[walletId] || '#4A90E2';
if (!wallet)
return $ionicHistory.goBack();
$scope.encryptEnabled = walletService.isEncrypted(wallet);
if (wallet.isPrivKeyExternal)
$scope.externalSource = wallet.getPrivKeyExternalSourceName() == 'ledger' ? 'Ledger' : 'Trezor';
var config = configService.getSync();
config.aliasFor = config.aliasFor || {};
$scope.alias = config.aliasFor[walletId] || wallet.credentials.walletName;
$scope.color = config.colorFor[walletId] || '#4A90E2';
// TODO externalAccount
//this.externalIndex = wallet.getExternalIndex();
}
$scope.encryptEnabled = walletService.isEncrypted(wallet);
if (wallet.isPrivKeyExternal)
$scope.externalSource = wallet.getPrivKeyExternalSourceName() == 'ledger' ? 'Ledger' : 'Trezor';
$scope.touchidAvailable = fingerprintService.isAvailable();
$scope.touchidEnabled = config.touchIdFor ? config.touchIdFor[walletId] : null;
$scope.touchIdAvailable = fingerprintService.isAvailable();
$scope.touchIdEnabled = config.touchIdFor ? config.touchIdFor[walletId] : null;
$scope.deleted = false;
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() {
if (!wallet) return;
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)) {
$rootScope.$emit('Local/NeedsPassword', true, function(err, password) {
if (err || !password) {
$log.debug('Encrypting private key for', wallet.name);
walletService.encrypt(wallet, function(err) {
if (err) {
$log.warn(err);
// ToDo show error?
$scope.encryptEnabled = false;
return;
}
setPrivateKeyEncryption(password, function() {
$rootScope.$emit('Local/NewEncryptionSetting');
profileService.updateCredentials(JSON.parse(wallet.export()), function() {
$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;
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() {
var opts = {
touchIdFor: {}
};
opts.touchIdFor[walletId] = $scope.touchidEnabled;
fingerprintService.check(wallet, function(err) {
$scope.touchIdChange = function() {
var newStatus = $scope.touchIdEnabled;
walletService.setTouchId(wallet, newStatus, function(err) {
if (err) {
$log.debug(err);
$timeout(function() {
$scope.touchidError = true;
$scope.touchidEnabled = true;
}, 100);
$log.warn(err);
$scope.touchIdEnabled = !newStatus;
return;
}
configService.set(opts, function(err) {
if (err) {
$log.debug(err);
$scope.touchidError = true;
$scope.touchidEnabled = false;
}
});
$log.debug('Touch Id status changed: ' + newStatus);
});
};
});

View File

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

View File

@ -1,8 +1,8 @@
'use strict';
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);
$scope.wallet = wallet;
var walletId = wallet.credentials.walletId;
@ -20,7 +20,7 @@ angular.module('copayApp.controllers').controller('preferencesAliasController',
configService.set(opts, function(err) {
if (err) $log.warn(err);
$state.go('wallet.preferences')
$ionicHistory.goBack();
});
};
});

View File

@ -1,7 +1,8 @@
'use strict';
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 completeAlternativeList;
@ -42,8 +43,8 @@ angular.module('copayApp.controllers').controller('preferencesAltCurrencyControl
configService.set(opts, function(err) {
if (err) $log.warn(err);
$state.go('tabs.settings');
$ionicHistory.goBack();
walletService.updateRemotePreferences(profileService.getWallets(), {}, function() {
$log.debug('Remote preferences saved');
});

View File

@ -1,7 +1,8 @@
'use strict';
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.success = null;

View File

@ -1,7 +1,7 @@
'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 = [
'#DD4B39',
'#F38F12',
@ -35,7 +35,7 @@ angular.module('copayApp.controllers').controller('preferencesColorController',
configService.set(opts, function(err) {
if (err) $log.warn(err);
$state.go('wallet.preferences');
$ionicHistory.goBack();
});
};
});

View File

@ -1,12 +1,12 @@
'use strict';
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);
$scope.alias = lodash.isEqual(wallet.name, wallet.credentials.walletName) ? null : wallet.name + ' ';
$scope.walletName = '[' + wallet.credentials.walletName + ']';
$scope.error = null;
var walletName = $scope.alias || $scope.walletName;
$scope.showDeletePopup = function() {
var popup = $ionicPopup.show({

View File

@ -1,7 +1,7 @@
'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 msg = gettext('Are you sure you want to delete the recovery phrase?');
var successMsg = gettext('Recovery phrase deleted');
@ -17,8 +17,7 @@ angular.module('copayApp.controllers').controller('preferencesDeleteWordsControl
if (ok) {
wallet.clearMnemonic();
profileService.updateCredentials(JSON.parse(wallet.export()), function() {
notification.success(successMsg);
$state.go('wallet.details');
$ionicHistory.goBack();
});
}
});

View File

@ -1,7 +1,7 @@
'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) {
var wallet = profileService.getWallet($stateParams.walletId);
var email = $scope.email || '';
@ -10,7 +10,7 @@ angular.module('copayApp.controllers').controller('preferencesEmailController',
email: email,
}, function(err) {
if (err) $log.warn(err);
$state.go('wallet.preferences');
$ionicHistory.goBack();
});
};

View File

@ -1,6 +1,7 @@
'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.loading = true;
@ -25,6 +26,7 @@ angular.module('copayApp.controllers').controller('preferencesFeeController', fu
configService.set(opts, function(err) {
if (err) $log.debug(err);
$scope.currentFeeLevel = newFee.level;
$ionicHistory.goBack();
$timeout(function() {
$scope.$apply();
}, 10);

View File

@ -1,8 +1,8 @@
'use strict';
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 c = wallet.credentials;
$scope.csvReady = false;

View File

@ -1,7 +1,8 @@
'use strict';
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 wallet = profileService.getWallet($stateParams.walletId);
var walletId = wallet.id;
@ -12,7 +13,7 @@ angular.module('copayApp.controllers').controller('preferencesInformation',
config.colorFor = config.colorFor || {};
$scope.init = function() {
var c =wallet.credentials;
var c = wallet.credentials;
var basePath = c.getBaseAddressDerivationPath();
$scope.wallet = wallet;

View File

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

View File

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

View File

@ -1,6 +1,7 @@
'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() {
var config = configService.getSync();
@ -36,7 +37,7 @@ angular.module('copayApp.controllers').controller('preferencesUnitController', f
configService.set(opts, function(err) {
if (err) $log.warn(err);
$state.go('tabs.settings');
$ionicHistory.goBack();
walletService.updateRemotePreferences(profileService.getWallets(), {}, function() {
$log.debug('Remote preferences saved');
});

View File

@ -30,14 +30,6 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
];
$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) {
self.allWallets = profileService.getWallets(testnet ? 'testnet' : 'livenet', 1);
@ -263,66 +255,7 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
this.confirmTx = function(txp, cb) {
fingerprintService.check(client, function(err) {
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);
});
});
});
});
});
// TODO see walletService createAndPublish
};
});

View File

@ -208,53 +208,44 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
self.error = err.message ||  bwcError.msg(err);
return;
}
fingerprintService.check(wallet, function(err) {
walletService.prepare(wallet, txp, function(err, password) {
if (err) {
self.error = err.message ||  bwcError.msg(err);
return;
}
walletService.handleEncryptedWallet(wallet, function(err) {
ongoingProcess.set('signingTx', true);
walletService.publishTx(wallet, createdTxp, function(err, publishedTxp) {
if (err) {
ongoingProcess.clear();
self.error = err.message ||  bwcError.msg(err);
return;
}
ongoingProcess.set('signingTx', true);
walletService.publishTx(wallet, createdTxp, function(err, publishedTxp) {
walletService.signTx(wallet, publishedTxp, function(err, password, signedTxp) {
walletService.removeTx(wallet, signedTxp, function(err) {
if (err) $log.debug(err);
});
ongoingProcess.clear();
if (err) {
ongoingProcess.clear();
self.error = err.message ||  bwcError.msg(err);
return;
}
walletService.signTx(wallet, publishedTxp, function(err, signedTxp) {
walletService.lock(wallet);
walletService.removeTx(wallet, signedTxp, function(err) {
if (err) $log.debug(err);
});
var rawTx = signedTxp.raw;
var data = {
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;
}
var rawTx = signedTxp.raw;
var data = {
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();
});
self.success = data;
$scope.update();
});
});
});

View File

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

View File

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

View File

@ -29,6 +29,10 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
$ionicConfigProvider.navBar.positionPrimaryButtons('left');
$ionicConfigProvider.navBar.positionSecondaryButtons('right');
// NAV BACK-BUTTON TEXT/ICON
$ionicConfigProvider.backButton.icon('ion-chevron-left');
$ionicConfigProvider.backButton.previousTitleText(false);
$logProvider.debugEnabled(true);
$provide.decorator('$log', ['$delegate', 'platformInfo',
function($delegate, platformInfo) {
@ -95,7 +99,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
*
*/
.state('unsupported', {
.state('unsupported', {
url: '/unsupported',
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) {
_setCredentials();
storageService.getBitpayCard(credentials.NETWORK, function(err, user) {
@ -53,8 +58,7 @@ angular.module('copayApp.services').factory('bitpayCardService', function($http,
bpSession = data.data.data;
return cb(null, bpSession);
}, function(data) {
$log.error('BitPay Get Session: ERROR ' + data.data.error);
return cb(data.data.error);
return cb(_setError('BitPay Card Error: Get Session', data));
});
};
@ -97,8 +101,7 @@ angular.module('copayApp.services').factory('bitpayCardService', function($http,
$log.info('BitPay TopUp: SUCCESS');
return cb(null, data.data.data.invoice);
}, function(data) {
$log.error('BitPay TopUp: ERROR ' + data.data.error);
return cb(data.data.error);
return cb(_setError('BitPay Card Error: TopUp', data));
});
};
@ -113,8 +116,7 @@ angular.module('copayApp.services').factory('bitpayCardService', function($http,
$log.info('BitPay Get Transaction History: SUCCESS');
return cb(null, data.data.data);
}, function(data) {
$log.error('BitPay Get Transaction History: ERROR ' + data.data);
return cb(data.data);
return cb(_setError('BitPay Card Error: Get Transaction History', data));
});
};
@ -123,8 +125,7 @@ angular.module('copayApp.services').factory('bitpayCardService', function($http,
$log.info('BitPay Get Invoice History: SUCCESS');
return cb(null, data.data.data);
}, function(data) {
$log.error('BitPay Get Invoice History: ERROR ' + data.data);
return cb(data.data);
return cb(_setError('BitPay Card Error: Get Invoice History', data));
});
};
@ -133,8 +134,7 @@ angular.module('copayApp.services').factory('bitpayCardService', function($http,
$log.info('BitPay Get Invoice: SUCCESS');
return cb(null, data.data.data);
}, function(data) {
$log.error('BitPay Get Invoice: ERROR ' + data.data.error);
return cb(data.data.error);
return cb(_setError('BitPay Card Error: Get Invoice', data));
});
};
@ -147,8 +147,8 @@ angular.module('copayApp.services').factory('bitpayCardService', function($http,
return cb(null, session);
});
}, function(data) {
$log.error('BitPay Authenticate: ERROR');
if (data.data.error.twoFactorPending) {
if (data && data.data && data.data.error.twoFactorPending) {
$log.error('BitPay Card needs 2FA Authentication');
_getSession(function(err, session) {
if (err) return cb(err);
return cb(null, session);
@ -165,8 +165,7 @@ angular.module('copayApp.services').factory('bitpayCardService', function($http,
$log.info('BitPay 2FA: SUCCESS');
return cb(null, data);
}, function(data) {
$log.error('BitPay 2FA: ERROR');
return cb(data);
return cb(_setError('BitPay Card Error: 2FA', data));
});
};
@ -195,8 +194,7 @@ angular.module('copayApp.services').factory('bitpayCardService', function($http,
$log.info('BitPay Logout: SUCCESS');
return cb(data);
}, function(data) {
$log.error('BitPay Logout: ERROR ' + data.data.error);
return cb(data.data.error);
return cb(_setError('BitPay Card Error: Logout ', data));
});
});
};

View File

@ -16,19 +16,23 @@ angular.module('copayApp.services')
root.profile = null;
Object.defineProperty(root, "focusedClient", {
get: function () { throw "focusedClient is not used any more" },
set: function () { throw "focusedClient is not used any more" }
Object.defineProperty(root, "focusedClient", {
get: function() {
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) {
var defaults = configService.getDefaults();
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.color = config.colorFor[wallet.id] || '#4A90E2';
@ -69,7 +73,7 @@ angular.module('copayApp.services')
// notification?
// TODO (put this in wallet ViewModel)
// TODO (put this in wallet ViewModel)
if (wallet.cachedStatus)
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) {
if (err) {
$log.error('Could not init notifications err:', err);
@ -99,7 +98,7 @@ angular.module('copayApp.services')
}
wallet.setNotificationsInterval(UPDATE_PERIOD);
wallet.openWallet(function(err) {
if (wallet.status !== true)
if (wallet.status !== true)
$log.log('Wallet + ' + walletId + ' status:' + wallet.status)
});
});
@ -107,7 +106,7 @@ angular.module('copayApp.services')
$rootScope.$on('Local/SettingsUpdated', function(e, walletId) {
if (!walletId || walletId == wallet.id) {
$log.debug('Updating settings for wallet:' + wallet.id);
$log.debug('Updating settings for wallet:' + wallet.id);
root.updateWalletSettings(wallet);
}
});
@ -159,7 +158,7 @@ angular.module('copayApp.services')
if (!credentials.walletId || !credentials.m)
return cb('bindWallet should receive credentials JSON');
// Create the client
// Create the client
var getBWSURL = function(walletId) {
var config = configService.getSync();
var defaults = configService.getDefaults();
@ -206,9 +205,6 @@ angular.module('copayApp.services')
}
bindWallets(function() {
if (usePushNotifications)
root.pushNotificationsInit();
root.isBound = true;
lodash.each(root._queue, function(x) {
@ -224,6 +220,8 @@ angular.module('copayApp.services')
if (!val) {
return cb(new Error('NONAGREEDDISCLAIMER: Non agreed disclaimer'));
}
if (usePushNotifications)
root.pushNotificationsInit();
$rootScope.$emit('disclaimerAccepted');
return cb();
});
@ -548,14 +546,6 @@ angular.module('copayApp.services')
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);
var addressBook = str.addressBook || {};
@ -716,10 +706,11 @@ angular.module('copayApp.services')
ret = lodash.filter(ret, function(w) {
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;

View File

@ -547,27 +547,6 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
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) {
if (lodash.isEmpty(txp) || lodash.isEmpty(wallet))
return cb('MISSING_PARAMETER');
@ -578,28 +557,12 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
else return cb(null, createdTxp);
});
} else {
wallet.getFeeLevels(wallet.credentials.network, function(err, levels) {
wallet.createTxProposal(txp, function(err, createdTxp) {
if (err) return cb(err);
var feeLevelValue = lodash.find(levels, {
level: txp.feeLevel
});
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);
}
});
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) {
if (lodash.isEmpty(txp) || lodash.isEmpty(wallet))
root.signTx = function(wallet, txp, password, cb) {
if (!wallet || !txp || !cb)
return cb('MISSING_PARAMETER');
if (wallet.isPrivKeyExternal()) {
@ -637,8 +600,8 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
} else {
try {
wallet.signTxProposal(txp, function(err, signedTxp) {
$log.debug('Transaction signed');
wallet.signTxProposal(txp, password, function(err, signedTxp) {
$log.debug('Transaction signed err:' + err);
return cb(err, signedTxp);
});
} catch (e) {
@ -861,12 +824,12 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
// An alert dialog
var askPassword = function(name, cb) {
var askPassword = function(name, title, cb) {
var scope = $rootScope.$new(true);
scope.data = [];
var pass = $ionicPopup.show({
template: '<input type="password" ng-model="data.pass">',
title: 'Enter Spending Password',
title: title,
subTitle: name,
scope: scope,
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) {
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');
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) {
var publishFn = root.publishTx;
@ -943,56 +949,51 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
};
}
fingerprintService.check(wallet, function(err) {
if (err) return cb(err);
root.prepare(wallet, function(err, password) {
if (err) return cb('Prepare error: ' + err);
root.handleEncryptedWallet(wallet, function(err) {
if (err) return cb(err);
ongoingProcess.set('sendingTx', true);
publishFn(wallet, txp, function(err, publishedTxp) {
ongoingProcess.set('sendingTx', false);
if (err) return cb('Send Error: ' + err);
ongoingProcess.set('sendingTx', true);
publishFn(wallet, txp, function(err, publishedTxp) {
ongoingProcess.set('sendingTx', false);
if (err) return cb(err);
ongoingProcess.set('signingTx', true);
root.signTx(wallet, publishedTxp, function(err, signedTxp) {
root.lock(wallet);
ongoingProcess.set('signingTx', false);
root.invalidateCache(wallet);
ongoingProcess.set('signingTx', true);
root.signTx(wallet, publishedTxp, password, function(err, signedTxp) {
ongoingProcess.set('signingTx', false);
root.invalidateCache(wallet);
if (err) {
// TODO?
var msg = err.message ?
err.message :
gettext('The payment was created but could not be completed. Please try again from home screen');
$rootScope.$emit('Local/TxAction', wallet.id);
return cb(err);
}
if (err) {
$log.warn('sign error:' + err);
// TODO?
var msg = err.message ?
err.message :
gettext('The payment was created but could not be completed. Please try again from home screen');
$rootScope.$emit('Local/TxAction', wallet.id);
return cb(msg);
}
if (signedTxp.status == 'accepted') {
ongoingProcess.set('broadcastingTx', true);
root.broadcastTx(wallet, signedTxp, function(err, broadcastedTxp) {
ongoingProcess.set('broadcastingTx', false);
if (err) return cb(err);
if (signedTxp.status == 'accepted') {
ongoingProcess.set('broadcastingTx', true);
root.broadcastTx(wallet, signedTxp, function(err, broadcastedTxp) {
ongoingProcess.set('broadcastingTx', false);
if (err) return cb('sign error' + err);
var type = txStatus.notify(broadcastedTxp);
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);
var type = txStatus.notify(broadcastedTxp);
root.openStatusModal(type, broadcastedTxp, function() {
$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);
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 = {};
@ -1027,42 +1028,34 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
root.getEncodedWalletInfo = function(wallet, cb) {
var getCode = function() {
var derivationPath = wallet.credentials.getBaseAddressDerivationPath();
var encodingType = {
mnemonic: 1,
xpriv: 2,
xpub: 3
};
var info;
var derivationPath = wallet.credentials.getBaseAddressDerivationPath();
var encodingType = {
mnemonic: 1,
xpriv: 2,
xpub: 3
};
var info;
// not supported yet
if (wallet.credentials.derivationStrategy != 'BIP44' || !wallet.canSign())
return null;
// not supported yet
if (wallet.credentials.derivationStrategy != 'BIP44' || !wallet.canSign())
return null;
if (wallet.credentials.mnemonic) {
root.getKeys(wallet, function(err, keys){
if (err || !keys) return cb(err);
if (keys.mnemonic) {
info = {
type: encodingType.mnemonic,
data: wallet.credentials.mnemonic,
data: keys.mnemonic,
}
} else {
info = {
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();
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;
});

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
@ -850,6 +865,7 @@ ul.wallet-selection.wallets {
.no-border {
border-style: none;
background-color: transparent !important;
}
input[type=file] {
@ -874,6 +890,16 @@ input[type=file] {
.wallets {
height: 90px;
}
.bar .button.back-button {
color: #444;
font-size: 14px;
}
.bar .button.button-clear .icon:before {
font-size: 16px;
}
/*
* Calculator
*/