[accelerator] remember hide accelerator preference
This commit is contained in:
parent
23fa28567d
commit
c71a0afe1f
@ -137,10 +137,11 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
hasEffectiveFeeRate: boolean;
|
hasEffectiveFeeRate: boolean;
|
||||||
accelerateCtaType: 'alert' | 'button' = 'button';
|
accelerateCtaType: 'alert' | 'button' = 'button';
|
||||||
acceleratorAvailable: boolean = this.stateService.env.ACCELERATOR && this.stateService.network === '';
|
acceleratorAvailable: boolean = this.stateService.env.ACCELERATOR && this.stateService.network === '';
|
||||||
showAccelerationSummary = false;
|
forceAccelerationSummary = false;
|
||||||
|
hideAccelerationSummary = false;
|
||||||
|
accelerationFlowCompleted = false;
|
||||||
showAccelerationDetails = false;
|
showAccelerationDetails = false;
|
||||||
hasAccelerationDetails = false;
|
hasAccelerationDetails = false;
|
||||||
accelerationFlowCompleted = false;
|
|
||||||
scrollIntoAccelPreview = false;
|
scrollIntoAccelPreview = false;
|
||||||
accelerationEligible = false;
|
accelerationEligible = false;
|
||||||
auditEnabled: boolean = this.stateService.env.AUDIT && this.stateService.env.BASE_MODULE === 'mempool' && this.stateService.env.MINING_DASHBOARD === true;
|
auditEnabled: boolean = this.stateService.env.AUDIT && this.stateService.env.BASE_MODULE === 'mempool' && this.stateService.env.MINING_DASHBOARD === true;
|
||||||
@ -173,11 +174,11 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
this.enterpriseService.page();
|
this.enterpriseService.page();
|
||||||
|
|
||||||
const urlParams = new URLSearchParams(window.location.search);
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
if (urlParams.get('cash_request_id')) {
|
this.forceAccelerationSummary = !!urlParams.get('cash_request_id');
|
||||||
this.showAccelerationSummary = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.stateService.isLiquid) {
|
this.hideAccelerationSummary = this.storageService.getValue('hide-accelerator-pref') == 'true';
|
||||||
|
|
||||||
|
if (!this.stateService.isLiquid()) {
|
||||||
this.miningService.getMiningStats('1w').subscribe(stats => {
|
this.miningService.getMiningStats('1w').subscribe(stats => {
|
||||||
this.miningStats = stats;
|
this.miningStats = stats;
|
||||||
});
|
});
|
||||||
@ -414,8 +415,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
|
|
||||||
if (this.stateService.network === '') {
|
if (this.stateService.network === '') {
|
||||||
if (!this.mempoolPosition.accelerated) {
|
if (!this.mempoolPosition.accelerated) {
|
||||||
if (!this.accelerationFlowCompleted && !this.showAccelerationSummary) {
|
if (!this.accelerationFlowCompleted && !this.hideAccelerationSummary && !this.showAccelerationSummary) {
|
||||||
this.showAccelerationSummary = true;
|
|
||||||
this.miningService.getMiningStats('1w').subscribe(stats => {
|
this.miningService.getMiningStats('1w').subscribe(stats => {
|
||||||
this.miningStats = stats;
|
this.miningStats = stats;
|
||||||
});
|
});
|
||||||
@ -425,7 +425,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
} else if (this.showAccelerationSummary) {
|
} else if (this.showAccelerationSummary) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.closeAccelerator();
|
this.accelerationFlowCompleted = true;
|
||||||
}, 2000);
|
}, 2000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -715,8 +715,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
|
|
||||||
document.location.hash = '#accelerate';
|
document.location.hash = '#accelerate';
|
||||||
this.enterpriseService.goal(8);
|
this.enterpriseService.goal(8);
|
||||||
this.accelerationFlowCompleted = false;
|
this.openAccelerator();
|
||||||
this.showAccelerationSummary = this.acceleratorAvailable;
|
|
||||||
this.scrollIntoAccelPreview = true;
|
this.scrollIntoAccelPreview = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -778,7 +777,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!this.isAcceleration && this.fragmentParams.has('accelerate')) {
|
if (!this.isAcceleration && this.fragmentParams.has('accelerate')) {
|
||||||
this.onAccelerateClicked();
|
this.forceAccelerationSummary = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.txChanged$.next(true);
|
this.txChanged$.next(true);
|
||||||
@ -797,10 +796,9 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
if (this.isAcceleration) {
|
if (this.isAcceleration) {
|
||||||
if (initialState) {
|
if (initialState) {
|
||||||
this.accelerationFlowCompleted = true;
|
this.accelerationFlowCompleted = true;
|
||||||
this.showAccelerationSummary = false;
|
|
||||||
} else if (this.showAccelerationSummary) {
|
} else if (this.showAccelerationSummary) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.closeAccelerator();
|
this.accelerationFlowCompleted = true;
|
||||||
}, 2000);
|
}, 2000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -890,11 +888,6 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
this.stateService.markBlock$.next({});
|
this.stateService.markBlock$.next({});
|
||||||
}
|
}
|
||||||
|
|
||||||
closeAccelerator(): void {
|
|
||||||
this.accelerationFlowCompleted = true;
|
|
||||||
this.showAccelerationSummary = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
roundToOneDecimal(cpfpTx: any): number {
|
roundToOneDecimal(cpfpTx: any): number {
|
||||||
return +(cpfpTx.fee / (cpfpTx.weight / 4)).toFixed(1);
|
return +(cpfpTx.fee / (cpfpTx.weight / 4)).toFixed(1);
|
||||||
}
|
}
|
||||||
@ -963,6 +956,31 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
return auth !== null;
|
return auth !== null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
closeAccelerator(): void {
|
||||||
|
document.location.hash = '';
|
||||||
|
this.hideAccelerationSummary = true;
|
||||||
|
this.forceAccelerationSummary = false;
|
||||||
|
this.storageService.setValue('hide-accelerator-pref', 'true');
|
||||||
|
}
|
||||||
|
|
||||||
|
openAccelerator(): void {
|
||||||
|
this.accelerationFlowCompleted = false;
|
||||||
|
this.hideAccelerationSummary = false;
|
||||||
|
this.storageService.setValue('hide-accelerator-pref', 'false');
|
||||||
|
}
|
||||||
|
|
||||||
|
get showAccelerationSummary(): boolean {
|
||||||
|
return (
|
||||||
|
this.tx
|
||||||
|
&& !this.tx.acceleration
|
||||||
|
&& this.acceleratorAvailable
|
||||||
|
&& (
|
||||||
|
(!this.hideAccelerationSummary && !this.accelerationFlowCompleted)
|
||||||
|
|| this.forceAccelerationSummary
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
this.subscription.unsubscribe();
|
this.subscription.unsubscribe();
|
||||||
this.fetchCpfpSubscription.unsubscribe();
|
this.fetchCpfpSubscription.unsubscribe();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user