mirror of https://github.com/BTCPrivate/copay.git
Fixes for send and confirm notifications
This commit is contained in:
parent
782f166ba9
commit
f1d12b3863
|
@ -9,7 +9,6 @@
|
|||
|
||||
<ion-content>
|
||||
<ion-list>
|
||||
<ion-label>Sending</ion-label>
|
||||
<ion-item *ngIf="!criticalError">
|
||||
<!--<ion-icon ios="ios-arrow-up" md="md-arrow-up" item-left></ion-icon>-->
|
||||
<div class="sending-label">
|
||||
|
@ -23,7 +22,15 @@
|
|||
</div>
|
||||
</ion-item>
|
||||
<ion-item *ngIf="!criticalError">
|
||||
<a [hidden]="!wallet" ng-click="showWalletSelector()">
|
||||
<div [hidden]="!wallet">
|
||||
<span translate>To</span>
|
||||
<div *ngIf="address">
|
||||
<div>{{address}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</ion-item>
|
||||
<ion-item *ngIf="!criticalError">
|
||||
<a [hidden]="!wallet" (click)="showWalletSelector()">
|
||||
<span translate>From</span>
|
||||
<div class="wallet" *ngIf="wallet">
|
||||
<div>{{wallet.name}}</div>
|
||||
|
@ -35,6 +42,5 @@
|
|||
</a>
|
||||
</ion-item>
|
||||
</ion-list>
|
||||
<div>To: {{address}}</div>
|
||||
<div>Amount: {{amount}}</div>
|
||||
<button ion-button full (click)="approve(tx, wallet, statusChangeHandler)" [disabled]="!wallet">Send</button>
|
||||
</ion-content>
|
|
@ -124,7 +124,7 @@ export class ConfirmPage {
|
|||
|
||||
// Grab stateParams
|
||||
let tx: any = {
|
||||
toAmount: parseFloat(this.navParams.data.amount),
|
||||
toAmount: parseFloat(this.navParams.data.amount) * 100000000, // TODO review this line '* 100000000' convert satoshi to BTC
|
||||
sendMax: this.navParams.data.useSendMax == 'true' ? true : false,
|
||||
toAddress: this.navParams.data.address,
|
||||
description: this.navParams.data.description,
|
||||
|
@ -559,7 +559,7 @@ export class ConfirmPage {
|
|||
let okText = 'Confirm'; // TODO gettextCatalog
|
||||
let cancelText = 'Cancel'; // TODO gettextCatalog
|
||||
this.popupProvider.ionicConfirm(null, message, okText, cancelText).then((ok: boolean) => {
|
||||
return reject(!ok);
|
||||
return resolve(!ok);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
@ -580,18 +580,21 @@ export class ConfirmPage {
|
|||
txid: txp.txid
|
||||
});
|
||||
}
|
||||
this.onSuccessConfirm(); // TODO review this line
|
||||
}).catch((err: any) => {
|
||||
this.setSendError(err);
|
||||
return;
|
||||
});
|
||||
};
|
||||
|
||||
confirmTx().then(() => {
|
||||
publishAndSign();
|
||||
}).catch((nok: boolean) => {
|
||||
confirmTx().then((nok: boolean) => {
|
||||
if (nok) {
|
||||
this.sendStatus = '';
|
||||
return;
|
||||
}
|
||||
publishAndSign();
|
||||
}).catch((err: any) => {
|
||||
this.logger.warn(err);
|
||||
return;
|
||||
});
|
||||
}).catch((err: any) => {
|
||||
|
|
|
@ -26,26 +26,22 @@ export class TxConfirmNotificationProvider {
|
|||
};
|
||||
|
||||
public subscribe(client: any, opts: any): void {
|
||||
client.txConfirmationSubscribe(opts).then((res: any) => {
|
||||
client.txConfirmationSubscribe(opts, (err: any, res: any) => {
|
||||
if (err) this.logger.error(err);
|
||||
this.persistenceProvider.setTxConfirmNotification(opts.txid, true).catch((err: any) => {
|
||||
this.logger.error(err);
|
||||
return;
|
||||
});
|
||||
}).catch((err: any) => {
|
||||
this.logger.error(err);
|
||||
return;
|
||||
});
|
||||
};
|
||||
|
||||
public unsubscribe(client: any, txId: string): void {
|
||||
client.txConfirmationUnsubscribe(txId).then((res: any) => {
|
||||
client.txConfirmationUnsubscribe(txId, (err: any, res: any) => {
|
||||
if (err) this.logger.error(err);
|
||||
this.persistenceProvider.removeTxConfirmNotification(txId).catch((err: any) => {
|
||||
this.logger.error(err);
|
||||
return;
|
||||
});
|
||||
}).catch((err: any) => {
|
||||
this.logger.error(err);
|
||||
return;
|
||||
});
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue