refactoring

This commit is contained in:
richard-loafle 2020-02-10 17:06:01 +09:00
parent 360adf6af3
commit 4faf0c6713
11 changed files with 74 additions and 22 deletions

View File

@ -1,5 +1,10 @@
<div fxFlex fxLayout="column" fxLayoutAlign="center center"> <div fxFlex fxLayout="column" fxLayoutAlign="center center">
<div class="empty-logo" fxLayoutAlign="center center" fxLayout="column"> <div
class="empty-logo"
fxLayoutAlign="center center"
fxLayout="column"
(click)="onClickStatusBar()"
>
<div <div
class="big-circle app-logo border-accent-color" class="big-circle app-logo border-accent-color"
fxLayoutAlign="center center" fxLayoutAlign="center center"

View File

@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { ucapAnimations } from '@ucap-webmessenger/ui'; import { ucapAnimations, StatusBarService } from '@ucap-webmessenger/ui';
import { environment } from '../../../../environments/environment'; import { environment } from '../../../../environments/environment';
@Component({ @Component({
@ -9,7 +9,7 @@ import { environment } from '../../../../environments/environment';
animations: ucapAnimations animations: ucapAnimations
}) })
export class IntroComponent implements OnInit { export class IntroComponent implements OnInit {
constructor() {} constructor(private statusBarService: StatusBarService) {}
ngOnInit() {} ngOnInit() {}
@ -18,4 +18,14 @@ export class IntroComponent implements OnInit {
? environment.title ? environment.title
: 'UCapMessenger'; : 'UCapMessenger';
} }
private toggle = false;
onClickStatusBar() {
if (!this.toggle) {
this.statusBarService.open();
} else {
this.statusBarService.dismiss();
}
this.toggle = !this.toggle;
}
} }

View File

@ -9,7 +9,11 @@ import {
AfterViewChecked, AfterViewChecked,
ChangeDetectorRef ChangeDetectorRef
} from '@angular/core'; } from '@angular/core';
import { ucapAnimations, DialogService } from '@ucap-webmessenger/ui'; import {
ucapAnimations,
DialogService,
StringFormatterPhonePipe
} from '@ucap-webmessenger/ui';
import { import {
Observable, Observable,
Subscription, Subscription,
@ -72,7 +76,7 @@ import {
SelectedUserListDialogData SelectedUserListDialogData
} from '../../dialogs/organization/selected-user-list.dialog.component'; } from '../../dialogs/organization/selected-user-list.dialog.component';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { StringFormatterPhonePipe } from 'projects/ucap-webmessenger-ui/src/lib/pipes/string.pipe';
import { VirtualScrollerComponent } from 'ngx-virtual-scroller'; import { VirtualScrollerComponent } from 'ngx-virtual-scroller';
import { OrganizationService } from '@ucap-webmessenger/ui-organization'; import { OrganizationService } from '@ucap-webmessenger/ui-organization';

View File

@ -24,7 +24,9 @@ import {
FileUploadQueueComponent, FileUploadQueueComponent,
StringUtil, StringUtil,
AlertSnackbarComponent, AlertSnackbarComponent,
AlertSnackbarData AlertSnackbarData,
TranslateService as UiTranslateService,
TranslatePipe as UiTranslatePipe
} from '@ucap-webmessenger/ui'; } from '@ucap-webmessenger/ui';
import { Store, select } from '@ngrx/store'; import { Store, select } from '@ngrx/store';
import { NGXLogger } from 'ngx-logger'; import { NGXLogger } from 'ngx-logger';
@ -121,8 +123,6 @@ import {
} from '../dialogs/chat/mass-detail.component'; } from '../dialogs/chat/mass-detail.component';
import { NativeService, UCAP_NATIVE_SERVICE } from '@ucap-webmessenger/native'; import { NativeService, UCAP_NATIVE_SERVICE } from '@ucap-webmessenger/native';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { TranslatePipe } from 'projects/ucap-webmessenger-ui/src/lib/pipes/translate.pipe';
import { TranslateService as UiTranslateService } from '@ucap-webmessenger/ui';
import { import {
ClipboardDialogComponent, ClipboardDialogComponent,
@ -502,7 +502,7 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
} }
getRoomNameByRoomUser(roomUserInfos: (UserInfo | UserInfoShort)[]) { getRoomNameByRoomUser(roomUserInfos: (UserInfo | UserInfoShort)[]) {
let roomName = new TranslatePipe( let roomName = new UiTranslatePipe(
this.uiTranslateService, this.uiTranslateService,
this.changeDetectorRef this.changeDetectorRef
).transform(roomUserInfos, 'name', ','); ).transform(roomUserInfos, 'name', ',');

View File

@ -25,13 +25,15 @@ import { environment } from '../../../../../environments/environment';
import { StatusBulkInfo } from '@ucap-webmessenger/protocol-status'; import { StatusBulkInfo } from '@ucap-webmessenger/protocol-status';
import { VersionInfo2Response } from '@ucap-webmessenger/api-public'; import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
import { DaesangProtocolService } from '@ucap-webmessenger/daesang'; import { DaesangProtocolService } from '@ucap-webmessenger/daesang';
import { DialogService } from '@ucap-webmessenger/ui'; import {
DialogService,
IntegratedSearchComponent
} from '@ucap-webmessenger/ui';
import { import {
ProfileDialogComponent, ProfileDialogComponent,
ProfileDialogData, ProfileDialogData,
ProfileDialogResult ProfileDialogResult
} from '../profile/profile.dialog.component'; } from '../profile/profile.dialog.component';
import { IntegratedSearchComponent } from 'projects/ucap-webmessenger-ui/src/lib/components/integrated-search.component';
export interface IntegratedSearchDialogData { export interface IntegratedSearchDialogData {
keyword: string; keyword: string;

View File

@ -15,12 +15,12 @@
></app-layout-messenger-left-side> ></app-layout-messenger-left-side>
</mat-drawer> </mat-drawer>
<div class="chat-messages bg-accent-brightest"> <div class="chat-messages bg-accent-brightest">
<!-- <div class="messenger-statusbar-container"> <div #statusbarContainer class="messenger-statusbar-container">
<div class="messenger-statusbar-message"> <div class="messenger-statusbar-message">
업데이트가 존재합니다. 업데이트가 존재합니다.
</div> </div>
<div class="messenger-statusbar-actions"></div> <div class="messenger-statusbar-actions"></div>
</div> --> </div>
<app-layout-messenger-intro <app-layout-messenger-intro
*ngIf="!(this.selectedChat$ | async)" *ngIf="!(this.selectedChat$ | async)"
></app-layout-messenger-intro> ></app-layout-messenger-intro>

View File

@ -27,7 +27,8 @@ import {
AlertDialogComponent, AlertDialogComponent,
AlertDialogResult, AlertDialogResult,
AlertDialogData, AlertDialogData,
ConfirmDialogData ConfirmDialogData,
StatusBarService
} from '@ucap-webmessenger/ui'; } from '@ucap-webmessenger/ui';
import { import {
ProfileDialogComponent, ProfileDialogComponent,
@ -64,6 +65,9 @@ export class MainPageComponent implements OnInit, OnDestroy {
@ViewChild('leftSideContainer', { static: false }) @ViewChild('leftSideContainer', { static: false })
leftSideContainer: LeftSideComponent; leftSideContainer: LeftSideComponent;
@ViewChild('statusbarContainer', { static: true })
statusbarContainer: ElementRef<HTMLElement>;
selectedChat$: Observable<string | null>; selectedChat$: Observable<string | null>;
selectedRightDrawer$: Observable<string | null>; selectedRightDrawer$: Observable<string | null>;
idleStateChangedSubscription: Subscription; idleStateChangedSubscription: Subscription;
@ -95,6 +99,7 @@ export class MainPageComponent implements OnInit, OnDestroy {
private sessionStorageService: SessionStorageService, private sessionStorageService: SessionStorageService,
private translateService: TranslateService, private translateService: TranslateService,
private dialogService: DialogService, private dialogService: DialogService,
private statusBarService: StatusBarService,
private logger: NGXLogger private logger: NGXLogger
) { ) {
this.environmentsInfo = this.sessionStorageService.get<EnvironmentsInfo>( this.environmentsInfo = this.sessionStorageService.get<EnvironmentsInfo>(
@ -103,6 +108,8 @@ export class MainPageComponent implements OnInit, OnDestroy {
} }
ngOnInit(): void { ngOnInit(): void {
this.statusBarService.container = this.statusbarContainer;
this.selectedChat$ = this.store.pipe( this.selectedChat$ = this.store.pipe(
select(AppStore.MessengerSelector.ChatSelector.selectedRoom), select(AppStore.MessengerSelector.ChatSelector.selectedRoom),
tap(selectedRoom => { tap(selectedRoom => {

View File

@ -17,9 +17,10 @@ import {
import { NGXLogger } from 'ngx-logger'; import { NGXLogger } from 'ngx-logger';
import { VersionInfo2Response } from '@ucap-webmessenger/api-public'; import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication'; import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
import { TranslatePipe } from 'projects/ucap-webmessenger-ui/src/lib/pipes/translate.pipe';
import { import {
TranslateService as UcapUiTranslateService, TranslateService as UiTranslateService,
TranslatePipe as UiTranslatePipe,
StringUtil StringUtil
} from '@ucap-webmessenger/ui'; } from '@ucap-webmessenger/ui';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
@ -62,7 +63,7 @@ export class ListItemComponent implements OnInit {
constructor( constructor(
private logger: NGXLogger, private logger: NGXLogger,
private ucapUiTranslateService: UcapUiTranslateService, private uiTranslateService: UiTranslateService,
private translateService: TranslateService, private translateService: TranslateService,
private changeDetectorRef: ChangeDetectorRef private changeDetectorRef: ChangeDetectorRef
) {} ) {}
@ -128,8 +129,8 @@ export class ListItemComponent implements OnInit {
} }
getRoomNameByRoomUser(roomUserInfos: (RoomUserInfo | UserInfoShort)[]) { getRoomNameByRoomUser(roomUserInfos: (RoomUserInfo | UserInfoShort)[]) {
let roomName = new TranslatePipe( let roomName = new UiTranslatePipe(
this.ucapUiTranslateService, this.uiTranslateService,
this.changeDetectorRef this.changeDetectorRef
).transform(roomUserInfos, 'name', ','); ).transform(roomUserInfos, 'name', ',');

View File

@ -1,10 +1,26 @@
import { Injectable } from '@angular/core'; import { Injectable, ViewContainerRef, ElementRef } from '@angular/core';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class StatusBarService { export class StatusBarService {
get container() {
return this._container;
}
set container(container: ElementRef<HTMLElement>) {
this._container = container;
this._container.nativeElement.style.display = 'none';
}
// tslint:disable-next-line: variable-name
private _container: ElementRef<HTMLElement>;
public constructor() {} public constructor() {}
open() {} open(message: string) {
this._container.nativeElement.style.display = '';
}
dismiss() {
this._container.nativeElement.style.display = 'none';
}
} }

View File

@ -56,6 +56,7 @@ import { SplashScreenService } from './services/splash-screen.service';
import { TranslateService } from './services/translate.service'; import { TranslateService } from './services/translate.service';
import { DateService } from './services/date.service'; import { DateService } from './services/date.service';
import { PaginatorIntlService } from './services/paginator-intl.service'; import { PaginatorIntlService } from './services/paginator-intl.service';
import { StatusBarService } from './services/status-bar.service';
import { ClickOutsideDirective } from './directives/click-outside.directive'; import { ClickOutsideDirective } from './directives/click-outside.directive';
import { FileUploadForDirective } from './directives/file-upload-for.directive'; import { FileUploadForDirective } from './directives/file-upload-for.directive';
@ -137,7 +138,8 @@ const SERVICES = [
SplashScreenService, SplashScreenService,
TranslateService, TranslateService,
DateService, DateService,
PaginatorIntlService PaginatorIntlService,
StatusBarService
]; ];
@NgModule({ @NgModule({

View File

@ -19,6 +19,7 @@ export * from './lib/components/step-input.component';
export * from './lib/components/split-button.component'; export * from './lib/components/split-button.component';
export * from './lib/components/sticker-selector.component'; export * from './lib/components/sticker-selector.component';
export * from './lib/components/inline-edit-input.component'; export * from './lib/components/inline-edit-input.component';
export * from './lib/components/integrated-search.component';
export * from './lib/data-source/virtual-scroll-tree-flat.data-source'; export * from './lib/data-source/virtual-scroll-tree-flat.data-source';
@ -37,6 +38,10 @@ export * from './lib/services/splash-screen.service';
export * from './lib/services/translate.service'; export * from './lib/services/translate.service';
export * from './lib/services/date.service'; export * from './lib/services/date.service';
export * from './lib/services/paginator-intl.service'; export * from './lib/services/paginator-intl.service';
export * from './lib/services/status-bar.service';
export * from './lib/pipes/string.pipe';
export * from './lib/pipes/translate.pipe';
export * from './lib/snackbars/alert.snackbar.component'; export * from './lib/snackbars/alert.snackbar.component';