diff --git a/app/src/ClickSimulator.js b/app/src/ClickSimulator.js deleted file mode 100644 index bce1e2f..0000000 --- a/app/src/ClickSimulator.js +++ /dev/null @@ -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 , 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, -}; diff --git a/app/src/Create.js b/app/src/Create.js index 85ff715..a4242cc 100644 --- a/app/src/Create.js +++ b/app/src/Create.js @@ -77,6 +77,7 @@ export default class Create extends Component { LocalData().allowAutoRejoin !== undefined ? LocalData().allowAutoRejoin : true, allowChatNotification: LocalData().allowChatNotification !== undefined ? LocalData().allowChatNotification : true, + expanded: 'alerts', }; this.createCall = this.createCall.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; this.setState({ alertStep: alertStep + direction }); } + handleExpanders(e) { + const { expanded } = this.state; + if (e === expanded) this.setState({ expanded: '' }); + else this.setState({ expanded: e }); + } render() { const { mode, @@ -253,6 +259,7 @@ export default class Create extends Component { allowAutoRejoin, allowChatNotification, alertStep, + expanded, } = this.state; const { status } = this.props; return ( @@ -365,8 +372,11 @@ export default class Create extends Component { {mode === 'create' ? 'Start Party' : 'Join Party'} - - }> + + this.handleExpanders('alerts')} + expandIcon={} + > Alerts @@ -399,8 +409,7 @@ export default class Create extends Component { activeStep={alertStep} backButton={ this.handleSteps(-1)}> - {' '} - {' '} + } nextButton={ @@ -408,8 +417,7 @@ export default class Create extends Component { disabled={alertStep === status.alerts.length - 1} onClick={() => this.handleSteps(1)} > - {' '} - {' '} + } steps={status.alerts ? status.alerts.length : 0} @@ -422,8 +430,11 @@ export default class Create extends Component { )} - - }> + + this.handleExpanders('settings')} + expandIcon={} + > Settings diff --git a/app/src/VideoListener.js b/app/src/VideoListener.js index 4abf07f..3a2237e 100644 --- a/app/src/VideoListener.js +++ b/app/src/VideoListener.js @@ -10,7 +10,6 @@ CITED ARE THE SOLE INTELECTUAL PROPERTY OF AYUSHYA AMITABH, AND MAY NOT BE COPIED, EDITED, OR REPRODUCED WITHOUT PERMISSION. ************************************************************************/ import { PLAYER_STATUS, getPlayerSource, PLAYER_SOURCE, LocalData } from './Api'; -import simulate from './ClickSimulator'; const templateListener = (video) => console.log('MISSING VIDEO LISTENER'); @@ -515,7 +514,9 @@ export default class VideoListener { const peacockInjectScript = document.createElement('script'); peacockInjectScript.text = peacockInject; 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) { this.firstTimeSync(peacockVideoElement); } else { @@ -523,7 +524,9 @@ export default class VideoListener { this.video.element ? null : () => { - var pve = document.querySelector(".video-player-component.playback-component video"); + var pve = document.querySelector( + '.video-player-component.playback-component video' + ); if ( pve !== null && pve !== undefined && diff --git a/functions/modules2/createRoom.js b/functions/modules2/createRoom.js index 9f232ab..37370bd 100644 --- a/functions/modules2/createRoom.js +++ b/functions/modules2/createRoom.js @@ -64,15 +64,19 @@ module.exports = async (req, res) => { }); res.status(201).send({ roomId: bodydata.partyName, message: 'Started a party!' }); - admin - .firestore() - .collection('rooms') - .doc(bodydata.partyName) - .collection('messages') - .add({ + admin.firestore().collection('rooms').doc(bodydata.partyName).collection('messages').add({ uid: '', 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`, time: new Date(), }); + + if (player.source === 'peacocktv.') { + admin.firestore().collection('rooms').doc(bodydata.partyName).collection('messages').add({ + uid: '', + 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(), + }); + } };