From c80121bf25240ffa48548b8a0b4b3e106a41af33 Mon Sep 17 00:00:00 2001 From: Ayushya Amitabh Date: Sun, 19 Jul 2020 03:27:05 -0400 Subject: [PATCH] v1.4.3/members and version handling --- app/public/background.js | 3 ++- app/src/App.js | 17 ++++++++++------- app/src/CallManager.js | 12 +++++++----- app/src/Chat.js | 38 ++++++++++++++++++++++++++++---------- app/src/Create.js | 13 ++----------- app/src/Inactive.js | 4 ++-- app/src/index.css | 16 +++++++++++++--- 7 files changed, 64 insertions(+), 39 deletions(-) diff --git a/app/public/background.js b/app/public/background.js index 98fa4e9..1484980 100644 --- a/app/public/background.js +++ b/app/public/background.js @@ -125,7 +125,8 @@ chrome.runtime.onConnect.addListener((port) => { const isAdmin = snap.docs .filter((user) => user.id === firebase.auth().currentUser.uid)[0] .data().admin; - port.postMessage({ admin: isAdmin }); + const users = snap.docs.map((userSnap) => userSnap.data().name); + port.postMessage({ admin: isAdmin, users }); } }, (err) => { diff --git a/app/src/App.js b/app/src/App.js index 015dbed..0ff6749 100644 --- a/app/src/App.js +++ b/app/src/App.js @@ -26,7 +26,8 @@ import 'firebase/firestore'; import Inactive from './Inactive'; import { getUserUid, getPlayerSource, PLAYER_SOURCE } from './Api'; -const APP_VERSION = '1.4.0'; +const APP_VERSION = '1.4.3'; +const APP_VERSION_STRING = APP_VERSION.replace(/\./g, ''); const darkTheme = createMuiTheme({ palette: { @@ -55,10 +56,6 @@ const Routes = (props) => ( ); -const wrongVersionStatus = { - message: `Looks like Watch Party needs to update.\nGo to chrome://extensions to manually update.\nExpected version v${APP_VERSION}`, -}; - const App = () => { const closedNotification = { open: false, message: '' }; @@ -129,13 +126,19 @@ const App = () => {
{loading && } - {status.active2 && status.version === APP_VERSION ? ( + {status[APP_VERSION_STRING] && status[APP_VERSION_STRING].active === true ? ( setNotification({ open: true, message })} /> ) : ( - + )}
setVisible(!visible)} className="watch-party-fab"> diff --git a/app/src/CallManager.js b/app/src/CallManager.js index 3e6e890..8a93359 100644 --- a/app/src/CallManager.js +++ b/app/src/CallManager.js @@ -35,13 +35,15 @@ export default class CallManager { this.__admin = false; } toggleCall(onCall, conference, admin) { + this.listener({ callActionPending: true }); this.__admin = admin; if (onCall === true) this.leaveCall(); else this.boot(conference); } toggleMute(muted) { + this.listener({ callActionPending: true }); VoxeetSDK.conference.mute(VoxeetSDK.session.participant, !muted); - this.listener({ muted: !muted }); + this.listener({ muted: !muted, callActionPending: false }); } async boot(conference) { await this.initialize(); @@ -93,7 +95,7 @@ export default class CallManager { async leaveCall() { VoxeetSDK.conference.leave().then(() => { VoxeetSDK.session.close(); - this.listener({ onCall: false }); + this.listener({ onCall: false, callActionPending: false }); }); } async openSession() { @@ -114,11 +116,11 @@ export default class CallManager { } async initialize() { VoxeetSDK.conference.on('joined', () => { - this.listener({ onCall: true }); + this.listener({ onCall: true, callActionPending: false, voxeet: VoxeetSDK }); }); VoxeetSDK.conference.on('left', () => { - this.listener({ onCall: false }); + this.listener({ onCall: false, callActionPending: false, voxeet: null }); }); VoxeetSDK.conference.on('streamAdded', (participant, stream) => { @@ -135,7 +137,7 @@ export default class CallManager { }); VoxeetSDK.conference.on('streamRemoved', (participant, stream) => { - document.getElementById(participant.id).remove(); + if (document.getElementById(participant.id)) document.getElementById(participant.id).remove(); }); if ( diff --git a/app/src/Chat.js b/app/src/Chat.js index 870d68b..08b274e 100644 --- a/app/src/Chat.js +++ b/app/src/Chat.js @@ -33,6 +33,7 @@ import { Tooltip, Switch, FormControlLabel, + Chip, } from '@material-ui/core'; import Thread from './Thread'; import { Carousel } from '@giphy/react-components'; @@ -49,10 +50,6 @@ import { emptyLocalData, updateLocalData, } from './Api'; -import { goTo } from 'route-lite'; -import Create from './Create'; -import VideoListener from './VideoListener'; -import CallManager from './CallManager'; import { Send, ExitToApp as Exit, @@ -63,13 +60,17 @@ import { MicOff, Mic as MicOn, Gif, - MoreVert, + KeyboardArrowDown, PauseCircleFilled, LinkOutlined, PlayCircleFilled, Cancel, Error, } from '@material-ui/icons'; +import Create from './Create'; +import { goTo } from 'route-lite'; +import CallManager from './CallManager'; +import VideoListener from './VideoListener'; const giphyFetch = new GiphyFetch('ojJbIMUN6XRMn4mHiFFav3rMCpXUg8sq'); const alerts = [ @@ -88,9 +89,11 @@ export default class Chat extends Component { messages: [], newMessage: '', admin: null, + users: [], gif: false, onCall: false, muted: false, + callActionPending: false, menuPopover: true, allowChatNotification: LocalData().allowChatNotification !== undefined ? LocalData().allowChatNotification : true, @@ -164,6 +167,7 @@ export default class Chat extends Component { } componentWillUnmount() { this.mVideoListener.end(); + this.leaveParty(); } videoEventListener(video) { this.syncPlayer(video); @@ -304,6 +308,8 @@ export default class Chat extends Component { muted, player, allowChatNotification, + users, + callActionPending, } = this.state; return (
@@ -316,7 +322,7 @@ export default class Chat extends Component { title="Share, leave, and other controls" aria-label="Share, leave, and other controls" > - + } > @@ -381,9 +387,17 @@ export default class Chat extends Component { color={allowChatNotification ? 'secondary' : 'primary'} /> } - label="Allow chat notification when hidden" + label="Allow chat notification when side panel is closed" labelPlacement="end" /> + + PARTY MEMBERS + +
+ {users.map((user) => ( + + ))} +
{player ? ( @@ -444,7 +458,11 @@ export default class Chat extends Component {
{gif || newMessage ? null : ( - + {onCall ? ( @@ -458,13 +476,13 @@ export default class Chat extends Component { )} {!gif && !newMessage && onCall && !muted ? ( - + ) : !gif && !newMessage && onCall && muted ? ( - + diff --git a/app/src/Create.js b/app/src/Create.js index 311a525..8130685 100644 --- a/app/src/Create.js +++ b/app/src/Create.js @@ -85,10 +85,10 @@ export default class Create extends Component { if (userName && name && pin) { switch (mode) { case 'create': - this.createCall(userName, name.trim(), pin); + this.createCall(userName.trim(), name.trim(), pin); break; case 'join': - this.joinCall(userName, name.trim(), pin); + this.joinCall(userName.trim(), name.trim(), pin); break; default: this.props.updateLoading(false); @@ -241,15 +241,6 @@ export default class Create extends Component { > FAQ -