bug of login protocol is fixed

This commit is contained in:
병준 박 2019-09-19 15:51:42 +09:00
parent 834c25762c
commit 977a6bcdc0
4 changed files with 41 additions and 13 deletions

View File

@ -17,6 +17,11 @@ import * as AppStore from '../store';
import * as VersionInfoStore from '../store/setting/version-info'; import * as VersionInfoStore from '../store/setting/version-info';
import { LoginInfo, KEY_LOGIN_INFO } from '../types'; import { LoginInfo, KEY_LOGIN_INFO } from '../types';
import { InnerProtocolService } from '@ucap-webmessenger/protocol-inner'; import { InnerProtocolService } from '@ucap-webmessenger/protocol-inner';
import {
AuthenticationProtocolService,
SSOMode
} from '@ucap-webmessenger/protocol-authentication';
import { LocaleCode } from '@ucap-webmessenger/core';
@Injectable() @Injectable()
export class MessengerResolver implements Resolve<void> { export class MessengerResolver implements Resolve<void> {
@ -25,6 +30,7 @@ export class MessengerResolver implements Resolve<void> {
private sessionStorageService: SessionStorageService, private sessionStorageService: SessionStorageService,
private publicApiService: PublicApiService, private publicApiService: PublicApiService,
private protocolService: ProtocolService, private protocolService: ProtocolService,
private authenticationProtocolService: AuthenticationProtocolService,
private innerProtocolService: InnerProtocolService private innerProtocolService: InnerProtocolService
) {} ) {}
@ -51,9 +57,33 @@ export class MessengerResolver implements Resolve<void> {
this.innerProtocolService this.innerProtocolService
.conn({}) .conn({})
.pipe( .pipe(
take(1), map(connRes => {
map(() => { this.authenticationProtocolService
console.log('innerProtocolService.conn'); .login({
loginId: loginInfo.loginId,
loginPw: loginInfo.loginPw,
deviceType: loginInfo.deviceType,
deviceId: ' ',
token: '',
localeCode: LocaleCode.Korean,
pushId: ' ',
companyCode: loginInfo.companyCode,
passwordEncodingType: 1,
clientVersion: '',
reconnect: false,
ip: 'localhost',
hostName: '',
ssoMode: SSOMode.AUTH,
userSpecificInformation: 'PRO_000482',
productId: 'PRO_000482',
productName: 'EZMessenger'
})
.pipe(
map(loginRes => {
console.log('loginRes', loginRes);
})
)
.subscribe();
}) })
) )
.subscribe(); .subscribe();

View File

@ -13,7 +13,7 @@ export interface LoginRequest extends ProtocolRequest {
// 3. 디바이스ID(s) (for mobile) // 3. 디바이스ID(s) (for mobile)
deviceId: string; deviceId: string;
// 4. Token(n) // 4. Token(n)
token: number; token: string;
// 5. 언어코드(s) // 5. 언어코드(s)
localeCode: LocaleCode; localeCode: LocaleCode;
// 6. Push ID (for mobile) // 6. Push ID (for mobile)

View File

@ -30,11 +30,11 @@ export class AuthenticationProtocolService {
{ type: PacketBodyValue.String, value: req.loginPw }, { type: PacketBodyValue.String, value: req.loginPw },
{ type: PacketBodyValue.String, value: req.deviceType }, { type: PacketBodyValue.String, value: req.deviceType },
{ type: PacketBodyValue.String, value: req.deviceId }, { type: PacketBodyValue.String, value: req.deviceId },
{ type: PacketBodyValue.Integer, value: req.token }, { type: PacketBodyValue.String, value: req.token },
{ type: PacketBodyValue.String, value: req.localeCode }, { type: PacketBodyValue.String, value: req.localeCode },
{ type: PacketBodyValue.String, value: req.pushId }, { type: PacketBodyValue.String, value: req.pushId },
{ type: PacketBodyValue.String, value: req.companyCode }, { type: PacketBodyValue.String, value: req.companyCode },
{ type: PacketBodyValue.String, value: req.passwordEncodingType }, { type: PacketBodyValue.Integer, value: req.passwordEncodingType },
{ type: PacketBodyValue.String, value: req.clientVersion }, { type: PacketBodyValue.String, value: req.clientVersion },
{ type: PacketBodyValue.String, value: req.reconnect ? 'Y' : 'N' }, { type: PacketBodyValue.String, value: req.reconnect ? 'Y' : 'N' },
{ type: PacketBodyValue.String, value: req.ip }, { type: PacketBodyValue.String, value: req.ip },

View File

@ -72,8 +72,6 @@ export class ProtocolService {
this.messagesSubscription = this.messages$.subscribe( this.messagesSubscription = this.messages$.subscribe(
(message: string) => { (message: string) => {
console.log(`message`, message);
const arg = message.split(PacketBodyDivider); const arg = message.split(PacketBodyDivider);
if (2 > arg.length) { if (2 > arg.length) {
// OnError(3); // OnError(3);
@ -212,7 +210,7 @@ export class ProtocolService {
} }
const valueType: PacketBodyValue = bodyArg[0] as PacketBodyValue; const valueType: PacketBodyValue = bodyArg[0] as PacketBodyValue;
const value = bodyArg[0]; const value = bodyArg[1];
switch (valueType) { switch (valueType) {
case PacketBodyValue.None: case PacketBodyValue.None:
@ -275,13 +273,13 @@ export class ProtocolService {
switch (body.type) { switch (body.type) {
case PacketBodyValue.None: case PacketBodyValue.None:
packet.push(body.value.toString()); packet.push(body.value);
break; break;
case PacketBodyValue.Binary: case PacketBodyValue.Binary:
packet.push(body.value.toString()); packet.push(body.value);
break; break;
case PacketBodyValue.Integer: case PacketBodyValue.Integer:
packet.push(body.value.toString()); packet.push(String(body.value));
break; break;
case PacketBodyValue.String: case PacketBodyValue.String:
packet.push(body.value); packet.push(body.value);
@ -299,7 +297,7 @@ export class ProtocolService {
packet.push(body.value); packet.push(body.value);
break; break;
case PacketBodyValue.RequestId: case PacketBodyValue.RequestId:
packet.push(body.value.toString()); packet.push(String(body.value));
break; break;
default: default:
break; break;