v1.7.0/auto follow

This commit is contained in:
2020-09-07 14:10:14 -04:00
parent c3c0d6311e
commit 1f5c9d3619
4 changed files with 65 additions and 12 deletions
-2
View File
@@ -84,8 +84,6 @@ const App = () => {
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [notification, setNotification] = useState(closedNotification); const [notification, setNotification] = useState(closedNotification);
let hasAttached = false;
useEffect(() => { useEffect(() => {
setLoading(true); setLoading(true);
getUserUid(); getUserUid();
+30 -9
View File
@@ -29,9 +29,6 @@ import {
Chip, Chip,
CircularProgress, CircularProgress,
Paper, Paper,
Grid,
Slider,
LinearProgress,
} from '@material-ui/core'; } from '@material-ui/core';
import Thread from './Thread'; import Thread from './Thread';
import { import {
@@ -39,8 +36,6 @@ import {
LeaveRoomApi, LeaveRoomApi,
DeleteRoomApi, DeleteRoomApi,
UpdatePlayerApi, UpdatePlayerApi,
getPlayerSource,
PLAYER_SOURCE,
LocalData, LocalData,
PLAYER_STATUS, PLAYER_STATUS,
updateLocalData, updateLocalData,
@@ -66,8 +61,6 @@ import {
Error, Error,
FullscreenExit, FullscreenExit,
Fullscreen, Fullscreen,
VolumeDown,
VolumeUp,
CancelRounded, CancelRounded,
VideocamRounded, VideocamRounded,
VideocamOffRounded, VideocamOffRounded,
@@ -99,6 +92,8 @@ export default class Chat extends Component {
isFullscreen: document.fullscreen, isFullscreen: document.fullscreen,
allowAutoRejoin: allowAutoRejoin:
LocalData().allowAutoRejoin !== undefined ? LocalData().allowAutoRejoin : true, LocalData().allowAutoRejoin !== undefined ? LocalData().allowAutoRejoin : true,
allowAutoFollow:
LocalData().allowAutoFollow !== undefined ? LocalData().allowAutoFollow : false,
replyTo: null, replyTo: null,
sendingMessages: [], sendingMessages: [],
usingVideo: false, usingVideo: false,
@@ -124,6 +119,7 @@ export default class Chat extends Component {
props.nameSelectors props.nameSelectors
); );
this.updateAllowAutoRejoin = this.updateAllowAutoRejoin.bind(this); this.updateAllowAutoRejoin = this.updateAllowAutoRejoin.bind(this);
this.updateAllowAutoFollow = this.updateAllowAutoFollow.bind(this);
this.updateAllowChatNotification = this.updateAllowChatNotification.bind(this); this.updateAllowChatNotification = this.updateAllowChatNotification.bind(this);
this.mCallManager = new CallManager(this.callEventListener, this.props.notify); this.mCallManager = new CallManager(this.callEventListener, this.props.notify);
} }
@@ -451,6 +447,10 @@ export default class Chat extends Component {
updateLocalData({ allowAutoRejoin: !this.state.allowAutoRejoin }); updateLocalData({ allowAutoRejoin: !this.state.allowAutoRejoin });
this.setState({ allowAutoRejoin: !this.state.allowAutoRejoin }); this.setState({ allowAutoRejoin: !this.state.allowAutoRejoin });
} }
updateAllowAutoFollow() {
updateLocalData({ allowAutoFollow: !this.state.allowAutoFollow });
this.setState({ allowAutoFollow: !this.state.allowAutoFollow });
}
toggleFullscreen() { toggleFullscreen() {
if (document.fullscreen) { if (document.fullscreen) {
document.exitFullscreen(); document.exitFullscreen();
@@ -506,6 +506,7 @@ export default class Chat extends Component {
users, users,
callActionPending, callActionPending,
allowAutoRejoin, allowAutoRejoin,
allowAutoFollow,
isFullscreen, isFullscreen,
adminModeUpdate, adminModeUpdate,
adminOnly, adminOnly,
@@ -655,14 +656,34 @@ export default class Chat extends Component {
<br /> <br />
<span style={{ color: '#8a8a8a' }}> <span style={{ color: '#8a8a8a' }}>
{adminOnly {adminOnly
? 'Only admin can update player and start calls right now' ? 'Only admin can update player and start calls'
: 'All party members can update player and start calls right now'} : 'All party members can update player and start calls'}
</span> </span>
</span> </span>
} }
labelPlacement="end" labelPlacement="end"
/> />
) : null} ) : null}
<FormControlLabel
className="notification-switch"
control={
<Switch
checked={allowAutoFollow}
onChange={this.updateAllowAutoFollow}
name="allowAutoFollow"
/>
}
label={
<span>
Allow Watch Party to change to the currently playing
<br />
<span style={{ color: '#8a8a8a' }}>
{allowAutoFollow ? 'Auto Follow Enabled' : 'Auto Follow Disabled'}
</span>
</span>
}
labelPlacement="end"
/>
<Typography className="party-controls-users-title" variant="overline"> <Typography className="party-controls-users-title" variant="overline">
PARTY MEMBERS PARTY MEMBERS
</Typography> </Typography>
+27
View File
@@ -78,6 +78,7 @@ export default class Create extends Component {
LocalData().allowAutoRejoin !== undefined ? LocalData().allowAutoRejoin : true, LocalData().allowAutoRejoin !== undefined ? LocalData().allowAutoRejoin : true,
allowChatNotification: allowChatNotification:
LocalData().allowChatNotification !== undefined ? LocalData().allowChatNotification : true, LocalData().allowChatNotification !== undefined ? LocalData().allowChatNotification : true,
allowAutoFollow: LocalData().allowAutoFollow || false,
expanded: 'alerts', expanded: 'alerts',
}; };
this.createCall = this.createCall.bind(this); this.createCall = this.createCall.bind(this);
@@ -85,6 +86,7 @@ export default class Create extends Component {
this.success = this.success.bind(this); this.success = this.success.bind(this);
this.partyNameAutocompleteProcessor = this.partyNameAutocompleteProcessor.bind(this); this.partyNameAutocompleteProcessor = this.partyNameAutocompleteProcessor.bind(this);
this.updateAllowAutoRejoin = this.updateAllowAutoRejoin.bind(this); this.updateAllowAutoRejoin = this.updateAllowAutoRejoin.bind(this);
this.updateAllowAutoFollow = this.updateAllowAutoFollow.bind(this);
this.updateAllowChatNotification = this.updateAllowChatNotification.bind(this); this.updateAllowChatNotification = this.updateAllowChatNotification.bind(this);
this.clearPartyHistory = this.clearPartyHistory.bind(this); this.clearPartyHistory = this.clearPartyHistory.bind(this);
this.handleSteps = this.handleSteps.bind(this); this.handleSteps = this.handleSteps.bind(this);
@@ -244,6 +246,10 @@ export default class Create extends Component {
updateLocalData({ allowAutoRejoin: !this.state.allowAutoRejoin }); updateLocalData({ allowAutoRejoin: !this.state.allowAutoRejoin });
this.setState({ allowAutoRejoin: !this.state.allowAutoRejoin }); this.setState({ allowAutoRejoin: !this.state.allowAutoRejoin });
} }
updateAllowAutoFollow() {
updateLocalData({ allowAutoFollow: !this.state.allowAutoFollow });
this.setState({ allowAutoFollow: !this.state.allowAutoFollow });
}
clearPartyHistory() { clearPartyHistory() {
this.setState({ this.setState({
parties: [], parties: [],
@@ -270,6 +276,7 @@ export default class Create extends Component {
parties, parties,
adminOnly, adminOnly,
allowAutoRejoin, allowAutoRejoin,
allowAutoFollow,
allowChatNotification, allowChatNotification,
alertStep, alertStep,
expanded, expanded,
@@ -500,6 +507,26 @@ export default class Create extends Component {
} }
labelPlacement="end" labelPlacement="end"
/> />
<FormControlLabel
className="notification-switch"
control={
<Switch
checked={allowAutoFollow}
onChange={this.updateAllowAutoFollow}
name="allowAutoFollow"
/>
}
label={
<span>
Allow Watch Party to change to the currently playing show
<br />
<span style={{ color: '#8a8a8a' }}>
{allowAutoFollow ? 'Auto Follow Enabled' : 'Auto Follow Disabled'}
</span>
</span>
}
labelPlacement="end"
/>
<Button <Button
color="secondary" color="secondary"
fullWidth fullWidth
+7
View File
@@ -60,6 +60,13 @@ export default class VideoListener {
} }
} }
async doUpdate(serverPlayer) { async doUpdate(serverPlayer) {
if (
this.video.showName !== serverPlayer.showName &&
window.location.href !== serverPlayer.url &&
serverPlayer.updatedBy !== LocalData().userUid
) {
window.location.href = serverPlayer.url;
}
if ( if (
this.isUpdating === false && this.isUpdating === false &&
serverPlayer.showName === this.video.showName && serverPlayer.showName === this.video.showName &&