You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Ombi/src/Ombi/ClientApp/src/app/state/features/features.facade.ts

29 lines
1.1 KiB

import { DisableFeature, EnableFeature, LoadFeatures } from "./features.actions";
import { FeaturesSelectors } from "./features.selectors";
import { IFeatureEnablement } from "../../interfaces";
import { Injectable } from "@angular/core";
import { Observable } from "rxjs";
import { Store } from "@ngxs/store";
@Injectable({
providedIn: 'root',
})
export class FeaturesFacade {
public constructor(private store: Store) {}
public features$ = (): Observable<IFeatureEnablement[]> => this.store.select(FeaturesSelectors.features);
public enable = (feature: IFeatureEnablement): Observable<unknown> => this.store.dispatch(new EnableFeature(feature));
public disable = (feature: IFeatureEnablement): Observable<unknown> => this.store.dispatch(new DisableFeature(feature));
public loadFeatures = (): Observable<unknown> => this.store.dispatch(new LoadFeatures());
public is4kEnabled = (): boolean => this.store.selectSnapshot(FeaturesSelectors.is4kEnabled);
public isPlayedSyncEnabled = (): boolean => this.store.selectSnapshot(FeaturesSelectors.isPlayedSyncEnabled);
}