Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(whiteboard/native): ui fixes #14585

Merged
merged 5 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { isUnsafeRoomWarningEnabled } from '../../../prejoin/functions';
// @ts-ignore
import WelcomePage from '../../../welcome/components/WelcomePage';
import { isWelcomePageEnabled } from '../../../welcome/functions';
import Whiteboard from '../../../whiteboard/components/native/Whiteboard';
import { _ROOT_NAVIGATION_READY } from '../actionTypes';
import { rootNavigationRef } from '../rootNavigationContainerRef';
import { screen } from '../routes';
Expand All @@ -24,8 +23,7 @@ import {
navigationContainerTheme,
preJoinScreenOptions,
unsafeMeetingScreenOptions,
welcomeScreenOptions,
whiteboardScreenOptions
welcomeScreenOptions
} from '../screenOptions';

import ConnectingPage from './ConnectingPage';
Expand Down Expand Up @@ -96,10 +94,6 @@ const RootNavigationContainer = ({ dispatch, isUnsafeRoomWarningAvailable, isWel
component = { ConnectingPage }
name = { screen.connecting }
options = { connectingScreenOptions } />
<RootStack.Screen // @ts-ignore
component = { Whiteboard }
name = { screen.conference.whiteboard }
options = { whiteboardScreenOptions } />
<RootStack.Screen
component = { Prejoin }
name = { screen.preJoin }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import SpeakerStats
import LanguageSelectorDialog
// @ts-ignore
from '../../../../../subtitles/components/native/LanguageSelectorDialog';
import Whiteboard from '../../../../../whiteboard/components/native/Whiteboard';
// @ts-ignore
import { screen } from '../../../routes';
import {
Expand All @@ -62,7 +63,8 @@ import {
settingsNavigationContainerScreenOptions,
sharedDocumentScreenOptions,
speakerStatsScreenOptions,
subtitlesScreenOptions
subtitlesScreenOptions,
whiteboardScreenOptions
// @ts-ignore
} from '../../../screenOptions';
// @ts-ignore
Expand Down Expand Up @@ -214,6 +216,14 @@ const ConferenceNavigationContainer = () => {
...breakoutRoomsScreenOptions,
title: t('breakoutRooms.title')
}} />
<ConferenceStack.Screen
// @ts-ignore
component = { Whiteboard }
name = { screen.conference.whiteboard }
options = {{
...whiteboardScreenOptions,
title: t('whiteboard.screenTitle')
}} />
</ConferenceStack.Navigator>
</NavigationContainer>
);
Expand Down
10 changes: 1 addition & 9 deletions react/features/mobile/navigation/screenOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,7 @@ export const connectingScreenOptions = {
/**
* Screen options for the whiteboard screen.
*/
export const whiteboardScreenOptions = {
gestureEnabled: true,
headerStyle: {
backgroundColor: BaseTheme.palette.ui01
},
headerTitleStyle: {
color: BaseTheme.palette.text01
}
};
export const whiteboardScreenOptions = presentationScreenOptions;

/**
* Screen options for pre-join screen.
Expand Down
7 changes: 5 additions & 2 deletions react/features/whiteboard/actions.native.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { createRestrictWhiteboardEvent } from '../analytics/AnalyticsEvents';
import { sendAnalytics } from '../analytics/functions';
import { IStore } from '../app/types';
import { navigateRoot } from '../mobile/navigation/rootNavigationContainerRef';
import {
navigate
} from '../mobile/navigation/components/conference/ConferenceNavigationContainerRef';
import { screen } from '../mobile/navigation/routes';


import { resetWhiteboard } from './actions.any';

export * from './actions.any';
Expand All @@ -16,7 +19,7 @@ export * from './actions.any';
*/
export const restrictWhiteboard = (shouldCloseWhiteboard = true) => (dispatch: IStore['dispatch']) => {
if (shouldCloseWhiteboard) {
navigateRoot(screen.conference.root);
navigate(screen.conference.root);
}
dispatch(resetWhiteboard());
sendAnalytics(createRestrictWhiteboardEvent());
Expand Down
32 changes: 26 additions & 6 deletions react/features/whiteboard/components/native/Whiteboard.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Route } from '@react-navigation/native';
import React, { PureComponent } from 'react';
import { WithTranslation } from 'react-i18next';
import { View, ViewStyle } from 'react-native';
import { Platform, View, ViewStyle } from 'react-native';
import { WebView } from 'react-native-webview';
import { connect } from 'react-redux';

Expand All @@ -10,16 +10,23 @@ import { getCurrentConference } from '../../../base/conference/functions';
import { IJitsiConference } from '../../../base/conference/reducer';
import { openDialog } from '../../../base/dialog/actions';
import { translate } from '../../../base/i18n/functions';
import { IconCloseLarge } from '../../../base/icons/svg';
import JitsiScreen from '../../../base/modal/components/JitsiScreen';
import LoadingIndicator from '../../../base/react/components/native/LoadingIndicator';
import { safeDecodeURIComponent } from '../../../base/util/uri';
import { setupWhiteboard } from '../../actions.any';
import HeaderNavigationButton
from '../../../mobile/navigation/components/HeaderNavigationButton';
import {
goBack
} from '../../../mobile/navigation/components/conference/ConferenceNavigationContainerRef';
import { setupWhiteboard } from '../../actions.native';
import { WHITEBOARD_ID } from '../../constants';
import { getCollabServerUrl, getWhiteboardInfoForURIString } from '../../functions';

import WhiteboardErrorDialog from './WhiteboardErrorDialog';
import styles, { INDICATOR_COLOR } from './styles';


interface IProps extends WithTranslation {

/**
Expand Down Expand Up @@ -85,10 +92,23 @@ class Whiteboard extends PureComponent<IProps> {
*/
componentDidMount() {
const { navigation, t } = this.props;

navigation.setOptions({
headerTitle: t('whiteboard.screenTitle')
});
const headerLeft = () => {
if (Platform.OS === 'ios') {
return (
<HeaderNavigationButton
label = { t('dialog.close') }
onPress = { goBack } />
);
}

return (
<HeaderNavigationButton
onPress = { goBack }
src = { IconCloseLarge } />
);
};

navigation.setOptions({ headerLeft });
}

/**
Expand Down
11 changes: 8 additions & 3 deletions react/features/whiteboard/middleware.native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import { hideDialog, openDialog } from '../base/dialog/actions';
import { isDialogOpen } from '../base/dialog/functions';
import { getLocalParticipant } from '../base/participants/functions';
import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';
import { navigateRoot } from '../mobile/navigation/rootNavigationContainerRef';
import {
navigate
} from '../mobile/navigation/components/conference/ConferenceNavigationContainerRef';
import { screen } from '../mobile/navigation/routes';

import { SET_WHITEBOARD_OPEN } from './actionTypes';
Expand All @@ -22,6 +24,7 @@ import {
} from './functions';
import './middleware.any';


/**
* Middleware which intercepts whiteboard actions to handle changes to the related state.
*
Expand All @@ -34,6 +37,8 @@ MiddlewareRegistry.register((store: IStore) => (next: Function) => async (action

switch (action.type) {
case SET_WHITEBOARD_OPEN: {
const { isOpen } = action;

const enforceUserLimit = shouldEnforceUserLimit(state);
const notifyUserLimit = shouldNotifyUserLimit(state);

Expand All @@ -44,7 +49,7 @@ MiddlewareRegistry.register((store: IStore) => (next: Function) => async (action
return next(action);
}

if (action.isOpen) {
if (isOpen) {
if (enforceUserLimit) {
dispatch(restrictWhiteboard());

Expand All @@ -63,7 +68,7 @@ MiddlewareRegistry.register((store: IStore) => (next: Function) => async (action
const collabServerUrl = getCollabServerUrl(state);
const localParticipantName = getLocalParticipant(state)?.name;

navigateRoot(screen.conference.whiteboard, {
navigate(screen.conference.whiteboard, {
collabDetails,
collabServerUrl,
localParticipantName
Expand Down
Loading