From a5b8245227e9b52d4593ae8445290dbac671b3d7 Mon Sep 17 00:00:00 2001 From: mix irving Date: Sun, 14 Mar 2021 08:54:36 +1300 Subject: [PATCH] [webclient] remove duplicate services files (#4269) --- .../WebClient/services/RoomService.tsx | 48 ---------- .../WebClient/services/SessionService.tsx | 93 ------------------- 2 files changed, 141 deletions(-) delete mode 100644 webclient/src/websocket/WebClient/services/RoomService.tsx delete mode 100644 webclient/src/websocket/WebClient/services/SessionService.tsx diff --git a/webclient/src/websocket/WebClient/services/RoomService.tsx b/webclient/src/websocket/WebClient/services/RoomService.tsx deleted file mode 100644 index 6fb204aa..00000000 --- a/webclient/src/websocket/WebClient/services/RoomService.tsx +++ /dev/null @@ -1,48 +0,0 @@ -import { RoomsDispatch, RoomsSelectors, store } from "store"; -import { WebClient } from "../../WebClient"; -import { NormalizeService } from "websocket"; - -export default class RoomService { - webClient: WebClient; - - constructor(webClient) { - this.webClient = webClient; - } - - clearStore() { - RoomsDispatch.clearStore(); - } - - joinRoom(roomInfo) { - NormalizeService.normalizeRoomInfo(roomInfo); - RoomsDispatch.joinRoom(roomInfo); - } - - updateRooms(rooms) { - RoomsDispatch.updateRooms(rooms); - } - - updateGames(roomId, gameList) { - const game = gameList[0]; - - if (!game.gameType) { - const { gametypeMap } = RoomsSelectors.getRoom(store.getState(), roomId); - NormalizeService.normalizeGameObject(game, gametypeMap); - } - - RoomsDispatch.updateGames(roomId, gameList); - } - - addMessage(roomId, message) { - NormalizeService.normalizeUserMessage(message); - RoomsDispatch.addMessage(roomId, message); - } - - userJoined(roomId, user) { - RoomsDispatch.userJoined(roomId, user); - } - - userLeft(roomId, name) { - RoomsDispatch.userLeft(roomId, name); - } -} diff --git a/webclient/src/websocket/WebClient/services/SessionService.tsx b/webclient/src/websocket/WebClient/services/SessionService.tsx deleted file mode 100644 index 8fdc8ba4..00000000 --- a/webclient/src/websocket/WebClient/services/SessionService.tsx +++ /dev/null @@ -1,93 +0,0 @@ -import { ServerDispatch, ServerConnectParams } from "store"; -import { StatusEnum } from "types"; - -import { sanitizeHtml } from "websocket/utils"; -import { WebClient } from "../../WebClient"; -import { NormalizeService } from "websocket"; - -export default class SessionService { - webClient: WebClient; - - constructor(webClient) { - this.webClient = webClient; - } - - clearStore() { - ServerDispatch.clearStore(); - } - - connectServer(options: ServerConnectParams) { - ServerDispatch.connectServer(); - this.webClient.updateStatus(StatusEnum.CONNECTING, "Connecting..."); - this.webClient.connect(options); - } - - disconnectServer() { - this.webClient.updateStatus(StatusEnum.DISCONNECTING, "Disconnecting..."); - this.webClient.disconnect(); - } - - connectionClosed(reason) { - ServerDispatch.connectionClosed(reason); - } - - updateBuddyList(buddyList) { - ServerDispatch.updateBuddyList(buddyList); - } - - addToBuddyList(user) { - ServerDispatch.addToBuddyList(user); - } - - removeFromBuddyList(userName) { - ServerDispatch.removeFromBuddyList(userName); - } - - updateIgnoreList(ignoreList) { - ServerDispatch.updateIgnoreList(ignoreList); - } - - addToIgnoreList(user) { - ServerDispatch.addToIgnoreList(user); - } - - removeFromIgnoreList(userName) { - ServerDispatch.removeFromIgnoreList(userName); - } - - updateInfo(name, version) { - ServerDispatch.updateInfo(name, version); - } - - updateStatus(state, description) { - ServerDispatch.updateStatus(state, description); - - if (state === StatusEnum.DISCONNECTED) { - this.connectionClosed({ reason: description }); - } - } - - updateUser(user) { - ServerDispatch.updateUser(user); - } - - updateUsers(users) { - ServerDispatch.updateUsers(users); - } - - userJoined(user) { - ServerDispatch.userJoined(user); - } - - userLeft(userId) { - ServerDispatch.userLeft(userId); - } - - viewLogs(logs) { - ServerDispatch.viewLogs(NormalizeService.normalizeLogs(logs)); - } - - serverMessage(message) { - ServerDispatch.serverMessage(sanitizeHtml(message)); - } -}