Skip to content

Commit

Permalink
feat(client) drop ability to specify an avatar URL
Browse files Browse the repository at this point in the history
The backend generated JWT can include one if desired.
  • Loading branch information
saghul committed Sep 5, 2024
1 parent cc1e7f2 commit 7461ae5
Show file tree
Hide file tree
Showing 11 changed files with 2 additions and 85 deletions.
2 changes: 0 additions & 2 deletions spot-client/src/common/app-state/setup/action-types.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
export const SETUP_COMPLETED = 'SETUP_COMPLETED';

export const SET_AVATAR_URL = 'SET_AVATAR_URL';

export const SET_CUSTOMER_ID = 'SET_CUSTOMER_ID';

export const SET_DISPLAY_NAME = 'SET_DISPLAY_NAME';
Expand Down
13 changes: 0 additions & 13 deletions spot-client/src/common/app-state/setup/actions.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
SETUP_COMPLETED,
SET_AVATAR_URL,
SET_CUSTOMER_ID,
SET_DISPLAY_NAME,
SET_IS_PERMANENT_REMOTE_PAIRED,
Expand All @@ -12,18 +11,6 @@ import {
SET_TENANT
} from './action-types';

/**
* Updates the preferred avatar URL to use for Spot-TV while in a meeting.
*
* @param {string} avatarUrl - The URL to an image.
* @returns {Object}
*/
export function setAvatarUrl(avatarUrl) {
return {
type: SET_AVATAR_URL,
avatarUrl
};
}

/**
* Sets the customer ID assigned to the room's owner.
Expand Down
8 changes: 0 additions & 8 deletions spot-client/src/common/app-state/setup/reducer.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
SETUP_COMPLETED,
SET_AVATAR_URL,
SET_DISPLAY_NAME,
SET_IS_PERMANENT_REMOTE_PAIRED,
SET_IS_SPOT,
Expand All @@ -11,7 +10,6 @@ import {
} from './action-types';

const DEFAULT_STATE = {
avatarUrl: '',
completed: false,
displayName: undefined,
isPermanentRemotePaired: false,
Expand Down Expand Up @@ -39,12 +37,6 @@ const setup = (state = DEFAULT_STATE, action) => {
completed: true
};

case SET_AVATAR_URL:
return {
...state,
avatarUrl: action.avatarUrl
};

case SET_DISPLAY_NAME:
return {
...state,
Expand Down
11 changes: 0 additions & 11 deletions spot-client/src/common/app-state/setup/selectors.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
/**
* A selector which returns the configured url to use for the Spot-TV avatar
* which should be displayed in meetings.
*
* @param {Object} state - The Redux state.
* @returns {boolean}
*/
export function getAvatarUrl(state) {
return state.setup.avatarUrl;
}

/**
* A selector which returns the locally configured name to use for the Spot-TV
* to be displayed while in a meeting.
Expand Down
7 changes: 0 additions & 7 deletions spot-client/src/common/app-state/setup/setup.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@ describe('setup state', () => {
expect(selectors.isSetupComplete(getState())).toBe(true);
});

it('saves the avatar url', () => {
const avatarUrl = 'new-url';

dispatch(actions.setAvatarUrl(avatarUrl));
expect(selectors.getAvatarUrl(getState())).toBe(avatarUrl);
});

it('saves the display name', () => {
const displayName = 'new-name';

Expand Down
1 change: 0 additions & 1 deletion spot-client/src/common/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@
"audioOut": "Speaker",
"audioOutTest": "Play test sound",
"autoSyncing": "Auto syncing is in progress...",
"avatar": "Enter an avatar url",
"devices": "Setup your devices",
"enterCode": "Enter your pairing code and start your setup",
"enterName": "Enter an email or room name (case-sensitive)",
Expand Down
2 changes: 0 additions & 2 deletions spot-client/src/common/utils/store-persistence.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ const keysToStore = [
'calendars.displayName',
'backend.permanentPairingCode',
'deviceId.deviceId',
'setup.avatarUrl',
'setup.completed',
'setup.displayName',
'setup.preferredCamera',
Expand Down Expand Up @@ -86,7 +85,6 @@ function parsePersistedState(state) {
deviceId: state.deviceId.deviceId
},
setup: {
avatarUrl: state.setup.avatarUrl,
completed: state.setup.completed,
displayName: state.setup.displayName,
preferredCamera: state.setup.preferredCamera,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { ApiHealthCheck } from './ApiHealthCheck';
*/
export default class AbstractMeetingFrame extends React.Component {
static propTypes = {
avatarUrl: PropTypes.string,
displayName: PropTypes.string,
dtmfThrottleRate: PropTypes.number,
invites: PropTypes.array,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ export class JitsiMeetingFrame extends AbstractMeetingFrame {
this._jitsiApi.addListener(
'videoMuteStatusChanged', this._onVideoMuteChange);

this._jitsiApi.executeCommand('avatarUrl', this.props.avatarUrl || '');
this._jitsiApi.executeCommand(
'displayName',
this.props.displayName
Expand Down
36 changes: 2 additions & 34 deletions spot-client/src/spot-tv/ui/components/setup/profile.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import {
getAvatarUrl,
getCalendarName,
getDisplayName,
setAvatarUrl,
setDisplayName
} from 'common/app-state';
import { Button, Input } from 'common/ui';
Expand All @@ -13,15 +11,12 @@ import { connect } from 'react-redux';


/**
* Prompts to set a display name and an avatar url for the Spot-TV to use during
* meetings.
* Prompts to set a display name and for the Spot-TV to use during meetings.
*/
export class Profile extends React.Component {
static propTypes = {
avatarUrl: PropTypes.string,
dispatch: PropTypes.func,
displayName: PropTypes.string,
onSetAvatarUrl: PropTypes.func,
onSetDisplayName: PropTypes.func,
onSuccess: PropTypes.func,
t: PropTypes.func
Expand All @@ -37,11 +32,9 @@ export class Profile extends React.Component {
super(props);

this.state = {
avatarUrl: props.avatarUrl || '',
displayName: props.displayName || ''
};

this._onAvatarUrlChange = this._onAvatarUrlChange.bind(this);
this._onDisplayNameChange = this._onDisplayNameChange.bind(this);
this._onSubmit = this._onSubmit.bind(this);
}
Expand All @@ -64,10 +57,6 @@ export class Profile extends React.Component {
onChange = { this._onDisplayNameChange }
placeholder = { t('setup.name') }
value = { this.state.displayName } />
<Input
onChange = { this._onAvatarUrlChange }
placeholder = { t('setup.avatar') }
value = { this.state.avatarUrl } />
</div>
<div className = 'setup-buttons'>
<Button onClick = { this._onSubmit }>
Expand All @@ -78,20 +67,6 @@ export class Profile extends React.Component {
);
}

/**
* Callback invoked to update the known entered room avatar url.
*
* @param {Event} event - The change event for updating the entered avatar
* url.
* @private
* @returns {void}
*/
_onAvatarUrlChange(event) {
this.setState({
avatarUrl: event.target.value
});
}

/**
* Callback invoked to update the known entered room display name.
*
Expand All @@ -107,7 +82,7 @@ export class Profile extends React.Component {
}

/**
* Callback invoked to save the entered display name and avatar url.
* Callback invoked to save the entered display name.
*
* @private
* @returns {void}
Expand All @@ -117,9 +92,7 @@ export class Profile extends React.Component {
return;
}

this.props.onSetAvatarUrl(this.state.avatarUrl.trim());
this.props.onSetDisplayName(this.state.displayName.trim());

this.props.onSuccess();
}
}
Expand All @@ -134,7 +107,6 @@ export class Profile extends React.Component {
*/
function mapStateToProps(state) {
return {
avatarUrl: getAvatarUrl(state),
displayName: getDisplayName(state) || getCalendarName(state)
};
}
Expand All @@ -148,10 +120,6 @@ function mapStateToProps(state) {
*/
function mapDispatchToProps(dispatch) {
return {
onSetAvatarUrl(avatarUrl) {
dispatch(setAvatarUrl(avatarUrl));
},

onSetDisplayName(displayName) {
dispatch(setDisplayName(displayName));
}
Expand Down
5 changes: 0 additions & 5 deletions spot-client/src/spot-tv/ui/views/meeting.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
addNotification,
getAvatarUrl,
getDesktopSharingFramerate,
getDisplayName,
getDtmfThrottleRate,
Expand Down Expand Up @@ -41,7 +40,6 @@ import {
*/
export class Meeting extends React.Component {
static propTypes = {
avatarUrl: PropTypes.string,
disconnectAllTemporaryRemotes: PropTypes.func,
displayName: PropTypes.string,
dtmfThrottleRate: PropTypes.number,
Expand Down Expand Up @@ -133,7 +131,6 @@ export class Meeting extends React.Component {
}

const {
avatarUrl,
displayName,
dtmfThrottleRate,
jitsiAppName,
Expand All @@ -158,7 +155,6 @@ export class Meeting extends React.Component {
return (
<div className = { `meeting-view ${meetingLoaded ? '' : 'loading'}` }>
<MeetingFrame
avatarUrl = { avatarUrl }
displayName = { displayName }
dtmfThrottleRate = { dtmfThrottleRate }
invites = { invites }
Expand Down Expand Up @@ -340,7 +336,6 @@ function mapStateToProps(state) {
} = getInMeetingStatus(state);

return {
avatarUrl: getAvatarUrl(state),
displayName: getDisplayName(state),
dtmfThrottleRate: getDtmfThrottleRate(state),
jitsiAppName: getJitsiAppName(state),
Expand Down

0 comments on commit 7461ae5

Please sign in to comment.