Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,44 +47,18 @@ export class SharePreviewFooterComponent implements OnInit, OnDestroy {
private scrollTimestamp: number;

constructor(private renderer: Renderer2) {
this.renderer.listen('window', 'click', (e: Event) => {
if (this.visible) {
if (!this.element.nativeElement.contains(e.target)) {
let target = e.target as HTMLElement;
while (target.parentElement) {
const tagName = target.tagName.toLocaleLowerCase();
if (tagName === 'pr-dialog') {
return;
}
if (tagName === 'pr-app-root') {
break;
}
target = target.parentElement;
}
this.close();
}
}
});

this.renderer.listen('window', 'scroll', (e: Event) => {
if (this.scrollTimeout) {
window.clearTimeout(this.scrollTimeout);
}
if (
window.scrollY + document.body.clientHeight ===
document.body.scrollHeight
) {
this.show();
} else {
this.scrollTimestamp = e.timeStamp;
window.setTimeout(() => {
if (this.scrollTimestamp === e.timeStamp) {
if (!document.querySelector('pr-dialog')) {
this.show();
}
this.scrollTimestamp = e.timeStamp;
window.setTimeout(() => {
if (this.scrollTimestamp === e.timeStamp) {
if (!document.querySelector('pr-dialog')) {
this.show();
}
}, 1000);
}
}
}, 1000);
});
}

Expand All @@ -94,9 +68,7 @@ export class SharePreviewFooterComponent implements OnInit, OnDestroy {
});

setTimeout(() => {
if (document.body.scrollHeight === document.body.clientHeight) {
this.show();
}
this.show();
}, 1000);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,14 +256,6 @@ describe('SharePreviewComponent', () => {
expect(component.showCover).toBeFalse();
});

it('should dispatch banner close', () => {
const spy = jasmine.createSpy();
component.hideBannerObservable.subscribe(spy);
component.dispatchBannerClose();

expect(spy).toHaveBeenCalled();
});

it('should stop event propagation', () => {
const event = jasmine.createSpyObj('Event', ['stopPropagation']);
component.stopPropagation(event);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,6 @@ export class SharePreviewComponent implements OnInit, OnDestroy {
if (this.isUnlistedShare) {
this.showFolder(itemClickEvent);
} else {
this.dispatchBannerClose();
this.showCreateAccountDialog();
}
},
Expand All @@ -719,10 +718,6 @@ export class SharePreviewComponent implements OnInit, OnDestroy {
evt.stopPropagation();
}

dispatchBannerClose(): void {
this.hideBannerSubject.next();
}

public navToAuth(): void {
if (this.isRelationshipShare) {
this.router.navigate(['/app', 'auth', 'login']);
Expand Down