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 2 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 @@ -62,7 +62,7 @@
settingsNavigationContainerScreenOptions,
sharedDocumentScreenOptions,
speakerStatsScreenOptions,
subtitlesScreenOptions
subtitlesScreenOptions, whiteboardScreenOptions
// @ts-ignore
} from '../../../screenOptions';
// @ts-ignore
Expand All @@ -75,6 +75,7 @@
conferenceNavigationRef
// @ts-ignore
} from '../ConferenceNavigationContainerRef';
import Whiteboard from "../../../../../whiteboard/components/native/Whiteboard";

Check failure on line 78 in react/features/mobile/navigation/components/conference/components/ConferenceNavigationContainer.tsx

View workflow job for this annotation

GitHub Actions / Lint

`../../../../../whiteboard/components/native/Whiteboard` import should occur before import of `../../../routes`

Check failure on line 78 in react/features/mobile/navigation/components/conference/components/ConferenceNavigationContainer.tsx

View workflow job for this annotation

GitHub Actions / Lint

Strings must use singlequote


const ConferenceStack = createStackNavigator();
Expand Down Expand Up @@ -214,6 +215,14 @@
...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
6 changes: 4 additions & 2 deletions react/features/whiteboard/actions.native.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { createRestrictWhiteboardEvent } from '../analytics/AnalyticsEvents';
import { sendAnalytics } from '../analytics/functions';
import { IStore } from '../app/types';
import { navigateRoot } from '../mobile/navigation/rootNavigationContainerRef';
import { screen } from '../mobile/navigation/routes';
import {

Check failure on line 5 in react/features/whiteboard/actions.native.ts

View workflow job for this annotation

GitHub Actions / Lint

`../mobile/navigation/components/conference/ConferenceNavigationContainerRef` import should occur before import of `../mobile/navigation/routes`
navigate
} from '../mobile/navigation/components/conference/ConferenceNavigationContainerRef';

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

Expand All @@ -16,7 +18,7 @@
*/
export const restrictWhiteboard = (shouldCloseWhiteboard = true) => (dispatch: IStore['dispatch']) => {
if (shouldCloseWhiteboard) {
navigateRoot(screen.conference.root);
navigate(screen.conference.root);
}
dispatch(resetWhiteboard());
sendAnalytics(createRestrictWhiteboardEvent());
Expand Down
40 changes: 33 additions & 7 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';

Check failure on line 4 in react/features/whiteboard/components/native/Whiteboard.tsx

View workflow job for this annotation

GitHub Actions / Lint

A space is required after '{'

Check failure on line 4 in react/features/whiteboard/components/native/Whiteboard.tsx

View workflow job for this annotation

GitHub Actions / Lint

A space is required before '}'
import { WebView } from 'react-native-webview';
import { connect } from 'react-redux';

Expand All @@ -10,16 +10,23 @@
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, setWhiteboardOpen } from '../../actions.native';

Check failure on line 22 in react/features/whiteboard/components/native/Whiteboard.tsx

View workflow job for this annotation

GitHub Actions / Lint

Member 'setWhiteboardOpen' of the import declaration should be sorted alphabetically
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 @@ -84,11 +91,30 @@
* @returns {void}
*/
componentDidMount() {
const { navigation, t } = this.props;

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

Check failure on line 100 in react/features/whiteboard/components/native/Whiteboard.tsx

View workflow job for this annotation

GitHub Actions / Lint

JSX props should not use arrow functions

Check failure on line 100 in react/features/whiteboard/components/native/Whiteboard.tsx

View workflow job for this annotation

GitHub Actions / Lint

A space is required after '{'
dispatch(setWhiteboardOpen(false));
goBack();
}} />

Check failure on line 103 in react/features/whiteboard/components/native/Whiteboard.tsx

View workflow job for this annotation

GitHub Actions / Lint

A space is required before '}'
);
}

return (
<HeaderNavigationButton
onPress = {() => {

Check failure on line 109 in react/features/whiteboard/components/native/Whiteboard.tsx

View workflow job for this annotation

GitHub Actions / Lint

JSX props should not use arrow functions
dispatch(setWhiteboardOpen(false));
goBack();
}}
src = { IconCloseLarge } />
);
};

navigation.setOptions({ headerLeft });
}

/**
Expand Down
1 change: 0 additions & 1 deletion react/features/whiteboard/middleware.any.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ MiddlewareRegistry.register((store: IStore) => next => action => {
store.dispatch(setupWhiteboard({
collabDetails: metadata[WHITEBOARD_ID].collabDetails
}));
store.dispatch(setWhiteboardOpen(true));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simulator.Screen.Recording.-.iPhone.14.-.2024-04-01.at.14.01.40.mp4

Why this approach? Why not leave it to the user to open/close the whiteboard whenever they want.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just leaving the reason here for posterity: other participants wouldn't otherwise get notified that a moderator has enabled the whiteboard. Maybe a notification with an action to take you to the whiteboard would fix the existing issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need. This change was discussed and reverted. All good.

}

break;
Expand Down
10 changes: 7 additions & 3 deletions react/features/whiteboard/middleware.native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ 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 { screen } from '../mobile/navigation/routes';

import { SET_WHITEBOARD_OPEN } from './actionTypes';
Expand All @@ -21,6 +20,9 @@ import {
shouldNotifyUserLimit
} from './functions';
import './middleware.any';
import {
navigate
} from "../mobile/navigation/components/conference/ConferenceNavigationContainerRef";

/**
* Middleware which intercepts whiteboard actions to handle changes to the related state.
Expand All @@ -34,6 +36,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 +48,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 +67,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