Verified Giphy

This commit is contained in:
Ayushya Amitabh
2020-04-28 23:27:17 -04:00
parent a169fde183
commit 2e6d943b9e
7 changed files with 28 additions and 174 deletions
+2 -1
View File
@@ -2,7 +2,8 @@
const API_HOST = window.location.href.startsWith('http://localhost')
? 'http://localhost:5001/watch-party-crx/us-central1/widgets'
: 'https://us-central1-watch-party-crx.cloudfunctions.net/widgets';
: 'http://localhost:5001/watch-party-crx/us-central1/widgets';
// : 'https://us-central1-watch-party-crx.cloudfunctions.net/widgets';
export const PLAYER_STATUS = {
PLAYING: 'PLAYING',
+2 -1
View File
@@ -7,6 +7,7 @@ import firebase from 'firebase/app';
import 'firebase/firestore';
import Inactive from './Inactive';
import { getUserUid } from './Api';
import Chat from './Chat';
const darkTheme = createMuiTheme({
palette: {
@@ -19,7 +20,7 @@ const darkTheme = createMuiTheme({
const Routes = (props) => (
<Router>
<Create {...props} />
<Chat {...props} />
</Router>
);
+5 -7
View File
@@ -28,7 +28,7 @@ import { goTo } from 'route-lite';
import Create from './Create';
import VideoListener from './VideoListener';
const giphyFetch = new GiphyFetch('meKO7qbULHC9Q26DRGt2yZguIn3LB6z7');
const giphyFetch = new GiphyFetch('ojJbIMUN6XRMn4mHiFFav3rMCpXUg8sq');
export default class Chat extends Component {
constructor(props) {
super(props);
@@ -180,7 +180,7 @@ export default class Chat extends Component {
name: window.localStorage.getItem('watchPartyUserName'),
uid: window.localStorage.getItem('watchPartyUserUid'),
text: message,
time: new Date().toISOString(),
time: new Date(),
type: '',
};
if (this.state.gif === true) data.type = 'giphy';
@@ -190,7 +190,7 @@ export default class Chat extends Component {
});
}
sendMessageInvoker(overrideMessage) {
if (overrideMessage) this.sendMessage(overrideMessage);
if (overrideMessage) console.log(overrideMessage);
else {
const trim = this.state.newMessage.replace(/^\s+|\s+$/g, '');
if (trim !== '') this.sendMessage(trim);
@@ -199,7 +199,7 @@ export default class Chat extends Component {
}
gifClick(iGif, ev) {
ev.preventDefault();
this.sendMessageInvoker(iGif.images.original.url);
this.sendMessageInvoker(iGif);
}
getCarousel() {
const trendingFetch = (offset) => giphyFetch.trending({ offset, limit: 5 });
@@ -242,9 +242,7 @@ export default class Chat extends Component {
</ButtonGroup>
</div>
<div className="thread-container">
<Thread
messages={messages.sort((a, b) => new Date(b).getTime() - new Date(a).getTime())}
/>
<Thread messages={messages} />
</div>
<TextField
multiline
+5 -11
View File
@@ -18,8 +18,6 @@ const firebaseConfig = {
firebase.initializeApp(firebaseConfig);
if (window.netflix) console.log('Netflix found');
const PartyWrapper = document.createElement('div');
PartyWrapper.id = 'party_wrapper';
document.body.appendChild(PartyWrapper);
@@ -42,6 +40,11 @@ switch (getPlayerSource()) {
{ capture: true }
);
document.body.classList.add('hulu');
const ds = document.createElement('script');
ds.text = `window.doquery=function(){window.huluPlayer=window.queryObjects(window.HuluMediaPlayer);}`;
document.head.appendChild(ds);
if (window.queryObjects) console.log('canqyery');
else console.log('cantqyery');
break;
case PLAYER_SOURCE.AMAZON:
document.body.classList.add('amazon-prime');
@@ -50,15 +53,6 @@ switch (getPlayerSource()) {
document.body.classList.add('disney');
break;
case PLAYER_SOURCE.LOCAL:
const VideoPlayer = document.createElement('video');
VideoPlayer.autoplay = true;
VideoPlayer.muted = true;
VideoPlayer.controls = true;
VideoPlayer.style.width = '300px';
VideoPlayer.src =
'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4';
VideoPlayer.addEventListener('change', (e) => console.log(e));
document.body.appendChild(VideoPlayer);
break;
default:
break;