Skip to content

Commit 372ee1f

Browse files
committed
feat: turn off spaces nearby and geolocation setting
1 parent 30d64cb commit 372ee1f

18 files changed

+33
-254
lines changed

public/app/listeners/getGeolocationEnabled.js

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* @deprecated
3+
*/
4+
15
const { DEFAULT_GEOLOCATION_ENABLED } = require('../config/config');
26
const { GET_GEOLOCATION_ENABLED_CHANNEL } = require('../config/channels');
37
const { ERROR_GENERAL } = require('../config/errors');

public/app/listeners/index.js

-4
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ const getSpaces = require('./getSpaces');
99
const { deleteSpace, deleteSpaceAndResources } = require('./deleteSpace');
1010
const syncSpace = require('./syncSpace');
1111
const exportSpace = require('./exportSpace');
12-
const getGeolocationEnabled = require('./getGeolocationEnabled');
13-
const setGeolocationEnabled = require('./setGeolocationEnabled');
1412
const showLoadSpacePrompt = require('./showLoadSpacePrompt');
1513
const showExportSpacePrompt = require('./showExportSpacePrompt');
1614
const showDeleteSpacePrompt = require('./showDeleteSpacePrompt');
@@ -71,8 +69,6 @@ module.exports = {
7169
deleteSpace,
7270
deleteSpaceAndResources,
7371
exportSpace,
74-
getGeolocationEnabled,
75-
setGeolocationEnabled,
7672
showLoadSpacePrompt,
7773
showExportSpacePrompt,
7874
showDeleteSpacePrompt,

public/app/listeners/setGeolocationEnabled.js

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* @deprecated
3+
*/
4+
15
const { SET_GEOLOCATION_ENABLED_CHANNEL } = require('../config/channels');
26
const { ERROR_GENERAL } = require('../config/errors');
37
const logger = require('../logger');

public/electron.js

-16
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ const {
4848
SET_DEVELOPER_MODE_CHANNEL,
4949
GET_SYNC_MODE_CHANNEL,
5050
SET_SYNC_MODE_CHANNEL,
51-
GET_GEOLOCATION_ENABLED_CHANNEL,
52-
SET_GEOLOCATION_ENABLED_CHANNEL,
5351
GET_DATABASE_CHANNEL,
5452
SET_DATABASE_CHANNEL,
5553
SYNC_SPACE_CHANNEL,
@@ -100,8 +98,6 @@ const {
10098
showLoadSpacePrompt,
10199
showExportSpacePrompt,
102100
showDeleteSpacePrompt,
103-
getGeolocationEnabled,
104-
setGeolocationEnabled,
105101
getUserFolder,
106102
setLanguage,
107103
getLanguage,
@@ -473,18 +469,6 @@ app.on('ready', async () => {
473469
// called when setting space as recent
474470
ipcMain.on(SET_SPACE_AS_RECENT_CHANNEL, setSpaceAsRecent(mainWindow, db));
475471

476-
// called when getting geolocation enabled
477-
ipcMain.on(
478-
GET_GEOLOCATION_ENABLED_CHANNEL,
479-
getGeolocationEnabled(mainWindow, db)
480-
);
481-
482-
// called when setting geolocation enabled
483-
ipcMain.on(
484-
SET_GEOLOCATION_ENABLED_CHANNEL,
485-
setGeolocationEnabled(mainWindow, db)
486-
);
487-
488472
// called when setting action accessibility
489473
ipcMain.on(
490474
SET_ACTION_ACCESSIBILITY_CHANNEL,

src/App.js

+1-28
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,9 @@ import {
4747
buildImportDataInClassroomPath,
4848
} from './config/paths';
4949
import {
50-
getGeolocation,
5150
getUserFolder,
5251
getLanguage,
5352
getDeveloperMode,
54-
getGeolocationEnabled,
5553
isAuthenticated,
5654
} from './actions';
5755
import { DEFAULT_LANGUAGE, USER_MODES, PRODUCT_NAME } from './config/constants';
@@ -89,17 +87,14 @@ export class App extends Component {
8987
state = { height: 0, isDownloadingUpdate: false };
9088

9189
static propTypes = {
92-
dispatchGetGeolocation: PropTypes.func.isRequired,
9390
dispatchGetUserFolder: PropTypes.func.isRequired,
9491
dispatchGetLanguage: PropTypes.func.isRequired,
9592
dispatchGetDeveloperMode: PropTypes.func.isRequired,
96-
dispatchGetGeolocationEnabled: PropTypes.func.isRequired,
9793
dispatchIsAuthenticated: PropTypes.func.isRequired,
9894
lang: PropTypes.string,
9995
i18n: PropTypes.shape({
10096
changeLanguage: PropTypes.func.isRequired,
10197
}).isRequired,
102-
geolocationEnabled: PropTypes.bool.isRequired,
10398
classes: PropTypes.shape({
10499
toastrIcon: PropTypes.string.isRequired,
105100
fullScreen: PropTypes.string.isRequired,
@@ -119,7 +114,6 @@ export class App extends Component {
119114
dispatchGetUserFolder,
120115
dispatchGetLanguage,
121116
dispatchGetDeveloperMode,
122-
dispatchGetGeolocationEnabled,
123117
dispatchIsAuthenticated,
124118
userMode,
125119
} = this.props;
@@ -128,7 +122,6 @@ export class App extends Component {
128122
dispatchGetLanguage();
129123
dispatchGetDeveloperMode();
130124
dispatchGetUserFolder();
131-
dispatchGetGeolocationEnabled();
132125

133126
if (userMode === USER_MODES.TEACHER) {
134127
this.checkAppUpgrade();
@@ -142,27 +135,14 @@ export class App extends Component {
142135

143136
componentDidUpdate({
144137
lang: prevLang,
145-
geolocationEnabled: prevGeolocationEnabled,
146-
dispatchGetGeolocation,
147138
connexionStatus: prevConnexionStatus,
148139
userMode: prevUserMode,
149140
}) {
150-
const {
151-
lang,
152-
i18n,
153-
geolocationEnabled,
154-
connexionStatus,
155-
userMode,
156-
} = this.props;
141+
const { lang, i18n, connexionStatus, userMode } = this.props;
157142
if (lang !== prevLang) {
158143
i18n.changeLanguage(lang);
159144
}
160145

161-
// fetch geolocation only if enabled
162-
if (geolocationEnabled && geolocationEnabled !== prevGeolocationEnabled) {
163-
dispatchGetGeolocation();
164-
}
165-
166146
// display toastr when connexion status changes
167147
if (connexionStatus !== prevConnexionStatus) {
168148
this.triggerConnectionToastr();
@@ -353,20 +333,13 @@ export class App extends Component {
353333

354334
const mapStateToProps = ({ authentication }) => ({
355335
lang: authentication.getIn(['user', 'settings', 'lang']),
356-
geolocationEnabled: authentication.getIn([
357-
'user',
358-
'settings',
359-
'geolocationEnabled',
360-
]),
361336
userMode: authentication.getIn(['user', 'settings', 'userMode']),
362337
});
363338

364339
const mapDispatchToProps = {
365-
dispatchGetGeolocation: getGeolocation,
366340
dispatchGetUserFolder: getUserFolder,
367341
dispatchGetLanguage: getLanguage,
368342
dispatchGetDeveloperMode: getDeveloperMode,
369-
dispatchGetGeolocationEnabled: getGeolocationEnabled,
370343
dispatchIsAuthenticated: isAuthenticated,
371344
};
372345

src/App.test.js

-3
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,10 @@ describe('<App />', () => {
1212
changeLanguage: jest.fn(),
1313
},
1414
t: jest.fn(),
15-
dispatchGetGeolocation: jest.fn(),
1615
dispatchGetUserFolder: jest.fn(),
1716
dispatchGetLanguage: jest.fn(),
1817
dispatchGetDeveloperMode: jest.fn(),
19-
dispatchGetGeolocationEnabled: jest.fn(),
2018
dispatchIsAuthenticated: jest.fn(),
21-
geolocationEnabled: false,
2219
classes: {
2320
toastrIcon: '',
2421
fullScreen: '',

src/components/Settings.js

-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import Divider from '@material-ui/core/Divider';
1010
import Styles from '../Styles';
1111
import LanguageSelect from './common/LanguageSelect';
1212
import DeveloperSwitch from './common/DeveloperSwitch';
13-
import GeolocationControl from './common/GeolocationControl';
1413
import Main from './common/Main';
1514
import {
1615
SETTINGS_ACTIONS_CLASS,
@@ -100,7 +99,6 @@ export class Settings extends Component {
10099
<LanguageSelect />
101100
{authenticated && (
102101
<>
103-
<GeolocationControl />
104102
<SyncAdvancedSwitch />
105103
<StudentModeSwitch />
106104
{this.renderDeveloperModeSwitch()}

src/components/Settings.test.js

-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import Typography from '@material-ui/core/Typography';
44
import { Settings } from './Settings';
55
import LanguageSelect from './common/LanguageSelect';
66
import DeveloperSwitch from './common/DeveloperSwitch';
7-
import GeolocationControl from './common/GeolocationControl';
87
import FontSizeSlider from './common/FontSizeSlider';
98
import { USER_MODES } from '../config/constants';
109

@@ -64,10 +63,6 @@ describe('<Settings />', () => {
6463
expect(wrapper.find(DeveloperSwitch)).toHaveLength(1);
6564
});
6665

67-
it('renders one <GeolocationControl /> component', () => {
68-
expect(wrapper.find(GeolocationControl)).toHaveLength(1);
69-
});
70-
7166
it('renders one <FontSizeSlider /> component', () => {
7267
expect(wrapper.find(FontSizeSlider)).toHaveLength(1);
7368
});

src/components/SpacesNearby.js

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* @deprecated
3+
*/
4+
15
import React, { Component } from 'react';
26
import { connect } from 'react-redux';
37
import PropTypes from 'prop-types';

src/components/__snapshots__/Settings.test.js.snap

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ exports[`<Settings /> renders correctly 1`] = `
1616
</WithStyles(ForwardRef(Typography))>
1717
<WithStyles(ForwardRef(FormGroup))>
1818
<withI18nextTranslation(WithStyles(Connect(LanguageSelect))) />
19-
<withI18nextTranslation(WithStyles(Connect(GeolocationControl))) />
2019
<withI18nextTranslation(WithStyles(Connect(SyncAdvancedSwitch))) />
2120
<withI18nextTranslation(WithStyles(Connect(StudentModeSwitch))) />
2221
<withI18nextTranslation(WithStyles(Connect(DeveloperSwitch))) />

src/components/common/GeolocationControl.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* @deprecated
3+
*/
4+
15
import React, { Component } from 'react';
26
import FormControl from '@material-ui/core/FormControl';
37
import { withStyles } from '@material-ui/core/styles';
@@ -12,7 +16,7 @@ import Loader from './Loader';
1216
import { CONTROL_TYPES, FORM_CONTROL_MIN_WIDTH } from '../../config/constants';
1317
import { GEOLOCATION_CONTROL_ID } from '../../config/selectors';
1418

15-
const styles = theme => ({
19+
const styles = (theme) => ({
1620
formControl: {
1721
margin: theme.spacing(),
1822
minWidth: FORM_CONTROL_MIN_WIDTH,

src/components/common/GeolocationControl.test.js

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* @deprecated
3+
*/
4+
15
import React from 'react';
26
import { shallow } from 'enzyme';
37
import Button from '@material-ui/core/Button';

src/components/common/MainMenu.js

-16
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import MenuItem from '@material-ui/core/MenuItem';
77
import ListItemIcon from '@material-ui/core/ListItemIcon';
88
import Tooltip from '@material-ui/core/Tooltip';
99
import SaveIcon from '@material-ui/icons/Save';
10-
import SearchIcon from '@material-ui/icons/Search';
1110
import Language from '@material-ui/icons/Language';
1211
import CodeIcon from '@material-ui/icons/Code';
1312
import ListItemText from '@material-ui/core/ListItemText';
@@ -25,7 +24,6 @@ import {
2524
HOME_PATH,
2625
LOAD_SPACE_PATH,
2726
SETTINGS_PATH,
28-
SPACES_NEARBY_PATH,
2927
VISIT_PATH,
3028
DEVELOPER_PATH,
3129
DASHBOARD_PATH,
@@ -38,7 +36,6 @@ import {
3836
LOAD_MENU_ITEM_ID,
3937
HOME_MENU_ITEM_ID,
4038
VISIT_MENU_ITEM_ID,
41-
SPACES_NEARBY_MENU_ITEM_ID,
4239
DASHBOARD_MENU_ITEM_ID,
4340
DEVELOPER_MENU_ITEM_ID,
4441
SIGN_OUT_MENU_ITEM_ID,
@@ -264,19 +261,6 @@ export class MainMenu extends Component {
264261
</ListItemIcon>
265262
<ListItemText primary={t('Saved Spaces')} />
266263
</MenuItem>
267-
{this.renderOfflineMenuItem(
268-
<MenuItem
269-
id={SPACES_NEARBY_MENU_ITEM_ID}
270-
onClick={() => this.handleClick(SPACES_NEARBY_PATH)}
271-
button
272-
selected={path === SPACES_NEARBY_PATH}
273-
>
274-
<ListItemIcon>
275-
<SearchIcon />
276-
</ListItemIcon>
277-
<ListItemText primary={t('Spaces Nearby')} />
278-
</MenuItem>
279-
)}
280264
{this.renderOfflineMenuItem(
281265
<MenuItem
282266
id={VISIT_MENU_ITEM_ID}

src/components/common/MainMenu.test.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import {
1717
} from '../../config/paths';
1818
import { DEFAULT_USER_MODE } from '../../config/constants';
1919

20-
const MENUITEM_OFFLINE_NUMBER = 2;
21-
const MENUITEM_OFFLINE_ONLINE_COUNT = 11;
20+
const MENUITEM_OFFLINE_NUMBER = 1;
21+
const MENUITEM_OFFLINE_ONLINE_COUNT = 9;
2222

2323
const createMainMenuProps = (
2424
developerMode,
@@ -103,10 +103,10 @@ describe('<MainMenu />', () => {
103103
});
104104

105105
it(`renders ${
106-
MENUITEM_OFFLINE_ONLINE_COUNT + 1
106+
MENUITEM_OFFLINE_ONLINE_COUNT + MENUITEM_OFFLINE_NUMBER
107107
} <MenuItem /> components`, () => {
108108
expect(wrapper.find(MenuItem)).toHaveLength(
109-
MENUITEM_OFFLINE_ONLINE_COUNT + 1
109+
MENUITEM_OFFLINE_ONLINE_COUNT + MENUITEM_OFFLINE_NUMBER
110110
);
111111
});
112112
});

0 commit comments

Comments
 (0)