From 59843834d6a9358e5fda5cf54b0bdbd7806c4ef8 Mon Sep 17 00:00:00 2001 From: Ayushya Amitabh Date: Tue, 16 Jun 2020 14:40:32 -0400 Subject: [PATCH] v1.4.1-beta/HBO Fixes --- app/package.json | 2 +- app/public/manifest.json | 2 +- app/src/App.js | 31 ++++++++++++++++++++++++++++++- app/src/index.js | 4 ++++ functions/package.json | 2 +- package.json | 2 +- 6 files changed, 38 insertions(+), 5 deletions(-) diff --git a/app/package.json b/app/package.json index 4734727..5a60ec6 100644 --- a/app/package.json +++ b/app/package.json @@ -1,6 +1,6 @@ { "name": "watch-party-crx", - "version": "1.4.0", + "version": "1.4.1", "private": true, "dependencies": { "@giphy/js-fetch-api": "^1.5.8", diff --git a/app/public/manifest.json b/app/public/manifest.json index 8644daa..aa56fc8 100644 --- a/app/public/manifest.json +++ b/app/public/manifest.json @@ -1,7 +1,7 @@ { "name": "Watch Party", "short_name": "WP", - "version": "1.4.0", + "version": "1.4.1", "description": "Watch streamed content together.", "background": { "page": "popup.html" diff --git a/app/src/App.js b/app/src/App.js index dc68db5..13cb030 100644 --- a/app/src/App.js +++ b/app/src/App.js @@ -6,7 +6,7 @@ import Loading from './Loading'; import firebase from 'firebase/app'; import 'firebase/firestore'; import Inactive from './Inactive'; -import { getUserUid } from './Api'; +import { getUserUid, getPlayerSource, PLAYER_SOURCE } from './Api'; const APP_VERSION = '1.4.0'; @@ -22,6 +22,15 @@ const darkTheme = createMuiTheme({ }, }); +function hboClickFix(ev) { + if (document.querySelector('body.visible')) { + ev.preventDefault(); + ev.stopPropagation(); + ev.stopImmediatePropagation(); + console.log('cc'); + } +} + const Routes = (props) => ( @@ -40,6 +49,8 @@ const App = () => { const [loading, setLoading] = useState(false); const [notification, setNotification] = useState(closedNotification); + let hasAttached = false; + useEffect(() => { setLoading(true); getUserUid(); @@ -58,6 +69,24 @@ const App = () => { if (visible) { document.body.classList.add('visible'); PartyRoutesWrapper && PartyRoutesWrapper.classList.add('visible'); + if ( + !hasAttached && + (getPlayerSource() === PLAYER_SOURCE.HBOMAX || getPlayerSource() === PLAYER_SOURCE.HBONOW) + ) { + document.addEventListener( + 'mousedown', + function (ev) { + if (document.body.querySelector('body.visible')) { + ev.preventDefault(); + ev.stopPropagation(); + ev.stopImmediatePropagation(); + console.log('cc'); + } + }, + { capture: true } + ); + hasAttached = true; + } } else { document.body.classList.remove('visible'); PartyRoutesWrapper && PartyRoutesWrapper.classList.remove('visible'); diff --git a/app/src/index.js b/app/src/index.js index c610880..b4775a8 100644 --- a/app/src/index.js +++ b/app/src/index.js @@ -55,6 +55,10 @@ switch (getPlayerSource()) { break; case PLAYER_SOURCE.HBONOW: case PLAYER_SOURCE.HBOMAX: + const hboClickInject = `var hboInputFix=function(ev){if(ev.target.tagName==='INPUT'||ev.target.tagName==='TEXTAREA'){ev.target.focus();}ev.stopImmediatePropagation();ev.stopPropagation();};document.addEventListener('keydown',hboInputFix,{capture:true});var hboClickFix=function(ev){if(document.querySelector('body.visible')){if(ev.clientX > window.innerWidth - 400){if(ev.target.tagName==='INPUT'||ev.target.tagName==='TEXTAREA'){ev.target.focus();}ev.preventDefault();ev.stopPropagation();ev.stopImmediatePropagation();}}};document.addEventListener("mousedown",hboClickFix,{capture:true});`; + const hboClickInjectScript = document.createElement('script'); + hboClickInjectScript.text = hboClickInject; + document.head.appendChild(hboClickInjectScript); document.body.classList.add('hbo'); break; case PLAYER_SOURCE.LOCAL: diff --git a/functions/package.json b/functions/package.json index f464fbd..04f58ca 100644 --- a/functions/package.json +++ b/functions/package.json @@ -1,6 +1,6 @@ { "name": "watch-party-api", - "version": "1.4.0", + "version": "1.4.1", "description": "Cloud Functions for Watch Party", "scripts": { "lint": "eslint .", diff --git a/package.json b/package.json index a63ba69..b2ffc3b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "watch-party", - "version": "1.4.0", + "version": "1.4.1", "description": "Watch Party", "scripts": { "start": "firebase emulators:start",