0
0
Fork 0

Fix pop-out player appearing on mobile screens in web UI (#15157)

Fix #15092
This commit is contained in:
Eugen Rochko 2020-11-16 05:16:39 +01:00 committed by GitHub
parent 04a079e723
commit 18ca4e0e9a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 79 additions and 72 deletions

View file

@ -97,7 +97,10 @@ class Status extends ImmutablePureComponent {
cachedMediaWidth: PropTypes.number,
scrollKey: PropTypes.string,
deployPictureInPicture: PropTypes.func,
usingPiP: PropTypes.bool,
pictureInPicture: PropTypes.shape({
inUse: PropTypes.bool,
available: PropTypes.bool,
}),
};
// Avoid checking props that are functions (and whose equality will always
@ -108,7 +111,7 @@ class Status extends ImmutablePureComponent {
'muted',
'hidden',
'unread',
'usingPiP',
'pictureInPicture',
];
state = {
@ -277,7 +280,7 @@ class Status extends ImmutablePureComponent {
let media = null;
let statusAvatar, prepend, rebloggedByText;
const { intl, hidden, featured, otherAccounts, unread, showThread, scrollKey, usingPiP } = this.props;
const { intl, hidden, featured, otherAccounts, unread, showThread, scrollKey, pictureInPicture } = this.props;
let { status, account, ...other } = this.props;
@ -348,7 +351,7 @@ class Status extends ImmutablePureComponent {
status = status.get('reblog');
}
if (usingPiP) {
if (pictureInPicture.inUse) {
media = <PictureInPicturePlaceholder width={this.props.cachedMediaWidth} />;
} else if (status.get('media_attachments').size > 0) {
if (this.props.muted) {
@ -375,7 +378,7 @@ class Status extends ImmutablePureComponent {
width={this.props.cachedMediaWidth}
height={110}
cacheWidth={this.props.cacheMediaWidth}
deployPictureInPicture={this.handleDeployPictureInPicture}
deployPictureInPicture={pictureInPicture.available ? this.handleDeployPictureInPicture : undefined}
/>
)}
</Bundle>
@ -397,7 +400,7 @@ class Status extends ImmutablePureComponent {
sensitive={status.get('sensitive')}
onOpenVideo={this.handleOpenVideo}
cacheWidth={this.props.cacheMediaWidth}
deployPictureInPicture={this.handleDeployPictureInPicture}
deployPictureInPicture={pictureInPicture.available ? this.handleDeployPictureInPicture : undefined}
visible={this.state.showMedia}
onToggleVisibility={this.handleToggleMediaVisibility}
/>