2018-05-08 13:04:26 +00:00
|
|
|
// @flow
|
2017-02-07 14:45:51 +00:00
|
|
|
|
2016-12-23 16:21:51 +00:00
|
|
|
import React, { Component } from 'react';
|
2019-03-21 16:38:29 +00:00
|
|
|
import { connect } from '../../base/redux';
|
2017-01-13 22:37:53 +00:00
|
|
|
|
2018-04-16 12:44:08 +00:00
|
|
|
import { createDeepLinkingPageEvent, sendAnalytics } from '../../analytics';
|
2019-08-04 00:08:43 +00:00
|
|
|
import { translate } from '../../base/i18n';
|
2018-06-27 09:43:13 +00:00
|
|
|
import { Platform } from '../../base/react';
|
2018-02-21 01:25:22 +00:00
|
|
|
import { DialInSummary } from '../../invite';
|
2017-02-16 20:00:54 +00:00
|
|
|
|
2018-04-14 00:00:40 +00:00
|
|
|
import { _TNS } from '../constants';
|
|
|
|
import { generateDeepLinkingURL } from '../functions';
|
2019-11-05 12:02:39 +00:00
|
|
|
import { renderPromotionalFooter } from '../renderPromotionalFooter';
|
2017-12-04 23:16:16 +00:00
|
|
|
|
2018-04-14 00:00:40 +00:00
|
|
|
declare var interfaceConfig: Object;
|
2017-03-01 02:55:12 +00:00
|
|
|
|
|
|
|
/**
|
2018-04-14 00:00:40 +00:00
|
|
|
* The namespace of the CSS styles of DeepLinkingMobilePage.
|
2017-03-01 02:55:12 +00:00
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @type {string}
|
|
|
|
*/
|
2018-04-14 00:00:40 +00:00
|
|
|
const _SNS = 'deep-linking-mobile';
|
2017-03-01 02:55:12 +00:00
|
|
|
|
2016-12-23 16:21:51 +00:00
|
|
|
/**
|
2018-10-30 05:02:23 +00:00
|
|
|
* The type of the React {@code Component} props of
|
|
|
|
* {@link DeepLinkingMobilePage}.
|
2016-12-23 16:21:51 +00:00
|
|
|
*/
|
2018-10-30 05:02:23 +00:00
|
|
|
type Props = {
|
2017-02-07 14:45:51 +00:00
|
|
|
|
2020-05-18 11:48:52 +00:00
|
|
|
/**
|
|
|
|
* Application download URL.
|
|
|
|
*/
|
|
|
|
_downloadUrl: ?string,
|
|
|
|
|
2017-01-25 22:11:44 +00:00
|
|
|
/**
|
2018-10-30 05:02:23 +00:00
|
|
|
* The name of the conference attempting to being joined.
|
2017-01-25 22:11:44 +00:00
|
|
|
*/
|
2018-10-30 05:02:23 +00:00
|
|
|
_room: string,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The function to translate human-readable text.
|
|
|
|
*/
|
|
|
|
t: Function
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* React component representing mobile browser page.
|
|
|
|
*
|
|
|
|
* @class DeepLinkingMobilePage
|
|
|
|
*/
|
2019-01-30 12:16:50 +00:00
|
|
|
class DeepLinkingMobilePage extends Component<Props> {
|
2018-04-16 12:44:08 +00:00
|
|
|
/**
|
|
|
|
* Initializes a new {@code DeepLinkingMobilePage} instance.
|
|
|
|
*
|
|
|
|
* @param {Object} props - The read-only React {@code Component} props with
|
|
|
|
* which the new instance is to be initialized.
|
|
|
|
*/
|
2018-10-30 05:02:23 +00:00
|
|
|
constructor(props: Props) {
|
2018-04-16 12:44:08 +00:00
|
|
|
super(props);
|
|
|
|
|
|
|
|
// Bind event handlers so they are only bound once per instance.
|
|
|
|
this._onDownloadApp = this._onDownloadApp.bind(this);
|
|
|
|
this._onOpenApp = this._onOpenApp.bind(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements the Component's componentDidMount method.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
componentDidMount() {
|
|
|
|
sendAnalytics(
|
|
|
|
createDeepLinkingPageEvent(
|
|
|
|
'displayed', 'DeepLinkingMobile', { isMobileBrowser: true }));
|
|
|
|
}
|
|
|
|
|
2016-12-23 16:21:51 +00:00
|
|
|
/**
|
2017-02-01 04:25:09 +00:00
|
|
|
* Implements React's {@link Component#render()}.
|
2016-12-23 16:21:51 +00:00
|
|
|
*
|
2017-02-01 04:25:09 +00:00
|
|
|
* @inheritdoc
|
2016-12-23 16:21:51 +00:00
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
|
|
|
render() {
|
2020-05-18 11:48:52 +00:00
|
|
|
const { _downloadUrl, _room, t } = this.props;
|
2018-04-14 00:00:40 +00:00
|
|
|
const { NATIVE_APP_NAME, SHOW_DEEP_LINKING_IMAGE } = interfaceConfig;
|
|
|
|
const downloadButtonClassName
|
2017-03-01 02:55:12 +00:00
|
|
|
= `${_SNS}__button ${_SNS}__button_primary`;
|
|
|
|
|
2019-11-15 08:43:18 +00:00
|
|
|
|
2020-05-18 11:48:52 +00:00
|
|
|
const onOpenLinkProperties = _downloadUrl
|
2019-11-15 08:43:18 +00:00
|
|
|
? {
|
|
|
|
// When opening a link to the download page, we want to let the
|
|
|
|
// OS itself handle intercepting and opening the appropriate
|
|
|
|
// app store. This avoids potential issues with browsers, such
|
|
|
|
// as iOS Chrome, not opening the store properly.
|
|
|
|
}
|
|
|
|
: {
|
|
|
|
// When falling back to another URL (Firebase) let the page be
|
|
|
|
// opened in a new window. This helps prevent the user getting
|
|
|
|
// trapped in an app-open-cycle where going back to the mobile
|
|
|
|
// browser re-triggers the app-open behavior.
|
|
|
|
target: '_blank',
|
|
|
|
rel: 'noopener noreferrer'
|
|
|
|
};
|
|
|
|
|
2016-12-23 16:21:51 +00:00
|
|
|
return (
|
2017-03-01 02:55:12 +00:00
|
|
|
<div className = { _SNS }>
|
2018-04-14 00:00:40 +00:00
|
|
|
<div className = 'header'>
|
2016-12-23 16:21:51 +00:00
|
|
|
<img
|
2018-04-14 00:00:40 +00:00
|
|
|
className = 'logo'
|
2018-05-02 14:55:08 +00:00
|
|
|
src = 'images/logo-deep-linking.png' />
|
2018-04-14 00:00:40 +00:00
|
|
|
</div>
|
|
|
|
<div className = { `${_SNS}__body` }>
|
|
|
|
{
|
|
|
|
SHOW_DEEP_LINKING_IMAGE
|
|
|
|
? <img
|
|
|
|
className = 'image'
|
2018-05-02 14:55:08 +00:00
|
|
|
src = 'images/deep-linking-image.png' />
|
2018-04-14 00:00:40 +00:00
|
|
|
: null
|
|
|
|
}
|
2017-03-01 02:55:12 +00:00
|
|
|
<p className = { `${_SNS}__text` }>
|
2019-08-04 00:08:43 +00:00
|
|
|
{ t(`${_TNS}.appNotInstalled`, { app: NATIVE_APP_NAME }) }
|
2016-12-23 16:21:51 +00:00
|
|
|
</p>
|
2018-04-16 12:44:08 +00:00
|
|
|
<a
|
2019-11-15 08:43:18 +00:00
|
|
|
{ ...onOpenLinkProperties }
|
2018-05-08 13:04:26 +00:00
|
|
|
href = { this._generateDownloadURL() }
|
2019-11-15 08:43:18 +00:00
|
|
|
onClick = { this._onDownloadApp }>
|
2018-04-14 00:00:40 +00:00
|
|
|
<button className = { downloadButtonClassName }>
|
2017-12-04 23:16:16 +00:00
|
|
|
{ t(`${_TNS}.downloadApp`) }
|
2017-02-01 04:25:09 +00:00
|
|
|
</button>
|
|
|
|
</a>
|
2018-04-14 00:00:40 +00:00
|
|
|
<a
|
2019-11-15 08:43:18 +00:00
|
|
|
{ ...onOpenLinkProperties }
|
2018-04-14 00:00:40 +00:00
|
|
|
className = { `${_SNS}__href` }
|
2019-01-30 12:16:50 +00:00
|
|
|
href = { generateDeepLinkingURL() }
|
2019-11-15 08:43:18 +00:00
|
|
|
onClick = { this._onOpenApp }>
|
2018-04-14 00:00:40 +00:00
|
|
|
{/* <button className = { `${_SNS}__button` }> */}
|
|
|
|
{ t(`${_TNS}.openApp`) }
|
|
|
|
{/* </button> */}
|
|
|
|
</a>
|
2019-11-05 12:02:39 +00:00
|
|
|
{ renderPromotionalFooter() }
|
2018-04-14 00:00:40 +00:00
|
|
|
<DialInSummary
|
|
|
|
className = 'deep-linking-dial-in'
|
|
|
|
clickableNumbers = { true }
|
|
|
|
room = { _room } />
|
2016-12-23 16:21:51 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2018-04-16 12:44:08 +00:00
|
|
|
|
2018-05-08 13:04:26 +00:00
|
|
|
/**
|
|
|
|
* Generates the URL for downloading the app.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {string} - The URL for downloading the app.
|
|
|
|
*/
|
|
|
|
_generateDownloadURL() {
|
2020-05-18 11:48:52 +00:00
|
|
|
const { _downloadUrl: url } = this.props;
|
2018-05-08 13:04:26 +00:00
|
|
|
|
2020-05-11 10:38:30 +00:00
|
|
|
if (url && typeof interfaceConfig.MOBILE_DYNAMIC_LINK === 'undefined') {
|
2018-05-08 13:04:26 +00:00
|
|
|
return url;
|
|
|
|
}
|
|
|
|
|
|
|
|
// For information about the properties of
|
|
|
|
// interfaceConfig.MOBILE_DYNAMIC_LINK check:
|
|
|
|
// https://firebase.google.com/docs/dynamic-links/create-manually
|
|
|
|
const {
|
|
|
|
APN = 'org.jitsi.meet',
|
|
|
|
APP_CODE = 'w2atb',
|
2020-05-11 10:38:30 +00:00
|
|
|
CUSTOM_DOMAIN = undefined,
|
2018-05-08 13:04:26 +00:00
|
|
|
IBI = 'com.atlassian.JitsiMeet.ios',
|
|
|
|
ISI = '1165103905'
|
|
|
|
} = interfaceConfig.MOBILE_DYNAMIC_LINK || {};
|
2020-05-11 10:38:30 +00:00
|
|
|
|
|
|
|
const domain = CUSTOM_DOMAIN ?? `https://${APP_CODE}.app.goo.gl`;
|
2018-05-08 13:04:26 +00:00
|
|
|
const IUS = interfaceConfig.APP_SCHEME || 'org.jitsi.meet';
|
|
|
|
|
2020-05-11 10:38:30 +00:00
|
|
|
return `${domain}/?link=${
|
2018-05-08 13:04:26 +00:00
|
|
|
encodeURIComponent(window.location.href)}&apn=${
|
|
|
|
APN}&ibi=${
|
|
|
|
IBI}&isi=${
|
|
|
|
ISI}&ius=${
|
|
|
|
IUS}&efr=1`;
|
|
|
|
}
|
|
|
|
|
2019-08-15 14:54:31 +00:00
|
|
|
_onDownloadApp: () => void;
|
2018-04-16 12:44:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Handles download app button clicks.
|
|
|
|
*
|
2018-05-08 13:04:26 +00:00
|
|
|
* @private
|
2018-04-16 12:44:08 +00:00
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onDownloadApp() {
|
|
|
|
sendAnalytics(
|
|
|
|
createDeepLinkingPageEvent(
|
|
|
|
'clicked', 'downloadAppButton', { isMobileBrowser: true }));
|
|
|
|
}
|
|
|
|
|
2019-08-15 14:54:31 +00:00
|
|
|
_onOpenApp: () => void;
|
2018-04-16 12:44:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Handles open app button clicks.
|
|
|
|
*
|
2018-05-08 13:04:26 +00:00
|
|
|
* @private
|
2018-04-16 12:44:08 +00:00
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onOpenApp() {
|
|
|
|
sendAnalytics(
|
|
|
|
createDeepLinkingPageEvent(
|
|
|
|
'clicked', 'openAppButton', { isMobileBrowser: true }));
|
|
|
|
}
|
2016-12-23 16:21:51 +00:00
|
|
|
}
|
|
|
|
|
2018-02-21 01:25:22 +00:00
|
|
|
/**
|
|
|
|
* Maps (parts of) the Redux state to the associated props for the
|
2018-04-14 00:00:40 +00:00
|
|
|
* {@code DeepLinkingMobilePage} component.
|
2018-02-21 01:25:22 +00:00
|
|
|
*
|
|
|
|
* @param {Object} state - The Redux state.
|
|
|
|
* @private
|
2020-05-18 11:48:52 +00:00
|
|
|
* @returns {Props}
|
2018-02-21 01:25:22 +00:00
|
|
|
*/
|
|
|
|
function _mapStateToProps(state) {
|
|
|
|
return {
|
2020-05-18 11:48:52 +00:00
|
|
|
_downloadUrl: interfaceConfig[`MOBILE_DOWNLOAD_LINK_${Platform.OS.toUpperCase()}`],
|
2019-07-10 17:27:11 +00:00
|
|
|
_room: decodeURIComponent(state['features/base/conference'].room)
|
2018-02-21 01:25:22 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2018-04-14 00:00:40 +00:00
|
|
|
export default translate(connect(_mapStateToProps)(DeepLinkingMobilePage));
|