Skip to content

Commit e68e473

Browse files
Merge pull request #2180 from cboard-org/revert/communication-history
Revert Communication History feature (#2080 and related)
2 parents de22510 + 1efc8f8 commit e68e473

30 files changed

Lines changed: 10 additions & 2183 deletions

src/components/App/App.actions.js

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
import API from '../../api';
2-
import shortid from 'shortid';
32
import {
43
FINISH_FIRST_VISIT,
54
UPDATE_DISPLAY_SETTINGS,
65
UPDATE_NAVIGATION_SETTINGS,
76
UPDATE_USER_DATA,
8-
START_COMMUNICATION_SESSION,
9-
CLEAR_COMMUNICATION_SESSION,
107
DISABLE_TOUR,
118
ENABLE_ALL_TOURS,
129
SET_UNLOGGED_USER_LOCATION,
@@ -72,19 +69,6 @@ export function updateUserData(userData) {
7269
};
7370
}
7471

75-
export function startCommunicationSession() {
76-
return {
77-
type: START_COMMUNICATION_SESSION,
78-
sessionId: shortid.generate()
79-
};
80-
}
81-
82-
export function clearCommunicationSession() {
83-
return {
84-
type: CLEAR_COMMUNICATION_SESSION
85-
};
86-
}
87-
8872
export function setUnloggedUserLocation(location) {
8973
return {
9074
type: SET_UNLOGGED_USER_LOCATION,

src/components/App/App.constants.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ export const UPDATE_SYMBOLS_SETTINGS = 'cboard/App/UPDATE_SYMBOLS_SETTINGS';
88
export const UPDATE_NAVIGATION_SETTINGS =
99
'cboard/App/UPDATE_NAVIGATION_SETTINGS';
1010
export const UPDATE_USER_DATA = 'cboard/App/UPDATE_USER_DATA';
11-
export const START_COMMUNICATION_SESSION =
12-
'cboard/App/START_COMMUNICATION_SESSION';
13-
export const CLEAR_COMMUNICATION_SESSION =
14-
'cboard/App/CLEAR_COMMUNICATION_SESSION';
1511
export const SET_UNLOGGED_USER_LOCATION =
1612
'cboard/App/SET_UNLOGGED_USER_LOCATION';
1713
// language constants

src/components/App/App.container.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ import {
1515
updateUserDataFromAPI,
1616
updateLoggedUserLocation,
1717
updateUnloggedUserLocation,
18-
updateConnectivity,
19-
startCommunicationSession
18+
updateConnectivity
2019
} from '../App/App.actions';
2120
import { getApiObjects } from '../Board/Board.actions';
2221
import {
@@ -53,10 +52,6 @@ export class AppContainer extends Component {
5352
* User Id
5453
*/
5554
userId: PropTypes.string,
56-
/**
57-
* Starts the communication session
58-
*/
59-
startCommunicationSession: PropTypes.func.isRequired,
6055
/**
6156
* Get API objects (boards and communicators)
6257
*/
@@ -66,7 +61,6 @@ export class AppContainer extends Component {
6661
lastSyncTime = null;
6762

6863
componentDidMount() {
69-
const { startCommunicationSession } = this.props;
7064
const localizeUser = () => {
7165
const {
7266
isLogged,
@@ -110,8 +104,6 @@ export class AppContainer extends Component {
110104

111105
localizeUser();
112106

113-
startCommunicationSession();
114-
115107
initGoogleAnalytics();
116108

117109
// Set initial connection status and register event listeners
@@ -256,7 +248,6 @@ const mapDispatchToProps = {
256248
updateLoggedUserLocation,
257249
updateUnloggedUserLocation,
258250
updateConnectivity,
259-
startCommunicationSession,
260251
getApiObjects
261252
};
262253

src/components/App/App.reducer.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import {
55
UPDATE_NAVIGATION_SETTINGS,
66
UPDATE_SYMBOLS_SETTINGS,
77
UPDATE_USER_DATA,
8-
START_COMMUNICATION_SESSION,
9-
CLEAR_COMMUNICATION_SESSION,
108
DISABLE_TOUR,
119
ENABLE_ALL_TOURS,
1210
SET_UNLOGGED_USER_LOCATION,
@@ -63,7 +61,6 @@ const initialState = {
6361
symbolsSettings: {
6462
arasaacActive: false
6563
},
66-
sessionId: null,
6764
userData: {}
6865
};
6966

@@ -179,16 +176,6 @@ function appReducer(state = initialState, action) {
179176
? getKeysFromApiUserDataResponse(action.userData)
180177
: state.userData
181178
};
182-
case START_COMMUNICATION_SESSION:
183-
return {
184-
...state,
185-
sessionId: action.sessionId
186-
};
187-
case CLEAR_COMMUNICATION_SESSION:
188-
return {
189-
...state,
190-
sessionId: null
191-
};
192179
case SET_UNLOGGED_USER_LOCATION:
193180
return {
194181
...state,

src/components/App/__tests__/App.actions.test.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,4 @@ describe('actions', () => {
5959
};
6060
expect(actions.finishFirstVisit()).toEqual(expectedAction);
6161
});
62-
63-
it('should create an action to start communication session', () => {
64-
const action = actions.startCommunicationSession();
65-
66-
expect(action.type).toEqual(types.START_COMMUNICATION_SESSION);
67-
expect(action.sessionId).toBeDefined();
68-
});
69-
70-
it('should create an action to clear communication session', () => {
71-
const expectedAction = {
72-
type: types.CLEAR_COMMUNICATION_SESSION
73-
};
74-
expect(actions.clearCommunicationSession()).toEqual(expectedAction);
75-
});
7662
});

src/components/App/__tests__/App.reducer.test.js

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import { DISPLAY_SIZE_STANDARD } from '../../Settings/Display/Display.constants'
44
import { NAVIGATION_BUTTONS_STYLE_SIDES } from '../../Settings/Navigation/Navigation.constants';
55
import {
66
FINISH_FIRST_VISIT,
7-
START_COMMUNICATION_SESSION,
8-
CLEAR_COMMUNICATION_SESSION,
97
UPDATE_CONNECTIVITY,
108
UPDATE_DISPLAY_SETTINGS,
119
UPDATE_NAVIGATION_SETTINGS
@@ -58,7 +56,6 @@ describe('reducer', () => {
5856
symbolsSettings: {
5957
arasaacActive: false
6058
},
61-
sessionId: null,
6259
userData: {}
6360
};
6461
uData = { name: 'martin bedouret', email: 'anything@cboard.io' };
@@ -151,27 +148,4 @@ describe('reducer', () => {
151148
isConnected: false
152149
});
153150
});
154-
it('should handle start communication session', () => {
155-
const startCommunicationSession = {
156-
type: START_COMMUNICATION_SESSION,
157-
sessionId: 'session_123'
158-
};
159-
expect(appReducer(initialState, startCommunicationSession)).toEqual({
160-
...initialState,
161-
sessionId: 'session_123'
162-
});
163-
});
164-
it('should handle clear communication session', () => {
165-
const stateWithSession = {
166-
...initialState,
167-
sessionId: 'session_123'
168-
};
169-
const clearCommunicationSession = {
170-
type: CLEAR_COMMUNICATION_SESSION
171-
};
172-
expect(appReducer(stateWithSession, clearCommunicationSession)).toEqual({
173-
...initialState,
174-
sessionId: null
175-
});
176-
});
177151
});

src/components/Board/Board.container.js

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,6 @@ import {
4949
changeDefaultBoard,
5050
setIsSaving
5151
} from './Board.actions';
52-
import {
53-
trackSymbolSelection,
54-
trackPhraseSpoken,
55-
trackClearAction,
56-
trackBackspaceAction
57-
} from '../CommunicationHistory/CommunicationHistory.actions';
5852
import {
5953
addBoardCommunicator,
6054
verifyAndUpsertCommunicator
@@ -195,12 +189,7 @@ export class BoardContainer extends Component {
195189
isSymbolSearchTourEnabled: PropTypes.bool,
196190
disableTour: PropTypes.func,
197191
isLiveMode: PropTypes.bool,
198-
changeDefaultBoard: PropTypes.func,
199-
sessionId: PropTypes.string,
200-
trackSymbolSelection: PropTypes.func,
201-
trackPhraseSpoken: PropTypes.func,
202-
trackClearAction: PropTypes.func,
203-
trackBackspaceAction: PropTypes.func
192+
changeDefaultBoard: PropTypes.func
204193
};
205194

206195
state = {
@@ -866,11 +855,7 @@ export class BoardContainer extends Component {
866855
boards,
867856
showNotification,
868857
navigationSettings,
869-
isLiveMode,
870-
trackSymbolSelection,
871-
userData,
872-
board,
873-
sessionId
858+
isLiveMode
874859
} = this.props;
875860
const hasAction = tile.action && tile.action.startsWith('+');
876861

@@ -901,12 +886,6 @@ export class BoardContainer extends Component {
901886
showNotification(intl.formatMessage(messages.boardMissed));
902887
}
903888
} else {
904-
const enhancedTile = {
905-
...tile,
906-
boardId: board.id
907-
};
908-
trackSymbolSelection(enhancedTile, userData?.id || null, sessionId);
909-
910889
clickSymbol(tile.label);
911890
if (!navigationSettings.quietBuilderMode) {
912891
say();
@@ -1859,8 +1838,7 @@ export const mapStateToProps = state => {
18591838
navigationSettings,
18601839
userData,
18611840
isConnected,
1862-
liveHelp,
1863-
sessionId
1841+
liveHelp
18641842
},
18651843
language: { lang },
18661844
subscription: { premiumRequiredModalState }
@@ -1886,7 +1864,6 @@ export const mapStateToProps = state => {
18861864
displaySettings,
18871865
navigationSettings,
18881866
userData,
1889-
sessionId,
18901867
emptyVoiceAlert,
18911868
lang,
18921869
offlineVoiceAlert,
@@ -1929,10 +1906,6 @@ const mapDispatchToProps = {
19291906
upsertApiBoard,
19301907
changeDefaultBoard,
19311908
verifyAndUpsertCommunicator,
1932-
trackSymbolSelection,
1933-
trackPhraseSpoken,
1934-
trackClearAction,
1935-
trackBackspaceAction,
19361909
showPremiumRequired,
19371910
setIsSaving
19381911
};

src/components/Board/Output/Output.container.js

Lines changed: 5 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ import {
1414
} from '../../../providers/SpeechProvider/SpeechProvider.actions';
1515

1616
import { changeOutput, clickOutput, changeLiveMode } from '../Board.actions';
17-
import {
18-
trackPhraseSpoken,
19-
trackClearAction,
20-
trackBackspaceAction
21-
} from '../../CommunicationHistory/CommunicationHistory.actions';
2217
import SymbolOutput from './SymbolOutput';
2318

2419
function translateOutput(output, intl) {
@@ -54,18 +49,7 @@ export class OutputContainer extends Component {
5449
*/
5550
label: PropTypes.oneOfType([PropTypes.string, PropTypes.node])
5651
})
57-
),
58-
/**
59-
* Tracking actions
60-
*/
61-
trackPhraseSpoken: PropTypes.func.isRequired,
62-
trackClearAction: PropTypes.func.isRequired,
63-
trackBackspaceAction: PropTypes.func.isRequired,
64-
/**
65-
* User/session metadata
66-
*/
67-
userData: PropTypes.object,
68-
sessionId: PropTypes.string
52+
)
6953
};
7054

7155
static getDerivedStateFromProps(props, state) {
@@ -179,15 +163,9 @@ export class OutputContainer extends Component {
179163
}
180164

181165
async play(liveText = '') {
182-
const { output, trackPhraseSpoken, userData, sessionId } = this.props;
183-
184166
if (liveText) {
185167
await this.speakOutput(liveText);
186168
} else {
187-
if (output.length > 0) {
188-
trackPhraseSpoken(output, userData?.id || null, sessionId);
189-
}
190-
191169
const outputFrames = this.groupOutputByType();
192170

193171
await this.asyncForEach(outputFrames, async frame => {
@@ -210,21 +188,14 @@ export class OutputContainer extends Component {
210188
}
211189

212190
handleBackspaceClick = () => {
213-
const {
214-
cancelSpeech,
215-
trackBackspaceAction,
216-
userData,
217-
sessionId
218-
} = this.props;
191+
const { cancelSpeech } = this.props;
219192
cancelSpeech();
220-
trackBackspaceAction(userData?.id || null, sessionId);
221193
this.popOutput();
222194
};
223195

224196
handleClearClick = () => {
225-
const { cancelSpeech, trackClearAction, userData, sessionId } = this.props;
197+
const { cancelSpeech } = this.props;
226198
cancelSpeech();
227-
trackClearAction(userData?.id || null, sessionId);
228199
this.clearOutput();
229200
};
230201

@@ -380,9 +351,7 @@ const mapStateToProps = ({ board, app }) => {
380351
output: board.output,
381352
isLiveMode: board.isLiveMode,
382353
navigationSettings: app.navigationSettings,
383-
increaseOutputButtons: app.displaySettings.increaseOutputButtons,
384-
userData: app.userData,
385-
sessionId: app.sessionId
354+
increaseOutputButtons: app.displaySettings.increaseOutputButtons
386355
};
387356
};
388357

@@ -392,10 +361,7 @@ const mapDispatchToProps = {
392361
clickOutput,
393362
speak,
394363
showNotification,
395-
changeLiveMode,
396-
trackPhraseSpoken,
397-
trackClearAction,
398-
trackBackspaceAction
364+
changeLiveMode
399365
};
400366

401367
export default connect(

src/components/Board/__tests__/Board.container.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ const createState = (boards, syncMeta = {}) => ({
2828
displaySettings: {},
2929
navigationSettings: {},
3030
userData: null,
31-
sessionId: null,
3231
isConnected: true,
3332
liveHelp: {
3433
isRootBoardTourEnabled: false,

0 commit comments

Comments
 (0)