Fix tx autoscroll

This commit is contained in:
Mononaut 2024-04-08 08:26:45 +00:00
parent b952642570
commit be5eb9ef70
No known key found for this signature in database
GPG Key ID: A3F058E41374C04E

View File

@ -85,7 +85,10 @@ export class AcceleratePreviewComponent implements OnInit, OnDestroy, OnChanges
private cd: ChangeDetectorRef private cd: ChangeDetectorRef
) { ) {
if (this.stateService.ref === 'https://cash.app/') { if (this.stateService.ref === 'https://cash.app/') {
this.paymentType = 'cashapp';
this.insertSquare(); this.insertSquare();
} else {
this.paymentType = 'bitcoin';
} }
} }
@ -104,16 +107,17 @@ export class AcceleratePreviewComponent implements OnInit, OnDestroy, OnChanges
} else { } else {
this.paymentType = 'bitcoin'; this.paymentType = 'bitcoin';
} }
this.onScroll();
} }
ngOnChanges(changes: SimpleChanges): void { ngOnChanges(changes: SimpleChanges): void {
if (changes.scrollEvent && this.paymentType !== 'cashapp') { if (changes.scrollEvent && this.paymentType !== 'cashapp' && this.stateService.ref !== 'https://cash.app/') {
this.scrollToPreview('acceleratePreviewAnchor', 'start'); this.scrollToPreview('acceleratePreviewAnchor', 'start');
} }
} }
ngAfterViewInit() { ngAfterViewInit() {
this.onScroll();
if (this.paymentType === 'cashapp') { if (this.paymentType === 'cashapp') {
this.showSpinner = true; this.showSpinner = true;
} }
@ -183,6 +187,10 @@ export class AcceleratePreviewComponent implements OnInit, OnDestroy, OnChanges
} else { } else {
this.scrollToPreview('acceleratePreviewAnchor', 'start'); this.scrollToPreview('acceleratePreviewAnchor', 'start');
} }
setTimeout(() => {
this.onScroll();
}, 100);
} }
} }
}), }),
@ -390,6 +398,12 @@ export class AcceleratePreviewComponent implements OnInit, OnDestroy, OnChanges
@HostListener('window:scroll', ['$event']) // for window scroll events @HostListener('window:scroll', ['$event']) // for window scroll events
onScroll() { onScroll() {
if (this.estimate && this.user && !this.cashappCTA?.nativeElement) {
setTimeout(() => {
this.onScroll();
}, 200);
return;
}
if (!this.cashappCTA?.nativeElement || this.paymentType !== 'cashapp' || !this.isMobile) { if (!this.cashappCTA?.nativeElement || this.paymentType !== 'cashapp' || !this.isMobile) {
return; return;
} }