diff --git a/src/app/core/services/spindl-ads/spindl.service.ts b/src/app/core/services/spindl-ads/spindl.service.ts index 2bf776f120..0edf65d613 100644 --- a/src/app/core/services/spindl-ads/spindl.service.ts +++ b/src/app/core/services/spindl-ads/spindl.service.ts @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core'; import spindl from '@spindl-xyz/attribution'; import { ENVIRONMENT } from 'src/environments/environment'; import { AuthService } from '../auth/auth.service'; -import { distinctUntilChanged, firstValueFrom } from 'rxjs'; +import { BehaviorSubject, distinctUntilChanged, firstValueFrom, Observable } from 'rxjs'; import { HttpService } from '../http/http.service'; interface IpGeolocationResp { @@ -27,10 +27,10 @@ export class SpindlService { private readonly IP2LOCATION_KEY = 'D13DC4B78F655A8DD9011ECC0FCDFA7D'; - private _showSpindl: boolean = false; + private _showSpindl$ = new BehaviorSubject(false); - public get showSpindl(): boolean { - return this._showSpindl; + public get showSpindl$(): Observable { + return this._showSpindl$.asObservable(); } constructor( @@ -81,8 +81,7 @@ export class SpindlService { public async initSpindlAds(): Promise { const isForbiddenIP = await this.isForbiddenIP(); - this._showSpindl = !isForbiddenIP; - + this._showSpindl$.next(!isForbiddenIP); spindl.configure({ sdkKey: '5c8549dc-9be6-49ee-bc3f-8192870f4553', debugMode: !ENVIRONMENT.production, diff --git a/src/app/features/trade/components/trade-view-container/trade-view-container.component.html b/src/app/features/trade/components/trade-view-container/trade-view-container.component.html index aa7c24ab8e..9e24e31a55 100644 --- a/src/app/features/trade/components/trade-view-container/trade-view-container.component.html +++ b/src/app/features/trade/components/trade-view-container/trade-view-container.component.html @@ -6,7 +6,8 @@ providers: providers$ | async, selectedForm: selectedForm$ | async, calculationStatus: calculationStatus$ | async, - transactionState: transactionState$ | async + transactionState: transactionState$ | async, + showSpindl: showSpindl$ | async } as state" >
-
diff --git a/src/app/features/trade/components/trade-view-container/trade-view-container.component.ts b/src/app/features/trade/components/trade-view-container/trade-view-container.component.ts index 9dad1c7bc8..17b487b6f4 100644 --- a/src/app/features/trade/components/trade-view-container/trade-view-container.component.ts +++ b/src/app/features/trade/components/trade-view-container/trade-view-container.component.ts @@ -14,7 +14,6 @@ import { HeaderStore } from '@core/header/services/header.store'; import { ActionButtonService } from '@features/trade/services/action-button-service/action-button.service'; import { NotificationsService } from '@core/services/notifications/notifications.service'; import { TuiNotification } from '@taiga-ui/core'; -import { TargetNetworkAddressService } from '../../services/target-network-address-service/target-network-address.service'; import { PreviewSwapService } from '../../services/preview-swap/preview-swap.service'; import { FormsTogglerService } from '../../services/forms-toggler/forms-toggler.service'; import { QueryParamsService } from '@app/core/services/query-params/query-params.service'; @@ -60,7 +59,7 @@ export class TradeViewContainerComponent { public readonly transactionState$ = this.previewSwapService.transactionState$; - public readonly showSpindl = this.spindlService.showSpindl; + public readonly showSpindl$ = this.spindlService.showSpindl$; constructor( private readonly swapsState: SwapsStateService, @@ -68,7 +67,6 @@ export class TradeViewContainerComponent { public readonly swapFormQueryService: SwapFormQueryService, public readonly swapFormService: SwapsFormService, public readonly swapTokensUpdaterService: SwapTokensUpdaterService, - private readonly targetNetworkAddressService: TargetNetworkAddressService, private readonly headerStore: HeaderStore, private readonly previewSwapService: PreviewSwapService, private readonly actionButtonService: ActionButtonService,