feat: add url params: config.disableInviteFunctions, config.doNotStoreRoom and userInfo.displayName

This commit is contained in:
Bettenbuk Zoltan 2020-04-09 15:26:19 +02:00 committed by Zoltan Bettenbuk
parent 2654c77f2c
commit 39d789a088
5 changed files with 75 additions and 40 deletions

View File

@ -87,6 +87,7 @@ export default [
'disableDeepLinking',
'disableH264',
'disableHPF',
'disableInviteFunctions',
'disableLocalVideoFlip',
'disableNS',
'disableRemoteControl',
@ -95,6 +96,7 @@ export default [
'disableSuspendVideo',
'disableThirdPartyRequests',
'displayJids',
'doNotStoreRoom',
'e2eping',
'enableDisplayNameInStats',
'enableEmailInStats',

View File

@ -137,8 +137,9 @@ function _updateLocalParticipantFromUrl({ dispatch, getState }) {
const urlParams
= parseURLParams(getState()['features/base/connection'].locationURL);
const urlEmail = urlParams['userInfo.email'];
const urlDisplayName = urlParams['userInfo.displayName'];
if (!urlEmail) {
if (!urlEmail && !urlDisplayName) {
return;
}
@ -147,7 +148,8 @@ function _updateLocalParticipantFromUrl({ dispatch, getState }) {
if (localParticipant) {
dispatch(participantUpdated({
...localParticipant,
email: _.escape(urlEmail)
email: _.escape(urlEmail),
name: _.escape(urlDisplayName)
}));
}
}

View File

@ -18,6 +18,11 @@ import { Icon, IconAddPeople } from '../../../base/icons';
*/
type Props = {
/**
* True if the invite functions (dial out, invite, share...etc) are disabled.
*/
_isInviteFunctionsDiabled: boolean,
/**
* True if it's a lonely meeting (participant count excluding fakes is 1).
*/
@ -60,7 +65,7 @@ class LonelyMeetingExperience extends PureComponent<Props> {
* @inheritdoc
*/
render() {
const { _isLonelyMeeting, _styles, t } = this.props;
const { _isInviteFunctionsDiabled, _isLonelyMeeting, _styles, t } = this.props;
if (!_isLonelyMeeting) {
return null;
@ -75,24 +80,26 @@ class LonelyMeetingExperience extends PureComponent<Props> {
] }>
{ t('lonelyMeetingExperience.youAreAlone') }
</Text>
<TouchableOpacity
onPress = { this._onPress }
style = { [
styles.lonelyButton,
_styles.lonelyButton
] }>
<Icon
size = { 24 }
src = { IconAddPeople }
style = { styles.lonelyButtonComponents } />
<Text
{ !_isInviteFunctionsDiabled && (
<TouchableOpacity
onPress = { this._onPress }
style = { [
styles.lonelyButtonComponents,
_styles.lonelyMessage
styles.lonelyButton,
_styles.lonelyButton
] }>
{ t('lonelyMeetingExperience.button') }
</Text>
</TouchableOpacity>
<Icon
size = { 24 }
src = { IconAddPeople }
style = { styles.lonelyButtonComponents } />
<Text
style = { [
styles.lonelyButtonComponents,
_styles.lonelyMessage
] }>
{ t('lonelyMeetingExperience.button') }
</Text>
</TouchableOpacity>
) }
</View>
);
}
@ -117,7 +124,10 @@ class LonelyMeetingExperience extends PureComponent<Props> {
* @returns {Props}
*/
function _mapStateToProps(state): $Shape<Props> {
const { disableInviteFunctions } = state['features/base/config'];
return {
_isInviteFunctionsDiabled: disableInviteFunctions,
_isLonelyMeeting: getParticipantCount(state) === 1,
_styles: ColorSchemeRegistry.get(state, 'Conference')
};

View File

@ -38,5 +38,20 @@ class InviteButton extends AbstractButton<Props, *> {
}
}
/**
* Maps part of the Redux state to the props of this component.
*
* @param {Object} state - The Redux state.
* @param {Props} ownProps - The own props of the component.
* @returns {Props}
*/
function _mapStateToProps(state, ownProps: Props) {
const { disableInviteFunctions } = state['features/base/config'];
export default translate(connect()(InviteButton));
return {
visible: !disableInviteFunctions && ownProps.visible
};
}
export default translate(connect(_mapStateToProps)(InviteButton));

View File

@ -86,27 +86,31 @@ function _appWillMount({ dispatch, getState }, next, action) {
* @returns {*} The result returned by {@code next(action)}.
*/
function _conferenceWillLeave({ dispatch, getState }, next, action) {
let locationURL;
const { doNotStoreRoom } = getState()['features/base/config'];
/**
* FIXME:
* It is better to use action.conference[JITSI_CONFERENCE_URL_KEY]
* in order to make sure we get the url the conference is leaving
* from (i.e. the room we are leaving from) because if the order of events
* is different, we cannot be guranteed that the location URL in base
* connection is the url we are leaving from... not the one we are going to
* (the latter happens on mobile -- if we use the web implementation);
* however, the conference object on web does not have
* JITSI_CONFERENCE_URL_KEY so we cannot call it and must use the other way
*/
if (typeof APP === 'undefined') {
locationURL = action.conference[JITSI_CONFERENCE_URL_KEY];
} else {
locationURL = getState()['features/base/connection'].locationURL;
if (!doNotStoreRoom) {
let locationURL;
/**
* FIXME:
* It is better to use action.conference[JITSI_CONFERENCE_URL_KEY]
* in order to make sure we get the url the conference is leaving
* from (i.e. the room we are leaving from) because if the order of events
* is different, we cannot be guranteed that the location URL in base
* connection is the url we are leaving from... not the one we are going to
* (the latter happens on mobile -- if we use the web implementation);
* however, the conference object on web does not have
* JITSI_CONFERENCE_URL_KEY so we cannot call it and must use the other way
*/
if (typeof APP === 'undefined') {
locationURL = action.conference[JITSI_CONFERENCE_URL_KEY];
} else {
locationURL = getState()['features/base/connection'].locationURL;
}
dispatch(
_updateConferenceDuration(
locationURL));
}
dispatch(
_updateConferenceDuration(
locationURL));
return next(action);
}
@ -122,7 +126,9 @@ function _conferenceWillLeave({ dispatch, getState }, next, action) {
* @returns {*} The result returned by {@code next(action)}.
*/
function _setRoom({ dispatch, getState }, next, action) {
if (action.room) {
const { doNotStoreRoom } = getState()['features/base/config'];
if (!doNotStoreRoom && action.room) {
const { locationURL } = getState()['features/base/connection'];
if (locationURL) {