타이머 대화방 사용유무, MASSTEXT 길이, 대화방 참여인원제한 > 환경설정으로 구성.

This commit is contained in:
leejinho 2019-12-19 15:29:18 +09:00
parent 79336bffb4
commit 568c0be6a5
9 changed files with 157 additions and 97 deletions

View File

@ -50,6 +50,7 @@ import {
KEY_LOGIN_RES_INFO KEY_LOGIN_RES_INFO
} from '@app/types'; } from '@app/types';
import { MessageBoxComponent } from './left-sidenav/message.component'; import { MessageBoxComponent } from './left-sidenav/message.component';
import { environment } from '../../../../environments/environment';
export enum MainMenu { export enum MainMenu {
Group = 'GROUP', Group = 'GROUP',
@ -301,17 +302,20 @@ export class LeftSideComponent implements OnInit, OnDestroy {
{ {
this.fabButtonShow = true; this.fabButtonShow = true;
this.fabButtons = [ this.fabButtons = [
{
icon: 'timer',
tooltip: 'New Timer Chat',
divisionType: 'CHAT_NEW_TIMER_ADD'
},
{ {
icon: 'chat', icon: 'chat',
tooltip: 'New Chat', tooltip: 'New Chat',
divisionType: 'CAHT_NEW_ADD' divisionType: 'CAHT_NEW_ADD'
} }
]; ];
if (environment.productConfig.CommonSetting.useTimerRoom) {
this.fabButtons.push({
icon: 'timer',
tooltip: 'New Timer Chat',
divisionType: 'CHAT_NEW_TIMER_ADD'
});
}
} }
break; break;
case MainMenu.Organization: case MainMenu.Organization:
@ -417,7 +421,9 @@ export class LeftSideComponent implements OnInit, OnDestroy {
break; break;
case 'CHAT_NEW_TIMER_ADD': case 'CHAT_NEW_TIMER_ADD':
{ {
this.onClickNewChat('TIMER'); if (environment.productConfig.CommonSetting.useTimerRoom) {
this.onClickNewChat('TIMER');
}
} }
break; break;

View File

@ -97,6 +97,7 @@ import {
SelectGroupDialogData SelectGroupDialogData
} from '../dialogs/group/select-group.dialog.component'; } from '../dialogs/group/select-group.dialog.component';
import { GroupDetailData } from '@ucap-webmessenger/protocol-sync'; import { GroupDetailData } from '@ucap-webmessenger/protocol-sync';
import { environment } from '../../../../environments/environment';
@Component({ @Component({
selector: 'app-layout-messenger-messages', selector: 'app-layout-messenger-messages',
@ -567,7 +568,11 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
if (!!this.selectedSticker) { if (!!this.selectedSticker) {
// Send Sticker // Send Sticker
if (!!message && message.trim().length > CONST.MASSTEXT_LEN) { if (
!!message &&
message.trim().length >
environment.productConfig.CommonSetting.masstextLength
) {
const result = await this.dialogService.open< const result = await this.dialogService.open<
AlertDialogComponent, AlertDialogComponent,
AlertDialogData, AlertDialogData,
@ -576,7 +581,7 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
width: '360px', width: '360px',
data: { data: {
title: 'Alert', title: 'Alert',
message: `스티커를 포함할 경우 ${CONST.MASSTEXT_LEN}자 이상 보낼 수 없습니다.` message: `스티커를 포함할 경우 ${environment.productConfig.CommonSetting.masstextLength}자 이상 보낼 수 없습니다.`
} }
}); });
return; return;
@ -599,7 +604,10 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
); );
this.isShowStickerSelector = false; this.isShowStickerSelector = false;
this.setStickerHistory(this.selectedSticker); this.setStickerHistory(this.selectedSticker);
} else if (message.trim().length > CONST.MASSTEXT_LEN) { } else if (
message.trim().length >
environment.productConfig.CommonSetting.masstextLength
) {
// MASS TEXT // MASS TEXT
this.store.dispatch( this.store.dispatch(
EventStore.sendMass({ EventStore.sendMass({

View File

@ -15,6 +15,7 @@ import {
import { Store, select } from '@ngrx/store'; import { Store, select } from '@ngrx/store';
import { Dictionary } from '@ngrx/entity'; import { Dictionary } from '@ngrx/entity';
import { NGXLogger } from 'ngx-logger'; import { NGXLogger } from 'ngx-logger';
import { environment } from '../../../../environments/environment';
import { import {
buddy2, buddy2,
@ -105,6 +106,12 @@ import {
import * as ChatStore from '@app/store/messenger/chat'; import * as ChatStore from '@app/store/messenger/chat';
import * as RoomStore from '@app/store/messenger/room'; import * as RoomStore from '@app/store/messenger/room';
import { CONST } from '@ucap-webmessenger/core'; import { CONST } from '@ucap-webmessenger/core';
import {
AlertDialogComponent,
AlertDialogResult,
DialogService,
AlertDialogData
} from '@ucap-webmessenger/ui';
@Injectable() @Injectable()
export class Effects { export class Effects {
@ -327,102 +334,124 @@ export class Effects {
) )
) )
), ),
tap(([action, loginRes, roomInfos, roomUsers, roomUserShorts]) => { tap(
const userSeqList = [...action.userSeqList, loginRes.userSeq]; async ([action, loginRes, roomInfos, roomUsers, roomUserShorts]) => {
let roomSeq = null; const userSeqList = [...action.userSeqList];
let roomSeq = null;
for (const key in roomUsers) { for (const key in roomUsers) {
if (roomUsers.hasOwnProperty(key)) { if (roomUsers.hasOwnProperty(key)) {
const element = roomUsers[key]; const element = roomUsers[key];
if (userSeqList.length === element.userInfos.length) { if (userSeqList.length === element.userInfos.length) {
roomSeq = key; roomSeq = key;
if (!!action.isTimeRoom && action.isTimeRoom) { if (!!action.isTimeRoom && action.isTimeRoom) {
// 타이머 방 // 타이머 방
if (!roomInfos[key].isTimeRoom) { if (!roomInfos[key].isTimeRoom) {
roomSeq = null; roomSeq = null;
continue; continue;
}
} else {
// 일반 방
if (roomInfos[key].isTimeRoom) {
roomSeq = null;
continue;
}
} }
} else { // user check
// 일반 방 for (const roomUserInfo of element.userInfos) {
if (roomInfos[key].isTimeRoom) { if (-1 === userSeqList.indexOf(roomUserInfo.seq)) {
roomSeq = null; roomSeq = null;
continue; break;
} }
}
// user check
for (const roomUserInfo of element.userInfos) {
if (-1 === userSeqList.indexOf(roomUserInfo.seq)) {
roomSeq = null;
break;
} }
} }
} }
} }
}
for (const key in roomUserShorts) { for (const key in roomUserShorts) {
if (roomUserShorts.hasOwnProperty(key)) { if (roomUserShorts.hasOwnProperty(key)) {
const element = roomUserShorts[key]; const element = roomUserShorts[key];
if (userSeqList.length === element.userInfos.length) { if (userSeqList.length === element.userInfos.length) {
roomSeq = key; roomSeq = key;
if (!!action.isTimeRoom && action.isTimeRoom) { if (!!action.isTimeRoom && action.isTimeRoom) {
// 타이머 방 // 타이머 방
if (!roomInfos[key].isTimeRoom) { if (!roomInfos[key].isTimeRoom) {
roomSeq = null; roomSeq = null;
continue; continue;
}
} else {
// 일반 방
if (roomInfos[key].isTimeRoom) {
roomSeq = null;
continue;
}
} }
} else { // user check
// 일반 방 for (const roomUserDetailData of element.userInfos) {
if (roomInfos[key].isTimeRoom) { if (-1 === userSeqList.indexOf(roomUserDetailData.seq)) {
roomSeq = null; roomSeq = null;
continue; break;
} }
}
// user check
for (const roomUserDetailData of element.userInfos) {
if (-1 === userSeqList.indexOf(roomUserDetailData.seq)) {
roomSeq = null;
break;
} }
} }
} }
} }
}
this.logger.debug( // 내 정보를 추가하여 방생성.
'openRoom', userSeqList.push(loginRes.userSeq);
'userSeqList',
userSeqList,
'roomSeq',
roomSeq
);
if (!!roomSeq) {
this.store.dispatch(ChatStore.selectedRoom({ roomSeq }));
return;
}
if (!!action.isTimeRoom && action.isTimeRoom) { this.logger.debug(
// 타이머 방 'openRoom',
this.store.dispatch( 'userSeqList',
RoomStore.openTimer({ userSeqList,
req: { 'roomSeq',
divCd: 'DivCodeT', roomSeq
roomName: '', );
isTimerRoom: true, if (!!roomSeq) {
timerRoomInterval: CONST.DEFAULT_TIMER_ROOM_INTERVAL, // 24h default this.store.dispatch(ChatStore.selectedRoom({ roomSeq }));
userSeqs: userSeqList return;
}
if (
environment.productConfig.CommonSetting.maxChatRoomUser <
userSeqList.length
) {
await this.dialogService.open<
AlertDialogComponent,
AlertDialogData,
AlertDialogResult
>(AlertDialogComponent, {
data: {
title: '',
html: `${environment.productConfig.CommonSetting.maxChatRoomUser}명 이상 대화할 수 없습니다.`
} }
}) });
); return;
} else { }
// 일반 방
this.store.dispatch( if (!!action.isTimeRoom && action.isTimeRoom) {
RoomStore.open({ // 타이머 방
req: { divCd: 'DivCode', userSeqs: userSeqList } this.store.dispatch(
}) RoomStore.openTimer({
); req: {
divCd: 'DivCodeT',
roomName: '',
isTimerRoom: true,
timerRoomInterval: CONST.DEFAULT_TIMER_ROOM_INTERVAL, // 24h default
userSeqs: userSeqList
}
})
);
} else {
// 일반 방
this.store.dispatch(
RoomStore.open({
req: { divCd: 'DivCode', userSeqs: userSeqList }
})
);
}
} }
}) )
), ),
{ dispatch: false } { dispatch: false }
); );
@ -1010,6 +1039,7 @@ export class Effects {
private groupProtocolService: GroupProtocolService, private groupProtocolService: GroupProtocolService,
private buddyProtocolService: BuddyProtocolService, private buddyProtocolService: BuddyProtocolService,
private sessionStorageService: SessionStorageService, private sessionStorageService: SessionStorageService,
private dialogService: DialogService,
private logger: NGXLogger private logger: NGXLogger
) {} ) {}
} }

View File

@ -52,7 +52,11 @@ export const environment: Environment = {
} }
}, },
CommonSetting: { CommonSetting: {
editableProfileImage: false editableProfileImage: false,
useTimerRoom: false,
maxChatRoomUser: 300,
masstextLength: 800
} }
}, },

View File

@ -52,7 +52,11 @@ export const environment: Environment = {
} }
}, },
CommonSetting: { CommonSetting: {
editableProfileImage: false editableProfileImage: false,
useTimerRoom: false,
maxChatRoomUser: 300,
masstextLength: 800
} }
}, },

View File

@ -52,7 +52,11 @@ export const environment: Environment = {
} }
}, },
CommonSetting: { CommonSetting: {
editableProfileImage: true editableProfileImage: true,
useTimerRoom: true,
maxChatRoomUser: 300,
masstextLength: 800
} }
}, },

View File

@ -52,7 +52,11 @@ export const environment: Environment = {
} }
}, },
CommonSetting: { CommonSetting: {
editableProfileImage: true editableProfileImage: true,
useTimerRoom: true,
maxChatRoomUser: 300,
masstextLength: 800
} }
}, },

View File

@ -65,6 +65,10 @@ export interface Environment {
CommonSetting: { CommonSetting: {
editableProfileImage: boolean; editableProfileImage: boolean;
useTimerRoom: boolean;
maxChatRoomUser: number;
masstextLength: number;
}; };
}; };

View File

@ -1,12 +1,8 @@
export enum CONST { export enum CONST {
/** 대용량 텍스트로 보내는 문자열의 길이 기준 */
MASSTEXT_LEN = 800,
/** 대화방의 이벤트를 조회하는 갯수 */ /** 대화방의 이벤트를 조회하는 갯수 */
EVENT_INFO_READ_COUNT = 50, EVENT_INFO_READ_COUNT = 50,
/** Timer Room 최초 오픈시 timer interval */ /** Timer Room 최초 오픈시 timer interval */
DEFAULT_TIMER_ROOM_INTERVAL = 24 * 60 * 60, DEFAULT_TIMER_ROOM_INTERVAL = 24 * 60 * 60,
/** 한번에 채팅을 할 수 있는 인원수 제한 */
CHATROOM_USER = 300,
/** 여기까지 읽음을 표시할때 조회할 최소 이벤트 갯수 */ /** 여기까지 읽음을 표시할때 조회할 최소 이벤트 갯수 */
READ_HERE_MIN_EVENT_INFO_READ_COUNT = 10, READ_HERE_MIN_EVENT_INFO_READ_COUNT = 10,