From 3a2f24da944b099dfd66b753f75dcf826379e290 Mon Sep 17 00:00:00 2001 From: Yevhenii Voloshchak Date: Thu, 26 May 2022 20:47:14 +0300 Subject: [PATCH 1/2] Open google meet app instead of creating a new meeting on Android --- src/CONST.js | 1 + .../BaseVideoChatButtonAndMenu.js} | 52 ++++++++----------- .../VideoChatButtonAndMenu/index.android.js | 20 +++++++ .../VideoChatButtonAndMenu/index.js | 15 ++++++ .../videoChatButtonAndMenuPropTypes.js | 20 +++++++ 5 files changed, 77 insertions(+), 31 deletions(-) rename src/components/{VideoChatButtonAndMenu.js => VideoChatButtonAndMenu/BaseVideoChatButtonAndMenu.js} (78%) create mode 100644 src/components/VideoChatButtonAndMenu/index.android.js create mode 100644 src/components/VideoChatButtonAndMenu/index.js create mode 100644 src/components/VideoChatButtonAndMenu/videoChatButtonAndMenuPropTypes.js diff --git a/src/CONST.js b/src/CONST.js index c0e26e78fca7..7ba430ed26d6 100755 --- a/src/CONST.js +++ b/src/CONST.js @@ -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`, diff --git a/src/components/VideoChatButtonAndMenu.js b/src/components/VideoChatButtonAndMenu/BaseVideoChatButtonAndMenu.js similarity index 78% rename from src/components/VideoChatButtonAndMenu.js rename to src/components/VideoChatButtonAndMenu/BaseVideoChatButtonAndMenu.js index 8fe3bdacfa1e..8184f47f7774 100755 --- a/src/components/VideoChatButtonAndMenu.js +++ b/src/components/VideoChatButtonAndMenu/BaseVideoChatButtonAndMenu.js @@ -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); @@ -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); }, }, ]; @@ -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); diff --git a/src/components/VideoChatButtonAndMenu/index.android.js b/src/components/VideoChatButtonAndMenu/index.android.js new file mode 100644 index 000000000000..8ae4a2ab94d0 --- /dev/null +++ b/src/components/VideoChatButtonAndMenu/index.android.js @@ -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 => ( + +); + +VideoChatButtonAndMenu.propTypes = propTypes; +VideoChatButtonAndMenu.defaultProps = defaultProps; +VideoChatButtonAndMenu.displayName = 'VideoChatButtonAndMenu'; +export default VideoChatButtonAndMenu; diff --git a/src/components/VideoChatButtonAndMenu/index.js b/src/components/VideoChatButtonAndMenu/index.js new file mode 100644 index 000000000000..9b310e012daa --- /dev/null +++ b/src/components/VideoChatButtonAndMenu/index.js @@ -0,0 +1,15 @@ +import React from 'react'; +import {propTypes, defaultProps} from './videoChatButtonAndMenuPropTypes'; +import BaseVideoChatButtonAndMenu from './BaseVideoChatButtonAndMenu'; + +const VideoChatButtonAndMenu = props => ( + +); + +VideoChatButtonAndMenu.propTypes = propTypes; +VideoChatButtonAndMenu.defaultProps = defaultProps; +VideoChatButtonAndMenu.displayName = 'VideoChatButtonAndMenu'; +export default VideoChatButtonAndMenu; diff --git a/src/components/VideoChatButtonAndMenu/videoChatButtonAndMenuPropTypes.js b/src/components/VideoChatButtonAndMenu/videoChatButtonAndMenuPropTypes.js new file mode 100644 index 000000000000..c129d4dd4904 --- /dev/null +++ b/src/components/VideoChatButtonAndMenu/videoChatButtonAndMenuPropTypes.js @@ -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, + + ...withLocalizePropTypes, + ...windowDimensionsPropTypes, +}; + +const defaultProps = { + isConcierge: false, +}; + +export {propTypes, defaultProps}; From d10b8b8380d5dda90c776d322f49d2fc593cb515 Mon Sep 17 00:00:00 2001 From: Yevhenii Voloshchak Date: Mon, 30 May 2022 13:42:41 +0300 Subject: [PATCH 2/2] Cleanup --- .../VideoChatButtonAndMenu/BaseVideoChatButtonAndMenu.js | 2 +- src/components/VideoChatButtonAndMenu/index.android.js | 2 +- src/components/VideoChatButtonAndMenu/index.js | 2 ++ .../VideoChatButtonAndMenu/videoChatButtonAndMenuPropTypes.js | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/VideoChatButtonAndMenu/BaseVideoChatButtonAndMenu.js b/src/components/VideoChatButtonAndMenu/BaseVideoChatButtonAndMenu.js index 8184f47f7774..f4fa0c7cad9a 100755 --- a/src/components/VideoChatButtonAndMenu/BaseVideoChatButtonAndMenu.js +++ b/src/components/VideoChatButtonAndMenu/BaseVideoChatButtonAndMenu.js @@ -43,7 +43,7 @@ class BaseVideoChatButtonAndMenu extends Component { text: props.translate('videoChatButtonAndMenu.googleMeet'), onPress: () => { this.toggleVideoChatMenu(); - Linking.openURL(this.props.newGoogleMeetingUrl || CONST.NEW_GOOGLE_MEET_MEETING_URL); + Linking.openURL(this.props.googleMeetURL); }, }, ]; diff --git a/src/components/VideoChatButtonAndMenu/index.android.js b/src/components/VideoChatButtonAndMenu/index.android.js index 8ae4a2ab94d0..addd5035aead 100644 --- a/src/components/VideoChatButtonAndMenu/index.android.js +++ b/src/components/VideoChatButtonAndMenu/index.android.js @@ -8,7 +8,7 @@ import BaseVideoChatButtonAndMenu from './BaseVideoChatButtonAndMenu'; // https://github.com/Expensify/App/issues/8851#issuecomment-1120236904 const VideoChatButtonAndMenu = props => ( diff --git a/src/components/VideoChatButtonAndMenu/index.js b/src/components/VideoChatButtonAndMenu/index.js index 9b310e012daa..b693424841a9 100644 --- a/src/components/VideoChatButtonAndMenu/index.js +++ b/src/components/VideoChatButtonAndMenu/index.js @@ -1,9 +1,11 @@ import React from 'react'; +import CONST from '../../CONST'; import {propTypes, defaultProps} from './videoChatButtonAndMenuPropTypes'; import BaseVideoChatButtonAndMenu from './BaseVideoChatButtonAndMenu'; const VideoChatButtonAndMenu = props => ( diff --git a/src/components/VideoChatButtonAndMenu/videoChatButtonAndMenuPropTypes.js b/src/components/VideoChatButtonAndMenu/videoChatButtonAndMenuPropTypes.js index c129d4dd4904..de6b5cb5aae3 100644 --- a/src/components/VideoChatButtonAndMenu/videoChatButtonAndMenuPropTypes.js +++ b/src/components/VideoChatButtonAndMenu/videoChatButtonAndMenuPropTypes.js @@ -7,7 +7,7 @@ const propTypes = { isConcierge: PropTypes.bool, /** Link to open when user wants to create a new google meet meeting */ - newGoogleMeetingUrl: PropTypes.string, + googleMeetURL: PropTypes.string.isRequired, ...withLocalizePropTypes, ...windowDimensionsPropTypes,