Accelerate with
diff --git a/frontend/src/app/components/accelerate-preview/accelerate-preview.component.ts b/frontend/src/app/components/accelerate-preview/accelerate-preview.component.ts
index 2a958ad28..aee0189aa 100644
--- a/frontend/src/app/components/accelerate-preview/accelerate-preview.component.ts
+++ b/frontend/src/app/components/accelerate-preview/accelerate-preview.component.ts
@@ -39,7 +39,7 @@ export const MAX_BID_RATIO = 4;
templateUrl: 'accelerate-preview.component.html',
styleUrls: ['accelerate-preview.component.scss']
})
-export class AcceleratePreviewComponent implements OnDestroy, OnChanges {
+export class AcceleratePreviewComponent implements OnInit, OnDestroy, OnChanges {
@Input() tx: Transaction | undefined;
@Input() scrollEvent: boolean;
@@ -79,11 +79,8 @@ export class AcceleratePreviewComponent implements OnDestroy, OnChanges {
private audioService: AudioService,
private cd: ChangeDetectorRef
) {
- if (window.document.referrer === 'https://cash.app/') {
+ if (this.stateService.ref === 'https://cash.app/') {
this.insertSquare();
- this.paymentType = 'cashapp';
- } else {
- this.paymentType = 'bitcoin';
}
}
@@ -96,6 +93,15 @@ export class AcceleratePreviewComponent implements OnDestroy, OnChanges {
}
}
+ ngOnInit() {
+ if (this.stateService.ref === 'https://cash.app/') {
+ this.paymentType = 'cashapp';
+ this.stateService.ref = '';
+ } else {
+ this.paymentType = 'bitcoin';
+ }
+ }
+
ngOnChanges(changes: SimpleChanges): void {
if (changes.scrollEvent) {
this.scrollToPreview('acceleratePreviewAnchor', 'start');
diff --git a/frontend/src/app/services/state.service.ts b/frontend/src/app/services/state.service.ts
index 010ca6b09..6d99d278a 100644
--- a/frontend/src/app/services/state.service.ts
+++ b/frontend/src/app/services/state.service.ts
@@ -86,6 +86,7 @@ const defaultEnv: Env = {
providedIn: 'root'
})
export class StateService {
+ ref: string = '';
isBrowser: boolean = isPlatformBrowser(this.platformId);
isMempoolSpaceBuild = window['isMempoolSpaceBuild'] ?? false;
backend: 'esplora' | 'electrum' | 'none' = 'esplora';
@@ -162,6 +163,8 @@ export class StateService {
private router: Router,
private storageService: StorageService,
) {
+ this.ref = window.document.referrer;
+
const browserWindow = window || {};
// @ts-ignore
const browserWindowEnv = browserWindow.__env || {};