ref: DialInSummary to JitsiModal

This commit is contained in:
Bettenbuk Zoltan 2020-04-06 17:25:30 +02:00 committed by Zoltan Bettenbuk
parent 2f817b6633
commit 0c2e13a453
7 changed files with 36 additions and 91 deletions

View File

@ -41,15 +41,6 @@ export const REMOVE_PENDING_INVITE_REQUESTS
*/ */
export const SET_CALLEE_INFO_VISIBLE = 'SET_CALLEE_INFO_VISIBLE'; export const SET_CALLEE_INFO_VISIBLE = 'SET_CALLEE_INFO_VISIBLE';
/**
* The type of Redux action to set the visibility of the dial in summary.
*
* {
* type: SET_DIAL_IN_SUMMARY_VISIBLE,
* visible: boolean
* }
*/
export const SET_DIAL_IN_SUMMARY_VISIBLE = 'SET_DIAL_IN_SUMMARY_VISIBLE';
/** /**
* The type of redux action which sets the invite dialog visible or invisible. * The type of redux action which sets the invite dialog visible or invisible.

View File

@ -11,7 +11,6 @@ import {
BEGIN_ADD_PEOPLE, BEGIN_ADD_PEOPLE,
REMOVE_PENDING_INVITE_REQUESTS, REMOVE_PENDING_INVITE_REQUESTS,
SET_CALLEE_INFO_VISIBLE, SET_CALLEE_INFO_VISIBLE,
SET_DIAL_IN_SUMMARY_VISIBLE,
SET_INVITE_DIALOG_VISIBLE, SET_INVITE_DIALOG_VISIBLE,
UPDATE_DIAL_IN_NUMBERS_FAILED, UPDATE_DIAL_IN_NUMBERS_FAILED,
UPDATE_DIAL_IN_NUMBERS_SUCCESS UPDATE_DIAL_IN_NUMBERS_SUCCESS
@ -256,14 +255,6 @@ export function addPendingInviteRequest(
}; };
} }
/**
* Action to hide the dial in summary.
*
* @returns {showDialInSummary}
*/
export function hideDialInSummary() {
return showDialInSummary(undefined);
}
/** /**
* Removes all pending invite requests. * Removes all pending invite requests.
@ -277,19 +268,3 @@ export function removePendingInviteRequests() {
type: REMOVE_PENDING_INVITE_REQUESTS type: REMOVE_PENDING_INVITE_REQUESTS
}; };
} }
/**
* Action to set the dial in summary url (and show it).
*
* @param {?string} locationUrl - The location URL to show the dial in summary for.
* @returns {{
* type: SET_DIAL_IN_SUMMARY_VISIBLE,
* summaryUrl: ?string
* }}
*/
export function showDialInSummary(locationUrl: ?string) {
return {
type: SET_DIAL_IN_SUMMARY_VISIBLE,
summaryUrl: locationUrl
};
}

View File

@ -7,14 +7,11 @@ import { type Dispatch } from 'redux';
import { openDialog } from '../../../../base/dialog'; import { openDialog } from '../../../../base/dialog';
import { translate } from '../../../../base/i18n'; import { translate } from '../../../../base/i18n';
import { import { JitsiModal, setActiveModalId } from '../../../../base/modal';
HeaderWithNavigation, import { LoadingIndicator } from '../../../../base/react';
LoadingIndicator,
SlidingView
} from '../../../../base/react';
import { connect } from '../../../../base/redux'; import { connect } from '../../../../base/redux';
import { hideDialInSummary } from '../../../actions'; import { DIAL_IN_SUMMARY_VIEW_ID } from '../../../constants';
import { getDialInfoPageURLForURIString } from '../../../functions'; import { getDialInfoPageURLForURIString } from '../../../functions';
import DialInSummaryErrorDialog from './DialInSummaryErrorDialog'; import DialInSummaryErrorDialog from './DialInSummaryErrorDialog';
@ -43,7 +40,6 @@ class DialInSummary extends Component<Props> {
constructor(props: Props) { constructor(props: Props) {
super(props); super(props);
this._onCloseView = this._onCloseView.bind(this);
this._onError = this._onError.bind(this); this._onError = this._onError.bind(this);
this._onNavigate = this._onNavigate.bind(this); this._onNavigate = this._onNavigate.bind(this);
this._renderLoading = this._renderLoading.bind(this); this._renderLoading = this._renderLoading.bind(this);
@ -58,43 +54,23 @@ class DialInSummary extends Component<Props> {
const { _summaryUrl } = this.props; const { _summaryUrl } = this.props;
return ( return (
<SlidingView <JitsiModal
onHide = { this._onCloseView } headerProps = {{
position = 'bottom' headerLabelKey: 'info.label'
show = { Boolean(_summaryUrl) } > }}
<View style = { styles.webViewWrapper }> modalId = { DIAL_IN_SUMMARY_VIEW_ID }
<HeaderWithNavigation style = { styles.backDrop } >
headerLabelKey = 'info.label' <WebView
onPressBack = { this._onCloseView } /> onError = { this._onError }
<WebView onShouldStartLoadWithRequest = { this._onNavigate }
onError = { this._onError } renderLoading = { this._renderLoading }
onShouldStartLoadWithRequest = { this._onNavigate } source = {{ uri: getDialInfoPageURLForURIString(_summaryUrl) }}
renderLoading = { this._renderLoading } startInLoadingState = { true }
source = {{ uri: getDialInfoPageURLForURIString(_summaryUrl) }} style = { styles.webView } />
startInLoadingState = { true } </JitsiModal>
style = { styles.webView } />
</View>
</SlidingView>
); );
} }
_onCloseView: () => boolean;
/**
* Closes the view.
*
* @returns {boolean}
*/
_onCloseView() {
if (this.props._summaryUrl) {
this.props.dispatch(hideDialInSummary());
return true;
}
return false;
}
_onError: () => void; _onError: () => void;
/** /**
@ -103,7 +79,7 @@ class DialInSummary extends Component<Props> {
* @returns {void} * @returns {void}
*/ */
_onError() { _onError() {
this.props.dispatch(hideDialInSummary()); this.props.dispatch(setActiveModalId());
this.props.dispatch(openDialog(DialInSummaryErrorDialog)); this.props.dispatch(openDialog(DialInSummaryErrorDialog));
} }
@ -122,7 +98,8 @@ class DialInSummary extends Component<Props> {
if (url.startsWith('tel:')) { if (url.startsWith('tel:')) {
Linking.openURL(url); Linking.openURL(url);
this.props.dispatch(hideDialInSummary());
this.props.dispatch(setActiveModalId());
} }
return url === getDialInfoPageURLForURIString(this.props._summaryUrl); return url === getDialInfoPageURLForURIString(this.props._summaryUrl);
@ -156,7 +133,7 @@ class DialInSummary extends Component<Props> {
*/ */
function _mapStateToProps(state) { function _mapStateToProps(state) {
return { return {
_summaryUrl: state['features/invite'].summaryUrl _summaryUrl: (state['features/base/modal'].modalProps || {}).summaryUrl
}; };
} }

View File

@ -4,8 +4,14 @@ import { ColorPalette } from '../../../../base/styles';
export const INDICATOR_COLOR = ColorPalette.lightGrey; export const INDICATOR_COLOR = ColorPalette.lightGrey;
const WV_BACKGROUND = 'rgb(71, 71, 71)';
export default { export default {
backDrop: {
backgroundColor: WV_BACKGROUND
},
indicatorWrapper: { indicatorWrapper: {
alignItems: 'center', alignItems: 'center',
backgroundColor: ColorPalette.white, backgroundColor: ColorPalette.white,
@ -14,11 +20,7 @@ export default {
}, },
webView: { webView: {
backgroundColor: WV_BACKGROUND,
flex: 1 flex: 1
},
webViewWrapper: {
flex: 1,
flexDirection: 'column'
} }
}; };

View File

@ -1,3 +1,8 @@
/**
* Modal ID for the DialInSummary modal.
*/
export const DIAL_IN_SUMMARY_VIEW_ID = 'DIAL_IN_SUMMARY_VIEW_ID';
/** /**
* The identifier of the sound to be played when the status of an outgoing call * The identifier of the sound to be played when the status of an outgoing call
* is expired. * is expired.

View File

@ -6,7 +6,6 @@ import {
ADD_PENDING_INVITE_REQUEST, ADD_PENDING_INVITE_REQUEST,
REMOVE_PENDING_INVITE_REQUESTS, REMOVE_PENDING_INVITE_REQUESTS,
SET_CALLEE_INFO_VISIBLE, SET_CALLEE_INFO_VISIBLE,
SET_DIAL_IN_SUMMARY_VISIBLE,
SET_INVITE_DIALOG_VISIBLE, SET_INVITE_DIALOG_VISIBLE,
UPDATE_DIAL_IN_NUMBERS_FAILED, UPDATE_DIAL_IN_NUMBERS_FAILED,
UPDATE_DIAL_IN_NUMBERS_SUCCESS UPDATE_DIAL_IN_NUMBERS_SUCCESS
@ -50,11 +49,6 @@ ReducerRegistry.register('features/invite', (state = DEFAULT_STATE, action) => {
initialCalleeInfo: action.initialCalleeInfo initialCalleeInfo: action.initialCalleeInfo
}; };
case SET_DIAL_IN_SUMMARY_VISIBLE:
return {
...state,
summaryUrl: action.summaryUrl
};
case SET_INVITE_DIALOG_VISIBLE: case SET_INVITE_DIALOG_VISIBLE:
return { return {

View File

@ -5,10 +5,11 @@ import type { Dispatch } from 'redux';
import { getDefaultURL } from '../../app'; import { getDefaultURL } from '../../app';
import { translate } from '../../base/i18n'; import { translate } from '../../base/i18n';
import { setActiveModalId } from '../../base/modal';
import { NavigateSectionList, type Section } from '../../base/react'; import { NavigateSectionList, type Section } from '../../base/react';
import { connect } from '../../base/redux'; import { connect } from '../../base/redux';
import { ColorPalette } from '../../base/styles'; import { ColorPalette } from '../../base/styles';
import { showDialInSummary } from '../../invite'; import { DIAL_IN_SUMMARY_VIEW_ID } from '../../invite/constants';
import { deleteRecentListEntry } from '../actions'; import { deleteRecentListEntry } from '../actions';
import { isRecentListEnabled, toDisplayableList } from '../functions'; import { isRecentListEnabled, toDisplayableList } from '../functions';
@ -124,7 +125,7 @@ class RecentList extends AbstractRecentList<Props> {
* @returns {void} * @returns {void}
*/ */
_onShowDialInInfo(itemId) { _onShowDialInInfo(itemId) {
this.props.dispatch(showDialInSummary(itemId.url)); this.props.dispatch(setActiveModalId(DIAL_IN_SUMMARY_VIEW_ID, { summaryUrl: itemId.url }));
} }
} }