[webclient] remove duplicate services files (#4269)

This commit is contained in:
mix irving 2021-03-14 08:54:36 +13:00 committed by GitHub
parent 073349fd05
commit a5b8245227
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 141 deletions

View file

@ -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);
}
}

View file

@ -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));
}
}