Skip to content

Commit

Permalink
Revert "Merge branch 'master' of github.com:cboard-org/cboard"
Browse files Browse the repository at this point in the history
This reverts commit c1f172a, reversing
changes made to 595861d.
  • Loading branch information
martinbedouret committed Feb 20, 2024
1 parent a0efb40 commit 3e39970
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 552 deletions.
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"private": false,
"license": "GPL-3.0-only",
"dependencies": {
"@analytics-debugger/ga4mp": "git+https://github.com/RodriSanchez1/ga4mp.git#fix/fullVersionList",
"@cospired/i18n-iso-languages": "^2.2.0",
"@crowdin/crowdin-api-client": "^1.26.0",
"@ctrl/react-adsense": "^1.7.0",
Expand Down Expand Up @@ -92,11 +91,10 @@
},
"devDependencies": {
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"babel-plugin-transform-import-meta": "^2.2.1",
"@craco/craco": "^7.1.0",
"@types/mime-types": "^2.1.1",
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.0",
"babel-jest": "^29.7.0",
"babel-plugin-transform-import-meta": "^2.2.1",
"decompress-zip": "^0.3.1",
"enzyme": "^3.11.0",
"enzyme-to-json": "3.3.5",
Expand Down Expand Up @@ -127,7 +125,7 @@
},
"jest": {
"transformIgnorePatterns": [
"node_modules/(?!idb|microsoft-cognitiveservices-speech-sdk|@analytics-debugger/ga4mp)"
"node_modules/(?!idb|microsoft-cognitiveservices-speech-sdk)"
],
"moduleNameMapper": {
"\\.(css|less)$": "<rootDir>/src/__mocks__/styleMock.js"
Expand Down
13 changes: 4 additions & 9 deletions src/components/Account/Login/Login.actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
} from '../../App/App.actions';
import { getVoiceURI } from '../../../i18n';
import { isCordova, isElectron } from '../../../cordova-util';
import ga4track from '../../../ga4mp';

export function loginSuccess(payload) {
return dispatch => {
Expand All @@ -23,11 +22,9 @@ export function loginSuccess(payload) {
payload
});
if (payload.isFirstLogin) firstLoginActions(dispatch, payload);
if (isCordova())
if (isCordova() && !isElectron())
try {
isElectron()
? ga4track.setUserId(payload.id)
: window.FirebasePlugin.setUserId(payload.id);
window.FirebasePlugin.setUserId(payload.id);
} catch (err) {
console.error(err);
}
Expand All @@ -44,11 +41,9 @@ async function firstLoginActions(dispatch, payload) {
}

export function logout() {
if (isCordova())
if (isCordova() && !isElectron())
try {
isElectron()
? ga4track.setUserId(undefined)
: window.FirebasePlugin.setUserId(undefined);
window.FirebasePlugin.setUserId(undefined);
} catch (err) {
console.error(err);
}
Expand Down
22 changes: 9 additions & 13 deletions src/components/App/App.container.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ import {
updateConnectivity
} from '../App/App.actions';
import { isCordova, isElectron } from '../../cordova-util';
import ga4track from '../../ga4mp';

export class AppContainer extends Component {
static propTypes = {
/**
Expand Down Expand Up @@ -68,17 +66,15 @@ export class AppContainer extends Component {

const initCVAGa4 = () => {
const { isLogged, userId } = this.props;
try {
if (isLogged)
isElectron()
? ga4track.setUserId(userId)
: window.FirebasePlugin.setUserId(userId);

isElectron()
? ga4track.trackEvent('page_view')
: window.FirebasePlugin.logEvent('page_view');
} catch (err) {
console.error(err);
if (!isElectron()) {
try {
if (isLogged) {
window.FirebasePlugin.setUserId(userId);
}
window.FirebasePlugin.logEvent('page_view');
} catch (err) {
console.error(err);
}
}
};

Expand Down
18 changes: 9 additions & 9 deletions src/components/Board/Board.analytics.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { trackEvent } from '@redux-beacon/google-analytics-gtag';
import { isCordova, cvaTrackEvent } from '../../cordova-util';
import ga4track from '../../ga4mp';

import {
IMPORT_BOARDS,
CREATE_BOARD,
Expand All @@ -27,7 +27,7 @@ const importBoards = trackEvent((action, prevState, nextState) => {
action: 'Import Boards'
};
if (isCordova()) {
cvaTrackEvent(gaEvent.category, gaEvent.action, false, ga4track);
cvaTrackEvent(gaEvent.category, gaEvent.action);
}
return gaEvent;
});
Expand All @@ -46,7 +46,7 @@ const changeBoard = trackEvent((action, prevState, nextState) => {
label: boardName
};
if (isCordova()) {
cvaTrackEvent(gaEvent.category, gaEvent.action, gaEvent.label, ga4track);
cvaTrackEvent(gaEvent.category, gaEvent.action, gaEvent.label);
}
return gaEvent;
});
Expand All @@ -58,7 +58,7 @@ const createBoard = trackEvent((action, prevState, nextState) => {
label: action.boardName
};
if (isCordova()) {
cvaTrackEvent(gaEvent.category, gaEvent.action, gaEvent.label, ga4track);
cvaTrackEvent(gaEvent.category, gaEvent.action, gaEvent.label);
}
return gaEvent;
});
Expand All @@ -70,7 +70,7 @@ const createTile = trackEvent((action, prevState, nextState) => {
label: action.tile.label
};
if (isCordova()) {
cvaTrackEvent(gaEvent.category, gaEvent.action, gaEvent.label, ga4track);
cvaTrackEvent(gaEvent.category, gaEvent.action, gaEvent.label);
}
return gaEvent;
});
Expand All @@ -87,7 +87,7 @@ const deleteTiles = trackEvent((action, prevState, nextState) => {
label: deletedTiles
};
if (isCordova()) {
cvaTrackEvent(gaEvent.category, gaEvent.action, gaEvent.label, ga4track);
cvaTrackEvent(gaEvent.category, gaEvent.action, gaEvent.label);
}
return gaEvent;
});
Expand All @@ -103,7 +103,7 @@ const editTiles = trackEvent((action, prevState, nextState) => {
label: editedTiles
};
if (isCordova()) {
cvaTrackEvent(gaEvent.category, gaEvent.action, gaEvent.label, ga4track);
cvaTrackEvent(gaEvent.category, gaEvent.action, gaEvent.label);
}
return gaEvent;
});
Expand All @@ -115,7 +115,7 @@ const clickSymbol = trackEvent((action, prevState, nextState) => {
label: action.symbolLabel
};
if (isCordova()) {
cvaTrackEvent(gaEvent.category, gaEvent.action, gaEvent.label, ga4track);
cvaTrackEvent(gaEvent.category, gaEvent.action, gaEvent.label);
}
return gaEvent;
});
Expand All @@ -127,7 +127,7 @@ const clickOutput = trackEvent((action, prevState, nextState) => {
label: action.outputPhrase
};
if (isCordova()) {
cvaTrackEvent(gaEvent.category, gaEvent.action, gaEvent.label, ga4track);
cvaTrackEvent(gaEvent.category, gaEvent.action, gaEvent.label);
}
return gaEvent;
});
Expand Down
3 changes: 0 additions & 3 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,3 @@ export const PAYPAL_CLIENT_ID =
// Google related constants
export const GOOGLE_FIREBASE_WEB_CLIENT_ID =
process.env.REACT_APP_GOOGLE_FIREBASE_WEB_CLIENT_ID || '';

// Google Analytics related constants
export const GA4_MEASUREMENT_ID = 'G-60S79265FY';
10 changes: 3 additions & 7 deletions src/cordova-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ const configFacebookPlugin = () => {
);
};

export const cvaTrackEvent = (category, action, label, ga4mp) => {
export const cvaTrackEvent = (category, action, label) => {
try {
const convertEventToNewNomenclature = name => {
const inLowerCase = name.toLowerCase();
Expand All @@ -154,13 +154,9 @@ export const cvaTrackEvent = (category, action, label, ga4mp) => {
: {
event_category: category
};

if (isAndroid() || isIOS())
window.FirebasePlugin.logEvent(event_name, eventOptions);

if (isElectron()) ga4mp.trackEvent(event_name, eventOptions);
if (!isElectron()) window.FirebasePlugin.logEvent(event_name, eventOptions);
} catch (err) {
console.error(err.message);
console.log(err.message);
}
};

Expand Down
11 changes: 0 additions & 11 deletions src/ga4mp.js

This file was deleted.

9 changes: 4 additions & 5 deletions src/providers/SpeechProvider/SpeechProvider.analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
EMPTY_VOICES
} from './SpeechProvider.constants';
import { isCordova, cvaTrackEvent } from '../../cordova-util';
import ga4track from '../../ga4mp';

const changeVoice = trackEvent((action, prevState, nextState) => {
const gaEvent = {
Expand All @@ -17,7 +16,7 @@ const changeVoice = trackEvent((action, prevState, nextState) => {
label: action ? action.voiceURI : EMPTY_VOICES
};
if (isCordova()) {
cvaTrackEvent(gaEvent.category, gaEvent.action, gaEvent.label, ga4track);
cvaTrackEvent(gaEvent.category, gaEvent.action, gaEvent.label);
}
return gaEvent;
});
Expand All @@ -29,7 +28,7 @@ const changePitch = trackEvent((action, prevState, nextState) => {
label: action.pitch
};
if (isCordova()) {
cvaTrackEvent(gaEvent.category, gaEvent.action, gaEvent.label, ga4track);
cvaTrackEvent(gaEvent.category, gaEvent.action, gaEvent.label);
}
return gaEvent;
});
Expand All @@ -41,7 +40,7 @@ const changeRate = trackEvent((action, prevState, nextState) => {
label: action.rate
};
if (isCordova()) {
cvaTrackEvent(gaEvent.category, gaEvent.action, gaEvent.label, ga4track);
cvaTrackEvent(gaEvent.category, gaEvent.action, gaEvent.label);
}
return gaEvent;
});
Expand All @@ -53,7 +52,7 @@ const startSpeech = trackEvent((action, prevState, nextState) => {
label: action.text
};
if (isCordova()) {
cvaTrackEvent(gaEvent.category, gaEvent.action, gaEvent.label, ga4track);
cvaTrackEvent(gaEvent.category, gaEvent.action, gaEvent.label);
}
return gaEvent;
});
Expand Down
Loading

0 comments on commit 3e39970

Please sign in to comment.