Merge branch 'develop' into feature-move-character-api

This commit is contained in:
Hanusiak Piotr 2022-01-20 13:00:31 +01:00
commit dd03a2d1ff
9 changed files with 1550 additions and 1434 deletions

View file

@ -32,7 +32,7 @@ jobs:
mode: start mode: start
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
ec2-image-id: ami-094dbcc53250a2480 ec2-image-id: ami-094dbcc53250a2480
ec2-instance-type: t3.xlarge ec2-instance-type: m5.2xlarge
subnet-id: subnet-0ac40025f559df1bc subnet-id: subnet-0ac40025f559df1bc
security-group-id: sg-0e36e96e3b8ed2d64 security-group-id: sg-0e36e96e3b8ed2d64
#iam-role-name: my-role-name # optional, requires additional permissions #iam-role-name: my-role-name # optional, requires additional permissions

View file

@ -1,4 +1,4 @@
FROM node:14.15.4-buster-slim@sha256:cbae886186467bbfd274b82a234a1cdfbbd31201c2a6ee63a6893eefcf3c6e76 as builder FROM node:14.18.2-buster-slim@sha256:20bedf0c09de887379e59a41c04284974f5fb529cf0e13aab613473ce298da3d as builder
WORKDIR /usr/src WORKDIR /usr/src
COPY messages . COPY messages .
RUN yarn install && yarn ts-proto RUN yarn install && yarn ts-proto

View file

@ -2,11 +2,13 @@ import { writable } from "svelte/store";
import { playersStore } from "./PlayersStore"; import { playersStore } from "./PlayersStore";
import type { PlayerInterface } from "../Phaser/Game/PlayerInterface"; import type { PlayerInterface } from "../Phaser/Game/PlayerInterface";
import { iframeListener } from "../Api/IframeListener"; import { iframeListener } from "../Api/IframeListener";
import { Subject } from "rxjs";
export const chatVisibilityStore = writable(false); export const chatVisibilityStore = writable(false);
export const chatInputFocusStore = writable(false); export const chatInputFocusStore = writable(false);
export const newChatMessageStore = writable<string | null>(null); const _newChatMessageSubject = new Subject<string>();
export const newChatMessageSubject = _newChatMessageSubject.asObservable();
export enum ChatMessageTypes { export enum ChatMessageTypes {
text = 1, text = 1,
@ -67,10 +69,9 @@ function createChatMessagesStore() {
}); });
}, },
addPersonnalMessage(text: string) { addPersonnalMessage(text: string) {
//post message iframe listener
iframeListener.sendUserInputChat(text); iframeListener.sendUserInputChat(text);
newChatMessageStore.set(text); _newChatMessageSubject.next(text);
update((list) => { update((list) => {
const lastMessage = list[list.length - 1]; const lastMessage = list[list.length - 1];
if (lastMessage && lastMessage.type === ChatMessageTypes.me && lastMessage.text) { if (lastMessage && lastMessage.type === ChatMessageTypes.me && lastMessage.text) {
@ -83,7 +84,6 @@ function createChatMessagesStore() {
}); });
} }
iframeListener.sendUserInputChat(text);
return list; return list;
}); });
}, },

View file

@ -7,7 +7,7 @@ import type { UserSimplePeerInterface } from "./SimplePeer";
import { readable, Readable, Unsubscriber } from "svelte/store"; import { readable, Readable, Unsubscriber } from "svelte/store";
import { localStreamStore, obtainedMediaConstraintStore, ObtainedMediaStreamConstraints } from "../Stores/MediaStore"; import { localStreamStore, obtainedMediaConstraintStore, ObtainedMediaStreamConstraints } from "../Stores/MediaStore";
import { playersStore } from "../Stores/PlayersStore"; import { playersStore } from "../Stores/PlayersStore";
import { chatMessagesStore, newChatMessageStore } from "../Stores/ChatStore"; import { chatMessagesStore, newChatMessageSubject } from "../Stores/ChatStore";
import { getIceServersConfig } from "../Components/Video/utils"; import { getIceServersConfig } from "../Components/Video/utils";
import { isMobile } from "../Enum/EnvironmentVariable"; import { isMobile } from "../Enum/EnvironmentVariable";
@ -35,7 +35,7 @@ export class VideoPeer extends Peer {
public readonly streamStore: Readable<MediaStream | null>; public readonly streamStore: Readable<MediaStream | null>;
public readonly statusStore: Readable<PeerStatus>; public readonly statusStore: Readable<PeerStatus>;
public readonly constraintsStore: Readable<ObtainedMediaStreamConstraints | null>; public readonly constraintsStore: Readable<ObtainedMediaStreamConstraints | null>;
private newMessageunsubscriber: Unsubscriber | null = null; private newMessageSubscribtion: Subscription | undefined;
private closing: Boolean = false; //this is used to prevent destroy() from being called twice private closing: Boolean = false; //this is used to prevent destroy() from being called twice
private localStreamStoreSubscribe: Unsubscriber; private localStreamStoreSubscribe: Unsubscriber;
private obtainedMediaConstraintStoreSubscribe: Unsubscriber; private obtainedMediaConstraintStoreSubscribe: Unsubscriber;
@ -129,7 +129,7 @@ export class VideoPeer extends Peer {
this._connected = true; this._connected = true;
chatMessagesStore.addIncomingUser(this.userId); chatMessagesStore.addIncomingUser(this.userId);
this.newMessageunsubscriber = newChatMessageStore.subscribe((newMessage) => { this.newMessageSubscribtion = newChatMessageSubject.subscribe((newMessage) => {
if (!newMessage) return; if (!newMessage) return;
this.write( this.write(
new Buffer( new Buffer(
@ -138,8 +138,7 @@ export class VideoPeer extends Peer {
message: newMessage, message: newMessage,
}) })
) )
); //send more data );
newChatMessageStore.set(null); //This is to prevent a newly created SimplePeer to send an old message a 2nd time. Is there a better way?
}); });
}); });
@ -262,7 +261,7 @@ export class VideoPeer extends Peer {
this.closing = true; this.closing = true;
this.onBlockSubscribe.unsubscribe(); this.onBlockSubscribe.unsubscribe();
this.onUnBlockSubscribe.unsubscribe(); this.onUnBlockSubscribe.unsubscribe();
if (this.newMessageunsubscriber) this.newMessageunsubscriber(); this.newMessageSubscribtion?.unsubscribe();
chatMessagesStore.addOutcomingUser(this.userId); chatMessagesStore.addOutcomingUser(this.userId);
if (this.localStreamStoreSubscribe) this.localStreamStoreSubscribe(); if (this.localStreamStoreSubscribe) this.localStreamStoreSubscribe();
if (this.obtainedMediaConstraintStoreSubscribe) this.obtainedMediaConstraintStoreSubscribe(); if (this.obtainedMediaConstraintStoreSubscribe) this.obtainedMediaConstraintStoreSubscribe();

View file

@ -38,7 +38,7 @@
"prettier": "^2.3.1", "prettier": "^2.3.1",
"protobufjs": "^6.10.1", "protobufjs": "^6.10.1",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"shelljs": "^0.8.4", "shelljs": "^0.8.5",
"typescript": "^4.0.5" "typescript": "^4.0.5"
}, },
"repository": { "repository": {

View file

@ -3828,10 +3828,10 @@ shebang-regex@^3.0.0:
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172"
integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==
shelljs@^0.8.4: shelljs@^0.8.5:
version "0.8.4" version "0.8.5"
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.4.tgz#de7684feeb767f8716b326078a8a00875890e3c2" resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.5.tgz#de055408d8361bed66c669d2f000538ced8ee20c"
integrity sha512-7gk3UZ9kOfPLIAbslLzyWeGiEqx9e3rxwZM0KE6EL8GlGwjym9Mrlx5/p33bWTu9YG6vcS4MBxYZDHYr5lr8BQ== integrity sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==
dependencies: dependencies:
glob "^7.0.0" glob "^7.0.0"
interpret "^1.0.0" interpret "^1.0.0"

View file

@ -1,4 +1,4 @@
FROM testcafe/testcafe:1.17.1 FROM testcafe/testcafe:1.18.2
USER root USER root
RUN apk add docker-compose RUN apk add docker-compose

2947
tests/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -14,7 +14,7 @@ export async function assertLogMessage(t: TestController, message: string): Prom
} }
await t.wait(1000); await t.wait(1000);
i++; i++;
} while (i < 10); } while (i < 30);
await t.expect(logs).contains(message); await t.expect(logs).contains(message);
} }