# Conflicts:
#	projects/ucap-webmessenger-app/src/app/pages/template/components/template.page.component.html
#	projects/ucap-webmessenger-ui-profile/src/lib/components/user-list-item.component.html
This commit is contained in:
김남중 2019-10-10 10:33:26 +09:00
commit f363d23242
286 changed files with 3899 additions and 1298 deletions

View File

@ -11,59 +11,59 @@ import {
FileProfileSaveResponse, FileProfileSaveResponse,
encodeFileProfileSave, encodeFileProfileSave,
decodeFileProfileSave decodeFileProfileSave
} from '../models/file-profile-save'; } from '../apis/file-profile-save';
import { import {
FileTalkDownloadRequest, FileTalkDownloadRequest,
encodeFileTalkDownload encodeFileTalkDownload
} from '../models/file-talk-download'; } from '../apis/file-talk-download';
import { import {
FileTalkSaveRequest, FileTalkSaveRequest,
FileTalkSaveResponse, FileTalkSaveResponse,
encodeFileTalkSave, encodeFileTalkSave,
decodeFileTalkSave decodeFileTalkSave
} from '../models/file-talk-save'; } from '../apis/file-talk-save';
import { import {
FileTalkShareRequest, FileTalkShareRequest,
FileTalkShareResponse, FileTalkShareResponse,
encodeFileTalkShare, encodeFileTalkShare,
decodeFileTalkShare decodeFileTalkShare
} from '../models/file-talk-share'; } from '../apis/file-talk-share';
import { import {
MassTalkDownloadRequest, MassTalkDownloadRequest,
MassTalkDownloadResponse, MassTalkDownloadResponse,
encodeMassTalkDownload, encodeMassTalkDownload,
decodeMassTalkDownload decodeMassTalkDownload
} from '../models/mass-talk-download'; } from '../apis/mass-talk-download';
import { import {
MassTalkSaveRequest, MassTalkSaveRequest,
MassTalkSaveResponse, MassTalkSaveResponse,
encodeMassTalkSave, encodeMassTalkSave,
decodeMassTalkSave decodeMassTalkSave
} from '../models/mass-talk-save'; } from '../apis/mass-talk-save';
import { import {
TransMassTalkDownloadRequest, TransMassTalkDownloadRequest,
TransMassTalkDownloadResponse, TransMassTalkDownloadResponse,
encodeTransMassTalkDownload, encodeTransMassTalkDownload,
decodeTransMassTalkDownload decodeTransMassTalkDownload
} from '../models/trans-mass-talk-download'; } from '../apis/trans-mass-talk-download';
import { import {
TransMassTalkSaveRequest, TransMassTalkSaveRequest,
TransMassTalkSaveResponse, TransMassTalkSaveResponse,
encodeTransMassTalkSave, encodeTransMassTalkSave,
decodeTransMassTalkSave decodeTransMassTalkSave
} from '../models/trans-mass-talk-save'; } from '../apis/trans-mass-talk-save';
import { import {
TranslationReqRequest, TranslationReqRequest,
TranslationReqResponse, TranslationReqResponse,
encodeTranslationReq, encodeTranslationReq,
decodeTranslationReq decodeTranslationReq
} from '../models/translation-req'; } from '../apis/translation-req';
import { import {
TranslationSaveRequest, TranslationSaveRequest,
TranslationSaveResponse, TranslationSaveResponse,
encodeTranslationSave, encodeTranslationSave,
decodeTranslationSave decodeTranslationSave
} from '../models/translation-save'; } from '../apis/translation-save';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'

View File

@ -4,16 +4,16 @@
export * from './lib/types/module-config'; export * from './lib/types/module-config';
export * from './lib/models/file-profile-save'; export * from './lib/apis/file-profile-save';
export * from './lib/models/file-talk-download'; export * from './lib/apis/file-talk-download';
export * from './lib/models/file-talk-save'; export * from './lib/apis/file-talk-save';
export * from './lib/models/file-talk-share'; export * from './lib/apis/file-talk-share';
export * from './lib/models/mass-talk-download'; export * from './lib/apis/mass-talk-download';
export * from './lib/models/mass-talk-save'; export * from './lib/apis/mass-talk-save';
export * from './lib/models/trans-mass-talk-download'; export * from './lib/apis/trans-mass-talk-download';
export * from './lib/models/trans-mass-talk-save'; export * from './lib/apis/trans-mass-talk-save';
export * from './lib/models/translation-req'; export * from './lib/apis/translation-req';
export * from './lib/models/translation-save'; export * from './lib/apis/translation-save';
export * from './lib/services/common-api.service'; export * from './lib/services/common-api.service';

View File

@ -5,6 +5,7 @@ import {
APIEncoder, APIEncoder,
APIDecoder APIDecoder
} from '@ucap-webmessenger/api'; } from '@ucap-webmessenger/api';
import { Company } from '../models/company';
export interface CompanyListRequest extends APIRequest { export interface CompanyListRequest extends APIRequest {
userSeq?: string; userSeq?: string;
@ -14,15 +15,6 @@ export interface CompanyListRequest extends APIRequest {
companyGroupCode: string; companyGroupCode: string;
} }
export interface Company {
companyCode?: string;
companyName?: string;
companyDomain?: string;
companyConfAuthYn?: string;
ucapUseYn?: string;
companyTimerChatAuthYn?: string;
}
export interface CompanyListResponse extends APIResponse { export interface CompanyListResponse extends APIResponse {
companyList?: Company[]; companyList?: Company[];
} }

View File

@ -0,0 +1,8 @@
export interface Company {
companyCode?: string;
companyName?: string;
companyDomain?: string;
companyConfAuthYn?: string;
ucapUseYn?: string;
companyTimerChatAuthYn?: string;
}

View File

@ -11,25 +11,25 @@ import {
CheckUserInfoExResponse, CheckUserInfoExResponse,
encodeCheckUserInfoEx, encodeCheckUserInfoEx,
decodeCheckUserInfoEx decodeCheckUserInfoEx
} from '../models/check-user-info-ex'; } from '../apis/check-user-info-ex';
import { import {
CompanyListRequest, CompanyListRequest,
CompanyListResponse, CompanyListResponse,
encodeCompanyList, encodeCompanyList,
decodeCompanyList decodeCompanyList
} from '../models/company-list'; } from '../apis/company-list';
import { import {
TokenUpdateRequest, TokenUpdateRequest,
TokenUpdateResponse, TokenUpdateResponse,
encodeTokenUpdate, encodeTokenUpdate,
decodeTokenUpdate decodeTokenUpdate
} from '../models/token-update'; } from '../apis/token-update';
import { import {
UrlInfoResponse, UrlInfoResponse,
UrlInfoRequest, UrlInfoRequest,
encodeUrlInfo, encodeUrlInfo,
decodeUrlInfo decodeUrlInfo
} from '../models/url-info'; } from '../apis/url-info';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'

View File

@ -4,10 +4,12 @@
export * from './lib/types/module-config'; export * from './lib/types/module-config';
export * from './lib/models/check-user-info-ex'; export * from './lib/models/company';
export * from './lib/models/company-list';
export * from './lib/models/token-update'; export * from './lib/apis/check-user-info-ex';
export * from './lib/models/url-info'; export * from './lib/apis/company-list';
export * from './lib/apis/token-update';
export * from './lib/apis/url-info';
export * from './lib/services/external-api.service'; export * from './lib/services/external-api.service';

View File

@ -10,13 +10,13 @@ import {
VersionInfo2Response, VersionInfo2Response,
encodeVersionInfo2, encodeVersionInfo2,
decodeVersionInfo2 decodeVersionInfo2
} from '../models/version-info2'; } from '../apis/version-info2';
import { import {
UpdateInfoRequest, UpdateInfoRequest,
UpdateInfoResponse, UpdateInfoResponse,
encodeUpdateInfo, encodeUpdateInfo,
decodeUpdateInfo decodeUpdateInfo
} from '../models/update-info'; } from '../apis/update-info';
import { ModuleConfig } from '../types/module-config'; import { ModuleConfig } from '../types/module-config';
@Injectable({ @Injectable({

View File

@ -2,8 +2,8 @@
* Public API Surface of ucap-webmessenger-api-public * Public API Surface of ucap-webmessenger-api-public
*/ */
export * from './lib/models/update-info'; export * from './lib/apis/update-info';
export * from './lib/models/version-info2'; export * from './lib/apis/version-info2';
export * from './lib/services/public-api.service'; export * from './lib/services/public-api.service';

View File

@ -2,7 +2,7 @@
* Public API Surface of ucap-webmessenger-api * Public API Surface of ucap-webmessenger-api
*/ */
export * from './lib/models/api'; export * from './lib/apis/api';
export * from './lib/types/status-code.type'; export * from './lib/types/status-code.type';

View File

@ -15,6 +15,7 @@ import { UCapProtocolModule } from '@ucap-webmessenger/protocol';
import { UCapAuthenticationProtocolModule } from '@ucap-webmessenger/protocol-authentication'; import { UCapAuthenticationProtocolModule } from '@ucap-webmessenger/protocol-authentication';
import { UCapInnerProtocolModule } from '@ucap-webmessenger/protocol-inner'; import { UCapInnerProtocolModule } from '@ucap-webmessenger/protocol-inner';
import { UCapOptionProtocolModule } from '@ucap-webmessenger/protocol-option'; import { UCapOptionProtocolModule } from '@ucap-webmessenger/protocol-option';
import { UCapServiceProtocolModule } from '@ucap-webmessenger/protocol-service';
import { UCapSyncProtocolModule } from '@ucap-webmessenger/protocol-sync'; import { UCapSyncProtocolModule } from '@ucap-webmessenger/protocol-sync';
import { UCapUiModule } from '@ucap-webmessenger/ui'; import { UCapUiModule } from '@ucap-webmessenger/ui';
@ -36,6 +37,7 @@ import { AppTranslateModule } from './app-translate.module';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import { GUARDS } from './guards'; import { GUARDS } from './guards';
import { AppMessengerLayoutModule } from './layouts/messenger/messenger.layout.module';
@NgModule({ @NgModule({
imports: [ imports: [
@ -67,6 +69,7 @@ import { GUARDS } from './guards';
UCapAuthenticationProtocolModule.forRoot(), UCapAuthenticationProtocolModule.forRoot(),
UCapInnerProtocolModule.forRoot(), UCapInnerProtocolModule.forRoot(),
UCapOptionProtocolModule.forRoot(), UCapOptionProtocolModule.forRoot(),
UCapServiceProtocolModule.forRoot(),
UCapSyncProtocolModule.forRoot(), UCapSyncProtocolModule.forRoot(),
UCapUiModule.forRoot(), UCapUiModule.forRoot(),
@ -81,6 +84,8 @@ import { GUARDS } from './guards';
AppStoreModule, AppStoreModule,
AppTranslateModule, AppTranslateModule,
AppMessengerLayoutModule,
LoggerModule.forRoot({ LoggerModule.forRoot({
level: NgxLoggerLevel.DEBUG level: NgxLoggerLevel.DEBUG
}) })

View File

@ -2,3 +2,16 @@
::ng-deep .mat-tab-label-active { ::ng-deep .mat-tab-label-active {
min-width: 0 !important; min-width: 0 !important;
} }
::ng-deep .mat-tab-body-wrapper,
::ng-deep .mat-tab-body {
height: 100%;
}
.container {
height: 100%;
mat-tab-group {
height: 100%;
}
}

View File

@ -1 +1,3 @@
Chat <div *ngFor="let room of roomList$ | async" (click)="onSelectedRoom(room)">
{{ room.finalEventMessage }}
</div>

View File

@ -1,5 +1,11 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { ucapAnimations } from '@ucap-webmessenger/ui'; import { ucapAnimations } from '@ucap-webmessenger/ui';
import { NGXLogger } from 'ngx-logger';
import { Store, select } from '@ngrx/store';
import { Observable } from 'rxjs';
import { RoomInfo } from '@ucap-webmessenger/protocol-room';
import * as AppStore from '@app/store';
import * as ChatStore from '@app/store/messenger/chat';
@Component({ @Component({
selector: 'app-layout-chat-left-sidenav-chat', selector: 'app-layout-chat-left-sidenav-chat',
@ -8,7 +14,17 @@ import { ucapAnimations } from '@ucap-webmessenger/ui';
animations: ucapAnimations animations: ucapAnimations
}) })
export class ChatComponent implements OnInit { export class ChatComponent implements OnInit {
constructor() {} roomList$: Observable<RoomInfo[]>;
ngOnInit() {} constructor(private store: Store<any>, private logger: NGXLogger) {}
ngOnInit() {
this.roomList$ = this.store.pipe(
select(AppStore.MessengerSelector.SyncSelector.roomList)
);
}
onSelectedRoom(roomInfo: RoomInfo) {
this.store.dispatch(ChatStore.selectedRoom({ roomSeq: roomInfo.roomSeq }));
}
} }

View File

@ -1,4 +1,46 @@
<ucap-group-expansion-panel <div>
[groupBuddyList]="groupBuddyList$ | async" <div>
(selectBuddy)="onSelectBuddy($event)" <ucap-organization-tenant-search
></ucap-group-expansion-panel> [companyList]="companyList$ | async"
[companyCode]="companyCode"
(keyDownEnter)="onKeyDownEnterOrganizationTenantSearch($event)"
></ucap-organization-tenant-search>
<button
mat-icon-button
[matMenuTriggerFor]="groupMenu"
aria-label="group menu"
>
<mat-icon>more_vert</mat-icon>
</button>
<mat-menu #groupMenu="matMenu" xPosition="after" yPosition="below">
<button mat-menu-item (click)="onClickGroupMenu('GROUP_NEW')">
<mat-icon>group_add</mat-icon>
<span>새 그룹 추가</span>
</button>
<button mat-menu-item (click)="onClickGroupMenu('GROUP_EXPAND_MORE')">
<mat-icon>expand_more</mat-icon>
<span>그룹 전체 열기</span>
</button>
<button mat-menu-item (click)="onClickGroupMenu('GROUP_EXPAND_LESS')">
<mat-icon>expand_less</mat-icon>
<span>그룹 전체 닫기</span>
</button>
<button mat-menu-item (click)="onClickGroupMenu('GROUP_SAVE')">
<mat-icon>save</mat-icon>
<span>그룹 저장하기</span>
</button>
<button mat-menu-item (click)="onClickGroupMenu('GROUP_RESTORE')">
<mat-icon>restore</mat-icon>
<span>그룹 가져오기</span>
</button>
</mat-menu>
</div>
<div>
<ucap-group-expansion-panel
#groupExpansionPanel
[groupBuddyList]="groupBuddyList$ | async"
(selectBuddy)="onSelectBuddy($event)"
>
</ucap-group-expansion-panel>
</div>
</div>

View File

@ -1,16 +1,28 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit, ViewChild } from '@angular/core';
import { Observable, combineLatest } from 'rxjs'; import { Observable, combineLatest, Subscription } from 'rxjs';
import { map } from 'rxjs/operators'; import { map, tap } from 'rxjs/operators';
import { Store, select } from '@ngrx/store'; import { Store, select } from '@ngrx/store';
import { ucapAnimations } from '@ucap-webmessenger/ui'; import { ucapAnimations, DialogService } from '@ucap-webmessenger/ui';
import { UserInfo, GroupDetailData } from '@ucap-webmessenger/protocol-sync'; import { UserInfo, GroupDetailData } from '@ucap-webmessenger/protocol-sync';
import * as AppStore from '@app/store'; import * as AppStore from '@app/store';
import * as ChatStore from '@app/store/messenger/chat'; import * as ChatStore from '@app/store/messenger/chat';
import * as QueryStore from '@app/store/messenger/query';
import { NGXLogger } from 'ngx-logger'; import { NGXLogger } from 'ngx-logger';
import { Company } from '@ucap-webmessenger/api-external';
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { LoginInfo, KEY_LOGIN_INFO } from '@app/types';
import { ExpansionPanelComponent as GroupExpansionPanelComponent } from '@ucap-webmessenger/ui-group';
import {
CreateGroupDialogComponent,
CreateGroupDialogData,
CreateGroupDialogResult
} from '@app/layouts/messenger/dialogs/create-group.dialog.component';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
import { DeptSearchType } from '@ucap-webmessenger/protocol-query';
@Component({ @Component({
selector: 'app-layout-chat-left-sidenav-group', selector: 'app-layout-chat-left-sidenav-group',
@ -19,13 +31,42 @@ import { NGXLogger } from 'ngx-logger';
animations: ucapAnimations animations: ucapAnimations
}) })
export class GroupComponent implements OnInit { export class GroupComponent implements OnInit {
@ViewChild('groupExpansionPanel', { static: true })
groupExpansionPanel: GroupExpansionPanelComponent;
groupBuddyList$: Observable< groupBuddyList$: Observable<
{ group: GroupDetailData; buddyList: UserInfo[] }[] { group: GroupDetailData; buddyList: UserInfo[] }[]
>; >;
companyList$: Observable<Company[]>;
companyCode: string;
constructor(private store: Store<any>, private logger: NGXLogger) {} loginRes: LoginResponse;
loginResSubscription: Subscription;
constructor(
private store: Store<any>,
private sessionStorageService: SessionStorageService,
private dialogService: DialogService,
private logger: NGXLogger
) {}
ngOnInit() { ngOnInit() {
const loginInfo = this.sessionStorageService.get<LoginInfo>(KEY_LOGIN_INFO);
this.companyCode = loginInfo.companyCode;
this.loginResSubscription = this.store
.pipe(
select(AppStore.AccountSelector.AuthenticationSelector.loginRes),
tap(loginRes => {
this.loginRes = loginRes;
})
)
.subscribe();
this.companyList$ = this.store.pipe(
select(AppStore.SettingSelector.CompanySelector.companyList)
);
this.groupBuddyList$ = this.store this.groupBuddyList$ = this.store
.pipe( .pipe(
select(AppStore.MessengerSelector.SyncSelector.groupListAndBuddyList) select(AppStore.MessengerSelector.SyncSelector.groupListAndBuddyList)
@ -71,7 +112,61 @@ export class GroupComponent implements OnInit {
); );
} }
async onClickGroupMenu(menuType: string) {
this.logger.debug('menuType', menuType);
switch (menuType) {
case 'GROUP_NEW':
{
const result = await this.dialogService.open<
CreateGroupDialogComponent,
CreateGroupDialogData,
CreateGroupDialogResult
>(CreateGroupDialogComponent, {
width: '220px',
data: {
title: 'Logout',
message: 'Logout ?'
}
});
}
break;
case 'GROUP_EXPAND_MORE':
{
this.groupExpansionPanel.expandMore();
}
break;
case 'GROUP_EXPAND_LESS':
{
this.groupExpansionPanel.expandLess();
}
break;
case 'GROUP_SAVE':
break;
case 'GROUP_RESTORE':
break;
default:
break;
}
}
onSelectBuddy(buddy: UserInfo) { onSelectBuddy(buddy: UserInfo) {
this.store.dispatch(ChatStore.selectedRoom({ roomSeq: buddy.seq })); this.store.dispatch(ChatStore.selectedRoom({ roomSeq: String(buddy.seq) }));
}
onKeyDownEnterOrganizationTenantSearch(params: {
companyCode: string;
searchWord: string;
}) {
this.store.dispatch(
QueryStore.deptUser({
divCd: 'GRP',
companyCode: params.companyCode,
searchRange: DeptSearchType.All,
search: params.searchWord,
senderCompanyCode: params.companyCode,
senderEmployeeType: this.loginRes.userInfo.employeeType
})
);
} }
} }

View File

@ -1 +1,13 @@
<ucap-organization-expansion-panel></ucap-organization-expansion-panel> <div class="oraganization-tab" fxLayout="column">
<div class="oraganization-tab-tree" fxFlex="50" style="overflow: scroll">
<ucap-organization-tree
[oraganizationList]="departmentInfoList$ | async"
(selected)="onSelectedOrganization($event)"
></ucap-organization-tree>
</div>
<div fxFlex="50" style="overflow: scroll">
<div *ngFor="let userInfo of selectedDepartmentUserInfoList$ | async">
{{ userInfo.name }}
</div>
</div>
</div>

View File

@ -0,0 +1,7 @@
.oraganization-tab {
height: 100%;
.oraganization-tab-tree {
overflow: scroll;
}
}

View File

@ -1,5 +1,21 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { ucapAnimations } from '@ucap-webmessenger/ui'; import { ucapAnimations } from '@ucap-webmessenger/ui';
import { Observable } from 'rxjs';
import {
DeptInfo,
QueryProtocolService,
DeptSearchType,
UserInfoSS,
DeptUserResponse
} from '@ucap-webmessenger/protocol-query';
import { Store, select } from '@ngrx/store';
import { NGXLogger } from 'ngx-logger';
import * as AppStore from '@app/store';
import * as QueryStore from '@app/store/messenger/query';
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { LoginInfo, KEY_LOGIN_INFO } from '@app/types';
import { take, map, switchMap } from 'rxjs/operators';
@Component({ @Component({
selector: 'app-layout-chat-left-sidenav-organization', selector: 'app-layout-chat-left-sidenav-organization',
@ -8,7 +24,52 @@ import { ucapAnimations } from '@ucap-webmessenger/ui';
animations: ucapAnimations animations: ucapAnimations
}) })
export class OrganizationComponent implements OnInit { export class OrganizationComponent implements OnInit {
constructor() {} departmentInfoList$: Observable<DeptInfo[]>;
selectedDepartmentUserInfoList$: Observable<UserInfoSS[]>;
selectedDepartmentStatus$: Observable<DeptUserResponse>;
ngOnInit() {} constructor(
private store: Store<any>,
private queryProtocolService: QueryProtocolService,
private sessionStorageService: SessionStorageService,
private logger: NGXLogger
) {}
ngOnInit() {
this.departmentInfoList$ = this.store.pipe(
select(AppStore.MessengerSelector.QuerySelector.departmentInfoList)
);
this.selectedDepartmentUserInfoList$ = this.store.pipe(
select(
AppStore.MessengerSelector.QuerySelector.selectedDepartmentUserInfoList
)
);
this.selectedDepartmentStatus$ = this.store.pipe(
select(AppStore.MessengerSelector.QuerySelector.selectedDepartmentStatus)
);
}
onSelectedOrganization(deptInfo: DeptInfo) {
const loginInfo = this.sessionStorageService.get<LoginInfo>(KEY_LOGIN_INFO);
this.store
.pipe(
take(1),
select(AppStore.AccountSelector.AuthenticationSelector.loginRes),
map(loginRes => {
this.store.dispatch(
QueryStore.deptUser({
divCd: 'ORG',
companyCode: loginInfo.companyCode,
seq: deptInfo.seq,
search: '',
searchRange: DeptSearchType.All,
senderCompanyCode: loginInfo.companyCode,
senderEmployeeType: loginRes.userInfo.employeeType
})
);
})
)
.subscribe();
}
} }

View File

@ -34,11 +34,17 @@
</div> </div>
</mat-toolbar> </mat-toolbar>
<!-- / CHAT TOOLBAR --> <!-- / CHAT TOOLBAR -->
<mat-progress-bar
*ngIf="eventListProcessing$ | async"
mode="indeterminate"
></mat-progress-bar>
<!-- CHAT CONTENT --> <!-- CHAT CONTENT -->
<div fxFlex="1 1 auto" class="chat-content"> <div fxFlex="1 1 auto" class="chat-content">
<!-- CHAT MESSAGES --> <!-- CHAT MESSAGES -->
<ucap-chat-messages></ucap-chat-messages> <ucap-chat-messages
[messages]="eventList$ | async"
[loginRes]="loginRes"
></ucap-chat-messages>
<!-- CHAT MESSAGES --> <!-- CHAT MESSAGES -->
</div> </div>
<!-- / CHAT CONTENT --> <!-- / CHAT CONTENT -->
@ -46,7 +52,7 @@
<!-- CHAT FOOTER --> <!-- CHAT FOOTER -->
<div fxFlex="0 0 auto" fxLayout="column"> <div fxFlex="0 0 auto" fxLayout="column">
<!-- REPLY FORM --> <!-- REPLY FORM -->
<ucap-chat-form></ucap-chat-form> <ucap-chat-form (send)="onSendMessage($event)"></ucap-chat-form>
<!-- / REPLY FORM --> <!-- / REPLY FORM -->
</div> </div>
<!-- / CHAT FOOTER--> <!-- / CHAT FOOTER-->

View File

@ -1,5 +1,17 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit, OnDestroy } from '@angular/core';
import { ucapAnimations } from '@ucap-webmessenger/ui'; import { ucapAnimations } from '@ucap-webmessenger/ui';
import { Store, select } from '@ngrx/store';
import { NGXLogger } from 'ngx-logger';
import { Observable, Subscription } from 'rxjs';
import { Info, EventType } from '@ucap-webmessenger/protocol-event';
import * as AppStore from '@app/store';
import * as EventStore from '@app/store/messenger/event';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { LoginInfo, KEY_LOGIN_INFO } from '@app/types';
import { RoomInfo } from '@ucap-webmessenger/protocol-room';
import { tap } from 'rxjs/operators';
@Component({ @Component({
selector: 'app-layout-messenger-messages', selector: 'app-layout-messenger-messages',
@ -7,10 +19,71 @@ import { ucapAnimations } from '@ucap-webmessenger/ui';
styleUrls: ['./messages.component.scss'], styleUrls: ['./messages.component.scss'],
animations: ucapAnimations animations: ucapAnimations
}) })
export class MessagesComponent implements OnInit { export class MessagesComponent implements OnInit, OnDestroy {
constructor() {} loginRes: LoginResponse;
loginResSubscription: Subscription;
eventList$: Observable<Info[]>;
roomInfo: RoomInfo;
roomInfoSubscription: Subscription;
eventListProcessing$: Observable<boolean>;
ngOnInit() {} constructor(
private store: Store<any>,
private sessionStorageService: SessionStorageService,
private logger: NGXLogger
) {}
ngOnInit() {
const loginInfo = this.sessionStorageService.get<LoginInfo>(KEY_LOGIN_INFO);
this.loginResSubscription = this.store
.pipe(
select(AppStore.AccountSelector.AuthenticationSelector.loginRes),
tap(loginRes => {
this.loginRes = loginRes;
})
)
.subscribe();
this.roomInfoSubscription = this.store
.pipe(
select(AppStore.MessengerSelector.RoomSelector.roomInfo),
tap(roomInfo => {
this.roomInfo = roomInfo;
})
)
.subscribe();
this.eventListProcessing$ = this.store.pipe(
select(AppStore.MessengerSelector.EventSelector.infoListProcessing)
);
this.eventList$ = this.store.pipe(
select(AppStore.MessengerSelector.EventSelector.infoList)
);
}
ngOnDestroy(): void {
if (!!this.loginResSubscription) {
this.loginResSubscription.unsubscribe();
}
if (!!this.roomInfoSubscription) {
this.roomInfoSubscription.unsubscribe();
}
}
selectContact() {} selectContact() {}
onSendMessage(message: string) {
this.store.dispatch(
EventStore.send({
senderSeq: this.loginRes.userSeq,
req: {
roomSeq: this.roomInfo.roomSeq,
eventType: EventType.Character,
sentMessage: message
}
})
);
}
} }

View File

@ -0,0 +1,18 @@
<mat-card class="confirm-card">
<mat-card-header cdkDrag cdkDragRootElement=".cdk-overlay-pane" cdkDragHandle>
<mat-card-title>새 그룹 추가</mat-card-title>
</mat-card-header>
<mat-card-content> </mat-card-content>
<mat-card-actions class="button-farm flex-row">
<button
mat-stroked-button
(click)="onClickChoice(false)"
class="mat-primary"
>
No
</button>
<button mat-flat-button (click)="onClickChoice(true)" class="mat-primary">
Yes
</button>
</mat-card-actions>
</mat-card>

View File

@ -0,0 +1,24 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { CreateGroupDialogComponent } from './create-group.dialog.component';
describe('app::layouts::messenger::CreateGroupDialogComponent', () => {
let component: CreateGroupDialogComponent;
let fixture: ComponentFixture<CreateGroupDialogComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [CreateGroupDialogComponent]
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(CreateGroupDialogComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,34 @@
import { Component, OnInit, Inject } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
export interface CreateGroupDialogData {
title: string;
message?: string;
}
export interface CreateGroupDialogResult {
choice: boolean;
}
@Component({
selector: 'app-layout-messenger-create-group',
templateUrl: './create-group.dialog.component.html',
styleUrls: ['./create-group.dialog.component.scss']
})
export class CreateGroupDialogComponent implements OnInit {
constructor(
public dialogRef: MatDialogRef<
CreateGroupDialogData,
CreateGroupDialogResult
>,
@Inject(MAT_DIALOG_DATA) public data: CreateGroupDialogData
) {}
ngOnInit(): void {}
onClickChoice(choice: boolean): void {
this.dialogRef.close({
choice
});
}
}

View File

@ -0,0 +1,3 @@
import { CreateGroupDialogComponent } from './create-group.dialog.component';
export const DIALOGS = [CreateGroupDialogComponent];

View File

@ -3,31 +3,45 @@ import { CommonModule } from '@angular/common';
import { FlexLayoutModule } from '@angular/flex-layout'; import { FlexLayoutModule } from '@angular/flex-layout';
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
import { MatDialogModule } from '@angular/material/dialog';
import { MatIconModule } from '@angular/material/icon'; import { MatIconModule } from '@angular/material/icon';
import { MatMenuModule } from '@angular/material/menu'; import { MatMenuModule } from '@angular/material/menu';
import { MatProgressBarModule } from '@angular/material/progress-bar';
import { MatTabsModule } from '@angular/material/tabs'; import { MatTabsModule } from '@angular/material/tabs';
import { MatToolbarModule } from '@angular/material/toolbar'; import { MatToolbarModule } from '@angular/material/toolbar';
import { DragDropModule } from '@angular/cdk/drag-drop';
import { UCapUiModule } from '@ucap-webmessenger/ui';
import { UCapUiChatModule } from '@ucap-webmessenger/ui-chat'; import { UCapUiChatModule } from '@ucap-webmessenger/ui-chat';
import { UCapUiGroupModule } from '@ucap-webmessenger/ui-group'; import { UCapUiGroupModule } from '@ucap-webmessenger/ui-group';
import { UCapUiOrganizationModule } from '@ucap-webmessenger/ui-organization'; import { UCapUiOrganizationModule } from '@ucap-webmessenger/ui-organization';
import { COMPONENTS } from './components'; import { COMPONENTS } from './components';
import { DIALOGS } from './dialogs';
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, CommonModule,
FlexLayoutModule, FlexLayoutModule,
DragDropModule,
MatButtonModule,
MatCardModule,
MatDialogModule,
MatIconModule, MatIconModule,
MatMenuModule, MatMenuModule,
MatProgressBarModule,
MatTabsModule, MatTabsModule,
MatToolbarModule, MatToolbarModule,
UCapUiModule,
UCapUiChatModule, UCapUiChatModule,
UCapUiGroupModule, UCapUiGroupModule,
UCapUiOrganizationModule UCapUiOrganizationModule
], ],
exports: [...COMPONENTS], exports: [...COMPONENTS, ...DIALOGS],
declarations: [...COMPONENTS], declarations: [...COMPONENTS, ...DIALOGS],
entryComponents: [] entryComponents: [...DIALOGS]
}) })
export class AppMessengerLayoutModule {} export class AppMessengerLayoutModule {}

View File

@ -3,6 +3,8 @@ import { CommonModule } from '@angular/common';
import { FlexLayoutModule } from '@angular/flex-layout'; import { FlexLayoutModule } from '@angular/flex-layout';
import { MatButtonModule } from '@angular/material/button';
import { UCapUiAccountModule } from '@ucap-webmessenger/ui-account'; import { UCapUiAccountModule } from '@ucap-webmessenger/ui-account';
import { AppAccountRoutingPageModule } from './account-routing.page.module'; import { AppAccountRoutingPageModule } from './account-routing.page.module';
@ -13,6 +15,7 @@ import { COMPONENTS } from './components';
imports: [ imports: [
CommonModule, CommonModule,
FlexLayoutModule, FlexLayoutModule,
MatButtonModule,
UCapUiAccountModule, UCapUiAccountModule,
AppAccountRoutingPageModule AppAccountRoutingPageModule
], ],

View File

@ -1,6 +1,19 @@
<div class="login" fxLayout="column"> <div class="login" fxLayout="column">
<div class="login-wrapper" fxLayout="column" fxLayoutAlign="center center"> <div class="login-wrapper" fxLayout="column" fxLayoutAlign="center center">
<ucap-account-login [companyList]="companyList$ | async" (login)="onLogin($event)" (template)="onTemplate($event)"> <ucap-account-login
[companyList]="companyList$ | async"
(login)="onLogin($event)"
>
</ucap-account-login> </ucap-account-login>
</div> </div>
<button
mat-raised-button
color="accent"
class="submit-button"
aria-label="Template"
(click)="onClickTemplate()"
>
Template
</button>
</div> </div>

View File

@ -52,7 +52,7 @@ export class LoginPageComponent implements OnInit {
); );
} }
onTemplate() { onClickTemplate() {
this.router.navigate(['/template']); this.router.navigate(['/template']);
} }
} }

View File

@ -2,14 +2,21 @@
<div class="left-side"> <div class="left-side">
<app-layout-messenger-left-side></app-layout-messenger-left-side> <app-layout-messenger-left-side></app-layout-messenger-left-side>
</div> </div>
<div class="contents"> <mat-drawer-container class="contents" autosize>
<app-layout-messenger-intro <div class="messages">
*ngIf="!(this.selectedChat$ | async)" <app-layout-messenger-intro
></app-layout-messenger-intro> (click)="drawer.toggle()"
<app-layout-messenger-messages *ngIf="!(this.selectedChat$ | async)"
*ngIf="!!(this.selectedChat$ | async)" ></app-layout-messenger-intro>
></app-layout-messenger-messages> <app-layout-messenger-messages
</div> *ngIf="!!(this.selectedChat$ | async)"
></app-layout-messenger-messages>
</div>
<mat-drawer #drawer mode="side" position="end">
<p>sidenav</p>
</mat-drawer>
</mat-drawer-container>
<div class="right-side"> <div class="right-side">
<app-layout-messenger-right-side></app-layout-messenger-right-side> <app-layout-messenger-right-side></app-layout-messenger-right-side>
</div> </div>

View File

@ -10,6 +10,11 @@
float: left; float: left;
width: calc(100% - 360px); width: calc(100% - 360px);
height: 100%; height: 100%;
.messages {
width: 100%;
height: 100%;
}
} }
.right-side { .right-side {
float: left; float: left;

View File

@ -11,7 +11,7 @@ import { Observable } from 'rxjs';
styleUrls: ['./main.page.component.scss'] styleUrls: ['./main.page.component.scss']
}) })
export class MainPageComponent implements OnInit { export class MainPageComponent implements OnInit {
selectedChat$: Observable<number | null>; selectedChat$: Observable<string | null>;
constructor(private store: Store<any>) {} constructor(private store: Store<any>) {}

View File

@ -1,11 +1,22 @@
<div> <div fxLayout="column">
<button
mat-raised-button
color="accent"
class="submit-button"
aria-label="Login"
(click)="onClickLogin()"
>
Login
</button>
<h3>User-list-item</h3> <h3>User-list-item</h3>
<div> <div>
<ucap-profile-user-list-item <ucap-profile-user-list-item
[userInfo]="userInfo" [userInfo]="userInfo"
[profileImageRoot]="profileImageRoot" [profileImageRoot]="profileImageRoot"
[presence]="presence" [presence]="presence"
></ucap-profile-user-list-item> >
</ucap-profile-user-list-item>
<ucap-profile-user-list-item <ucap-profile-user-list-item
[userInfo]="userInfo" [userInfo]="userInfo"
[profileImageRoot]="profileImageRoot" [profileImageRoot]="profileImageRoot"
@ -18,4 +29,131 @@
> >
</ucap-profile-user-list-item> </ucap-profile-user-list-item>
</div> </div>
<h3>Organization</h3>
<div>
<div>
<div>
Tenant Search
</div>
<div>
<ucap-organization-tenant-search
[companyList]="companyList"
[companyCode]="companyCode"
></ucap-organization-tenant-search>
</div>
</div>
</div>
<h3>Chat::MessageBox</h3>
<div>
<div>
<div>
date splitter
</div>
<div>
<ucap-chat-message-box-date-splitter></ucap-chat-message-box-date-splitter>
</div>
</div>
<div>
<div>
file
</div>
<div>
<ucap-chat-message-box-file></ucap-chat-message-box-file>
</div>
</div>
<div>
<div>
image
</div>
<div>
<ucap-chat-message-box-image></ucap-chat-message-box-image>
</div>
</div>
<div>
<div>
information
</div>
<div>
<ucap-chat-message-box-information></ucap-chat-message-box-information>
</div>
</div>
<div>
<div>
mass-translation
</div>
<div>
<ucap-chat-message-box-mass-translation></ucap-chat-message-box-mass-translation>
</div>
</div>
<div>
<div>
mass
</div>
<div>
<ucap-chat-message-box-mass></ucap-chat-message-box-mass>
</div>
</div>
<div>
<div>
notice
</div>
<div>
<ucap-chat-message-box-notice></ucap-chat-message-box-notice>
</div>
</div>
<div>
<div>
recall
</div>
<div>
<ucap-chat-message-box-recall></ucap-chat-message-box-recall>
</div>
</div>
<div>
<div>schedule</div>
<div>
<ucap-chat-message-box-schedule></ucap-chat-message-box-schedule>
</div>
</div>
<div>
<div>
sticker
</div>
<div>
<ucap-chat-message-box-sticker></ucap-chat-message-box-sticker>
</div>
</div>
<div>
<div>
text
</div>
<div>
<ucap-chat-message-box-text></ucap-chat-message-box-text>
</div>
</div>
<div>
<div>
translation
</div>
<div>
<ucap-chat-message-box-translation></ucap-chat-message-box-translation>
</div>
</div>
<div>
<div>
video
</div>
<div>
<ucap-chat-message-box-video></ucap-chat-message-box-video>
</div>
</div>
<div>
<div>
video-conference
</div>
<div>
<ucap-chat-message-box-video-conference></ucap-chat-message-box-video-conference>
</div>
</div>
</div>
</div> </div>

View File

@ -8,6 +8,8 @@ import {
TerminalStatusNumber TerminalStatusNumber
} from '@ucap-webmessenger/protocol-status'; } from '@ucap-webmessenger/protocol-status';
import { StatusCode } from '@ucap-webmessenger/core'; import { StatusCode } from '@ucap-webmessenger/core';
import { Router } from '@angular/router';
import { Company } from '@ucap-webmessenger/api-external';
@Component({ @Component({
selector: 'app-template.page', selector: 'app-template.page',
@ -21,9 +23,17 @@ export class TemplatePageComponent implements OnInit {
presence: StatusBulkInfo = status; presence: StatusBulkInfo = status;
constructor() {} companyList: Company[] = companyList;
companyCode: string = 'GUC006';
constructor(private router: Router) {}
ngOnInit() {} ngOnInit() {}
onClickLogin() {
this.router.navigate(['/account/login']);
}
} }
export const status: StatusBulkInfo = { export const status: StatusBulkInfo = {
@ -79,3 +89,182 @@ export const buddyData: UserInfo = {
employeeType: EmployeeType.Regular, employeeType: EmployeeType.Regular,
nickName: '채책임(닉)' nickName: '채책임(닉)'
}; };
const companyList: Company[] = [
{
companyCode: 'GUC002',
companyName: 'LG Electronics.',
companyDomain: 'lge.com',
companyConfAuthYn: 'N',
ucapUseYn: 'Y',
companyTimerChatAuthYn: 'Y'
},
{
companyCode: 'GUC040',
companyName: 'LGE한국영업협력사',
companyDomain: 'lgepartner.com',
companyConfAuthYn: 'Y',
ucapUseYn: 'Y',
companyTimerChatAuthYn: 'Y'
},
{
companyCode: 'GUC021',
companyName: 'LG이노텍',
companyDomain: 'lginnotek.com',
companyConfAuthYn: 'N',
ucapUseYn: 'Y',
companyTimerChatAuthYn: 'Y'
},
{
companyCode: 'GUC036',
companyName: '하이프라자',
companyDomain: 'hiplaza.co.kr',
companyConfAuthYn: 'Y',
ucapUseYn: 'Y',
companyTimerChatAuthYn: 'Y'
},
{
companyCode: 'GUC006',
companyName: 'LG CNS',
companyDomain: 'lgcns.com',
companyConfAuthYn: 'Y',
ucapUseYn: 'Y',
companyTimerChatAuthYn: 'Y'
},
{
companyCode: 'GUC041',
companyName: 'LGEIL',
companyDomain: 'lgeil.com',
companyConfAuthYn: 'Y',
ucapUseYn: 'Y',
companyTimerChatAuthYn: 'Y'
},
{
companyCode: 'GUC100',
companyName: 'LG UCAP',
companyDomain: 'lgucap.com',
companyConfAuthYn: 'Y',
ucapUseYn: 'Y',
companyTimerChatAuthYn: 'Y'
},
{
companyCode: 'GUCIM',
companyName: '아메사용회사',
companyDomain: 'test.com',
companyConfAuthYn: 'N',
ucapUseYn: 'N',
companyTimerChatAuthYn: 'Y'
},
{
companyCode: 'GUC005',
companyName: 'LG화학',
companyDomain: 'lgchem.com',
companyConfAuthYn: 'N',
ucapUseYn: 'Y',
companyTimerChatAuthYn: 'Y'
},
{
companyCode: 'GSGAL',
companyName: 'GS칼텍스',
companyDomain: 'gscaltex.com',
companyConfAuthYn: 'N',
ucapUseYn: 'Y',
companyTimerChatAuthYn: 'Y'
},
{
companyCode: 'GUC001',
companyName: 'LG U+',
companyDomain: 'lguplus.com',
companyConfAuthYn: 'N',
ucapUseYn: 'Y',
companyTimerChatAuthYn: 'Y'
},
{
companyCode: 'GUC007',
companyName: 'LG Display',
companyDomain: 'lgdisplay.com',
companyConfAuthYn: 'N',
ucapUseYn: 'Y',
companyTimerChatAuthYn: 'N'
},
{
companyCode: 'GUC011',
companyName: 'LG인화원',
companyDomain: 'lgacademy.com',
companyConfAuthYn: 'N',
ucapUseYn: 'Y',
companyTimerChatAuthYn: 'Y'
},
{
companyCode: 'GUC013',
companyName: 'LG MMA',
companyDomain: 'lgmma.com',
companyConfAuthYn: 'N',
ucapUseYn: 'Y',
companyTimerChatAuthYn: 'Y'
},
{
companyCode: 'GUC015',
companyName: '(주)LG',
companyDomain: 'lg.com',
companyConfAuthYn: 'N',
ucapUseYn: 'Y',
companyTimerChatAuthYn: 'Y'
},
{
companyCode: 'GUC016',
companyName: 'LGERI',
companyDomain: 'lgeri.com',
companyConfAuthYn: 'N',
ucapUseYn: 'Y',
companyTimerChatAuthYn: 'Y'
},
{
companyCode: 'GUC024',
companyName: 'LG Hausys',
companyDomain: 'lghausys.com',
companyConfAuthYn: 'N',
ucapUseYn: 'Y',
companyTimerChatAuthYn: 'Y'
},
{
companyCode: 'GUC028',
companyName: 'LG상사',
companyDomain: 'lgi.co.kr',
companyConfAuthYn: 'N',
ucapUseYn: 'Y',
companyTimerChatAuthYn: 'Y'
},
{
companyCode: 'GUC032',
companyName: '코리아일레콤',
companyDomain: 'koreaelecom.com',
companyConfAuthYn: 'N',
ucapUseYn: 'Y',
companyTimerChatAuthYn: 'Y'
},
{
companyCode: 'GUC035',
companyName: 'HLDS',
companyDomain: 'hlds.co.kr',
companyConfAuthYn: 'N',
ucapUseYn: 'Y',
companyTimerChatAuthYn: 'Y'
},
{
companyCode: 'GUC038',
companyName: 'BizTech Partners',
companyDomain: 'GUC018',
companyConfAuthYn: 'N',
ucapUseYn: 'Y',
companyTimerChatAuthYn: 'Y'
},
{
companyCode: 'GUC042',
companyName: 'Japan R&D Lab',
companyDomain: 'lgjlab.com',
companyConfAuthYn: 'N',
ucapUseYn: 'Y',
companyTimerChatAuthYn: 'Y'
}
];

View File

@ -3,20 +3,27 @@ import { CommonModule } from '@angular/common';
import { FlexLayoutModule } from '@angular/flex-layout'; import { FlexLayoutModule } from '@angular/flex-layout';
import { MatButtonModule } from '@angular/material/button';
import { UCapUiChatModule } from '@ucap-webmessenger/ui-chat';
import { UCapUiGroupModule } from '@ucap-webmessenger/ui-group'; import { UCapUiGroupModule } from '@ucap-webmessenger/ui-group';
import { UCapUiOrganizationModule } from '@ucap-webmessenger/ui-organization';
import { UCapUiProfileModule } from '@ucap-webmessenger/ui-profile';
import { AppTemplateRoutingPageModule } from './template-routing.page.module'; import { AppTemplateRoutingPageModule } from './template-routing.page.module';
import { COMPONENTS, MET_MODULES } from './components'; import { COMPONENTS, MET_MODULES } from './components';
import { UcapUiProfileModule } from '@ucap-webmessenger/ui-profile';
@NgModule({ @NgModule({
imports: [ imports: [
...MET_MODULES, ...MET_MODULES,
CommonModule, CommonModule,
FlexLayoutModule, FlexLayoutModule,
MatButtonModule,
UCapUiChatModule,
UCapUiGroupModule, UCapUiGroupModule,
UcapUiProfileModule, UCapUiOrganizationModule,
UCapUiProfileModule,
AppTemplateRoutingPageModule AppTemplateRoutingPageModule
], ],
declarations: [...COMPONENTS], declarations: [...COMPONENTS],

View File

@ -4,15 +4,12 @@ import {
ActivatedRouteSnapshot, ActivatedRouteSnapshot,
RouterStateSnapshot RouterStateSnapshot
} from '@angular/router'; } from '@angular/router';
import { Observable, throwError, of, EMPTY, forkJoin } from 'rxjs'; import { Observable, throwError, forkJoin } from 'rxjs';
import { import {
map, map,
tap, tap,
mergeMap,
catchError, catchError,
take, take,
exhaustMap,
concatMap,
switchMap, switchMap,
withLatestFrom withLatestFrom
} from 'rxjs/operators'; } from 'rxjs/operators';
@ -21,17 +18,14 @@ import { Store, select } from '@ngrx/store';
import { ProtocolService } from '@ucap-webmessenger/protocol'; import { ProtocolService } from '@ucap-webmessenger/protocol';
import { SessionStorageService } from '@ucap-webmessenger/web-storage'; import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { import { PublicApiService } from '@ucap-webmessenger/api-public';
PublicApiService,
VersionInfo2Response
} from '@ucap-webmessenger/api-public';
import { import {
LoginInfo, LoginInfo,
KEY_LOGIN_INFO, KEY_LOGIN_INFO,
EnvironmentsInfo, EnvironmentsInfo,
KEY_ENVIRONMENTS_INFO KEY_ENVIRONMENTS_INFO
} from '../types'; } from '@app/types';
import { InnerProtocolService } from '@ucap-webmessenger/protocol-inner'; import { InnerProtocolService } from '@ucap-webmessenger/protocol-inner';
import { import {
AuthenticationProtocolService, AuthenticationProtocolService,
@ -40,16 +34,15 @@ import {
} from '@ucap-webmessenger/protocol-authentication'; } from '@ucap-webmessenger/protocol-authentication';
import * as AuthenticationStore from '@app/store/account/authentication'; import * as AuthenticationStore from '@app/store/account/authentication';
import { ConnResponse } from 'projects/ucap-webmessenger-protocol-inner/src/lib/models/conn';
import { PiService } from '@ucap-webmessenger/pi';
import { NGXLogger } from 'ngx-logger'; import { NGXLogger } from 'ngx-logger';
import { QueryProtocolService } from '@ucap-webmessenger/protocol-query'; import { QueryProtocolService } from '@ucap-webmessenger/protocol-query';
import { OptionProtocolService } from '@ucap-webmessenger/protocol-option'; import { OptionProtocolService } from '@ucap-webmessenger/protocol-option';
import * as AppStore from '@app/store'; import * as AppStore from '@app/store';
import * as CompanyStore from '@app/store/setting/company';
import * as VersionInfoStore from '@app/store/setting/version-info'; import * as VersionInfoStore from '@app/store/setting/version-info';
import * as OptionStore from '@app/store/setting/option'; import * as OptionStore from '@app/store/messenger/option';
import * as QueryStore from '@app/store/setting/query'; import * as QueryStore from '@app/store/messenger/query';
import * as SyncStore from '@app/store/messenger/sync'; import * as SyncStore from '@app/store/messenger/sync';
@Injectable() @Injectable()
@ -58,7 +51,6 @@ export class AppMessengerResolver implements Resolve<void> {
private store: Store<any>, private store: Store<any>,
private sessionStorageService: SessionStorageService, private sessionStorageService: SessionStorageService,
private publicApiService: PublicApiService, private publicApiService: PublicApiService,
private piService: PiService,
private protocolService: ProtocolService, private protocolService: ProtocolService,
private queryProtocolService: QueryProtocolService, private queryProtocolService: QueryProtocolService,
private optionProtocolService: OptionProtocolService, private optionProtocolService: OptionProtocolService,
@ -72,8 +64,6 @@ export class AppMessengerResolver implements Resolve<void> {
routerStateSnapshot: RouterStateSnapshot routerStateSnapshot: RouterStateSnapshot
): void | Observable<void> | Promise<void> { ): void | Observable<void> | Promise<void> {
return new Promise<void>((resolve, reject) => { return new Promise<void>((resolve, reject) => {
let versionInfo2Res: VersionInfo2Response;
let connRres: ConnResponse;
let loginRes: LoginResponse; let loginRes: LoginResponse;
const loginInfo = this.sessionStorageService.get<LoginInfo>( const loginInfo = this.sessionStorageService.get<LoginInfo>(
@ -92,13 +82,14 @@ export class AppMessengerResolver implements Resolve<void> {
}) })
.pipe( .pipe(
take(1), take(1),
tap(res => {
this.store.dispatch(VersionInfoStore.versionInfo2Success({ res }));
}),
switchMap(res => { switchMap(res => {
versionInfo2Res = res; return this.protocolService.connect(res.serverIp);
return this.protocolService.connect(versionInfo2Res.serverIp);
}), }),
switchMap(() => this.innerProtocolService.conn({})), switchMap(() => this.innerProtocolService.conn({})),
switchMap(res => { switchMap(res => {
connRres = res;
return this.authenticationProtocolService.login({ return this.authenticationProtocolService.login({
loginId: loginInfo.loginId, loginId: loginInfo.loginId,
loginPw: loginInfo.loginPw, loginPw: loginInfo.loginPw,
@ -119,19 +110,28 @@ export class AppMessengerResolver implements Resolve<void> {
productName: 'EZMessenger' productName: 'EZMessenger'
}); });
}), }),
switchMap(res => switchMap(res => {
forkJoin([ loginRes = res;
return forkJoin([
this.queryProtocolService.auth({ this.queryProtocolService.auth({
deviceType: environmentsInfo.deviceType deviceType: environmentsInfo.deviceType
}), }),
this.optionProtocolService.regView({}) this.optionProtocolService.regView({})
]) ]);
), }),
tap(([authRes, regViewRes]) => { map(([authRes, regViewRes]) => {
this.store.dispatch( this.store.dispatch(
OptionStore.regViewSuccess({ res: regViewRes }) OptionStore.regViewSuccess({ res: regViewRes })
); );
this.store.dispatch(QueryStore.authSuccess({ res: authRes })); this.store.dispatch(QueryStore.authSuccess({ res: authRes }));
this.store.dispatch(
CompanyStore.companyList({
companyGroupCode: 'LG'
})
);
// this.store.dispatch(AuthenticationStore.postLogin({ loginRes }));
}), }),
withLatestFrom( withLatestFrom(
this.store.pipe( this.store.pipe(
@ -139,11 +139,26 @@ export class AppMessengerResolver implements Resolve<void> {
), ),
this.store.pipe( this.store.pipe(
select(AppStore.MessengerSelector.SyncSelector.group2SyncDate) select(AppStore.MessengerSelector.SyncSelector.group2SyncDate)
),
this.store.pipe(
select(AppStore.MessengerSelector.SyncSelector.roomSyncDate)
) )
), ),
map(([[], buddy2SyncDate, group2SyncDate]) => { map(([_, buddy2SyncDate, group2SyncDate, roomSyncDate]) => {
this.store.dispatch(SyncStore.buddy2({ syncDate: buddy2SyncDate })); this.store.dispatch(SyncStore.buddy2({ syncDate: buddy2SyncDate }));
this.store.dispatch(SyncStore.group2({ syncDate: group2SyncDate })); this.store.dispatch(SyncStore.group2({ syncDate: group2SyncDate }));
this.store.dispatch(
SyncStore.room({
syncDate: roomSyncDate,
localeCode: loginInfo.localeCode
})
);
this.store.dispatch(
QueryStore.dept({
divCd: 'ORG',
companyCode: loginInfo.companyCode
})
);
}), }),
catchError(err => { catchError(err => {
return throwError(err); return throwError(err);
@ -153,18 +168,13 @@ export class AppMessengerResolver implements Resolve<void> {
() => { () => {
this.store.dispatch( this.store.dispatch(
AuthenticationStore.loginSuccess({ AuthenticationStore.loginSuccess({
loginInfo: loginRes loginRes
}) })
); );
console.log('next');
resolve(); resolve();
}, },
err => { err => {
console.log('err', err);
reject(err); reject(err);
},
() => {
console.log('complete');
} }
); );
}); });

View File

@ -1,16 +1,15 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { filter, tap } from 'rxjs/operators'; import { tap } from 'rxjs/operators';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { ProtocolService } from '@ucap-webmessenger/protocol';
import { import {
SVC_TYPE_LOGOUT,
SSVC_TYPE_LOGOUT_RES, SSVC_TYPE_LOGOUT_RES,
SSVC_TYPE_LOGOUT_REMOTE_NOTI, SSVC_TYPE_LOGOUT_REMOTE_NOTI,
decodeLogout, AuthenticationProtocolService,
decodeLogoutRemoteNotification LogoutResponse,
LogoutRemoteNotification
} from '@ucap-webmessenger/protocol-authentication'; } from '@ucap-webmessenger/protocol-authentication';
import * as AuthenticationStore from '../store/account/authentication'; import * as AuthenticationStore from '../store/account/authentication';
@ -19,36 +18,29 @@ import { NGXLogger } from 'ngx-logger';
@Injectable() @Injectable()
export class AppNotificationService { export class AppNotificationService {
constructor( constructor(
private protocolService: ProtocolService, private authenticationProtocolService: AuthenticationProtocolService,
private store: Store<any>, private store: Store<any>,
private logger: NGXLogger private logger: NGXLogger
) {} ) {}
public subscribe(): void { public subscribe(): void {
this.protocolService.serverMessage this.authenticationProtocolService.logoutNotification$
.pipe( .pipe(
filter( tap(notiOrRes => {
message => switch (notiOrRes.Type) {
message.serviceType === SVC_TYPE_LOGOUT && case SSVC_TYPE_LOGOUT_RES:
message.subServiceType === SSVC_TYPE_LOGOUT_RES {
), const res = notiOrRes as LogoutResponse;
tap(message => { }
const logoutRes = decodeLogout(message); break;
this.logger.debug('logoutRes', logoutRes); case SSVC_TYPE_LOGOUT_REMOTE_NOTI:
this.store.dispatch(AuthenticationStore.logout()); {
}) const noti = notiOrRes as LogoutRemoteNotification;
) }
.subscribe(); break;
default:
this.protocolService.serverMessage break;
.pipe( }
filter(
message =>
message.serviceType === SVC_TYPE_LOGOUT &&
message.subServiceType === SSVC_TYPE_LOGOUT_REMOTE_NOTI
),
tap(message => {
const logoutRemoteNoti = decodeLogoutRemoteNotification(message);
this.store.dispatch(AuthenticationStore.logout()); this.store.dispatch(AuthenticationStore.logout());
}) })
) )

View File

@ -3,7 +3,11 @@ import { createAction, props } from '@ngrx/store';
import { Login2Response } from '@ucap-webmessenger/pi'; import { Login2Response } from '@ucap-webmessenger/pi';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication'; import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
import { LoginInfo } from '../../../types'; import { LoginInfo } from '@app/types';
import {
UserPasswordSetRequest,
UserPasswordSetResponse
} from '@ucap-webmessenger/protocol-service';
export const webLogin = createAction( export const webLogin = createAction(
'[Account::Authentication] Web Login', '[Account::Authentication] Web Login',
@ -30,7 +34,7 @@ export const webLoginFailure = createAction(
export const loginSuccess = createAction( export const loginSuccess = createAction(
'[Account::Authentication] Login Success', '[Account::Authentication] Login Success',
props<{ props<{
loginInfo: LoginResponse; loginRes: LoginResponse;
}>() }>()
); );
@ -52,3 +56,47 @@ export const logoutConfirmation = createAction(
export const logoutConfirmationDismiss = createAction( export const logoutConfirmationDismiss = createAction(
'[Account::Authentication] Logout Confirmation Dismiss' '[Account::Authentication] Logout Confirmation Dismiss'
); );
export const postLogin = createAction(
'[Account::Authentication] Post Login',
props<{
loginRes: LoginResponse;
}>()
);
export const privacyAgree = createAction(
'[Account::Authentication] Privacy Agree',
props<{
loginRes: LoginResponse;
}>()
);
export const privacyAgreeSuccess = createAction(
'[Account::Authentication] Privacy Agree Success'
);
export const privacyAgreeFailure = createAction(
'[Account::Authentication] Privacy Agree Failure',
props<{ error: any }>()
);
export const privacyDisagree = createAction(
'[Account::Authentication] Privacy Disagree'
);
export const changePassword = createAction(
'[Account::Authentication] Change Password',
props<{ req: UserPasswordSetRequest }>()
);
export const changePasswordSuccess = createAction(
'[Account::Authentication] Change Password Success',
props<{
res: UserPasswordSetResponse;
}>()
);
export const changePasswordFailure = createAction(
'[Account::Authentication] Change Password Failure',
props<{ error: any }>()
);

View File

@ -6,7 +6,11 @@ import { catchError, exhaustMap, map, tap, switchMap } from 'rxjs/operators';
import { Actions, ofType, createEffect } from '@ngrx/effects'; import { Actions, ofType, createEffect } from '@ngrx/effects';
import { PiService, Login2Response } from '@ucap-webmessenger/pi'; import {
PiService,
Login2Response,
UserTermsActionResponse
} from '@ucap-webmessenger/pi';
import { NativeService, UCAP_NATIVE_SERVICE } from '@ucap-webmessenger/native'; import { NativeService, UCAP_NATIVE_SERVICE } from '@ucap-webmessenger/native';
import { import {
DialogService, DialogService,
@ -22,11 +26,30 @@ import {
logoutConfirmationDismiss, logoutConfirmationDismiss,
webLogin, webLogin,
webLoginSuccess, webLoginSuccess,
webLoginFailure webLoginFailure,
postLogin,
privacyAgree,
privacyDisagree,
privacyAgreeFailure,
privacyAgreeSuccess,
changePassword,
changePasswordFailure,
changePasswordSuccess
} from './actions'; } from './actions';
import { LoginInfo } from '../../../types'; import {
import { AppAuthenticationService } from '../../../services/authentication.service'; LoginInfo,
KEY_LOGIN_INFO,
EnvironmentsInfo,
KEY_ENVIRONMENTS_INFO
} from '@app/types';
import { AppAuthenticationService } from '@app/services/authentication.service';
import { NGXLogger } from 'ngx-logger'; import { NGXLogger } from 'ngx-logger';
import { Store } from '@ngrx/store';
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import {
ServiceProtocolService,
UserPasswordSetResponse
} from '@ucap-webmessenger/protocol-service';
@Injectable() @Injectable()
export class Effects { export class Effects {
@ -125,11 +148,139 @@ export class Effects {
) )
); );
postLogin$ = createEffect(
() =>
this.actions$.pipe(
ofType(postLogin),
map(action => action.loginRes),
tap(async loginRes => {
const loginInfo = this.sessionStorageService.get<LoginInfo>(
KEY_LOGIN_INFO
);
const environmentsInfo = this.sessionStorageService.get<
EnvironmentsInfo
>(KEY_ENVIRONMENTS_INFO);
if (!loginRes.privateInformationAgree) {
const privacyTotalUrl = this.piService.privacyTotalUrl({
companyCode: loginInfo.companyCode,
userSeq: loginRes.userSeq,
token: loginRes.tokenString,
deviceType: environmentsInfo.deviceType,
localeCode: loginInfo.localeCode,
textOnly: 'true'
});
const result = await this.dialogService.open<
ConfirmDialogComponent,
ConfirmDialogData,
ConfirmDialogResult
>(ConfirmDialogComponent, {
width: '100%',
height: '500px',
disableClose: true,
data: {
title: '개인정보 동의'
// html: `<iframe id="ifm_privacy" src="${privacyTotalUrl}" style="width: 100%;height: 300px;" />`
}
});
if (result.choice) {
this.store.dispatch(privacyAgree({ loginRes }));
} else {
this.store.dispatch(privacyDisagree());
return;
}
}
if (!!loginRes.passwordExpired) {
const result = await this.dialogService.open<
ConfirmDialogComponent,
ConfirmDialogData,
ConfirmDialogResult
>(ConfirmDialogComponent, {
width: '100%',
height: '500px',
disableClose: true,
data: {
title: '패스워드 만료',
message: ''
}
});
if (result.choice) {
} else {
return;
}
}
})
),
{ dispatch: false }
);
privacyAgree$ = createEffect(() =>
this.actions$.pipe(
ofType(privacyAgree),
map(action => {
const loginInfo = this.sessionStorageService.get<LoginInfo>(
KEY_LOGIN_INFO
);
const environmentsInfo = this.sessionStorageService.get<
EnvironmentsInfo
>(KEY_ENVIRONMENTS_INFO);
return {
loginInfo,
environmentsInfo,
loginResponse: action.loginRes
};
}),
exhaustMap(params =>
this.piService
.userTermsAction({
userSeq: params.loginResponse.userSeq,
token: params.loginResponse.tokenString,
deviceType: params.environmentsInfo.deviceType
})
.pipe(
map((res: UserTermsActionResponse) => {
if ('00' !== res.responseCode) {
return privacyAgreeFailure({ error: 'Failed' });
} else {
return privacyAgreeSuccess();
}
}),
catchError(error => of(privacyAgreeFailure({ error })))
)
)
)
);
changePassword$ = createEffect(() =>
this.actions$.pipe(
ofType(changePassword),
map(action => action.req),
exhaustMap(req =>
this.serviceProtocolService.userPasswordSet(req).pipe(
map((res: UserPasswordSetResponse) => {
return changePasswordSuccess({
res
});
}),
catchError(error => of(changePasswordFailure({ error })))
)
)
)
);
constructor( constructor(
private actions$: Actions, private actions$: Actions,
private router: Router, private router: Router,
private store: Store<any>,
private sessionStorageService: SessionStorageService,
private piService: PiService, private piService: PiService,
private appAuthenticationService: AppAuthenticationService, private appAuthenticationService: AppAuthenticationService,
private serviceProtocolService: ServiceProtocolService,
private dialogService: DialogService, private dialogService: DialogService,
@Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService, @Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService,
private logger: NGXLogger private logger: NGXLogger

View File

@ -7,7 +7,7 @@ export const reducer = createReducer(
on(loginSuccess, (state, action) => { on(loginSuccess, (state, action) => {
return { return {
...state, ...state,
loginInfo: action.loginInfo loginRes: action.loginRes
}; };
}) })
); );

View File

@ -3,18 +3,18 @@ import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
// tslint:disable-next-line: no-empty-interface // tslint:disable-next-line: no-empty-interface
export interface State { export interface State {
loginInfo: LoginResponse | null; loginRes: LoginResponse | null;
} }
export const initialState: State = { export const initialState: State = {
loginInfo: null loginRes: null
}; };
export function selectors<S>(selector: Selector<any, State>) { export function selectors<S>(selector: Selector<any, State>) {
return { return {
loginInfo: createSelector( loginRes: createSelector(
selector, selector,
(state: State) => state.loginInfo (state: State) => state.loginRes
) )
}; };
} }

View File

@ -2,22 +2,16 @@ import { Type } from '@angular/core';
import { Action, combineReducers, Selector, createSelector } from '@ngrx/store'; import { Action, combineReducers, Selector, createSelector } from '@ngrx/store';
import * as AuthenticationStore from './authentication'; import * as AuthenticationStore from './authentication';
import * as PrivacyStore from './privacy';
export interface State { export interface State {
authentication: AuthenticationStore.State; authentication: AuthenticationStore.State;
privacy: PrivacyStore.State;
} }
export const effects: Type<any>[] = [ export const effects: Type<any>[] = [AuthenticationStore.Effects];
AuthenticationStore.Effects,
PrivacyStore.Effects
];
export function reducers(state: State | undefined, action: Action) { export function reducers(state: State | undefined, action: Action) {
return combineReducers({ return combineReducers({
authentication: AuthenticationStore.reducer, authentication: AuthenticationStore.reducer
privacy: PrivacyStore.reducer
})(state, action); })(state, action);
} }
@ -28,12 +22,6 @@ export function selectors<S>(selector: Selector<any, State>) {
selector, selector,
(state: State) => state.authentication (state: State) => state.authentication
) )
),
PrivacySelector: PrivacyStore.selectors(
createSelector(
selector,
(state: State) => state.privacy
)
) )
}; };
} }

View File

@ -1,25 +0,0 @@
import { createAction, props } from '@ngrx/store';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
export const agreeConfirmationNotNeeded = createAction(
'[Account::Privacy] Agree Confirmation not needed'
);
export const agreeConfirmationYes = createAction(
'[Account::Privacy] Agree Confirmation Yes',
props<{
loginInfo: LoginResponse;
}>()
);
export const agreeConfirmationNo = createAction(
'[Account::Privacy] Agree Confirmation No'
);
export const agreeSuccess = createAction('[Account::Privacy] Agree Success');
export const agreeFailure = createAction(
'[Account::Privacy] Agree Failure',
props<{ error: any }>()
);

View File

@ -1,157 +0,0 @@
import { Injectable } from '@angular/core';
import { Router } from '@angular/router';
import { Actions, ofType, createEffect } from '@ngrx/effects';
import { of } from 'rxjs';
import { catchError, exhaustMap, map } from 'rxjs/operators';
import {
PiService,
UserTermsActionResponse,
ResponseStatus
} from '@ucap-webmessenger/pi';
import {
DialogService,
ConfirmDialogComponent,
ConfirmDialogData,
ConfirmDialogResult
} from '@ucap-webmessenger/ui';
import { AppAuthenticationService } from '@app/services/authentication.service';
import { loginSuccess, logout } from '../authentication';
import {
agreeConfirmationYes,
agreeConfirmationNo,
agreeConfirmationNotNeeded,
agreeSuccess,
agreeFailure
} from './actions';
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import {
LoginInfo,
KEY_LOGIN_INFO,
EnvironmentsInfo,
KEY_ENVIRONMENTS_INFO
} from '@app/types';
import { initSettings } from '@app/store/setting/init';
@Injectable()
export class Effects {
// agreeConfirmation$ = createEffect(() =>
// this.actions$.pipe(
// ofType(loginSuccess),
// exhaustMap(async params => {
// if (params.loginInfo.privateInformationAgree) {
// return null;
// }
// const loginInfo = this.sessionStorageService.get<LoginInfo>(
// KEY_LOGIN_INFO
// );
// const environmentsInfo = this.sessionStorageService.get<
// EnvironmentsInfo
// >(KEY_ENVIRONMENTS_INFO);
// const privacyTotalUrl = this.piService.privacyTotalUrl({
// companyCode: params.loginInfo.companyCode,
// userSeq: params.loginInfo.userSeq,
// token: params.loginInfo.tokenString,
// deviceType: environmentsInfo.deviceType,
// localeCode: loginInfo.localeCode,
// textOnly: 'true'
// });
// const result = await this.dialogService.open<
// ConfirmDialogComponent,
// ConfirmDialogData,
// ConfirmDialogResult
// >(ConfirmDialogComponent, {
// width: '100%',
// height: '500px',
// disableClose: true,
// data: {
// title: '개인정보 동의',
// html: `<iframe id="ifm_privacy" src="${privacyTotalUrl}" style="width: 100%;height: 300px;" />`
// }
// });
// return {
// loginInfo: params.loginInfo,
// choice: result.choice
// };
// }),
// map(params => {
// if (!params) {
// return agreeConfirmationNotNeeded();
// }
// return params.choice
// ? agreeConfirmationYes({ loginInfo: params.loginInfo })
// : agreeConfirmationNo();
// })
// )
// );
agreeConfirmationYes$ = createEffect(() =>
this.actions$.pipe(
ofType(agreeConfirmationYes),
map(action => {
const loginInfo = this.sessionStorageService.get<LoginInfo>(
KEY_LOGIN_INFO
);
const environmentsInfo = this.sessionStorageService.get<
EnvironmentsInfo
>(KEY_ENVIRONMENTS_INFO);
return {
loginInfo,
environmentsInfo,
loginResponse: action.loginInfo
};
}),
exhaustMap(params =>
this.piService
.userTermsAction({
userSeq: params.loginResponse.userSeq,
token: params.loginResponse.tokenString,
deviceType: params.environmentsInfo.deviceType
})
.pipe(
map((res: UserTermsActionResponse) => {
if ('00' !== res.responseCode) {
return agreeFailure({ error: 'Failed' });
} else {
return agreeSuccess();
}
}),
catchError(error => of(agreeFailure({ error })))
)
)
)
);
agreeSuccess$ = createEffect(() =>
this.actions$.pipe(
ofType(agreeSuccess),
map(() => initSettings())
)
);
agreeFailure$ = createEffect(() =>
this.actions$.pipe(
ofType(agreeFailure),
map(action => action),
map(() => logout())
)
);
constructor(
private actions$: Actions,
private router: Router,
private piService: PiService,
private sessionStorageService: SessionStorageService,
private appAuthenticationService: AppAuthenticationService,
private dialogService: DialogService
) {}
}

View File

@ -1,4 +0,0 @@
import { Action, combineReducers, createReducer, on } from '@ngrx/store';
import { State, initialState } from './state';
export const reducer = createReducer(initialState);

View File

@ -1,11 +0,0 @@
import { Selector, createSelector } from '@ngrx/store';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
// tslint:disable-next-line: no-empty-interface
export interface State {}
export const initialState: State = {};
export function selectors<S>(selector: Selector<any, State>) {
return {};
}

View File

@ -2,5 +2,5 @@ import { createAction, props } from '@ngrx/store';
export const selectedRoom = createAction( export const selectedRoom = createAction(
'[Messenger::Chat] selectedRoom', '[Messenger::Chat] selectedRoom',
props<{ roomSeq: number }>() props<{ roomSeq: string }>()
); );

View File

@ -1,7 +1,7 @@
import { Selector, createSelector } from '@ngrx/store'; import { Selector, createSelector } from '@ngrx/store';
export interface State { export interface State {
selectedRoom: number | null; selectedRoom: string | null;
} }
export const initialState: State = { export const initialState: State = {

View File

@ -0,0 +1,51 @@
import { createAction, props } from '@ngrx/store';
import {
InfoRequest,
Info,
InfoResponse,
SendResponse,
SendRequest
} from '@ucap-webmessenger/protocol-event';
export const info = createAction(
'[Messenger::Event] Info',
props<InfoRequest>()
);
export const infoSuccess = createAction(
'[Messenger::Event] Info Success',
props<{
infoList: Info[];
res: InfoResponse;
}>()
);
export const infoFailure = createAction(
'[Messenger::Event] Info Failure',
props<{ error: any }>()
);
export const appendInfoList = createAction(
'[Messenger::Event] Append InfoList',
props<{
info: Info;
}>()
);
export const send = createAction(
'[Messenger::Event] Send',
props<{ senderSeq: number; req: SendRequest }>()
);
export const sendSuccess = createAction(
'[Messenger::Event] Send Success',
props<{
senderSeq: number;
res: SendResponse;
}>()
);
export const sendFailure = createAction(
'[Messenger::Event] Send Failure',
props<{ error: any }>()
);

View File

@ -0,0 +1,129 @@
import { Injectable } from '@angular/core';
import { Actions, createEffect, ofType } from '@ngrx/effects';
import { Store } from '@ngrx/store';
import { NGXLogger } from 'ngx-logger';
import { of } from 'rxjs';
import { tap, switchMap, map, catchError, exhaustMap } from 'rxjs/operators';
import {
InfoData,
Info,
InfoResponse,
EventProtocolService,
SSVC_TYPE_EVENT_INFO_DATA,
SSVC_TYPE_EVENT_INFO_RES,
SendResponse
} from '@ucap-webmessenger/protocol-event';
import * as ChatStore from '@app/store/messenger/chat';
import {
info,
infoSuccess,
infoFailure,
send,
sendSuccess,
sendFailure,
appendInfoList
} from './actions';
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
@Injectable()
export class Effects {
selectedRoomForInfo$ = createEffect(() =>
this.actions$.pipe(
ofType(ChatStore.selectedRoom),
map(action => {
return info({
roomSeq: action.roomSeq,
baseSeq: 0,
requestCount: 50
});
})
)
);
info$ = createEffect(
() => {
let infoList: Info[];
return this.actions$.pipe(
ofType(info),
tap(() => {
infoList = [];
}),
switchMap(req => {
return this.eventProtocolService.info(req).pipe(
map(res => {
switch (res.Type) {
case SSVC_TYPE_EVENT_INFO_DATA:
infoList.push(...(res as InfoData).infoList);
break;
case SSVC_TYPE_EVENT_INFO_RES:
this.store.dispatch(
infoSuccess({
infoList,
res: res as InfoResponse
})
);
break;
}
}),
catchError(error => of(infoFailure({ error })))
);
})
);
},
{ dispatch: false }
);
send$ = createEffect(() =>
this.actions$.pipe(
ofType(send),
exhaustMap(action =>
this.eventProtocolService.send(action.req).pipe(
map((res: SendResponse) => {
return sendSuccess({
senderSeq: action.senderSeq,
res
});
}),
catchError(error => of(sendFailure({ error })))
)
)
)
);
sendSuccess$ = createEffect(
() => {
return this.actions$.pipe(
ofType(sendSuccess),
tap(action => {
const res = action.res;
const appendInfo: Info = {
seq: res.seq,
type: res.eventType,
senderSeq: action.senderSeq,
sendDate: res.sendDate,
sentMessage: res.message,
receiverCount: res.receiverCount
};
this.store.dispatch(appendInfoList({ info: appendInfo }));
})
);
},
{ dispatch: false }
);
constructor(
private actions$: Actions,
private store: Store<any>,
private eventProtocolService: EventProtocolService,
private sessionStorageService: SessionStorageService,
private logger: NGXLogger
) {}
}

View File

@ -0,0 +1,36 @@
import { createReducer, on } from '@ngrx/store';
import { initialState } from './state';
import { infoSuccess, appendInfoList, info, infoFailure } from './actions';
export const reducer = createReducer(
initialState,
on(info, (state, action) => {
return {
...state,
infoListProcessing: true
};
}),
on(infoSuccess, (state, action) => {
return {
...state,
infoList: action.infoList,
infoStatus: action.res,
infoListProcessing: false
};
}),
on(infoFailure, (state, action) => {
return {
...state,
infoListProcessing: false
};
}),
on(appendInfoList, (state, action) => {
return {
...state,
infoList: [...state.infoList, action.info]
};
})
);

View File

@ -0,0 +1,31 @@
import { Selector, createSelector } from '@ngrx/store';
import { InfoResponse, Info } from '@ucap-webmessenger/protocol-event';
export interface State {
infoListProcessing: boolean;
infoList: Info[] | null;
infoStatus: InfoResponse | null;
}
export const initialState: State = {
infoListProcessing: false,
infoList: null,
infoStatus: null
};
export function selectors<S>(selector: Selector<any, State>) {
return {
infoListProcessing: createSelector(
selector,
(state: State) => state.infoListProcessing
),
infoList: createSelector(
selector,
(state: State) => state.infoList
),
infoStatus: createSelector(
selector,
(state: State) => state.infoStatus
)
};
}

View File

@ -2,18 +2,41 @@ import { Type } from '@angular/core';
import { Action, combineReducers, Selector, createSelector } from '@ngrx/store'; import { Action, combineReducers, Selector, createSelector } from '@ngrx/store';
import * as ChatStore from './chat'; import * as ChatStore from './chat';
import * as EventStore from './event';
import * as OptionStore from './option';
import * as QueryStore from './query';
import * as RoomStore from './room';
import * as StatusStore from './status';
import * as SyncStore from './sync'; import * as SyncStore from './sync';
export interface State { export interface State {
chat: ChatStore.State; chat: ChatStore.State;
event: EventStore.State;
option: OptionStore.State;
query: QueryStore.State;
room: RoomStore.State;
status: StatusStore.State;
sync: SyncStore.State; sync: SyncStore.State;
} }
export const effects: Type<any>[] = [ChatStore.Effects, SyncStore.Effects]; export const effects: Type<any>[] = [
ChatStore.Effects,
EventStore.Effects,
OptionStore.Effects,
QueryStore.Effects,
RoomStore.Effects,
StatusStore.Effects,
SyncStore.Effects
];
export function reducers(state: State | undefined, action: Action) { export function reducers(state: State | undefined, action: Action) {
return combineReducers({ return combineReducers({
chat: ChatStore.reducer, chat: ChatStore.reducer,
event: EventStore.reducer,
option: OptionStore.reducer,
query: QueryStore.reducer,
room: RoomStore.reducer,
status: StatusStore.reducer,
sync: SyncStore.reducer sync: SyncStore.reducer
})(state, action); })(state, action);
} }
@ -26,6 +49,36 @@ export function selectors<S>(selector: Selector<any, State>) {
(state: State) => state.chat (state: State) => state.chat
) )
), ),
EventSelector: EventStore.selectors(
createSelector(
selector,
(state: State) => state.event
)
),
OptionSelector: OptionStore.selectors(
createSelector(
selector,
(state: State) => state.option
)
),
RoomSelector: RoomStore.selectors(
createSelector(
selector,
(state: State) => state.room
)
),
QuerySelector: QueryStore.selectors(
createSelector(
selector,
(state: State) => state.query
)
),
StatusSelector: StatusStore.selectors(
createSelector(
selector,
(state: State) => state.status
)
),
SyncSelector: SyncStore.selectors( SyncSelector: SyncStore.selectors(
createSelector( createSelector(
selector, selector,

View File

@ -8,31 +8,31 @@ import {
} from '@ucap-webmessenger/protocol-option'; } from '@ucap-webmessenger/protocol-option';
export const regView = createAction( export const regView = createAction(
'[Setting::Option] RegView', '[Messenger::Option] RegView',
props<RegViewRequest>() props<RegViewRequest>()
); );
export const regViewSuccess = createAction( export const regViewSuccess = createAction(
'[Setting::Option] RegView Success', '[Messenger::Option] RegView Success',
props<{ res: RegViewResponse }>() props<{ res: RegViewResponse }>()
); );
export const regViewFailure = createAction( export const regViewFailure = createAction(
'[Setting::Option] RegView Failure', '[Messenger::Option] RegView Failure',
props<{ error: any }>() props<{ error: any }>()
); );
export const regUpdate = createAction( export const regUpdate = createAction(
'[Setting::Option] RegUpdate', '[Messenger::Option] RegUpdate',
props<RegUpdateRequest>() props<RegUpdateRequest>()
); );
export const regUpdateSuccess = createAction( export const regUpdateSuccess = createAction(
'[Setting::Option] RegUpdate Success', '[Messenger::Option] RegUpdate Success',
props<{ res: RegUpdateResponse }>() props<{ res: RegUpdateResponse }>()
); );
export const regUpdateFailure = createAction( export const regUpdateFailure = createAction(
'[Setting::Option] RegUpdate Failure', '[Messenger::Option] RegUpdate Failure',
props<{ error: any }>() props<{ error: any }>()
); );

View File

@ -6,24 +6,12 @@ import { of } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators'; import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { regViewSuccess, regViewFailure } from './actions'; import { regViewSuccess, regViewFailure } from './actions';
import { initSettings } from '../init';
import { OptionProtocolService } from '@ucap-webmessenger/protocol-option'; import { OptionProtocolService } from '@ucap-webmessenger/protocol-option';
import { loginSuccess } from '@app/store/account/authentication'; import { loginSuccess } from '@app/store/account/authentication';
@Injectable() @Injectable()
export class Effects { export class Effects {
// initSettings$ = createEffect(() =>
// this.actions$.pipe(
// ofType(loginSuccess),
// exhaustMap(() =>
// this.optionProtocolService.regView({}).pipe(
// map(res => regViewSuccess({ res })),
// catchError(error => of(regViewFailure({ error })))
// )
// )
// )
// );
constructor( constructor(
private actions$: Actions, private actions$: Actions,
private optionProtocolService: OptionProtocolService private optionProtocolService: OptionProtocolService

View File

@ -1,7 +1,6 @@
import { Selector, createSelector } from '@ngrx/store'; import { Selector, createSelector } from '@ngrx/store';
import { RegViewResponse } from '@ucap-webmessenger/protocol-option'; import { RegViewResponse } from '@ucap-webmessenger/protocol-option';
// tslint:disable-next-line: no-empty-interface
export interface State { export interface State {
reg?: RegViewResponse; reg?: RegViewResponse;
} }

View File

@ -0,0 +1,56 @@
import { createAction, props } from '@ngrx/store';
import {
AuthRequest,
AuthResponse,
DeptRequest,
DeptInfo,
DeptUserRequest,
UserInfoSS,
DeptUserResponse
} from '@ucap-webmessenger/protocol-query';
export const auth = createAction(
'[Messenger::Query] Auth',
props<AuthRequest>()
);
export const authSuccess = createAction(
'[Messenger::Query] Auth Success',
props<{ res: AuthResponse }>()
);
export const authFailure = createAction(
'[Messenger::Query] Auth Failure',
props<{ error: any }>()
);
export const dept = createAction(
'[Messenger::Query] Dept',
props<DeptRequest>()
);
export const deptSuccess = createAction(
'[Messenger::Query] Dept Success',
props<{ departmentInfoList: DeptInfo[] }>()
);
export const deptFailure = createAction(
'[Messenger::Query] Dept Failure',
props<{ error: any }>()
);
export const deptUser = createAction(
'[Messenger::Query] Dept User',
props<DeptUserRequest>()
);
export const deptUserSuccess = createAction(
'[Messenger::Query] Dept User Success',
props<{ userInfos: UserInfoSS[]; res: DeptUserResponse }>()
);
export const deptUserFailure = createAction(
'[Messenger::Query] Dept User Failure',
props<{ error: any }>()
);

View File

@ -0,0 +1,108 @@
import { Injectable } from '@angular/core';
import { Actions, ofType, createEffect } from '@ngrx/effects';
import { of } from 'rxjs';
import { catchError, map, tap, switchMap } from 'rxjs/operators';
import {
dept,
deptSuccess,
deptFailure,
deptUser,
deptUserSuccess,
deptUserFailure
} from './actions';
import {
QueryProtocolService,
DeptInfo,
SSVC_TYPE_QUERY_DEPT_DATA,
SSVC_TYPE_QUERY_DEPT_RES,
DeptData,
UserInfoSS,
SSVC_TYPE_QUERY_DEPT_USER_DATA,
DeptUserData,
SSVC_TYPE_QUERY_DEPT_USER_RES,
DeptUserResponse
} from '@ucap-webmessenger/protocol-query';
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { Store } from '@ngrx/store';
@Injectable()
export class Effects {
dept$ = createEffect(
() => {
let departmentInfoList: DeptInfo[];
return this.actions$.pipe(
ofType(dept),
tap(() => {
departmentInfoList = [];
}),
switchMap(req => {
return this.queryProtocolService.dept(req).pipe(
map(res => {
switch (res.Type) {
case SSVC_TYPE_QUERY_DEPT_DATA:
departmentInfoList.push(...(res as DeptData).departmentInfos);
break;
case SSVC_TYPE_QUERY_DEPT_RES:
this.store.dispatch(
deptSuccess({
departmentInfoList
})
);
break;
}
}),
catchError(error => of(deptFailure({ error })))
);
})
);
},
{ dispatch: false }
);
deptUser$ = createEffect(
() => {
let userInfos: UserInfoSS[];
return this.actions$.pipe(
ofType(deptUser),
tap(() => {
userInfos = [];
}),
switchMap(req => {
return this.queryProtocolService.deptUser(req).pipe(
map(res => {
switch (res.Type) {
case SSVC_TYPE_QUERY_DEPT_USER_DATA:
userInfos.push(...(res as DeptUserData).userInfos);
break;
case SSVC_TYPE_QUERY_DEPT_USER_RES:
this.store.dispatch(
deptUserSuccess({
userInfos,
res: res as DeptUserResponse
})
);
break;
}
}),
catchError(error => of(deptUserFailure({ error })))
);
})
);
},
{ dispatch: false }
);
constructor(
private actions$: Actions,
private store: Store<any>,
private sessionStorageService: SessionStorageService,
private queryProtocolService: QueryProtocolService
) {}
}

View File

@ -0,0 +1,28 @@
import { createReducer, on } from '@ngrx/store';
import { initialState } from './state';
import { authSuccess, deptSuccess, deptUserSuccess } from './actions';
export const reducer = createReducer(
initialState,
on(authSuccess, (state, action) => {
return {
...state,
auth: action.res
};
}),
on(deptSuccess, (state, action) => {
return {
...state,
departmentInfoList: action.departmentInfoList
};
}),
on(deptUserSuccess, (state, action) => {
return {
...state,
selectedDepartmentUserInfoList: action.userInfos,
selectedDepartmentStatus: action.res
};
})
);

View File

@ -0,0 +1,44 @@
import { Selector, createSelector } from '@ngrx/store';
import {
AuthResponse,
DeptInfo,
UserInfoSS,
DeptUserResponse
} from '@ucap-webmessenger/protocol-query';
export interface State {
auth?: AuthResponse;
departmentInfoList: DeptInfo[] | null;
selectedDepartmentUserInfoList: UserInfoSS[] | null;
selectedDepartmentStatus: DeptUserResponse | null;
}
export const initialState: State = {
auth: null,
departmentInfoList: null,
selectedDepartmentUserInfoList: null,
selectedDepartmentStatus: null
};
export function selectors<S>(selector: Selector<any, State>) {
return {
auth: createSelector(
selector,
(state: State) => state.auth
),
departmentInfoList: createSelector(
selector,
(state: State) => state.departmentInfoList
),
selectedDepartmentUserInfoList: createSelector(
selector,
(state: State) => state.selectedDepartmentUserInfoList
),
selectedDepartmentStatus: createSelector(
selector,
(state: State) => state.selectedDepartmentStatus
)
};
}

View File

@ -0,0 +1,26 @@
import { createAction, props } from '@ngrx/store';
import {
InfoRequest,
RoomInfo,
UserInfoShort,
UserInfo
} from '@ucap-webmessenger/protocol-room';
export const info = createAction(
'[Messenger::Room] Info',
props<InfoRequest>()
);
export const infoSuccess = createAction(
'[Messenger::Room] Info Success',
props<{
roomInfo: RoomInfo;
userInfoShortList: UserInfoShort[];
userInfoList: UserInfo[];
}>()
);
export const infoFailure = createAction(
'[Messenger::Room] Info Failure',
props<{ error: any }>()
);

View File

@ -0,0 +1,101 @@
import { Injectable } from '@angular/core';
import { Actions, createEffect, ofType } from '@ngrx/effects';
import { Store } from '@ngrx/store';
import { NGXLogger } from 'ngx-logger';
import { of } from 'rxjs';
import { tap, switchMap, map, catchError } from 'rxjs/operators';
import {
RoomInfo,
UserInfoShort,
UserInfo,
RoomProtocolService,
SSVC_TYPE_ROOM_INFO_ROOM,
InfoData,
SSVC_TYPE_ROOM_INFO_USER,
SSVC_TYPE_ROOM_INFO_USER2,
SSVC_TYPE_ROOM_INFO_RES,
UserShortData,
UserData
} from '@ucap-webmessenger/protocol-room';
import * as ChatStore from '@app/store/messenger/chat';
import { info, infoSuccess, infoFailure } from './actions';
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { LoginInfo, KEY_LOGIN_INFO } from '@app/types';
@Injectable()
export class Effects {
selectedRoomForInfo$ = createEffect(() =>
this.actions$.pipe(
ofType(ChatStore.selectedRoom),
map(action => {
const loginInfo = this.sessionStorageService.get<LoginInfo>(
KEY_LOGIN_INFO
);
return info({
roomSeq: action.roomSeq,
isDetail: true,
localeCode: loginInfo.localeCode
});
})
)
);
info$ = createEffect(
() => {
let roomInfo: RoomInfo;
let userInfoShortList: UserInfoShort[];
let userInfoList: UserInfo[];
return this.actions$.pipe(
ofType(info),
tap(() => {
roomInfo = null;
userInfoShortList = [];
userInfoList = [];
}),
switchMap(req => {
return this.roomProtocolService.info(req).pipe(
map(res => {
switch (res.Type) {
case SSVC_TYPE_ROOM_INFO_ROOM:
roomInfo = (res as InfoData).roomInfo;
break;
case SSVC_TYPE_ROOM_INFO_USER:
userInfoShortList.push(...(res as UserShortData).userInfos);
break;
case SSVC_TYPE_ROOM_INFO_USER2:
userInfoList.push(...(res as UserData).userInfos);
break;
case SSVC_TYPE_ROOM_INFO_RES:
this.store.dispatch(
infoSuccess({
roomInfo,
userInfoShortList,
userInfoList
})
);
break;
}
}),
catchError(error => of(infoFailure({ error })))
);
})
);
},
{ dispatch: false }
);
constructor(
private actions$: Actions,
private store: Store<any>,
private roomProtocolService: RoomProtocolService,
private sessionStorageService: SessionStorageService,
private logger: NGXLogger
) {}
}

View File

@ -0,0 +1,4 @@
export * from './actions';
export * from './effects';
export * from './reducers';
export * from './state';

View File

@ -0,0 +1,15 @@
import { createReducer, on } from '@ngrx/store';
import { initialState } from './state';
import { infoSuccess } from './actions';
export const reducer = createReducer(
initialState,
on(infoSuccess, (state, action) => {
return {
...state,
roomInfo: action.roomInfo,
userInfoList: action.userInfoList,
userInfoShortList: action.userInfoShortList
};
})
);

View File

@ -0,0 +1,36 @@
import { Selector, createSelector } from '@ngrx/store';
import {
InfoRequest,
RoomInfo,
UserInfoShort,
UserInfo
} from '@ucap-webmessenger/protocol-room';
export interface State {
roomInfo: RoomInfo | null;
userInfoShortList: UserInfoShort[] | null;
userInfoList: UserInfo[] | null;
}
export const initialState: State = {
roomInfo: null,
userInfoShortList: null,
userInfoList: null
};
export function selectors<S>(selector: Selector<any, State>) {
return {
roomInfo: createSelector(
selector,
(state: State) => state.roomInfo
),
userInfoShortList: createSelector(
selector,
(state: State) => state.userInfoShortList
),
userInfoList: createSelector(
selector,
(state: State) => state.userInfoList
)
};
}

View File

@ -0,0 +1,20 @@
import { createAction, props } from '@ngrx/store';
import {
BulkInfoRequest,
StatusBulkInfo
} from '@ucap-webmessenger/protocol-status';
export const bulkInfo = createAction(
'[Messenger::Status] Bulk Info',
props<BulkInfoRequest>()
);
export const bulkInfoSuccess = createAction(
'[Messenger::Status] Bulk Info Success',
props<{ statusBulkInfoList: StatusBulkInfo[] }>()
);
export const bulkInfoFailure = createAction(
'[Messenger::Status] Bulk Info Failure',
props<{ error: any }>()
);

View File

@ -0,0 +1,77 @@
import { Injectable } from '@angular/core';
import { Actions, createEffect, ofType } from '@ngrx/effects';
import { Store } from '@ngrx/store';
import { NGXLogger } from 'ngx-logger';
import * as SyncStore from '@app/store/messenger/sync';
import { bulkInfo, bulkInfoSuccess, bulkInfoFailure } from './actions';
import { tap, switchMap, map, catchError } from 'rxjs/operators';
import {
StatusProtocolService,
SSVC_TYPE_STATUS_BULK_INFO_DATA,
SSVC_TYPE_STATUS_BULK_INFO_RES,
BulkInfoData,
StatusBulkInfo
} from '@ucap-webmessenger/protocol-status';
import { of } from 'rxjs';
@Injectable()
export class Effects {
buddy2SuccessPostBulk$ = createEffect(() =>
this.actions$.pipe(
ofType(SyncStore.buddy2Success),
map(params => {
const userSeqList: number[] = [];
for (const buddy of params.buddyList) {
userSeqList.push(buddy.seq);
}
return bulkInfo({ divCd: 'bulk', userSeqs: userSeqList });
})
)
);
bulkInfo$ = createEffect(
() => {
let statusBulkInfoList: StatusBulkInfo[];
return this.actions$.pipe(
ofType(bulkInfo),
tap(() => {
statusBulkInfoList = [];
}),
switchMap(req => {
return this.statusProtocolService.bulkInfo(req).pipe(
map(res => {
switch (res.Type) {
case SSVC_TYPE_STATUS_BULK_INFO_DATA:
statusBulkInfoList.push(
...(res as BulkInfoData).statusBulkInfos
);
break;
case SSVC_TYPE_STATUS_BULK_INFO_RES:
this.store.dispatch(
bulkInfoSuccess({
statusBulkInfoList
})
);
break;
}
}),
catchError(error => of(bulkInfoFailure({ error })))
);
})
);
},
{ dispatch: false }
);
constructor(
private actions$: Actions,
private store: Store<any>,
private statusProtocolService: StatusProtocolService,
private logger: NGXLogger
) {}
}

View File

@ -0,0 +1,4 @@
export * from './actions';
export * from './effects';
export * from './reducers';
export * from './state';

View File

@ -1,13 +1,13 @@
import { createReducer, on } from '@ngrx/store'; import { createReducer, on } from '@ngrx/store';
import { initialState } from './state'; import { initialState } from './state';
import { authSuccess } from './actions'; import { bulkInfoSuccess } from './actions';
export const reducer = createReducer( export const reducer = createReducer(
initialState, initialState,
on(authSuccess, (state, action) => { on(bulkInfoSuccess, (state, action) => {
return { return {
...state, ...state,
auth: action.res statusBulkInfoList: action.statusBulkInfoList
}; };
}) })
); );

View File

@ -1,19 +1,19 @@
import { Selector, createSelector } from '@ngrx/store'; import { Selector, createSelector } from '@ngrx/store';
import { AuthResponse } from '@ucap-webmessenger/protocol-query'; import { StatusBulkInfo } from '@ucap-webmessenger/protocol-status';
export interface State { export interface State {
auth?: AuthResponse; statusBulkInfoList: StatusBulkInfo[];
} }
export const initialState: State = { export const initialState: State = {
auth: null statusBulkInfoList: []
}; };
export function selectors<S>(selector: Selector<any, State>) { export function selectors<S>(selector: Selector<any, State>) {
return { return {
auth: createSelector( statusBulkInfoList: createSelector(
selector, selector,
(state: State) => state.auth (state: State) => state.statusBulkInfoList
) )
}; };
} }

View File

@ -49,7 +49,7 @@ import {
RoomUserDetailData, RoomUserDetailData,
RoomResponse RoomResponse
} from '@ucap-webmessenger/protocol-sync'; } from '@ucap-webmessenger/protocol-sync';
import { regViewSuccess } from '@app/store/setting/option'; import { regViewSuccess } from '@app/store/messenger/option';
import { import {
RoomInfo, RoomInfo,
UserInfoShort, UserInfoShort,
@ -127,29 +127,6 @@ export class Effects {
{ dispatch: false } { dispatch: false }
); );
buddy2SuccessPostRoom$ = createEffect(() =>
this.actions$.pipe(
ofType(buddy2Success),
map(action => {
const loginInfo = this.sessionStorageService.get<LoginInfo>(
KEY_LOGIN_INFO
);
return loginInfo.localeCode;
}),
withLatestFrom(
this.store.pipe(
select(state => {
return state.messenger.sync.roomSyncDate as string;
})
)
),
map(([localeCode, roomSyncDate]) =>
room({ syncDate: roomSyncDate, localeCode })
)
)
);
room$ = createEffect( room$ = createEffect(
() => { () => {
let roomList: RoomInfo[]; let roomList: RoomInfo[];
@ -203,12 +180,6 @@ export class Effects {
break; break;
case SSVC_TYPE_SYNC_ROOM_RES: case SSVC_TYPE_SYNC_ROOM_RES:
{ {
this.logger.debug(
'roomList',
roomList,
'roomUserInfoMap',
roomUserInfoMap
);
this.store.dispatch( this.store.dispatch(
roomSuccess({ roomSuccess({
roomList, roomList,

View File

@ -3,23 +3,17 @@ import { Action, combineReducers, Selector, createSelector } from '@ngrx/store';
import * as CompanyStore from './company'; import * as CompanyStore from './company';
import * as InitStore from './init'; import * as InitStore from './init';
import * as OptionStore from './option';
import * as QueryStore from './query';
import * as VersionInfoStore from './version-info'; import * as VersionInfoStore from './version-info';
export interface State { export interface State {
company: CompanyStore.State; company: CompanyStore.State;
init: InitStore.State; init: InitStore.State;
option: OptionStore.State;
query: QueryStore.State;
versionInfo: VersionInfoStore.State; versionInfo: VersionInfoStore.State;
} }
export const effects: Type<any>[] = [ export const effects: Type<any>[] = [
CompanyStore.Effects, CompanyStore.Effects,
InitStore.Effects, InitStore.Effects,
OptionStore.Effects,
QueryStore.Effects,
VersionInfoStore.Effects VersionInfoStore.Effects
]; ];
@ -27,8 +21,6 @@ export function reducers(state: State | undefined, action: Action) {
return combineReducers({ return combineReducers({
company: CompanyStore.reducer, company: CompanyStore.reducer,
init: InitStore.reducer, init: InitStore.reducer,
option: OptionStore.reducer,
query: QueryStore.reducer,
versionInfo: VersionInfoStore.reducer versionInfo: VersionInfoStore.reducer
})(state, action); })(state, action);
} }
@ -47,18 +39,6 @@ export function selectors<S>(selector: Selector<any, State>) {
(state: State) => state.init (state: State) => state.init
) )
), ),
OptionSelector: OptionStore.selectors(
createSelector(
selector,
(state: State) => state.option
)
),
QuerySelector: QueryStore.selectors(
createSelector(
selector,
(state: State) => state.query
)
),
VersionInfoSelector: VersionInfoStore.selectors( VersionInfoSelector: VersionInfoStore.selectors(
createSelector( createSelector(
selector, selector,

View File

@ -1,15 +0,0 @@
import { createAction, props } from '@ngrx/store';
import { AuthRequest, AuthResponse } from '@ucap-webmessenger/protocol-query';
export const auth = createAction('[Setting::Query] Auth', props<AuthRequest>());
export const authSuccess = createAction(
'[Setting::Query] Auth Success',
props<{ res: AuthResponse }>()
);
export const authFailure = createAction(
'[Setting::Query] Auth Failure',
props<{ error: any }>()
);

View File

@ -1,55 +0,0 @@
import { Injectable } from '@angular/core';
import { Actions, ofType, createEffect } from '@ngrx/effects';
import { of } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { authSuccess, authFailure } from './actions';
import { initSettings } from '../init';
import {
QueryProtocolService,
AuthRequest
} from '@ucap-webmessenger/protocol-query';
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import {
LoginInfo,
KEY_LOGIN_INFO,
EnvironmentsInfo,
KEY_ENVIRONMENTS_INFO
} from '@app/types';
import { loginSuccess } from '@app/store/account/authentication';
@Injectable()
export class Effects {
// initSettings$ = createEffect(() =>
// this.actions$.pipe(
// ofType(loginSuccess),
// map(() => {
// const loginInfo = this.sessionStorageService.get<LoginInfo>(
// KEY_LOGIN_INFO
// );
// const environmentsInfo = this.sessionStorageService.get<
// EnvironmentsInfo
// >(KEY_ENVIRONMENTS_INFO);
// return {
// deviceType: environmentsInfo.deviceType
// } as AuthRequest;
// }),
// exhaustMap(req =>
// this.queryProtocolService.auth(req).pipe(
// map(res => authSuccess({ res })),
// catchError(error => of(authFailure({ error })))
// )
// )
// )
// );
constructor(
private actions$: Actions,
private sessionStorageService: SessionStorageService,
private queryProtocolService: QueryProtocolService
) {}
}

View File

@ -5,17 +5,17 @@ import {
VersionInfo2Response VersionInfo2Response
} from '@ucap-webmessenger/api-public'; } from '@ucap-webmessenger/api-public';
export const fetch = createAction( export const versionInfo2 = createAction(
'[Setting::VersionInfo] Fetch', '[Setting::VersionInfo] VersionInfo2',
props<VersionInfo2Request>() props<VersionInfo2Request>()
); );
export const fetchSuccess = createAction( export const versionInfo2Success = createAction(
'[Setting::VersionInfo] Fetch Success', '[Setting::VersionInfo] VersionInfo2 Success',
props<VersionInfo2Response>() props<{ res: VersionInfo2Response }>()
); );
export const fetchFailure = createAction( export const versionInfo2Failure = createAction(
'[Setting::VersionInfo] Fetch Failure', '[Setting::VersionInfo] VersionInfo2 Failure',
props<{ error: any }>() props<{ error: any }>()
); );

View File

@ -12,39 +12,33 @@ import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { NGXLogger } from 'ngx-logger'; import { NGXLogger } from 'ngx-logger';
import { fetch, fetchSuccess, fetchFailure } from './actions'; import {
versionInfo2,
versionInfo2Success,
versionInfo2Failure
} from './actions';
@Injectable() @Injectable()
export class Effects { export class Effects {
fetch$ = createEffect(() => versionInfo2$ = createEffect(() =>
this.actions$.pipe( this.actions$.pipe(
ofType(fetch), ofType(versionInfo2),
map(action => action), map(action => action),
exhaustMap(req => exhaustMap(req =>
this.publicApiService.versionInfo2(req).pipe( this.publicApiService.versionInfo2(req).pipe(
map(res => { map(res => {
if (res.statusCode === StatusCode.Success) { if (res.statusCode === StatusCode.Success) {
this.logger.debug('fetchSuccess', res); return versionInfo2Success({ res });
return fetchSuccess(res);
} else { } else {
return fetchFailure({ error: 'Failed' }); return versionInfo2Failure({ error: 'Failed' });
} }
}), }),
catchError(error => of(fetchFailure({ error }))) catchError(error => of(versionInfo2Failure({ error })))
) )
) )
) )
); );
fetchSuccess$ = createEffect(
() =>
this.actions$.pipe(
ofType(fetchSuccess),
tap(params => {})
),
{ dispatch: false }
);
constructor( constructor(
private actions$: Actions, private actions$: Actions,
private publicApiService: PublicApiService, private publicApiService: PublicApiService,

View File

@ -1,23 +1,23 @@
import { createReducer, on } from '@ngrx/store'; import { createReducer, on } from '@ngrx/store';
import { initialState } from './state'; import { initialState } from './state';
import { fetchSuccess } from './actions'; import { versionInfo2Success } from './actions';
export const reducer = createReducer( export const reducer = createReducer(
initialState, initialState,
on(fetchSuccess, (state, action) => { on(versionInfo2Success, (state, action) => {
return { return {
...state, ...state,
profileImageRoot: action.profileRoot, profileImageRoot: action.res.profileRoot,
profileImageUploadUrl: action.profileUploadUrl, profileImageUploadUrl: action.res.profileUploadUrl,
fileUploadMaxSize: fileUploadMaxSize:
!!action.fileAllowSize && !!action.res.fileAllowSize &&
!isNaN(action.fileAllowSize) && !isNaN(action.res.fileAllowSize) &&
0 < action.fileAllowSize 0 < action.res.fileAllowSize
? action.fileAllowSize ? action.res.fileAllowSize
: 0, : 0,
fileUploadUrl: action.uploadUrl, fileUploadUrl: action.res.uploadUrl,
fileDownloadUrl: action.downloadUrl, fileDownloadUrl: action.res.downloadUrl,
serverIp: action.serverIp serverIp: action.res.serverIp
}; };
}) })
); );

Some files were not shown because too many files have changed in this diff Show More