Skip to content
Snippets Groups Projects
Commit 7a288596 authored by Xiao Gui's avatar Xiao Gui
Browse files

chore: reintroduce delay when showing cookie disclaimer modal

you are right daviti, there needs to be a delay when creating
views in lifecycle hooks. but I will be damned if we need to use
setTimeout, and I'd rather use rxjs observable
parent bb8abc18
No related branches found
No related tags found
No related merge requests found
......@@ -301,14 +301,20 @@ export class AtlasViewer implements OnDestroy, OnInit, AfterViewInit {
/**
* Show Cookie disclaimer if not yet agreed
*/
if (localStorage.getItem('cookies') !== 'agreed') {
/**
* TODO avoid creating new views in lifecycle hooks in general
*/
of(localStorage.getItem('cookies') !== 'agreed').pipe(
delay(0),
filter(flag => flag)
).subscribe(() => {
this.modalService.show(ModalUnit, {
initialState: {
title: 'Cookie Disclaimer',
template: this.cookieAgreementComponent,
template: this.cookieAgreementComponent
}
});
}
})
})
this.onhoverSegmentForFixed$ = this.rClContextualMenu.onShow.pipe(
withLatestFrom(this.onhoverSegment$),
......
......@@ -9,5 +9,5 @@ import { Component, ChangeDetectionStrategy } from '@angular/core'
changeDetection: ChangeDetectionStrategy.OnPush
})
export class CookieAgreement {
showMore = false;
public showMore:boolean = false
}
\ No newline at end of file
......@@ -11,8 +11,11 @@
<p>To opt-out of being tracked by Google Analytics across all websites, visit
<a href="http://tools.google.com/dlpage/gaoptout">http://tools.google.com/dlpage/gaoptout</a> .</p>
<button class="btn btn-outline-info btn-block mb-2" (click)="showMore = !showMore">Show
{{showMore? "less" : "more"}}</button>
<button
class="btn btn-outline-info btn-block mb-2"
(click)="showMore = !showMore">
Show {{showMore? "less" : "more"}}
</button>
<div *ngIf="showMore">
<small>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment