fix(android) fix default value for pip.enabled

Fixes: https://github.com/jitsi/jitsi-meet/issues/15014
pull/15039/head jitsi-meet_9690
Saúl Ibarra Corretgé 9 months ago committed by Calinteodor
parent 22bbf4939e
commit d6fa066e4d
  1. 5
      android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetConferenceOptions.java
  2. 6
      react/features/conference/components/native/Conference.tsx
  3. 5
      react/features/mobile/picture-in-picture/actions.ts
  4. 14
      react/features/mobile/picture-in-picture/components/PictureInPictureButton.ts
  5. 23
      react/features/mobile/picture-in-picture/functions.ts

@ -270,11 +270,6 @@ public class JitsiMeetConferenceOptions implements Parcelable {
Bundle asProps() {
Bundle props = new Bundle();
// Android always has the PiP flag set by default.
if (!featureFlags.containsKey("pip.enabled")) {
featureFlags.putBoolean("pip.enabled", true);
}
props.putBundle("flags", featureFlags);
Bundle urlProps = new Bundle();

@ -15,7 +15,7 @@ import { connect, useDispatch } from 'react-redux';
import { appNavigate } from '../../../app/actions.native';
import { IReduxState, IStore } from '../../../app/types';
import { CONFERENCE_BLURRED, CONFERENCE_FOCUSED } from '../../../base/conference/actionTypes';
import { FULLSCREEN_ENABLED, PIP_ENABLED } from '../../../base/flags/constants';
import { FULLSCREEN_ENABLED } from '../../../base/flags/constants';
import { getFeatureFlag } from '../../../base/flags/functions';
import Container from '../../../base/react/components/native/Container';
import LoadingIndicator from '../../../base/react/components/native/LoadingIndicator';
@ -38,7 +38,7 @@ import LargeVideo from '../../../large-video/components/LargeVideo.native';
import { getIsLobbyVisible } from '../../../lobby/functions';
import { navigate } from '../../../mobile/navigation/components/conference/ConferenceNavigationContainerRef';
import { screen } from '../../../mobile/navigation/routes';
import { setPictureInPictureEnabled } from '../../../mobile/picture-in-picture/functions';
import { isPipEnabled, setPictureInPictureEnabled } from '../../../mobile/picture-in-picture/functions';
import Captions from '../../../subtitles/components/native/Captions';
import { setToolboxVisible } from '../../../toolbox/actions.native';
import Toolbox from '../../../toolbox/components/native/Toolbox';
@ -579,7 +579,7 @@ function _mapStateToProps(state: IReduxState, _ownProps: any) {
_fullscreenEnabled: getFeatureFlag(state, FULLSCREEN_ENABLED, true),
_isParticipantsPaneOpen: isOpen,
_largeVideoParticipantId: state['features/large-video'].participantId,
_pictureInPictureEnabled: getFeatureFlag(state, PIP_ENABLED),
_pictureInPictureEnabled: isPipEnabled(state),
_reducedUI: reducedUI,
_showLobby: getIsLobbyVisible(state),
_startCarMode: startCarMode,

@ -1,11 +1,10 @@
import { NativeModules } from 'react-native';
import { IStore } from '../../app/types';
import { PIP_ENABLED } from '../../base/flags/constants';
import { getFeatureFlag } from '../../base/flags/functions';
import Platform from '../../base/react/Platform.native';
import { ENTER_PICTURE_IN_PICTURE } from './actionTypes';
import { isPipEnabled } from './functions';
import logger from './logger';
/**
@ -23,7 +22,7 @@ export function enterPictureInPicture() {
// XXX At the time of this writing this action can only be dispatched by
// the button which is on the conference view, which means that it's
// fine to enter PiP mode.
if (getFeatureFlag(getState, PIP_ENABLED)) {
if (isPipEnabled(getState())) {
const { PictureInPicture } = NativeModules;
const p
= Platform.OS === 'android'

@ -1,14 +1,14 @@
import { NativeModules, Platform } from 'react-native';
import { connect } from 'react-redux';
import { IReduxState } from '../../../app/types';
import { PIP_ENABLED, PIP_WHILE_SCREEN_SHARING_ENABLED } from '../../../base/flags/constants';
import { PIP_WHILE_SCREEN_SHARING_ENABLED } from '../../../base/flags/constants';
import { getFeatureFlag } from '../../../base/flags/functions';
import { translate } from '../../../base/i18n/functions';
import { IconArrowDown } from '../../../base/icons/svg';
import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
import { isLocalVideoTrackDesktop } from '../../../base/tracks/functions.native';
import { enterPictureInPicture } from '../actions';
import { isPipEnabled } from '../functions';
interface IProps extends AbstractButtonProps {
@ -58,15 +58,9 @@ class PictureInPictureButton extends AbstractButton<IProps> {
* }}
*/
function _mapStateToProps(state: IReduxState) {
const pipEnabled = Boolean(getFeatureFlag(state, PIP_ENABLED));
const pipEnabled = isPipEnabled(state);
const pipWhileScreenSharingEnabled = getFeatureFlag(state, PIP_WHILE_SCREEN_SHARING_ENABLED, false);
let enabled = pipEnabled && (!isLocalVideoTrackDesktop(state) || pipWhileScreenSharingEnabled);
// Override flag for Android, since it might be unsupported.
if (Platform.OS === 'android' && !NativeModules.PictureInPicture.SUPPORTED) {
enabled = false;
}
const enabled = pipEnabled && (!isLocalVideoTrackDesktop(state) || pipWhileScreenSharingEnabled);
return {
_enabled: enabled

@ -1,4 +1,25 @@
import { NativeModules } from 'react-native';
import { NativeModules, Platform } from 'react-native';
import { IReduxState } from '../../app/types';
import { PIP_ENABLED } from '../../base/flags/constants';
import { getFeatureFlag } from '../../base/flags/functions';
/**
* Checks whether Picture-in-Picture is enabled.
*
* @param {Object} state - The Redux state.
* @returns {boolean} Whether PiP is enabled or not.
*/
export function isPipEnabled(state: IReduxState) {
let enabled = getFeatureFlag(state, PIP_ENABLED);
// Override flag for Android, since it might be unsupported.
if (Platform.OS === 'android' && (typeof enabled === 'undefined' || enabled)) {
enabled = NativeModules.PictureInPicture.SUPPORTED;
}
return Boolean(enabled);
}
/**
* Enabled/Disables the PictureInPicture mode in PiP native module.

Loading…
Cancel
Save