All files / app/pages/room room.component.ts

80.39% Statements 41/51
0% Branches 0/4
55.55% Functions 5/9
78.26% Lines 36/46

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105                                                                1x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x       4x 4x 4x             4x 4x 4x                                                        
import {Component, OnDestroy, OnInit} from '@angular/core';
import {MatBottomSheet} from "@angular/material/bottom-sheet";
import {
  faAngleRight, faBottleDroplet,
  faBottleWater,
  faClock,
  faDoorOpen,
  faDumbbell,
  faFan,
  faHotTubPerson,
  faLightbulb,
  faLocationPin, faLockOpen,
  faPersonBiking,
  faPersonBooth, faPumpSoap, faRing,
  faSheetPlastic,
  faShower, faSoap, faTarp,
  faUser, faVault, faVolumeHigh,
  faWeightHanging, faWheatAwn
} from '@fortawesome/free-solid-svg-icons';
import {BaseComponent} from "../../helpers/base/base.component";
import {LightsHelpComponent} from "../../modals/help/lights/lights-help.component";
import {BlindsHelpComponent} from "../../modals/help/blinds-help/blinds-help.component";
import {ClimateHelpComponent} from "../../modals/help/climate-help/climate-help.component";
import {DoorHelpComponent} from "../../modals/help/door-help/door-help.component";
import {MediacontrolComponent} from "../../modals/mediacontrol/mediacontrol.component";
import {DataService} from "../../services/data.service";
import {TimerService} from "../../services/timer.service";
@Component({
  selector: 'app-room',
  templateUrl: './room.component.html',
  styleUrls: ['./room.component.css']
})
export class RoomComponent extends BaseComponent implements OnInit, OnDestroy {
  protected readonly event = event;
  protected readonly faBottleDroplet = faBottleDroplet;
  protected readonly faSoap = faSoap;
  protected readonly faPumpSoap = faPumpSoap;
  protected readonly faWheatAwn = faWheatAwn;
  protected readonly faVault = faVault;
  protected readonly faTarp = faTarp;
  protected readonly faRing = faRing;
  protected readonly faLockOpen = faLockOpen;
  protected readonly faVolumeHigh = faVolumeHigh;
  protected readonly faLocationPin = faLocationPin;
  protected readonly faClock = faClock;
  protected readonly faUser = faUser;
  protected readonly faLightbulb = faLightbulb;
  protected readonly faPersonBooth = faPersonBooth;
  protected readonly faDoorOpen = faDoorOpen;
  protected readonly faAngleRight = faAngleRight;
  protected readonly faDumbbell = faDumbbell;
  protected readonly faWeightHanging = faWeightHanging;
  protected readonly faPersonBiking = faPersonBiking;
  protected readonly faSheetPlastic = faSheetPlastic;
  protected readonly faShower = faShower;
  protected readonly faHotTubPerson = faHotTubPerson;
  protected readonly faFan = faFan;
  protected readonly faBottleWater = faBottleWater;
  LightsHelpComponent = LightsHelpComponent;
  BlindsHelpComponent = BlindsHelpComponent;
  ClimateHelpComponent = ClimateHelpComponent;
  DoorHelpComponent = DoorHelpComponent;
  musicProgress: number | undefined;
  musicIsPaused: boolean | undefined;
  musicIsFav: boolean | undefined;
  showGettingStarted: boolean = true;
  constructor(private _bottomSheet: MatBottomSheet, private data: DataService, private timer: TimerService) {
    super()
  }
  openBottomSheet(): void {
    this._bottomSheet.open(MediacontrolComponent);
  }
 
  ngOnInit() {
    this.data.currentMusicProgress.dieWith(this).subscribe(d => this.musicProgress = d)
    this.data.currentMusicIsPaused.dieWith(this).subscribe(d => this.musicIsPaused = d)
    this.data.currentMusicIsFav.dieWith(this).subscribe(d => this.musicIsFav = d)
 
  }
 
  public toggleWorkoutTools() {
    //TODO: Implement
  }
 
  toggleMusicPause(event: MouseEvent) {
    Iif (this.musicIsPaused !== undefined) {
      if (!this.musicIsPaused) {
        this.timer.pauseTimer();
      }else{
        this.timer.startTimer();
      }
      this.data.changeMusicIsPaused(!this.musicIsPaused)
    }
    event.stopPropagation();
  }
  toggleMusicFav(event: MouseEvent) {
    Iif (this.musicIsFav !== undefined) {
      this.data.changeMusicIsFav(!this.musicIsFav)
    }
    event.stopPropagation();
  }
 
 
}