Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
ref: SharedDocument to JitsiModal
Bettenbuk Zoltan55742210443e
diff --git a/react/features/etherpad/components/native/SharedDocument.js b/react/features/etherpad/components/native/SharedDocument.jsindex f5c91b3787..490667a289 100644--- a/react/features/etherpad/components/native/SharedDocument.js+++ b/react/features/etherpad/components/native/SharedDocument.js@@ -1,16 +1,18 @@// @flowimport React, { PureComponent } from 'react';-import { SafeAreaView, View } from 'react-native';+import { View } from 'react-native';import { WebView } from 'react-native-webview';import type { Dispatch } from 'redux';import { ColorSchemeRegistry } from '../../../base/color-scheme';import { translate } from '../../../base/i18n';-import { HeaderWithNavigation, LoadingIndicator, SlidingView } from '../../../base/react';+import { JitsiModal } from '../../../base/modal';+import { LoadingIndicator } from '../../../base/react';import { connect } from '../../../base/redux';import { toggleDocument } from '../../actions';+import { SHARE_DOCUMENT_VIEW_ID } from '../../constants';import { getSharedDocumentUrl } from '../../functions';import styles, { INDICATOR_COLOR } from './styles';@@ -69,42 +71,24 @@ class SharedDocument extends PureComponent<Props> {* @inheritdoc*/render() {- const { _documentUrl, _isOpen } = this.props;- const webViewStyles = this._getWebViewStyles();+ const { _documentUrl } = this.props;return (- <SlidingView- onHide = { this._onClose }- position = 'bottom'- show = { _isOpen } >- <View style = { styles.webViewWrapper }>- <HeaderWithNavigation- headerLabelKey = 'documentSharing.title'- onPressBack = { this._onClose } />- <SafeAreaView style = { webViewStyles }>- <WebView- onError = { this._onError }- renderLoading = { this._renderLoading }- source = {{ uri: _documentUrl }}- startInLoadingState = { true } />- </SafeAreaView>- </View>- </SlidingView>+ <JitsiModal+ headerProps = {{+ headerLabelKey: 'documentSharing.title'+ }}+ modalId = { SHARE_DOCUMENT_VIEW_ID }+ style = { styles.webView }>+ <WebView+ onError = { this._onError }+ renderLoading = { this._renderLoading }+ source = {{ uri: _documentUrl }}+ startInLoadingState = { true } />+ </JitsiModal>);}- /**- * Computes the styles required for the WebView component.- *- * @returns {Object}- */- _getWebViewStyles() {- return {- ...styles.webView,- backgroundColor: this.props._headerStyles.screenHeader.backgroundColor- };- }-_onClose: () => boolean/**diff --git a/react/features/etherpad/components/native/styles.js b/react/features/etherpad/components/native/styles.jsindex 15a4f1d889..8e6f59af5a 100644--- a/react/features/etherpad/components/native/styles.js+++ b/react/features/etherpad/components/native/styles.js@@ -14,11 +14,6 @@ export default {},webView: {- flex: 1- },-- webViewWrapper: {- flex: 1,- flexDirection: 'column'+ backgroundColor: 'rgb(242, 242, 242)'}};diff --git a/react/features/etherpad/constants.js b/react/features/etherpad/constants.jsnew file mode 100644index 0000000000..6ff565303f--- /dev/null+++ b/react/features/etherpad/constants.js@@ -0,0 +1,4 @@+/**+ * Modal view ID of the SharedDocument view.+ */+export const SHARE_DOCUMENT_VIEW_ID = 'SHARE_DOCUMENT_VIEW_ID';diff --git a/react/features/etherpad/index.js b/react/features/etherpad/index.jsindex 44000a1a7b..0a8f4ad7bb 100644--- a/react/features/etherpad/index.js+++ b/react/features/etherpad/index.js@@ -1,6 +1,7 @@export * from './actions';export * from './actionTypes';export * from './components';+export * from './constants';export * from './functions';import './middleware';diff --git a/react/features/etherpad/middleware.js b/react/features/etherpad/middleware.jsindex 12fcb2e83a..f293908bc5 100644--- a/react/features/etherpad/middleware.js+++ b/react/features/etherpad/middleware.js@@ -1,11 +1,13 @@// @flowimport { getCurrentConference } from '../base/conference';+import { setActiveModalId } from '../base/modal';import { MiddlewareRegistry, StateListenerRegistry } from '../base/redux';import UIEvents from '../../../service/UI/UIEvents';import { TOGGLE_DOCUMENT_EDITING } from './actionTypes';import { setDocumentEditingState, setDocumentUrl } from './actions';+import { SHARE_DOCUMENT_VIEW_ID } from './constants';declare var APP: Object;@@ -23,9 +25,15 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {switch (action.type) {case TOGGLE_DOCUMENT_EDITING: {if (typeof APP === 'undefined') {- const { editing } = getState()['features/etherpad'];+ const editing = !getState()['features/etherpad'].editing;- dispatch(setDocumentEditingState(!editing));+ dispatch(setDocumentEditingState(editing));++ if (editing) {+ dispatch(setActiveModalId(SHARE_DOCUMENT_VIEW_ID));+ } else if (getState()['features/base/modal'].activeModalId === SHARE_DOCUMENT_VIEW_ID) {+ dispatch(setActiveModalId(undefined));+ }} else {APP.UI.emitEvent(UIEvents.ETHERPAD_CLICKED);}