mirror of https://github.com/BTCPrivate/copay.git
fixes
This commit is contained in:
parent
602c97267b
commit
4c1203559c
|
@ -14,7 +14,3 @@
|
|||
// To declare rules for a specific mode, create a child rule
|
||||
// for the .md, .ios, or .wp mode classes. The mode class is
|
||||
// automatically applied to the <body> element in the app.
|
||||
|
||||
.wallet-background-color-default {
|
||||
background-color: #019477;
|
||||
}
|
|
@ -18,14 +18,14 @@
|
|||
<ion-icon name="help-circle" item-start></ion-icon>
|
||||
Help & support
|
||||
</ion-item>
|
||||
<!-- <ion-item (click)="feedback()">
|
||||
<ion-item (click)="openFeedbackPage()">
|
||||
<ion-icon name="mail" item-start></ion-icon>
|
||||
Send feedback
|
||||
</ion-item>
|
||||
<ion-item (click)="share()">
|
||||
<ion-item (click)="openSharePage()">
|
||||
<ion-icon name="heart" item-start></ion-icon>
|
||||
Share {{ appName }}
|
||||
</ion-item> -->
|
||||
</ion-item>
|
||||
|
||||
<ion-item-divider color="light">Preferences</ion-item-divider>
|
||||
<ion-item (click)="openNotificationPage()">
|
||||
|
@ -63,24 +63,34 @@
|
|||
Lock
|
||||
</ion-label>
|
||||
</ion-item>
|
||||
<div ng-show="walletsBtc">
|
||||
<ion-item-divider color="light">{{'Bitcoin Wallets' | translate}}</ion-item-divider>
|
||||
<button ion-item *ngFor="let wallet of walletsBtc" (click)="openWalletSettings(wallet.credentials.walletId)">
|
||||
<ion-icon item-start>
|
||||
<img ng-if="wallet.network == 'testnet'" src="assets/img/icon-wallet-testnet.svg" class="icon-wallet" />
|
||||
<img ng-if="wallet.network != 'testnet'" src="assets/img/icon-wallet.svg" class="icon-wallet" />
|
||||
</ion-icon>
|
||||
<h2>{{wallet.credentials.walletName}} <span *ngIf="wallet.credentials.m > 1">{{wallet.credentials.m}}-{{wallet.credentials.n}}</span></h2>
|
||||
<ion-note [hidden]="wallet.isComplete()" item-end>
|
||||
{{'Incomplete' | translate}}
|
||||
</ion-note>
|
||||
<ion-note [hidden]="!wallet.isComplete() || wallet.needsBackup" item-end>
|
||||
{{'Backup needed' | translate}}
|
||||
</ion-note>
|
||||
<i class="icon bp-arrow-right"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<ion-item-divider *ngIf="walletsBtc.length" color="light">{{'Bitcoin Wallets' | translate}}</ion-item-divider>
|
||||
<button ion-item *ngFor="let wallet of walletsBtc" (click)="openWalletSettings(wallet.credentials.walletId)">
|
||||
<ion-icon item-start>
|
||||
<img ng-if="wallet.network == 'testnet'" src="assets/img/icon-wallet-testnet.svg" class="icon-wallet" />
|
||||
<img ng-if="wallet.network != 'testnet'" src="assets/img/icon-wallet.svg" class="icon-wallet" />
|
||||
</ion-icon>
|
||||
<h2>{{wallet.name}} <span *ngIf="wallet.credentials.m > 1">{{wallet.credentials.m}}-{{wallet.credentials.n}}</span></h2>
|
||||
<ion-note class="assertive" *ngIf="!wallet.isComplete()" item-end>
|
||||
{{'Incomplete' | translate}}
|
||||
</ion-note>
|
||||
<ion-note class="assertive" *ngIf="wallet.isComplete() && wallet.needsBackup" item-end>
|
||||
{{'Backup needed' | translate}}
|
||||
</ion-note>
|
||||
</button>
|
||||
<ion-item-divider *ngIf="walletsBch.length" color="light">{{'BCH Wallets' | translate}}</ion-item-divider>
|
||||
<button ion-item *ngFor="let wallet of walletsBch" (click)="openWalletSettings(wallet.credentials.walletId)">
|
||||
<ion-icon item-start>
|
||||
<img ng-if="wallet.network == 'testnet'" src="assets/img/icon-wallet-testnet.svg" class="icon-wallet" />
|
||||
<img ng-if="wallet.network != 'testnet'" src="assets/img/icon-wallet.svg" class="icon-wallet" />
|
||||
</ion-icon>
|
||||
<h2>{{wallet.name}} <span *ngIf="wallet.credentials.m > 1">{{wallet.credentials.m}}-{{wallet.credentials.n}}</span></h2>
|
||||
<ion-note class="assertive" *ngIf="!wallet.isComplete()" item-end>
|
||||
{{'Incomplete' | translate}}
|
||||
</ion-note>
|
||||
<ion-note class="assertive" *ngIf="wallet.isComplete() && wallet.needsBackup" item-end>
|
||||
{{'Backup needed' | translate}}
|
||||
</ion-note>
|
||||
</button>
|
||||
<ion-item-divider color="light">More</ion-item-divider>
|
||||
<ion-item (click)="openAdvancedPage()">
|
||||
<ion-icon name="hammer" item-start></ion-icon>
|
||||
|
|
|
@ -5,6 +5,12 @@ page-settings {
|
|||
background-color: color($colors, primary);
|
||||
}
|
||||
}
|
||||
.assertive {
|
||||
color: color($colors, danger);
|
||||
ion-label {
|
||||
white-space: inherit;
|
||||
}
|
||||
}
|
||||
ion-item {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
import { Component } from '@angular/core';
|
||||
import { NavController, NavParams } from 'ionic-angular';
|
||||
import { NavController } from 'ionic-angular';
|
||||
import { ModalController } from 'ionic-angular';
|
||||
|
||||
//providers
|
||||
import { AppProvider } from '../../providers/app/app';
|
||||
import { LanguageProvider } from '../../providers/language/language';
|
||||
import { RateProvider } from '../../providers/rate/rate';
|
||||
import { ExternalLinkProvider } from '../../providers/external-link/external-link';
|
||||
import { ProfileProvider } from '../../providers/profile/profile';
|
||||
|
||||
|
@ -20,37 +19,40 @@ import { WalletSettingsPage } from './wallet-settings/wallet-settings';
|
|||
@Component({
|
||||
selector: 'page-settings',
|
||||
templateUrl: 'settings.html',
|
||||
providers: [RateProvider]
|
||||
})
|
||||
export class SettingsPage {
|
||||
public appName: string;
|
||||
public currentLanguage: string;
|
||||
public languages: Array<any>;
|
||||
public walletsBtc: any;
|
||||
public walletsBtc: Array<any>;
|
||||
public walletsBch: Array<any>;
|
||||
|
||||
constructor(
|
||||
private modalCtrl: ModalController,
|
||||
private navCtrl: NavController,
|
||||
private navParams: NavParams,
|
||||
private app: AppProvider,
|
||||
private language: LanguageProvider,
|
||||
private rate: RateProvider,
|
||||
private externalLinkProvider: ExternalLinkProvider,
|
||||
private profileProvider: ProfileProvider
|
||||
) {
|
||||
this.appName = this.app.info.nameCase;
|
||||
this.currentLanguage = this.language.getCurrent();
|
||||
this.languages = this.language.getAvailables();
|
||||
this.walletsBch = [];
|
||||
this.walletsBtc = [];
|
||||
}
|
||||
|
||||
ionViewDidLoad() {
|
||||
console.log('ionViewDidLoad SettingsPage');
|
||||
}
|
||||
|
||||
ionViewDidEnter() {
|
||||
ionViewWillEnter() {
|
||||
this.walletsBtc = this.profileProvider.getWallets({
|
||||
coin: 'btc'
|
||||
});
|
||||
this.walletsBch = this.profileProvider.getWallets({
|
||||
coin: 'bch'
|
||||
});
|
||||
}
|
||||
|
||||
altCurrencyModal() {
|
||||
|
|
|
@ -30,7 +30,7 @@ export class WalletColorPage {
|
|||
console.log('ionViewDidLoad WalletColorPage');
|
||||
}
|
||||
|
||||
ionViewDidEnter() {
|
||||
ionViewWillEnter() {
|
||||
this.wallet = this.profileProvider.getWallet(this.navParams.data.walletId);
|
||||
this.config = this.configProvider.get();
|
||||
this.colorCount = Array(this.getColorCount()).fill(0).map((x, i) => i);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<form [formGroup]="walletNameForm" (ngSubmit)="save()">
|
||||
<ion-item>
|
||||
<ion-label stacked translate>Name</ion-label>
|
||||
<ion-input type="text" formControlName="walletName" placeholder="{{walletAlias}}" required></ion-input>
|
||||
<ion-input type="text" formControlName="walletName" [value]="walletNameForm.value.walletName" required></ion-input>
|
||||
</ion-item>
|
||||
<button ion-button block type="submit" [disabled]="!walletNameForm.valid">Save</button>
|
||||
</form>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Component } from '@angular/core';
|
||||
import { NavController, NavParams, ModalController } from 'ionic-angular';
|
||||
import { NavController, NavParams, ModalController, Events } from 'ionic-angular';
|
||||
import { Logger } from '@nsalaun/ng-logger';
|
||||
import { Validators, FormBuilder, FormGroup } from '@angular/forms';
|
||||
|
||||
|
@ -14,7 +14,7 @@ import { ConfigProvider } from '../../../../providers/config/config';
|
|||
export class WalletNamePage {
|
||||
|
||||
public wallet: any;
|
||||
public walletAlias: string;
|
||||
public walletName: string;
|
||||
public walletNameForm: FormGroup;
|
||||
private config: any;
|
||||
|
||||
|
@ -23,7 +23,8 @@ export class WalletNamePage {
|
|||
private navCtrl: NavController,
|
||||
private navParams: NavParams,
|
||||
private configProvider: ConfigProvider,
|
||||
private formBuilder: FormBuilder
|
||||
private formBuilder: FormBuilder,
|
||||
private events: Events
|
||||
) {
|
||||
this.walletNameForm = this.formBuilder.group({
|
||||
walletName: ['', Validators.compose([Validators.minLength(1), Validators.required])]
|
||||
|
@ -34,19 +35,21 @@ export class WalletNamePage {
|
|||
console.log('ionViewDidLoad WalletNamePage');
|
||||
}
|
||||
|
||||
ionViewDidEnter() {
|
||||
ionViewWillEnter() {
|
||||
this.wallet = this.profileProvider.getWallet(this.navParams.data.walletId);
|
||||
this.config = this.configProvider.get();
|
||||
let alias = this.config.aliasFor && this.config.aliasFor[this.wallet.credentials.walletId];
|
||||
this.walletAlias = alias ? alias : this.wallet.credentials.walletName;
|
||||
this.walletNameForm.value.walletName = alias ? alias : this.wallet.credentials.walletName;
|
||||
this.walletName = this.wallet.credentials.walletName;
|
||||
}
|
||||
|
||||
public save(): void {
|
||||
var opts = {
|
||||
let opts = {
|
||||
aliasFor: {}
|
||||
};
|
||||
opts.aliasFor[this.wallet.credentials.walletId] = this.walletNameForm.value.walletName;
|
||||
this.configProvider.set(opts);
|
||||
this.events.publish('wallet:updated', this.wallet.credentials.walletId);
|
||||
this.navCtrl.pop();
|
||||
}
|
||||
}
|
|
@ -13,22 +13,19 @@
|
|||
|
||||
<ion-list>
|
||||
<button ion-item (click)="scan()">
|
||||
<h2 translate>Scan addresses for funds</h2>
|
||||
<i class="icon bp-arrow-right"></i>
|
||||
<h2 translate>Scan addresses for funds</h2>
|
||||
</button>
|
||||
|
||||
<button ion-item *ngIf="viewAll" (click)="viewAllAddresses()">
|
||||
<h2 translate>View All Addresses</h2>
|
||||
<i class="icon bp-arrow-right"></i>
|
||||
<h2 translate>View All Addresses</h2>
|
||||
</button>
|
||||
|
||||
<ion-item-divider (click)="newAddress()" color="light" translate>
|
||||
Unused Addresses
|
||||
<i class="icon ion-ios-plus-empty"></i>
|
||||
</ion-item-divider>
|
||||
|
||||
<div *ngIf="loading" class="updating">
|
||||
<ion-spinner class="spinner-dark recent" icon="crescent"></ion-spinner>
|
||||
<div *ngIf="loading">
|
||||
<ion-spinner icon="crescent"></ion-spinner>
|
||||
<span translate>Loading addresses...</span>
|
||||
</div>
|
||||
|
||||
|
@ -56,9 +53,9 @@
|
|||
Addresses With Balance
|
||||
</ion-item-divider>
|
||||
|
||||
<ion-item class="item" *ngFor="let w of latestWithBalance" copy-to-clipboard="w.address">
|
||||
<ion-item *ngFor="let w of latestWithBalance" copy-to-clipboard="w.address">
|
||||
{{w.address}}
|
||||
<div class="addr-balance">{{w.amount | satToUnit}}</div>
|
||||
<div>{{w.amount | satToUnit}}</div>
|
||||
</ion-item>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ export class WalletAddressesPage {
|
|||
console.log('ionViewDidLoad WalletAddressesPage');
|
||||
}
|
||||
|
||||
ionViewDidEnter() {
|
||||
ionViewWillEnter() {
|
||||
this.wallet = this.profileProvider.getWallet(this.navParams.data.walletId);
|
||||
this.allAddressesView = this.navParams.data.stateName == 'tabs.receive.allAddresses' ? true : false;
|
||||
if (!this.isCachedWallet(this.navParams.data.walletId)) this.init();
|
||||
|
@ -114,7 +114,7 @@ export class WalletAddressesPage {
|
|||
}
|
||||
|
||||
private processPaths(list: any): void {
|
||||
_.each(list, (n) => {
|
||||
_.each(list, (n: any) => {
|
||||
n.path = n.path.replace(/^m/g, 'xpub');
|
||||
});
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
</ion-navbar>
|
||||
</ion-header>
|
||||
<ion-content>
|
||||
<div ng-show="wallet">
|
||||
<div>
|
||||
<h1>Warning!</h1>
|
||||
<div>
|
||||
<p translate>
|
||||
|
|
|
@ -44,7 +44,7 @@ export class WalletDeletePage {
|
|||
console.log('ionViewDidLoad WalletDeletePage');
|
||||
}
|
||||
|
||||
ionViewDidEnter() {
|
||||
ionViewWillEnter() {
|
||||
this.wallet = this.profileProvider.getWallet(this.navParams.data.walletId);
|
||||
this.walletName = this.wallet.name;
|
||||
}
|
||||
|
@ -64,6 +64,7 @@ export class WalletDeletePage {
|
|||
this.pushNotificationsProvider.unsubscribe(this.wallet);
|
||||
this.navCtrl.setRoot(HomePage);
|
||||
this.navCtrl.popToRoot();
|
||||
this.navCtrl.parent.select(0);
|
||||
}).catch((err) => {
|
||||
this.popupProvider.ionicAlert('Error', err.message || err);//TODO gettextcatalog
|
||||
});
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<ion-segment-button value="file/text">
|
||||
File/Text
|
||||
</ion-segment-button>
|
||||
<ion-segment-button (click)="generateQrCode()" value="qrCode">
|
||||
<ion-segment-button (click)="generateQrCode()">
|
||||
QR Code
|
||||
</ion-segment-button>
|
||||
</ion-segment>
|
||||
|
@ -20,13 +20,14 @@
|
|||
<form [formGroup]="exportWalletForm">
|
||||
<ion-item>
|
||||
<ion-label stacked translate>Set up a password</ion-label>
|
||||
<ion-input type="text" formControlName="password" placeholder="{{'Your password'|translate}}" (ionChange)="checkPassword(exportWalletForm.value.password, exportWalletForm.value.repeatpassword)"
|
||||
[ngClass]="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}" required></ion-input>
|
||||
<ion-input type="password" formControlName="password" placeholder="{{'Your password'|translate}}" required></ion-input>
|
||||
</ion-item>
|
||||
<ion-item>
|
||||
<ion-label stacked translate>Repeat the password</ion-label>
|
||||
<ion-input type="text" formControlName="repeatpassword" placeholder="{{'Repeat password'|translate}}" (ionChange)="checkPassword(exportWalletForm.value.password, exportWalletForm.value.repeatpassword)"
|
||||
[ngClass]="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}" required></ion-input>
|
||||
<ion-input type="password" formControlName="confirmPassword" placeholder="{{'Repeat password'|translate}}" required></ion-input>
|
||||
</ion-item>
|
||||
<ion-item class='form-text error' *ngIf="exportWalletForm.controls.confirmPassword.touched && exportWalletForm.hasError('mismatchedPasswords') && exportWalletForm.controls.password.valid">
|
||||
<div translate>Passwords do not match</div>
|
||||
</ion-item>
|
||||
<div *ngIf="canSign">
|
||||
<ion-item-divider color="light"></ion-item-divider>
|
||||
|
@ -49,11 +50,11 @@
|
|||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<button *ngIf="!isSafari && !isCordova" ion-button block type="submit" (click)="downloadWalletBackup()" [disabled]="(!exportWalletForm.value.password || exportWalletForm.value.password != exportWalletForm.value.repeatpassword) || !exportWalletForm.valid ">Download</button>
|
||||
<button *ngIf="isSafari && !isCordova" ion-button block type="submit" (click)="viewWalletBackup()" [disabled]="(!exportWalletForm.value.password || exportWalletForm.value.password != exportWalletForm.value.repeatpassword) || !exportWalletForm.valid ">View</button>
|
||||
<button *ngIf="!isSafari && !isCordova" ion-button block type="submit" (click)="downloadWalletBackup()" [disabled]="(!exportWalletForm.value.password || exportWalletForm.value.password != exportWalletForm.value.confirmPassword) || !exportWalletForm.valid ">Download</button>
|
||||
<button *ngIf="isSafari && !isCordova" ion-button block type="submit" (click)="viewWalletBackup()" [disabled]="(!exportWalletForm.value.password || exportWalletForm.value.password != exportWalletForm.value.confirmPassword) || !exportWalletForm.valid ">View</button>
|
||||
<div *ngIf="isCordova">
|
||||
<button ion-button block type="submit" (click)="copyWalletBackup()" [disabled]="(!exportWalletForm.value.password || exportWalletForm.value.password != exportWalletForm.value.repeatpassword) || !exportWalletForm.valid ">Copy to clipboard</button>
|
||||
<button ion-button block type="submit" (click)="sendWalletBackup()" [disabled]="(!exportWalletForm.value.password || exportWalletForm.value.password != exportWalletForm.value.repeatpassword) || !exportWalletForm.valid ">Send by email</button>
|
||||
<button ion-button block type="submit" (click)="copyWalletBackup()" [disabled]="(!exportWalletForm.value.password || exportWalletForm.value.password != exportWalletForm.value.confirmPassword) || !exportWalletForm.valid ">Copy to clipboard</button>
|
||||
<button ion-button block type="submit" (click)="sendWalletBackup()" [disabled]="(!exportWalletForm.value.password || exportWalletForm.value.password != exportWalletForm.value.confirmPassword) || !exportWalletForm.valid ">Send by email</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
.page-wallet-export {
|
||||
|
||||
}
|
|
@ -12,6 +12,7 @@ import { PersistenceProvider } from '../../../../../providers/persistence/persis
|
|||
import { AppProvider } from '../../../../../providers/app/app';
|
||||
import { BackupProvider } from '../../../../../providers/backup/backup';
|
||||
import { PlatformProvider } from '../../../../../providers/platform/platform';
|
||||
|
||||
//pages
|
||||
import { HomePage } from '../../../../../pages/home/home';
|
||||
|
||||
|
@ -52,9 +53,16 @@ export class WalletExportPage {
|
|||
) {
|
||||
this.exportWalletForm = this.formBuilder.group({
|
||||
password: ['', Validators.required],
|
||||
repeatpassword: ['', Validators.required],
|
||||
confirmPassword: ['', Validators.required],
|
||||
noSignEnabled: ['']
|
||||
});
|
||||
}, { validator: this.matchingPasswords('password', 'confirmPassword') });
|
||||
}
|
||||
|
||||
ionViewDidLoad() {
|
||||
console.log('ionViewDidLoad WalletExportPage');
|
||||
}
|
||||
|
||||
ionViewWillEnter() {
|
||||
this.wallet = this.profileProvider.getWallet(this.navParams.data.walletId);
|
||||
this.isEncrypted = this.wallet.isPrivKeyEncrypted();
|
||||
this.canSign = this.wallet.canSign();
|
||||
|
@ -62,25 +70,22 @@ export class WalletExportPage {
|
|||
this.isSafari = this.platformProvider.isSafari;
|
||||
}
|
||||
|
||||
ionViewDidLoad() {
|
||||
console.log('ionViewDidLoad WalletExportPage');
|
||||
private matchingPasswords(passwordKey: string, confirmPasswordKey: string) {
|
||||
return (group: FormGroup): { [key: string]: any } => {
|
||||
let password = group.controls[passwordKey];
|
||||
let confirmPassword = group.controls[confirmPasswordKey];
|
||||
if (password.value !== confirmPassword.value) {
|
||||
return {
|
||||
mismatchedPasswords: true
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public showAdvChange(): void {
|
||||
this.showAdv = !this.showAdv;
|
||||
};
|
||||
|
||||
public checkPassword(pw1: string, pw2: string): void {
|
||||
if (pw1.length > 0) {
|
||||
if (pw2.length > 0) {
|
||||
if (pw1 == pw2) this.result = 'correct';
|
||||
else this.result = 'incorrect';
|
||||
} else
|
||||
this.result = '';
|
||||
} else
|
||||
this.result = '';
|
||||
};
|
||||
|
||||
public getPassword(): Promise<any> {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (this.password) return resolve(this.password);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
</ion-navbar>
|
||||
</ion-header>
|
||||
<ion-content>
|
||||
<ion-list *ngIf="wallet">
|
||||
<ion-list>
|
||||
<ion-item (click)="saveBlack()">
|
||||
<h2 translate>Wallet Name (at creation)</h2>
|
||||
<ion-note item-end>
|
||||
|
@ -29,7 +29,7 @@
|
|||
<ion-item>
|
||||
<h2 translate>Wallet Configuration (m-n)</h2>
|
||||
<ion-note item-end>
|
||||
{{wallet.credentials.m}}-{{wallet.credentials.n}}
|
||||
{{M}}-{{N}}
|
||||
</ion-note>
|
||||
<i class="icon bp-arrow-right"></i>
|
||||
</ion-item>
|
||||
|
@ -54,24 +54,24 @@
|
|||
</ion-note>
|
||||
<i class="icon bp-arrow-right"></i>
|
||||
</ion-item>
|
||||
<ion-item [hidden]="wallet.canSign()">
|
||||
<ion-item *ngIf="!canSign">
|
||||
<h2></h2>
|
||||
<ion-note item-end translate>
|
||||
No private key
|
||||
</ion-note>
|
||||
<i class="icon bp-arrow-right"></i>
|
||||
</ion-item>
|
||||
<ion-item [hidden]="wallet.canSign()">
|
||||
<ion-item>
|
||||
<h2 translate>Account</h2>({{derivationStrategy}})
|
||||
<ion-note item-end>
|
||||
#{{wallet.credentials.account}}
|
||||
#{{account}}
|
||||
</ion-note>
|
||||
<i class="icon bp-arrow-right"></i>
|
||||
</ion-item>
|
||||
<ion-item-divider *ngIf="wallet.cachedStatus.wallet.copayers[0]" color="light" translate>Copayers</ion-item-divider>
|
||||
<ion-item *ngFor="let copayer of wallet.cachedStatus.wallet.copayers" [hidden]="wallet.canSign()">
|
||||
<h2 translate>{{copayer.name}}</h2>
|
||||
<ion-note [hidden]="copayer.id == wallet.copayerId" item-end>
|
||||
<ion-item-divider *ngIf="copayers" color="light" translate>Copayers</ion-item-divider>
|
||||
<ion-item *ngFor="let copayer of copayers">
|
||||
<h2>{{copayer.name}}</h2>
|
||||
<ion-note *ngIf="copayer.id == copayerId" item-end>
|
||||
({{'Me' | translate}})
|
||||
</ion-note>
|
||||
<i class="icon bp-arrow-right"></i>
|
||||
|
@ -85,21 +85,19 @@
|
|||
<span *ngIf="$index == 0">({{basePath}})</span>
|
||||
<i class="icon bp-arrow-right"></i>
|
||||
</ion-item>
|
||||
<div *ngIf="!wallet.needsBackup && canSign">
|
||||
<div *ngIf="!needsBackup && canSign">
|
||||
<ion-item-divider color="light"></ion-item-divider>
|
||||
<button ion-item (click)="openWalletExtendedPrivateKey()">
|
||||
<h2 translate>Extended Private Key</h2>
|
||||
<i class="icon bp-arrow-right"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div *ngIf="wallet.balanceByAddress && wallet.balanceByAddress[0]">
|
||||
<ion-item-divider color="light">Balance By Address</ion-item-divider>
|
||||
<div class="item" *ngFor="let a of wallet.balanceByAddress" copy-to-clipboard="a.address">
|
||||
<h2>{{a.address}}</h2>
|
||||
<ion-note item-end>
|
||||
{{(a.amount/1e8).toFixed(8)}} BTC
|
||||
</ion-note>
|
||||
</div>
|
||||
</div>
|
||||
<ion-item-divider *ngIf="balanceByAddress" color="light">Balance By Address</ion-item-divider>
|
||||
<ion-item class="item" *ngFor="let a of balanceByAddress" copy-to-clipboard="a.address">
|
||||
<h2>{{a.address}}</h2>
|
||||
<ion-note item-end>
|
||||
{{(a.amount/1e8).toFixed(8)}} BTC
|
||||
</ion-note>
|
||||
</ion-item>
|
||||
</ion-list>
|
||||
</ion-content>
|
|
@ -1,5 +1,5 @@
|
|||
import { Component } from '@angular/core';
|
||||
import { NavController, NavParams, ModalController } from 'ionic-angular';
|
||||
import { NavController, NavParams, ModalController, Events } from 'ionic-angular';
|
||||
import { Logger } from '@nsalaun/ng-logger';
|
||||
import { Validators, FormBuilder, FormGroup } from '@angular/forms';
|
||||
|
||||
|
@ -23,6 +23,12 @@ export class WalletInformationPage {
|
|||
public wallet: any;
|
||||
public walletId: string;
|
||||
public walletName: string;
|
||||
public N: number;
|
||||
public M: number;
|
||||
public copayers: any;
|
||||
public copayerId: any;
|
||||
public balanceByAddress: any;
|
||||
public account: number;
|
||||
public coin: string;
|
||||
public network: string;
|
||||
public addressType: string;
|
||||
|
@ -31,6 +37,7 @@ export class WalletInformationPage {
|
|||
public pubKeys: Array<string>;
|
||||
public externalSource: string;
|
||||
public canSign: boolean;
|
||||
public needsBackup: boolean;
|
||||
private config: any;
|
||||
private colorCounter = 1;
|
||||
private BLACK_WALLET_COLOR = '#202020';
|
||||
|
@ -40,7 +47,8 @@ export class WalletInformationPage {
|
|||
private configProvider: ConfigProvider,
|
||||
private walletProvider: WalletProvider,
|
||||
private navParams: NavParams,
|
||||
private navCtrl: NavController
|
||||
private navCtrl: NavController,
|
||||
private events: Events
|
||||
) {
|
||||
|
||||
}
|
||||
|
@ -49,12 +57,17 @@ export class WalletInformationPage {
|
|||
console.log('ionViewDidLoad WalletInformationPage');
|
||||
}
|
||||
|
||||
ionViewDidEnter() {
|
||||
ionViewWillEnter() {
|
||||
this.wallet = this.profileProvider.getWallet(this.navParams.data.walletId);
|
||||
this.config = this.configProvider.get();
|
||||
this.walletName = this.wallet.credentials.walletName;
|
||||
this.coin = this.wallet.coin;
|
||||
this.walletId = this.wallet.credentials.walletId;
|
||||
this.N = this.wallet.credentials.n;
|
||||
this.M = this.wallet.credentials.m;
|
||||
this.copayers = this.wallet.cachedStatus.wallet.copayers;
|
||||
this.copayerId = this.wallet.credentials.copayerId;
|
||||
this.balanceByAddress = this.wallet.balanceByAddress;
|
||||
this.account = this.wallet.credentials.account;
|
||||
this.network = this.wallet.credentials.network;
|
||||
this.addressType = this.wallet.credentials.addressType || 'P2SH';
|
||||
this.derivationStrategy = this.wallet.credentials.derivationStrategy || 'BIP45';
|
||||
|
@ -62,6 +75,8 @@ export class WalletInformationPage {
|
|||
this.pubKeys = _.map(this.wallet.credentials.publicKeyRing, 'xPubKey');
|
||||
this.externalSource = null;
|
||||
this.canSign = this.wallet.canSign();
|
||||
this.needsBackup = this.wallet.needsBackup;
|
||||
this.config = this.configProvider.get();
|
||||
}
|
||||
|
||||
public saveBlack(): void {
|
||||
|
@ -78,8 +93,10 @@ export class WalletInformationPage {
|
|||
};
|
||||
opts.colorFor[this.wallet.credentials.walletId] = color;
|
||||
this.configProvider.set(opts);
|
||||
this.events.publish('wallet:updated', this.wallet.credentials.walletId);
|
||||
this.navCtrl.setRoot(HomePage);
|
||||
this.navCtrl.popToRoot();
|
||||
this.navCtrl.parent.select(0);
|
||||
};
|
||||
|
||||
public openWalletExtendedPrivateKey(): void {
|
||||
|
|
|
@ -40,7 +40,7 @@ export class WalletServiceUrlPage {
|
|||
console.log('ionViewDidLoad WalletServiceUrlPage');
|
||||
}
|
||||
|
||||
ionViewDidEnter() {
|
||||
ionViewWillEnter() {
|
||||
this.wallet = this.profileProvider.getWallet(this.navParams.data.walletId);
|
||||
this.defaults = this.configProvider.getDefaults();
|
||||
this.config = this.configProvider.get();
|
||||
|
|
|
@ -5,27 +5,21 @@
|
|||
</ion-header>
|
||||
<ion-content>
|
||||
<button ion-item (click)="openWalletInformation()">
|
||||
<h2 translate>Wallet information</h2>
|
||||
<i class="icon bp-arrow-right"></i>
|
||||
<h2 translate>Wallet information</h2>
|
||||
</button>
|
||||
<button ion-item (click)="openWalletAddresses()">
|
||||
<h2 translate>Wallet Addresses</h2>
|
||||
<i class="icon bp-arrow-right"></i>
|
||||
<h2 translate>Wallet Addresses</h2>
|
||||
</button>
|
||||
<button ion-item (click)="openExportWallet()">
|
||||
<h2 translate>Export Wallet</h2>
|
||||
<i class="icon bp-arrow-right"></i>
|
||||
<h2 translate>Export Wallet</h2>
|
||||
</button>
|
||||
<button ion-item (click)="openWalletServiceUrl()">
|
||||
<h2 translate>Wallet Service URL</h2>
|
||||
<i class="icon bp-arrow-right"></i>
|
||||
<h2 translate>Wallet Service URL</h2>
|
||||
</button>
|
||||
<button ion-item (click)="openTransactionHistory()">
|
||||
<h2 translate>Transaction History</h2>
|
||||
<i class="icon bp-arrow-right"></i>
|
||||
<h2 translate>Transaction History</h2>
|
||||
</button>
|
||||
<button ion-item (click)="openDeleteWallet()">
|
||||
<h2 translate>DeleteWallet</h2>
|
||||
<i class="icon bp-arrow-right"></i>
|
||||
<h2 translate>DeleteWallet</h2>
|
||||
</button>
|
||||
</ion-content>
|
|
@ -25,13 +25,16 @@ export class WalletSettingsAdvancedPage {
|
|||
private navCtrl: NavController,
|
||||
private navParams: NavParams,
|
||||
) {
|
||||
this.wallet = this.profileProvider.getWallet(this.navParams.data.walletId);
|
||||
}
|
||||
|
||||
ionViewDidLoad() {
|
||||
console.log('ionViewDidLoad WalletSettingsAdvancedPage');
|
||||
}
|
||||
|
||||
ionViewWillEnter() {
|
||||
this.wallet = this.profileProvider.getWallet(this.navParams.data.walletId);
|
||||
}
|
||||
|
||||
public openWalletInformation(): void {
|
||||
this.navCtrl.push(WalletInformationPage, { walletId: this.wallet.credentials.walletId });
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ export class WalletTransactionHistoryPage {
|
|||
console.log('ionViewDidLoad WalletTransactionHistoryPage');
|
||||
}
|
||||
|
||||
ionViewDidEnter() {
|
||||
ionViewWillEnter() {
|
||||
this.wallet = this.profileProvider.getWallet(this.navParams.data.walletId);
|
||||
this.isCordova = this.platformProvider.isCordova;
|
||||
this.appName = this.appProvider.info.nameCase;
|
||||
|
|
|
@ -4,17 +4,15 @@
|
|||
</ion-navbar>
|
||||
</ion-header>
|
||||
<ion-content>
|
||||
<ion-list *ngIf="wallet">
|
||||
<ion-list>
|
||||
<button ion-item (click)="openWalletName()">
|
||||
<h2 translate>Name</h2>
|
||||
<ion-note item-end>
|
||||
{{wallet.credentials.walletName}}
|
||||
{{walletName}}
|
||||
</ion-note>
|
||||
<i class="icon bp-arrow-right"></i>
|
||||
</button>
|
||||
<button ion-item (click)="openWalletColor()">
|
||||
<h2 translate>Color</h2>
|
||||
<i class="icon bp-arrow-right"></i>
|
||||
<h2 translate>Color</h2>
|
||||
</button>
|
||||
<ion-item>
|
||||
<ion-label translate>Hide Balance</ion-label>
|
||||
|
@ -23,36 +21,34 @@
|
|||
<ion-item-divider color="light" translate>Security</ion-item-divider>
|
||||
<button ion-item (click)="openBackupSettings()">
|
||||
<h2 translate>Backup</h2>
|
||||
<ion-note item-end translate>
|
||||
<ion-note *ngIf="needsBackup" class="assertive" item-end translate>
|
||||
Backup needed
|
||||
</ion-note>
|
||||
<i class="icon bp-arrow-right"></i>
|
||||
</ion-note>
|
||||
</button>
|
||||
<div *ngIf="wallet.canSign()">
|
||||
<div *ngIf="canSign">
|
||||
<ion-item>
|
||||
<ion-label [ngClass]="{'disabled': wallet.needsBackup}" translate>Request Spending Password</ion-label>
|
||||
<ion-toggle [(ngModel)]="encryptEnabled" (ionChange)="encryptChange()" [disabled]="wallet.needsBackup"></ion-toggle>
|
||||
<ion-label [ngClass]="{'disabled': needsBackup}" translate>Request Spending Password</ion-label>
|
||||
<ion-toggle [(ngModel)]="encryptEnabled" (ionChange)="encryptChange()" [disabled]="needsBackup"></ion-toggle>
|
||||
</ion-item>
|
||||
<div class="comment">
|
||||
<span translate>
|
||||
If enabled, all sensitive information (private key and recovery phrase) and actions (spending and exporting) associated with this wallet will be protected.
|
||||
</span>
|
||||
<a (click)="openWikiSpendingPassword()" translate>Learn more</a>
|
||||
<div class="assertive" *ngIf="wallet.needsBackup" translate>
|
||||
<div class="assertive" *ngIf="needsBackup" translate>
|
||||
Complete the backup process to use this option
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="wallet.canSign() && touchIdAvailable">
|
||||
<div *ngIf="canSign && touchIdAvailable">
|
||||
<ion-item>
|
||||
<ion-label [ngClass]="{'disabled': wallet.needsBackup}" translate>Request Fingerprint</ion-label>
|
||||
<ion-label [ngClass]="{'disabled': needsBackup}" translate>Request Fingerprint</ion-label>
|
||||
<ion-toggle [(ngModel)]="touchIdEnabled" (ionChange)="touchIdChange()"></ion-toggle>
|
||||
</ion-item>
|
||||
</div>
|
||||
<ion-item-divider color="light" translate></ion-item-divider>
|
||||
<button ion-item (click)="openAdvancedSettings()">
|
||||
<h2 translate>More Options</h2>
|
||||
<i class="icon bp-arrow-right"></i>
|
||||
<h2 translate>More Options</h2>
|
||||
</button>
|
||||
</ion-list>
|
||||
|
||||
|
|
|
@ -5,4 +5,7 @@ page-wallet-settings {
|
|||
white-space: inherit;
|
||||
}
|
||||
}
|
||||
.comment {
|
||||
padding: 20px;
|
||||
}
|
||||
}
|
|
@ -22,6 +22,9 @@ import { BackupWarningPage } from '../../backup/backup-warning/backup-warning';
|
|||
export class WalletSettingsPage {
|
||||
|
||||
public wallet: any;
|
||||
public walletName: any;
|
||||
public canSign: boolean;
|
||||
public needsBackup: boolean;
|
||||
public hiddenBalance: boolean;
|
||||
public encryptEnabled: boolean;
|
||||
public touchIdEnabled: boolean;
|
||||
|
@ -45,47 +48,41 @@ export class WalletSettingsPage {
|
|||
console.log('ionViewDidLoad WalletSettingsPage');
|
||||
}
|
||||
|
||||
ionViewDidEnter() {
|
||||
ionViewWillEnter() {
|
||||
this.wallet = this.profileProvider.getWallet(this.navParams.data.walletId);
|
||||
this.config = this.configProvider.get();
|
||||
this.walletName = this.wallet.name;
|
||||
this.canSign = this.wallet.canSign();
|
||||
this.needsBackup = this.wallet.needsBackup;
|
||||
this.hiddenBalance = this.wallet.balanceHidden;
|
||||
this.encryptEnabled = this.walletProvider.isEncrypted(this.wallet);
|
||||
this.touchIdAvailable = this.touchIdProvider.isAvailable();
|
||||
this.config = this.configProvider.get();
|
||||
this.touchIdEnabled = this.config.touchIdFor ? this.config.touchIdFor[this.wallet.credentials.walletId] : null;
|
||||
if (this.wallet.credentials && !this.wallet.credentials.mnemonicEncrypted && !this.wallet.credentials.mnemonic)
|
||||
this.deleted = true;
|
||||
}
|
||||
|
||||
public hiddenBalanceChange(): void {
|
||||
let opts = {
|
||||
balance: {
|
||||
enabled: this.hiddenBalance
|
||||
}
|
||||
};
|
||||
this.profileProvider.toggleHideBalanceFlag(this.wallet.credentials.walletId).catch((err: any) => {
|
||||
if (err) this.logger.error(err);
|
||||
});
|
||||
this.profileProvider.toggleHideBalanceFlag(this.wallet.credentials.walletId);
|
||||
}
|
||||
|
||||
public encryptChange(): void {
|
||||
if (!this.wallet) return;
|
||||
var val = this.encryptEnabled;
|
||||
let val = this.encryptEnabled;
|
||||
|
||||
if (val && !this.walletProvider.isEncrypted(this.wallet)) {
|
||||
this.logger.debug('Encrypting private key for', this.wallet.name);
|
||||
this.walletProvider.encrypt(this.wallet).then(() => {
|
||||
this.profileProvider.updateCredentials(JSON.parse(this.wallet.export())).then(() => {
|
||||
this.logger.debug('Wallet encrypted');
|
||||
});
|
||||
this.profileProvider.updateCredentials(JSON.parse(this.wallet.export()));
|
||||
this.logger.debug('Wallet encrypted');
|
||||
}).catch((err: any) => {
|
||||
this.logger.warn(err);
|
||||
this.encryptEnabled = false;
|
||||
})
|
||||
} else if (!val && this.walletProvider.isEncrypted(this.wallet)) {
|
||||
this.walletProvider.decrypt(this.wallet).then(() => {
|
||||
this.profileProvider.updateCredentials(JSON.parse(this.wallet.export())).then(() => {
|
||||
this.logger.debug('Wallet decrypted');
|
||||
});
|
||||
this.profileProvider.updateCredentials(JSON.parse(this.wallet.export()));
|
||||
this.logger.debug('Wallet decrypted');
|
||||
}).catch((err) => {
|
||||
this.logger.warn(err);
|
||||
this.encryptEnabled = true;
|
||||
|
@ -108,9 +105,7 @@ export class WalletSettingsPage {
|
|||
this.walletProvider.setTouchId(this.wallet, !!newStatus).then(() => {
|
||||
this.logger.debug('Touch Id status changed: ' + newStatus);
|
||||
}).catch((err: any) => {
|
||||
if (err) {
|
||||
this.touchIdEnabled = !newStatus;
|
||||
}
|
||||
this.touchIdEnabled = !newStatus;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -217,8 +217,6 @@ export class ConfigProvider {
|
|||
}
|
||||
_.merge(config, this.configCache, newOpts);
|
||||
this.configCache = config;
|
||||
this.events.publish('config:updated', this.configCache);
|
||||
|
||||
this.persistence.storeConfig(this.configCache).then(() => {
|
||||
this.logger.info('Config saved');
|
||||
});
|
||||
|
|
|
@ -55,13 +55,16 @@ export class PopupProvider {
|
|||
return new Promise((resolve, reject) => {
|
||||
let defaultText = opts && opts.defaultText ? opts.defaultText : null;
|
||||
let placeholder = opts && opts.placeholder ? opts.placeholder : null;
|
||||
let inputType = opts && opts.type ? opts.type : 'text';
|
||||
|
||||
let prompt = this.alertCtrl.create({
|
||||
title: title,
|
||||
message: message,
|
||||
inputs: [
|
||||
{
|
||||
value: defaultText,
|
||||
placeholder: placeholder
|
||||
placeholder: placeholder,
|
||||
type: inputType
|
||||
},
|
||||
],
|
||||
buttons: [
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { Logger } from '@nsalaun/ng-logger';
|
||||
import { Events } from 'ionic-angular';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
//providers
|
||||
import { PersistenceProvider } from '../persistence/persistence';
|
||||
import { ConfigProvider } from '../config/config';
|
||||
import { BwcProvider } from '../bwc/bwc';
|
||||
|
@ -9,6 +12,8 @@ import { WalletProvider } from '../wallet/wallet';
|
|||
import { PlatformProvider } from '../platform/platform';
|
||||
import { AppProvider } from '../../providers/app/app';
|
||||
import { LanguageProvider } from '../../providers/language/language';
|
||||
|
||||
//models
|
||||
import { Profile } from '../../models/profile/profile.model';
|
||||
|
||||
@Injectable()
|
||||
|
@ -32,6 +37,7 @@ export class ProfileProvider {
|
|||
private platformProvider: PlatformProvider,
|
||||
private appProvider: AppProvider,
|
||||
private languageProvider: LanguageProvider,
|
||||
private events: Events
|
||||
) {
|
||||
this.throttledBwsEvent = _.throttle((n, wallet) => {
|
||||
this.newBwsEvent(n, wallet);
|
||||
|
@ -145,9 +151,8 @@ export class ProfileProvider {
|
|||
wallet.on('walletCompleted', () => {
|
||||
this.logger.debug('Wallet completed');
|
||||
|
||||
this.updateCredentials(JSON.parse(wallet.export())).then(() => {
|
||||
//$rootScope.$emit('Local/WalletCompleted', walletId); TODO
|
||||
});
|
||||
this.updateCredentials(JSON.parse(wallet.export()))
|
||||
//$rootScope.$emit('Local/WalletCompleted', walletId); TODO
|
||||
});
|
||||
|
||||
wallet.initialize({
|
||||
|
@ -163,13 +168,12 @@ export class ProfileProvider {
|
|||
this.logger.debug('Wallet + ' + walletId + ' status:' + JSON.stringify(wallet.status));
|
||||
});
|
||||
});
|
||||
|
||||
/* TODO $rootScope.$on('Local/SettingsUpdated', (e: any, walletId: string) => {
|
||||
if (!walletId || walletId == wallet.id) {
|
||||
this.events.subscribe('wallet:updated', (walletId: string) => {
|
||||
if (walletId && walletId == wallet.id) {
|
||||
this.logger.debug('Updating settings for wallet:' + wallet.id);
|
||||
this.updateWalletSettings(wallet);
|
||||
}
|
||||
}); */
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -190,13 +194,9 @@ export class ProfileProvider {
|
|||
//$rootScope.$emit('bwsEvent', wallet.id, n.type, n); TODO
|
||||
}
|
||||
|
||||
public updateCredentials(credentials: any): Promise<boolean> {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.profile.updateWallet(credentials);
|
||||
this.persistenceProvider.storeProfile(this.profile).then(() => {
|
||||
return resolve();
|
||||
});
|
||||
});
|
||||
public updateCredentials(credentials: any): void {
|
||||
this.profile.updateWallet(credentials);
|
||||
this.persistenceProvider.storeProfile(this.profile);
|
||||
}
|
||||
|
||||
public getLastKnownBalance(wid: string): Promise<string> {
|
||||
|
@ -824,7 +824,7 @@ export class ProfileProvider {
|
|||
|
||||
public createDefaultWallet(): Promise<any> {
|
||||
return new Promise((resolve, reject) => {
|
||||
var opts: any = {};
|
||||
let opts: any = {};
|
||||
opts.m = 1;
|
||||
opts.n = 1;
|
||||
opts.networkName = 'livenet';
|
||||
|
@ -911,15 +911,9 @@ export class ProfileProvider {
|
|||
}, 'createdOn']);
|
||||
}
|
||||
|
||||
public toggleHideBalanceFlag(walletId: string): Promise<any> {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.wallet[walletId].balanceHidden = !this.wallet[walletId].balanceHidden;
|
||||
this.persistenceProvider.setHideBalanceFlag(walletId, this.wallet[walletId].balanceHidden.toString()).then(() => {
|
||||
return resolve();
|
||||
}).catch((err: any) => {
|
||||
return reject(err);
|
||||
});
|
||||
});
|
||||
public toggleHideBalanceFlag(walletId: string): void {
|
||||
this.wallet[walletId].balanceHidden = !this.wallet[walletId].balanceHidden;
|
||||
this.persistenceProvider.setHideBalanceFlag(walletId, this.wallet[walletId].balanceHidden.toString());
|
||||
}
|
||||
|
||||
public getNotifications(opts: any): Promise<any> {
|
||||
|
|
|
@ -845,7 +845,10 @@ export class WalletProvider {
|
|||
// An alert dialog
|
||||
private askPassword(name: string, title: string): Promise<any> {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.popupProvider.ionicPrompt(title, name, null, null, null).then((res: any) => {
|
||||
let opts = {
|
||||
type: 'password'
|
||||
}
|
||||
this.popupProvider.ionicPrompt(title, name, opts, null, null).then((res: any) => {
|
||||
return resolve(res);
|
||||
}).catch((err: any) => {
|
||||
return reject(err);
|
||||
|
@ -1047,7 +1050,7 @@ export class WalletProvider {
|
|||
|
||||
public setTouchId(wallet: any, enabled: boolean): Promise<any> {
|
||||
return new Promise((resolve, reject) => {
|
||||
var opts = {
|
||||
let opts = {
|
||||
touchIdFor: {}
|
||||
};
|
||||
opts.touchIdFor[wallet.id] = enabled;
|
||||
|
|
Loading…
Reference in New Issue