v1.6.0/cleanup, create expander, peacock msg

This commit is contained in:
2020-08-07 23:09:59 -04:00
parent fcd223bf2e
commit 89b956967c
4 changed files with 35 additions and 105 deletions
-88
View File
@@ -1,88 +0,0 @@
/************************************************************************
Copyright (C) Ayushya Amitabh - All Rights Reserved
Unauthorized copying of this file, via any medium is strictly prohibited
Proprietary and confidential
Written by Ayushya Amitabh <admin@chromewatchparty.com>, 2020
https://www.chromewatchparty.com/copyright
=========================================================================
ALL CONTENT ON WATCH PARTY'S WEBSITE OR IN WATCH PARTY'S CHROME EXTENSION APP, UNLESS OTHERWISE
CITED ARE THE SOLE INTELECTUAL PROPERTY OF AYUSHYA AMITABH, AND MAY NOT BE
COPIED, EDITED, OR REPRODUCED WITHOUT PERMISSION.
************************************************************************/
/************************************************************************
THE CODE BELOW WAS WRITTEN BY USER
https://stackoverflow.com/users/68808/tweezz
ON STACKOVERFLOW, WHICH CAN BE FOUND AT
https://stackoverflow.com/questions/6157929/how-to-simulate-a-mouse-click-using-javascript
************************************************************************/
export default function simulate(element, eventName) {
var options = extend(defaultOptions, arguments[2] || {});
var oEvent,
eventType = null;
for (var name in eventMatchers) {
if (eventMatchers[name].test(eventName)) {
eventType = name;
break;
}
}
if (!eventType) throw new SyntaxError('Only HTMLEvents and MouseEvents interfaces are supported');
if (document.createEvent) {
oEvent = document.createEvent(eventType);
if (eventType == 'HTMLEvents') {
oEvent.initEvent(eventName, options.bubbles, options.cancelable);
} else {
oEvent.initMouseEvent(
eventName,
options.bubbles,
options.cancelable,
document.defaultView,
options.button,
options.pointerX,
options.pointerY,
options.pointerX,
options.pointerY,
options.ctrlKey,
options.altKey,
options.shiftKey,
options.metaKey,
options.button,
element
);
}
element.dispatchEvent(oEvent);
} else {
options.clientX = options.pointerX;
options.clientY = options.pointerY;
var evt = document.createEventObject();
oEvent = extend(evt, options);
element.fireEvent('on' + eventName, oEvent);
}
return element;
}
function extend(destination, source) {
for (var property in source) destination[property] = source[property];
return destination;
}
const eventMatchers = {
HTMLEvents: /^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/,
MouseEvents: /^(?:click|dblclick|mouse(?:down|up|over|move|out))$/,
};
const defaultOptions = {
pointerX: 0,
pointerY: 0,
button: 0,
ctrlKey: false,
altKey: false,
shiftKey: false,
metaKey: false,
bubbles: true,
cancelable: true,
};
+19 -8
View File
@@ -77,6 +77,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,
expanded: 'alerts',
}; };
this.createCall = this.createCall.bind(this); this.createCall = this.createCall.bind(this);
this.joinCall = this.joinCall.bind(this); this.joinCall = this.joinCall.bind(this);
@@ -242,6 +243,11 @@ export default class Create extends Component {
if (alertStep + direction >= this.props.status.alerts.length) return; if (alertStep + direction >= this.props.status.alerts.length) return;
this.setState({ alertStep: alertStep + direction }); this.setState({ alertStep: alertStep + direction });
} }
handleExpanders(e) {
const { expanded } = this.state;
if (e === expanded) this.setState({ expanded: '' });
else this.setState({ expanded: e });
}
render() { render() {
const { const {
mode, mode,
@@ -253,6 +259,7 @@ export default class Create extends Component {
allowAutoRejoin, allowAutoRejoin,
allowChatNotification, allowChatNotification,
alertStep, alertStep,
expanded,
} = this.state; } = this.state;
const { status } = this.props; const { status } = this.props;
return ( return (
@@ -365,8 +372,11 @@ export default class Create extends Component {
<span>{mode === 'create' ? 'Start Party' : 'Join Party'}</span> <ChevronRight /> <span>{mode === 'create' ? 'Start Party' : 'Join Party'}</span> <ChevronRight />
</Button> </Button>
</Paper> </Paper>
<ExpansionPanel defaultExpanded className="create-settings-card"> <ExpansionPanel expanded={expanded === 'alerts'} className="create-settings-card">
<ExpansionPanelSummary expandIcon={<ExpandLess />}> <ExpansionPanelSummary
onClick={() => this.handleExpanders('alerts')}
expandIcon={<ExpandLess />}
>
<Notifications /> <Notifications />
<Typography className="create-settings-title" variant="button"> <Typography className="create-settings-title" variant="button">
Alerts Alerts
@@ -399,8 +409,7 @@ export default class Create extends Component {
activeStep={alertStep} activeStep={alertStep}
backButton={ backButton={
<IconButton disabled={alertStep === 0} onClick={() => this.handleSteps(-1)}> <IconButton disabled={alertStep === 0} onClick={() => this.handleSteps(-1)}>
{' '} <KeyboardArrowLeft />
<KeyboardArrowLeft />{' '}
</IconButton> </IconButton>
} }
nextButton={ nextButton={
@@ -408,8 +417,7 @@ export default class Create extends Component {
disabled={alertStep === status.alerts.length - 1} disabled={alertStep === status.alerts.length - 1}
onClick={() => this.handleSteps(1)} onClick={() => this.handleSteps(1)}
> >
{' '} <KeyboardArrowRight />
<KeyboardArrowRight />{' '}
</IconButton> </IconButton>
} }
steps={status.alerts ? status.alerts.length : 0} steps={status.alerts ? status.alerts.length : 0}
@@ -422,8 +430,11 @@ export default class Create extends Component {
)} )}
</ExpansionPanelDetails> </ExpansionPanelDetails>
</ExpansionPanel> </ExpansionPanel>
<ExpansionPanel className="create-settings-card"> <ExpansionPanel expanded={expanded === 'settings'} className="create-settings-card">
<ExpansionPanelSummary expandIcon={<ExpandLess />}> <ExpansionPanelSummary
onClick={() => this.handleExpanders('settings')}
expandIcon={<ExpandLess />}
>
<Settings /> <Settings />
<Typography className="create-settings-title" variant="button"> <Typography className="create-settings-title" variant="button">
Settings Settings
+6 -3
View File
@@ -10,7 +10,6 @@ CITED ARE THE SOLE INTELECTUAL PROPERTY OF AYUSHYA AMITABH, AND MAY NOT BE
COPIED, EDITED, OR REPRODUCED WITHOUT PERMISSION. COPIED, EDITED, OR REPRODUCED WITHOUT PERMISSION.
************************************************************************/ ************************************************************************/
import { PLAYER_STATUS, getPlayerSource, PLAYER_SOURCE, LocalData } from './Api'; import { PLAYER_STATUS, getPlayerSource, PLAYER_SOURCE, LocalData } from './Api';
import simulate from './ClickSimulator';
const templateListener = (video) => console.log('MISSING VIDEO LISTENER'); const templateListener = (video) => console.log('MISSING VIDEO LISTENER');
@@ -515,7 +514,9 @@ export default class VideoListener {
const peacockInjectScript = document.createElement('script'); const peacockInjectScript = document.createElement('script');
peacockInjectScript.text = peacockInject; peacockInjectScript.text = peacockInject;
document.head.appendChild(peacockInjectScript); document.head.appendChild(peacockInjectScript);
const peacockVideoElement = document.querySelector(".video-player-component.playback-component video") const peacockVideoElement = document.querySelector(
'.video-player-component.playback-component video'
);
if (peacockVideoElement) { if (peacockVideoElement) {
this.firstTimeSync(peacockVideoElement); this.firstTimeSync(peacockVideoElement);
} else { } else {
@@ -523,7 +524,9 @@ export default class VideoListener {
this.video.element this.video.element
? null ? null
: () => { : () => {
var pve = document.querySelector(".video-player-component.playback-component video"); var pve = document.querySelector(
'.video-player-component.playback-component video'
);
if ( if (
pve !== null && pve !== null &&
pve !== undefined && pve !== undefined &&
+10 -6
View File
@@ -64,15 +64,19 @@ module.exports = async (req, res) => {
}); });
res.status(201).send({ roomId: bodydata.partyName, message: 'Started a party!' }); res.status(201).send({ roomId: bodydata.partyName, message: 'Started a party!' });
admin admin.firestore().collection('rooms').doc(bodydata.partyName).collection('messages').add({
.firestore()
.collection('rooms')
.doc(bodydata.partyName)
.collection('messages')
.add({
uid: '<system>', uid: '<system>',
name: '', name: '',
text: `Big update coming on Monday (Aug. 10). Watch Party will be unavailable during the afternoon as we upgrade our services. See what's new at whatsnew.chromewatchparty.com`, text: `Big update coming on Monday (Aug. 10). Watch Party will be unavailable during the afternoon as we upgrade our services. See what's new at whatsnew.chromewatchparty.com`,
time: new Date(), time: new Date(),
}); });
if (player.source === 'peacocktv.') {
admin.firestore().collection('rooms').doc(bodydata.partyName).collection('messages').add({
uid: '<system>',
name: '',
text: `Sync may not work flawlessly with PeacockTV till Monday's update. Please stick with us as we address this issue.`,
time: new Date(),
});
}
}; };