import { Injectable } from '@angular/core';
import { BreakpointObserver, BreakpointState, Breakpoints } from '@angular/cdk/layout';
import { Observable, Subject, BehaviorSubject } from 'rxjs';
import { map } from 'rxjs/operators';

@Injectable({
  providedIn: 'root'
})
export class LayoutService {
  isWebView: Observable<Boolean> = this.breakpointObserver.observe(Breakpoints.Web).pipe(
    map((state: BreakpointState) => state.matches)
  );
  isWebContent: Observable<Boolean> = this.breakpointObserver.observe('(min-width: 1100px) and (orientation: portrait), (min-width: 880px) and (orientation: landscape)').pipe(
    map((state: BreakpointState) => state.matches)
  );

  isReachingBottom: Subject<boolean> = new Subject();
  updateHasScroll: Subject<void> = new Subject();
  hasScroll: Subject<boolean> = new Subject();

  constructor(private breakpointObserver: BreakpointObserver) { }
}
