Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with google meet not opening on Android #9193

Merged
merged 2 commits into from
Jun 2, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/CONST.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ const CONST = {
USE_EXPENSIFY_URL,
NEW_ZOOM_MEETING_URL: 'https://zoom.us/start/videomeeting',
NEW_GOOGLE_MEET_MEETING_URL: 'https://meet.google.com/new',
GOOGLE_MEET_URL_ANDROID: 'https://meet.google.com',
DEEPLINK_BASE_URL: 'new-expensify://',
PDF_VIEWER_URL: '/pdf/web/viewer.html',
EXPENSIFY_ICON_URL: `${CLOUDFRONT_URL}/images/favicon-2019.png`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,24 @@ import React, {Component} from 'react';
import {
View, Pressable, Dimensions, Linking,
} from 'react-native';
import PropTypes from 'prop-types';
import Icon from './Icon';
import * as Expensicons from './Icon/Expensicons';
import Popover from './Popover';
import MenuItem from './MenuItem';
import ZoomIcon from '../../assets/images/zoom-icon.svg';
import GoogleMeetIcon from '../../assets/images/google-meet.svg';
import CONST from '../CONST';
import styles from '../styles/styles';
import themeColors from '../styles/themes/default';
import withWindowDimensions, {windowDimensionsPropTypes} from './withWindowDimensions';
import withLocalize, {withLocalizePropTypes} from './withLocalize';
import compose from '../libs/compose';
import Navigation from '../libs/Navigation/Navigation';
import ROUTES from '../ROUTES';
import Tooltip from './Tooltip';
import Icon from '../Icon';
import * as Expensicons from '../Icon/Expensicons';
import Popover from '../Popover';
import MenuItem from '../MenuItem';
import ZoomIcon from '../../../assets/images/zoom-icon.svg';
import GoogleMeetIcon from '../../../assets/images/google-meet.svg';
import CONST from '../../CONST';
import styles from '../../styles/styles';
import themeColors from '../../styles/themes/default';
import withWindowDimensions from '../withWindowDimensions';
import withLocalize from '../withLocalize';
import compose from '../../libs/compose';
import Navigation from '../../libs/Navigation/Navigation';
import ROUTES from '../../ROUTES';
import Tooltip from '../Tooltip';
import {propTypes, defaultProps} from './videoChatButtonAndMenuPropTypes';

const propTypes = {
...withLocalizePropTypes,
...windowDimensionsPropTypes,
isConcierge: PropTypes.bool,
};

const defaultProps = {
isConcierge: false,
};

class VideoChatButtonAndMenu extends Component {
class BaseVideoChatButtonAndMenu extends Component {
constructor(props) {
super(props);

Expand All @@ -53,7 +43,7 @@ class VideoChatButtonAndMenu extends Component {
text: props.translate('videoChatButtonAndMenu.googleMeet'),
onPress: () => {
this.toggleVideoChatMenu();
Linking.openURL(CONST.NEW_GOOGLE_MEET_MEETING_URL);
Linking.openURL(this.props.newGoogleMeetingUrl || CONST.NEW_GOOGLE_MEET_MEETING_URL);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Umm, let's pass CONST.NEW_GOOGLE_MEET_MEETING_URL from index.js
I think it improves code readability.

},
},
];
Expand Down Expand Up @@ -148,10 +138,10 @@ class VideoChatButtonAndMenu extends Component {
}
}

VideoChatButtonAndMenu.propTypes = propTypes;
VideoChatButtonAndMenu.defaultProps = defaultProps;
BaseVideoChatButtonAndMenu.propTypes = propTypes;
BaseVideoChatButtonAndMenu.defaultProps = defaultProps;

export default compose(
withWindowDimensions,
withLocalize,
)(VideoChatButtonAndMenu);
)(BaseVideoChatButtonAndMenu);
20 changes: 20 additions & 0 deletions src/components/VideoChatButtonAndMenu/index.android.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from 'react';
import CONST from '../../CONST';
import {propTypes, defaultProps} from './videoChatButtonAndMenuPropTypes';
import BaseVideoChatButtonAndMenu from './BaseVideoChatButtonAndMenu';

// On Android creating a new google meet meeting requires the CALL_PHONE permission in some cases
// so we're just opening the google meet app instead, more details:
// https://github.com/Expensify/App/issues/8851#issuecomment-1120236904
const VideoChatButtonAndMenu = props => (
<BaseVideoChatButtonAndMenu
newGoogleMeetingUrl={CONST.GOOGLE_MEET_URL_ANDROID}
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
/>
);

VideoChatButtonAndMenu.propTypes = propTypes;
VideoChatButtonAndMenu.defaultProps = defaultProps;
VideoChatButtonAndMenu.displayName = 'VideoChatButtonAndMenu';
export default VideoChatButtonAndMenu;
15 changes: 15 additions & 0 deletions src/components/VideoChatButtonAndMenu/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react';
import {propTypes, defaultProps} from './videoChatButtonAndMenuPropTypes';
import BaseVideoChatButtonAndMenu from './BaseVideoChatButtonAndMenu';

const VideoChatButtonAndMenu = props => (
<BaseVideoChatButtonAndMenu
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
/>
);

VideoChatButtonAndMenu.propTypes = propTypes;
VideoChatButtonAndMenu.defaultProps = defaultProps;
VideoChatButtonAndMenu.displayName = 'VideoChatButtonAndMenu';
export default VideoChatButtonAndMenu;
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import PropTypes from 'prop-types';
import {windowDimensionsPropTypes} from '../withWindowDimensions';
import {withLocalizePropTypes} from '../withLocalize';

const propTypes = {
/** If this is the Concierge chat, we'll open the modal for requesting a setup call instead of showing popover menu */
isConcierge: PropTypes.bool,

/** Link to open when user wants to create a new google meet meeting */
newGoogleMeetingUrl: PropTypes.string,
Copy link
Member

@rushatgabhane rushatgabhane May 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename newGoogleMeetingUrl -> googleMeetURL, and we'll also need to make it a required prop because of the above index.js change.


...withLocalizePropTypes,
...windowDimensionsPropTypes,
};

const defaultProps = {
isConcierge: false,
};

export {propTypes, defaultProps};