mirror of https://github.com/jitsi/jitsi-meet
parent
126e2d6e14
commit
2d87757aaa
@ -0,0 +1,39 @@ |
||||
// @flow
|
||||
|
||||
import React, { Component } from 'react'; |
||||
import { Text, View } from 'react-native'; |
||||
|
||||
import { dialog as styles } from './styles'; |
||||
|
||||
type Props = { |
||||
|
||||
/** |
||||
* Children of the component. |
||||
*/ |
||||
children: string | React$Node |
||||
}; |
||||
|
||||
/** |
||||
* Generic dialog content container to provide the same styling for all custom |
||||
* dialogs. |
||||
*/ |
||||
export default class DialogContent extends Component<Props> { |
||||
/** |
||||
* Implements {@code Component#render}. |
||||
* |
||||
* @inheritdoc |
||||
*/ |
||||
render() { |
||||
const { children } = this.props; |
||||
|
||||
const childrenComponent = typeof children === 'string' |
||||
? <Text>{ children }</Text> |
||||
: children; |
||||
|
||||
return ( |
||||
<View style = { styles.dialogContainer }> |
||||
{ childrenComponent } |
||||
</View> |
||||
); |
||||
} |
||||
} |
@ -0,0 +1,63 @@ |
||||
// @flow
|
||||
|
||||
import { |
||||
REFRESH_CALENDAR, |
||||
SET_CALENDAR_AUTHORIZATION, |
||||
SET_CALENDAR_EVENTS |
||||
} from './actionTypes'; |
||||
|
||||
/** |
||||
* Sends an action to refresh the entry list (fetches new data). |
||||
* |
||||
* @param {boolean} forcePermission - Whether to force to re-ask for |
||||
* the permission or not. |
||||
* @param {boolean} isInteractive - If true this refresh was caused by |
||||
* direct user interaction, false otherwise. |
||||
* @returns {{ |
||||
* type: REFRESH_CALENDAR, |
||||
* forcePermission: boolean, |
||||
* isInteractive: boolean |
||||
* }} |
||||
*/ |
||||
export function refreshCalendar( |
||||
forcePermission: boolean = false, isInteractive: boolean = true) { |
||||
return { |
||||
type: REFRESH_CALENDAR, |
||||
forcePermission, |
||||
isInteractive |
||||
}; |
||||
} |
||||
|
||||
/** |
||||
* Sends an action to signal that a calendar access has been requested. For more |
||||
* info, see {@link SET_CALENDAR_AUTHORIZATION}. |
||||
* |
||||
* @param {string | undefined} authorization - The result of the last calendar |
||||
* authorization request. |
||||
* @returns {{ |
||||
* type: SET_CALENDAR_AUTHORIZATION, |
||||
* authorization: ?string |
||||
* }} |
||||
*/ |
||||
export function setCalendarAuthorization(authorization: ?string) { |
||||
return { |
||||
type: SET_CALENDAR_AUTHORIZATION, |
||||
authorization |
||||
}; |
||||
} |
||||
|
||||
/** |
||||
* Sends an action to update the current calendar list in redux. |
||||
* |
||||
* @param {Array<Object>} events - The new list. |
||||
* @returns {{ |
||||
* type: SET_CALENDAR_EVENTS, |
||||
* events: Array<Object> |
||||
* }} |
||||
*/ |
||||
export function setCalendarEvents(events: Array<Object>) { |
||||
return { |
||||
type: SET_CALENDAR_EVENTS, |
||||
events |
||||
}; |
||||
} |
@ -0,0 +1,47 @@ |
||||
// @flow
|
||||
|
||||
import { getDefaultURL } from '../app'; |
||||
import { openDialog } from '../base/dialog'; |
||||
import { generateRoomWithoutSeparator } from '../welcome'; |
||||
|
||||
import { refreshCalendar } from './actions'; |
||||
import { addLinkToCalendarEntry } from './functions.native'; |
||||
|
||||
import { |
||||
UpdateCalendarEventDialog |
||||
} from './components'; |
||||
|
||||
export * from './actions.any'; |
||||
|
||||
/** |
||||
* Asks confirmation from the user to add a Jitsi link to the calendar event. |
||||
* |
||||
* @param {string} eventId - The event id. |
||||
* @returns {{ |
||||
* type: OPEN_DIALOG, |
||||
* component: React.Component, |
||||
* componentProps: (Object | undefined) |
||||
* }} |
||||
*/ |
||||
export function openUpdateCalendarEventDialog(eventId: string) { |
||||
return openDialog(UpdateCalendarEventDialog, { eventId }); |
||||
} |
||||
|
||||
/** |
||||
* Updates calendar event by generating new invite URL and editing the event |
||||
* adding some descriptive text and location. |
||||
* |
||||
* @param {string} eventId - The event id. |
||||
* @returns {Function} |
||||
*/ |
||||
export function updateCalendarEvent(eventId: string) { |
||||
return (dispatch: Dispatch<*>, getState: Function) => { |
||||
const defaultUrl = getDefaultURL(getState); |
||||
const roomName = generateRoomWithoutSeparator(); |
||||
|
||||
addLinkToCalendarEntry(getState(), eventId, `${defaultUrl}/${roomName}`) |
||||
.finally(() => { |
||||
dispatch(refreshCalendar(false, false)); |
||||
}); |
||||
}; |
||||
} |
@ -0,0 +1,79 @@ |
||||
// @flow
|
||||
|
||||
import React, { Component } from 'react'; |
||||
import { connect } from 'react-redux'; |
||||
|
||||
import { Dialog, DialogContent } from '../../base/dialog'; |
||||
import { translate } from '../../base/i18n'; |
||||
|
||||
import { updateCalendarEvent } from '../actions'; |
||||
|
||||
type Props = { |
||||
|
||||
/** |
||||
* The Redux dispatch function. |
||||
*/ |
||||
dispatch: Function, |
||||
|
||||
/** |
||||
* The ID of the event to be updated. |
||||
*/ |
||||
eventId: string, |
||||
|
||||
/** |
||||
* Function to translate i18n labels. |
||||
*/ |
||||
t: Function |
||||
}; |
||||
|
||||
/** |
||||
* Component for the add Jitsi link confirm dialog. |
||||
*/ |
||||
class UpdateCalendarEventDialog extends Component<Props> { |
||||
/** |
||||
* Initializes a new {@code UpdateCalendarEventDialog} instance. |
||||
* |
||||
* @inheritdoc |
||||
*/ |
||||
constructor(props: Props) { |
||||
super(props); |
||||
|
||||
this._onSubmit = this._onSubmit.bind(this); |
||||
} |
||||
|
||||
/** |
||||
* Implements React's {@link Component#render()}. |
||||
* |
||||
* @inheritdoc |
||||
* @returns {ReactElement} |
||||
*/ |
||||
render() { |
||||
return ( |
||||
<Dialog |
||||
okTitleKey = 'dialog.confirm' |
||||
onSubmit = { this._onSubmit } |
||||
titleKey = 'calendarSync.confirmAddLinkTitle' |
||||
width = 'small'> |
||||
<DialogContent> |
||||
{ this.props.t('calendarSync.confirmAddLink') } |
||||
</DialogContent> |
||||
</Dialog> |
||||
); |
||||
} |
||||
|
||||
_onSubmit: () => boolean; |
||||
|
||||
/** |
||||
* Callback for the confirm button. |
||||
* |
||||
* @private |
||||
* @returns {boolean} - True (to note that the modal should be closed). |
||||
*/ |
||||
_onSubmit() { |
||||
this.props.dispatch(updateCalendarEvent(this.props.eventId, '')); |
||||
|
||||
return true; |
||||
} |
||||
} |
||||
|
||||
export default translate(connect()(UpdateCalendarEventDialog)); |
@ -1,3 +1,6 @@ |
||||
export { default as ConferenceNotification } from './ConferenceNotification'; |
||||
export { default as CalendarList } from './CalendarList'; |
||||
export { default as MicrosoftSignInButton } from './MicrosoftSignInButton'; |
||||
export { |
||||
default as UpdateCalendarEventDialog |
||||
} from './UpdateCalendarEventDialog'; |
||||
|
Loading…
Reference in new issue