[accelerator] clear state after loading preview
This commit is contained in:
parent
c45111333d
commit
854222b8cc
@ -237,7 +237,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row d-flex justify-content-end align-items-center mr-1" style="height: 48px" *ngIf="!hideCashApp">
|
<div class="row d-flex justify-content-end align-items-center mr-1" style="height: 48px" *ngIf="!hideCashApp && paymentType === 'cashapp'">
|
||||||
<div [style]="showSpinner ? 'opacity: 0' : 'opacity: 1'" class="p-2">Accelerate with</div>
|
<div [style]="showSpinner ? 'opacity: 0' : 'opacity: 1'" class="p-2">Accelerate with</div>
|
||||||
<div id="cash-app-pay" style="max-width: 320px" [style]="showSpinner ? 'opacity: 0' : 'opacity: 1'"></div>
|
<div id="cash-app-pay" style="max-width: 320px" [style]="showSpinner ? 'opacity: 0' : 'opacity: 1'"></div>
|
||||||
<div *ngIf="showSpinner" class="d-flex align-items-center">
|
<div *ngIf="showSpinner" class="d-flex align-items-center">
|
||||||
|
@ -39,7 +39,7 @@ export const MAX_BID_RATIO = 4;
|
|||||||
templateUrl: 'accelerate-preview.component.html',
|
templateUrl: 'accelerate-preview.component.html',
|
||||||
styleUrls: ['accelerate-preview.component.scss']
|
styleUrls: ['accelerate-preview.component.scss']
|
||||||
})
|
})
|
||||||
export class AcceleratePreviewComponent implements OnDestroy, OnChanges {
|
export class AcceleratePreviewComponent implements OnInit, OnDestroy, OnChanges {
|
||||||
@Input() tx: Transaction | undefined;
|
@Input() tx: Transaction | undefined;
|
||||||
@Input() scrollEvent: boolean;
|
@Input() scrollEvent: boolean;
|
||||||
|
|
||||||
@ -79,11 +79,8 @@ export class AcceleratePreviewComponent implements OnDestroy, OnChanges {
|
|||||||
private audioService: AudioService,
|
private audioService: AudioService,
|
||||||
private cd: ChangeDetectorRef
|
private cd: ChangeDetectorRef
|
||||||
) {
|
) {
|
||||||
if (window.document.referrer === 'https://cash.app/') {
|
if (this.stateService.ref === 'https://cash.app/') {
|
||||||
this.insertSquare();
|
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 {
|
ngOnChanges(changes: SimpleChanges): void {
|
||||||
if (changes.scrollEvent) {
|
if (changes.scrollEvent) {
|
||||||
this.scrollToPreview('acceleratePreviewAnchor', 'start');
|
this.scrollToPreview('acceleratePreviewAnchor', 'start');
|
||||||
|
@ -86,6 +86,7 @@ const defaultEnv: Env = {
|
|||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class StateService {
|
export class StateService {
|
||||||
|
ref: string = '';
|
||||||
isBrowser: boolean = isPlatformBrowser(this.platformId);
|
isBrowser: boolean = isPlatformBrowser(this.platformId);
|
||||||
isMempoolSpaceBuild = window['isMempoolSpaceBuild'] ?? false;
|
isMempoolSpaceBuild = window['isMempoolSpaceBuild'] ?? false;
|
||||||
backend: 'esplora' | 'electrum' | 'none' = 'esplora';
|
backend: 'esplora' | 'electrum' | 'none' = 'esplora';
|
||||||
@ -162,6 +163,8 @@ export class StateService {
|
|||||||
private router: Router,
|
private router: Router,
|
||||||
private storageService: StorageService,
|
private storageService: StorageService,
|
||||||
) {
|
) {
|
||||||
|
this.ref = window.document.referrer;
|
||||||
|
|
||||||
const browserWindow = window || {};
|
const browserWindow = window || {};
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const browserWindowEnv = browserWindow.__env || {};
|
const browserWindowEnv = browserWindow.__env || {};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user