next-ucap-messenger/projects/ucap-webmessenger-app/src/app/layouts/native/components/top-bar.component.ts

54 lines
1.2 KiB
TypeScript
Raw Normal View History

import { Component, OnInit, Inject, OnDestroy } from '@angular/core';
import {
UCAP_NATIVE_SERVICE,
NativeService,
WindowState
} from '@ucap-webmessenger/native';
import { Observable } from 'rxjs';
2019-11-25 00:41:15 +00:00
import { Store } from '@ngrx/store';
import * as AuthenticationStore from '@app/store/account/authentication';
import * as SettingsStore from '@app/store/messenger/settings';
@Component({
selector: 'app-layout-native-top-bar',
templateUrl: './top-bar.component.html',
styleUrls: ['./top-bar.component.scss']
})
export class TopBarComponent implements OnInit, OnDestroy {
windowStateChanged$: Observable<WindowState>;
WindowState = WindowState;
constructor(
2019-11-25 00:41:15 +00:00
private store: Store<any>,
@Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService
) {}
ngOnInit() {
this.windowStateChanged$ = this.nativeService.windowStateChanged();
}
ngOnDestroy(): void {}
onClickClose() {
this.nativeService.windowClose();
}
onClickMinimize() {
this.nativeService.windowMinimize();
}
onClickMaxmize() {
this.nativeService.windowMaximize();
}
2019-11-25 00:41:15 +00:00
onClickSettings(): void {
this.store.dispatch(SettingsStore.showDialog());
}
onClickLogout(): void {
this.store.dispatch(AuthenticationStore.logout());
}
}