타이머 대화방 사용유무, 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
} from '@app/types';
import { MessageBoxComponent } from './left-sidenav/message.component';
import { environment } from '../../../../environments/environment';
export enum MainMenu {
Group = 'GROUP',
@ -301,17 +302,20 @@ export class LeftSideComponent implements OnInit, OnDestroy {
{
this.fabButtonShow = true;
this.fabButtons = [
{
icon: 'timer',
tooltip: 'New Timer Chat',
divisionType: 'CHAT_NEW_TIMER_ADD'
},
{
icon: 'chat',
tooltip: 'New Chat',
divisionType: 'CAHT_NEW_ADD'
}
];
if (environment.productConfig.CommonSetting.useTimerRoom) {
this.fabButtons.push({
icon: 'timer',
tooltip: 'New Timer Chat',
divisionType: 'CHAT_NEW_TIMER_ADD'
});
}
}
break;
case MainMenu.Organization:
@ -417,7 +421,9 @@ export class LeftSideComponent implements OnInit, OnDestroy {
break;
case 'CHAT_NEW_TIMER_ADD':
{
this.onClickNewChat('TIMER');
if (environment.productConfig.CommonSetting.useTimerRoom) {
this.onClickNewChat('TIMER');
}
}
break;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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