From 3a0f12ff9d34262d4d5cf19460dc64e5b8efcfc1 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Tue, 12 Mar 2019 15:15:11 -0400 Subject: [PATCH] Merge 'release' into 'master' (#2327) * fix: wallet balance style with 0lbc * v0.29.3-rc.1 * v0.29.3 * fix: videoplayer Switched from timeout to slight delay, works consistently on lbry://test-stream-1. This also fixes the white screen issue (copied most code from current master). * fix: add back timeout * fix: phone collection styling * v0.29.4-rc.2 * update changelog * v0.29.4 * fix rebase --- CHANGELOG.md | 15 +++++- package.json | 2 +- .../component/fileViewer/internal/player.jsx | 51 ++++++++----------- src/ui/component/userPhoneNew/view.jsx | 16 ++++-- src/ui/component/walletBalance/view.jsx | 4 +- src/ui/modal/modalRemoveFile/view.jsx | 16 ++---- 6 files changed, 54 insertions(+), 50 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d32878837..c801f03d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,20 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Fixed -## [0.29.1] - 2019-3-1 +## [0.29.4] - 2019-3-12 + +### Fixed + +- Style issue on phone number collection modal +- White screen when watching videos for some files + +## [0.29.3] - 2019-3-7 + +### Fixed + +- Minor style issue with 0 LBC balance on the wallet page + +## [0.29.2] - 2019-3-1 ### Fixed diff --git a/package.json b/package.json index 404f7c95d..6d526508f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "LBRY", - "version": "0.29.2", + "version": "0.29.4", "description": "A browser for the LBRY network, a digital marketplace controlled by its users.", "keywords": [ "lbry" diff --git a/src/ui/component/fileViewer/internal/player.jsx b/src/ui/component/fileViewer/internal/player.jsx index 343e5122f..a36b164ac 100644 --- a/src/ui/component/fileViewer/internal/player.jsx +++ b/src/ui/component/fileViewer/internal/player.jsx @@ -1,4 +1,4 @@ -/* eslint-disable */ +// @flow import type { Claim } from 'types/claim'; import * as React from 'react'; // @if TARGET='app' @@ -14,7 +14,6 @@ type Props = { contentType: string, mediaType: string, downloadCompleted: boolean, - playingUri: ?string, volume: number, position: ?number, downloadPath: string, @@ -74,9 +73,9 @@ class MediaPlayer extends React.PureComponent { componentDidMount() { this.playMedia(); - // Temp hack to force the video to play if the metadataloaded event was never fired // Will be removed with the new video player + // Unoptimized MP4s will fail to render. // @if TARGET='app' setTimeout(() => { const { hasMetadata } = this.state; @@ -88,23 +87,8 @@ class MediaPlayer extends React.PureComponent { // @endif } - // @if TARGET='app' - componentDidUpdate(prevProps: Props) { - const { downloadCompleted } = this.props; - const { fileSource } = this.state; - - const el = this.mediaContainer.current; - - if (this.props.playingUri && !prevProps.playingUri && !el.paused) { - el.pause(); - } else if (this.isSupportedFile() && !fileSource && downloadCompleted) { - this.renderFile(); - } - } - // @endif - componentWillUnmount() { - document.removeEventListener('keydown', this.togglePlay); + document.removeEventListener('keydown', this.togglePlayListener); const mediaElement = this.mediaContainer.current.children[0]; if (mediaElement) { mediaElement.removeEventListener('click', this.togglePlay); @@ -125,7 +109,6 @@ class MediaPlayer extends React.PureComponent { } playMedia() { - // @if TARGET='app' const container = this.mediaContainer.current; const { downloadCompleted, @@ -138,6 +121,8 @@ class MediaPlayer extends React.PureComponent { fileName, } = this.props; + // @if TARGET='app' + const renderMediaCallback = error => { if (error) this.setState({ unplayable: true }); }; @@ -157,15 +142,18 @@ class MediaPlayer extends React.PureComponent { } // Render default viewer: render-media (video, audio, img, iframe) else { - player.append( - { - name: fileName, - createReadStream: opts => fs.createReadStream(downloadPath, opts), - }, - container, - { autoplay: true, controls: true }, - renderMediaCallback.bind(this) - ); + // Temp hack to help in some metadata loading cases + setTimeout(() => { + player.append( + { + name: fileName, + createReadStream: opts => fs.createReadStream(downloadPath, opts), + }, + container, + { autoplay: true, controls: true }, + renderMediaCallback.bind(this) + ); + }, 300); } document.addEventListener('keydown', this.togglePlay); @@ -175,7 +163,9 @@ class MediaPlayer extends React.PureComponent { mediaElement.currentTime = position; } - mediaElement.addEventListener('loadedmetadata', () => this.refreshMetadata()); + mediaElement.addEventListener('loadedmetadata', () => this.refreshMetadata(), { + once: true, + }); mediaElement.addEventListener('timeupdate', () => savePosition(mediaElement.currentTime)); mediaElement.addEventListener('click', this.togglePlay); mediaElement.addEventListener('ended', () => { @@ -210,7 +200,6 @@ class MediaPlayer extends React.PureComponent { if (onStartCb) { onStartCb(); } - const playerElement = this.mediaContainer.current; if (playerElement) { playerElement.children[0].play(); diff --git a/src/ui/component/userPhoneNew/view.jsx b/src/ui/component/userPhoneNew/view.jsx index 92f0673da..241a0c18f 100644 --- a/src/ui/component/userPhoneNew/view.jsx +++ b/src/ui/component/userPhoneNew/view.jsx @@ -94,12 +94,17 @@ class UserPhoneNew extends React.PureComponent {

-
- + +
- + {countryCodes.map((country, index) => ( - // eslint-disable-next-line + // eslint-disable-next-line react/no-array-index-key { }} /> - +
{cancelButton} diff --git a/src/ui/component/walletBalance/view.jsx b/src/ui/component/walletBalance/view.jsx index 92d07f622..48ba9091e 100644 --- a/src/ui/component/walletBalance/view.jsx +++ b/src/ui/component/walletBalance/view.jsx @@ -17,7 +17,9 @@ const WalletBalance = (props: Props) => {
- {(balance || balance === 0) && } + {(balance || balance === 0) && ( + + )}
); diff --git a/src/ui/modal/modalRemoveFile/view.jsx b/src/ui/modal/modalRemoveFile/view.jsx index 8f032b8c7..7d54c5e97 100644 --- a/src/ui/modal/modalRemoveFile/view.jsx +++ b/src/ui/modal/modalRemoveFile/view.jsx @@ -8,8 +8,8 @@ type Props = { closeModal: () => void, deleteFile: (string, boolean, boolean) => void, title: string, - fileInfo: { - outpoint: string, + fileInfo?: { + outpoint: ?string, }, }; @@ -21,7 +21,6 @@ type State = { class ModalRemoveFile extends React.PureComponent { constructor(props: Props) { super(props); - this.state = { deleteChecked: false, abandonClaimChecked: true, @@ -48,15 +47,10 @@ class ModalRemoveFile extends React.PureComponent { } render() { - const { - claimIsMine, - closeModal, - deleteFile, - fileInfo: { outpoint }, - title, - } = this.props; + const { claimIsMine, closeModal, deleteFile, fileInfo, title } = this.props; const { deleteChecked, abandonClaimChecked } = this.state; + const outpoint = fileInfo ? fileInfo.outpoint : ''; return ( { contentLabel={__('Confirm File Remove')} type="confirm" confirmButtonLabel={__('Remove')} - onConfirmed={() => deleteFile(outpoint, deleteChecked, abandonClaimChecked)} + onConfirmed={() => deleteFile(outpoint || '', deleteChecked, abandonClaimChecked)} onAborted={closeModal} >