Merge branch 'develop' of github.com:thecodingmachine/workadventure into metadataScriptAPIV2
This commit is contained in:
commit
c79603d7fa
@ -27,7 +27,6 @@ import {
|
|||||||
import { TextureError } from "../../Exception/TextureError";
|
import { TextureError } from "../../Exception/TextureError";
|
||||||
import type { UserMovedMessage } from "../../Messages/generated/messages_pb";
|
import type { UserMovedMessage } from "../../Messages/generated/messages_pb";
|
||||||
import { ProtobufClientUtils } from "../../Network/ProtobufClientUtils";
|
import { ProtobufClientUtils } from "../../Network/ProtobufClientUtils";
|
||||||
import { peerStore } from "../../Stores/PeerStore";
|
|
||||||
import { touchScreenManager } from "../../Touch/TouchScreenManager";
|
import { touchScreenManager } from "../../Touch/TouchScreenManager";
|
||||||
import { urlManager } from "../../Url/UrlManager";
|
import { urlManager } from "../../Url/UrlManager";
|
||||||
import { audioManager } from "../../WebRtc/AudioManager";
|
import { audioManager } from "../../WebRtc/AudioManager";
|
||||||
@ -94,7 +93,7 @@ import type { HasPlayerMovedEvent } from '../../Api/Events/HasPlayerMovedEvent';
|
|||||||
|
|
||||||
import AnimatedTiles from "phaser-animated-tiles";
|
import AnimatedTiles from "phaser-animated-tiles";
|
||||||
import {soundManager} from "./SoundManager";
|
import {soundManager} from "./SoundManager";
|
||||||
import {screenSharingPeerStore} from "../../Stores/PeerStore";
|
import {peerStore, screenSharingPeerStore} from "../../Stores/PeerStore";
|
||||||
import {videoFocusStore} from "../../Stores/VideoFocusStore";
|
import {videoFocusStore} from "../../Stores/VideoFocusStore";
|
||||||
import {biggestAvailableAreaStore} from "../../Stores/BiggestAvailableAreaStore";
|
import {biggestAvailableAreaStore} from "../../Stores/BiggestAvailableAreaStore";
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import {derived, get, Readable, readable, writable, Writable} from "svelte/store";
|
import {derived, get, Readable, readable, writable, Writable} from "svelte/store";
|
||||||
import {peerStore} from "./PeerStore";
|
|
||||||
import {localUserStore} from "../Connexion/LocalUserStore";
|
import {localUserStore} from "../Connexion/LocalUserStore";
|
||||||
import {userMovingStore} from "./GameStore";
|
import {userMovingStore} from "./GameStore";
|
||||||
import {HtmlUtils} from "../WebRtc/HtmlUtils";
|
import {HtmlUtils} from "../WebRtc/HtmlUtils";
|
||||||
@ -8,6 +7,8 @@ import {errorStore} from "./ErrorStore";
|
|||||||
import {isIOS} from "../WebRtc/DeviceUtils";
|
import {isIOS} from "../WebRtc/DeviceUtils";
|
||||||
import {WebviewOnOldIOS} from "./Errors/WebviewOnOldIOS";
|
import {WebviewOnOldIOS} from "./Errors/WebviewOnOldIOS";
|
||||||
import {gameOverlayVisibilityStore} from "./GameOverlayStoreVisibility";
|
import {gameOverlayVisibilityStore} from "./GameOverlayStoreVisibility";
|
||||||
|
import {peerStore} from "./PeerStore";
|
||||||
|
import {privacyShutdownStore} from "./PrivacyShutdownStore";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A store that contains the camera state requested by the user (on or off).
|
* A store that contains the camera state requested by the user (on or off).
|
||||||
@ -35,21 +36,6 @@ function createRequestedMicrophoneState() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* A store containing whether the current page is visible or not.
|
|
||||||
*/
|
|
||||||
export const visibilityStore = readable(document.visibilityState === 'visible', function start(set) {
|
|
||||||
const onVisibilityChange = () => {
|
|
||||||
set(document.visibilityState === 'visible');
|
|
||||||
};
|
|
||||||
|
|
||||||
document.addEventListener('visibilitychange', onVisibilityChange);
|
|
||||||
|
|
||||||
return function stop() {
|
|
||||||
document.removeEventListener('visibilitychange', onVisibilityChange);
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A store that contains whether the EnableCameraScene is shown or not.
|
* A store that contains whether the EnableCameraScene is shown or not.
|
||||||
*/
|
*/
|
||||||
@ -67,41 +53,6 @@ export const requestedCameraState = createRequestedCameraState();
|
|||||||
export const requestedMicrophoneState = createRequestedMicrophoneState();
|
export const requestedMicrophoneState = createRequestedMicrophoneState();
|
||||||
export const enableCameraSceneVisibilityStore = createEnableCameraSceneVisibilityStore();
|
export const enableCameraSceneVisibilityStore = createEnableCameraSceneVisibilityStore();
|
||||||
|
|
||||||
/**
|
|
||||||
* A store that contains "true" if the webcam should be stopped for privacy reasons - i.e. if the the user left the the page while not in a discussion.
|
|
||||||
*/
|
|
||||||
function createPrivacyShutdownStore() {
|
|
||||||
let privacyEnabled = false;
|
|
||||||
|
|
||||||
const { subscribe, set, update } = writable(privacyEnabled);
|
|
||||||
|
|
||||||
visibilityStore.subscribe((isVisible) => {
|
|
||||||
if (!isVisible && get(peerStore).size === 0) {
|
|
||||||
privacyEnabled = true;
|
|
||||||
set(true);
|
|
||||||
}
|
|
||||||
if (isVisible) {
|
|
||||||
privacyEnabled = false;
|
|
||||||
set(false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
peerStore.subscribe((peers) => {
|
|
||||||
if (peers.size === 0 && get(visibilityStore) === false) {
|
|
||||||
privacyEnabled = true;
|
|
||||||
set(true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
return {
|
|
||||||
subscribe,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export const privacyShutdownStore = createPrivacyShutdownStore();
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A store containing whether the webcam was enabled in the last 10 seconds
|
* A store containing whether the webcam was enabled in the last 10 seconds
|
||||||
*/
|
*/
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import {derived, get, readable, writable} from "svelte/store";
|
import {readable, writable} from "svelte/store";
|
||||||
import type {RemotePeer, SimplePeer} from "../WebRtc/SimplePeer";
|
import type {RemotePeer, SimplePeer} from "../WebRtc/SimplePeer";
|
||||||
import {VideoPeer} from "../WebRtc/VideoPeer";
|
import {VideoPeer} from "../WebRtc/VideoPeer";
|
||||||
import {ScreenSharingPeer} from "../WebRtc/ScreenSharingPeer";
|
import {ScreenSharingPeer} from "../WebRtc/ScreenSharingPeer";
|
||||||
|
37
front/src/Stores/PrivacyShutdownStore.ts
Normal file
37
front/src/Stores/PrivacyShutdownStore.ts
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
import {get, writable} from "svelte/store";
|
||||||
|
import {peerStore} from "./PeerStore";
|
||||||
|
import {visibilityStore} from "./VisibilityStore";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A store that contains "true" if the webcam should be stopped for privacy reasons - i.e. if the the user left the the page while not in a discussion.
|
||||||
|
*/
|
||||||
|
function createPrivacyShutdownStore() {
|
||||||
|
let privacyEnabled = false;
|
||||||
|
|
||||||
|
const { subscribe, set, update } = writable(privacyEnabled);
|
||||||
|
|
||||||
|
visibilityStore.subscribe((isVisible) => {
|
||||||
|
if (!isVisible && get(peerStore).size === 0) {
|
||||||
|
privacyEnabled = true;
|
||||||
|
set(true);
|
||||||
|
}
|
||||||
|
if (isVisible) {
|
||||||
|
privacyEnabled = false;
|
||||||
|
set(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
peerStore.subscribe((peers) => {
|
||||||
|
if (peers.size === 0 && get(visibilityStore) === false) {
|
||||||
|
privacyEnabled = true;
|
||||||
|
set(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
return {
|
||||||
|
subscribe,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export const privacyShutdownStore = createPrivacyShutdownStore();
|
16
front/src/Stores/VisibilityStore.ts
Normal file
16
front/src/Stores/VisibilityStore.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import {readable} from "svelte/store";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A store containing whether the current page is visible or not.
|
||||||
|
*/
|
||||||
|
export const visibilityStore = readable(document.visibilityState === 'visible', function start(set) {
|
||||||
|
const onVisibilityChange = () => {
|
||||||
|
set(document.visibilityState === 'visible');
|
||||||
|
};
|
||||||
|
|
||||||
|
document.addEventListener('visibilitychange', onVisibilityChange);
|
||||||
|
|
||||||
|
return function stop() {
|
||||||
|
document.removeEventListener('visibilitychange', onVisibilityChange);
|
||||||
|
};
|
||||||
|
});
|
@ -7,7 +7,6 @@ import type {Subscription} from "rxjs";
|
|||||||
import type {UserSimplePeerInterface} from "./SimplePeer";
|
import type {UserSimplePeerInterface} from "./SimplePeer";
|
||||||
import {get, readable, Readable} from "svelte/store";
|
import {get, readable, Readable} from "svelte/store";
|
||||||
import {obtainedMediaConstraintStore} from "../Stores/MediaStore";
|
import {obtainedMediaConstraintStore} from "../Stores/MediaStore";
|
||||||
import {DivImportance} from "./LayoutManager";
|
|
||||||
import {discussionManager} from "./DiscussionManager";
|
import {discussionManager} from "./DiscussionManager";
|
||||||
|
|
||||||
const Peer: SimplePeerNamespace.SimplePeer = require('simple-peer');
|
const Peer: SimplePeerNamespace.SimplePeer = require('simple-peer');
|
||||||
|
Loading…
Reference in New Issue
Block a user