Skip to content

Commit

Permalink
Merge branch 'master' into chore/modernize-form-components
Browse files Browse the repository at this point in the history
  • Loading branch information
martinbedouret committed Mar 5, 2023
2 parents 6679dd3 + e40af34 commit 5680e22
Show file tree
Hide file tree
Showing 7 changed files with 109 additions and 64 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,22 @@ In order to pull the latest translations from CrowdIn into the codebase, you can

## Getting Started

### `npm start` or `yarn start`
### `yarn start`

Runs the app in development mode.<br>
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.<br>
You will see the build errors and lint warnings in the console.

### `npm test` or `yarn test`
### `yarn test`

Runs the test watcher in an interactive mode.<br>
By default, runs tests related to files changed since the last commit.

[Read more about testing.](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#running-tests)

### `npm run build` or `yarn build`
### `yarn build`

Builds the app for production to the `build` folder.<br>
It correctly bundles React in production mode and optimizes the build for the best performance.
Expand All @@ -59,7 +59,7 @@ By default, it also [includes a service worker](https://github.com/facebookincub

Cboard is ready to be deployed.

### `npm run build-cordova-debug`
### `yarn build-cordova-debug`

Use this to produce non-minified build for use in debugging within Cordova. It uses `react-app-rewired` & `config-overrides.js` to customize webpack operation without ejecting react.

Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"license": "GPL-3.0-only",
"dependencies": {
"@cospired/i18n-iso-languages": "^2.2.0",
"@crowdin/crowdin-api-client": "^1.18.2",
"@crowdin/crowdin-api-client": "^1.21.1",
"@ctrl/react-adsense": "^1.5.0",
"@material-ui/core": "^4.12.4",
"@material-ui/icons": "^4.11.3",
Expand Down Expand Up @@ -49,39 +49,39 @@
"keycode": "^2.2.1",
"lodash": "^4.17.21",
"mathjs": "7.6.0",
"microsoft-cognitiveservices-speech-sdk": "^1.21.1",
"microsoft-cognitiveservices-speech-sdk": "^1.25.0",
"mime-types": "^2.1.35",
"moment": "2.29.4",
"mongoose": "^6.4.6",
"opencollective": "^1.0.3",
"pdfmake": "^0.2.7",
"prop-types": "^15.8.1",
"query-string": "^6.14.1",
"ramda": "^0.27.2",
"ramda": "^0.28.0",
"react": "^17.0.2",
"react-autosuggest": "^10.1.0",
"react-cropper": "^2.1.8",
"react-dnd": "^11.1.3",
"react-dnd-touch-backend": "^11.1.3",
"react-dom": "^17.0.2",
"react-grid-layout": "^1.3.4",
"react-grid-layout": "^0.16.6",
"react-helmet": "^6.1.0",
"react-icons": "^4.2.0",
"react-icons": "^4.7.1",
"react-intl": "^2.7.2",
"react-joyride": "^2.5.3",
"react-markdown": "^5.0.3",
"react-media-recorder": "^0.7.1",
"react-redux": "^5.1.2",
"react-router-dom": "^5.3.4",
"react-scannable": "0.0.18",
"react-share": "^4.4.1",
"react-share": "^2.3.1",
"react-sizeme": "^3.0.2",
"react-social-login-buttons": "^3.6.1",
"react-transition-group": "4.4.2",
"react-transition-group": "4.4.5",
"redux": "^4.2.1",
"redux-beacon": "^2.0.3",
"redux-persist": "^5.10.0",
"redux-thunk": "^2.3.0",
"redux-thunk": "^2.4.2",
"shortid": "^2.2.16",
"source-map-explorer": "^2.5.3",
"swiper": "^6.8.4",
Expand Down Expand Up @@ -136,7 +136,7 @@
"start": "react-scripts start",
"build": "react-scripts build && sw-precache --config=sw-precache-config.js",
"build-cordova-debug": "react-app-rewired build",
"predeploy": "npm run build",
"predeploy": "yarn build",
"deploy": "gh-pages -d build",
"test": "react-scripts test",
"decrypt:local": "./scripts/decrypt-private.sh local",
Expand Down
14 changes: 9 additions & 5 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@
http://localhost:3000/
http://localhost:10010/
http://www.googletagmanager.com/gtag/js
ws://localhost:3000/
wss://localhost:3000/
ws://192.168.0.109:3000/
wss://192.168.0.109:3000/
wss://*.microsoft.com/cognitiveservices/
blob:
blob:
gap:
data:;
img-src * data: filesystem: blob: ;
Expand All @@ -32,7 +36,7 @@
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
Learn how to configure a non-root public URL by running `yarn build`.
-->

<!-- Add to homescreen for Chrome on Android -->
Expand Down Expand Up @@ -80,9 +84,9 @@
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
To begin the development, run `yarn start` or `yarn start`.
To create a production bundle, use `yarn run build` or `yarn build`.
-->
</body>

</html>
</html>
4 changes: 4 additions & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ export const ADTEST_AVAILABLE =
export const ADSENSE_CLIENT = 'ca-pub-7162313874228987';

export const ADD_SLOT_SETTINGS_TOP = '5250438005';

export const IS_BROWSING_FROM_APPLE = /iPad|iPhone|iPod|Mac/.test(
navigator.userAgent
);
2 changes: 1 addition & 1 deletion src/providers/SpeechProvider/SpeechProvider.actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ export function cancelSpeech() {
try {
tts.cancel();
} catch (error) {
console.err(error);
console.error(error);
}
};
}
Expand Down
21 changes: 19 additions & 2 deletions src/providers/SpeechProvider/tts.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { isAndroid, isCordova } from '../../cordova-util';
import API from '../../api';
import {
AZURE_SPEECH_SERVICE_REGION,
AZURE_SPEECH_SUBSCR_KEY
AZURE_SPEECH_SUBSCR_KEY,
IS_BROWSING_FROM_APPLE
} from '../../constants';
import { getStore } from '../../store';

Expand All @@ -14,6 +15,8 @@ let synth = window.speechSynthesis;
var azureSynthesizer;

const audioElement = new Audio();

let appleFirstCloudPlay = IS_BROWSING_FROM_APPLE;
var speakQueue = [];
var platformVoices = [];

Expand Down Expand Up @@ -49,7 +52,9 @@ const playQueue = () => {
if (speakQueue.length) {
const blob = new Blob([speakQueue[0].audioData], { type: 'audio/wav' });
audioElement.src = window.URL.createObjectURL(blob);
audioElement.play();
audioElement.play().catch(err => {
console.error(err);
});
audioElement.onended = () => {
window.URL.revokeObjectURL(audioElement.src);
if (speakQueue.length) {
Expand Down Expand Up @@ -191,6 +196,17 @@ const tts = {
) {
const voice = this.getVoiceByVoiceURI(voiceURI);
if (voice && voice.voiceSource === 'cloud') {
if (appleFirstCloudPlay) {
audioElement
.play()
.then(() => {})
.catch(() => {})
.finally(() => {
console.log('Apple user Agent is ready to reproduce cloud voices');
});
audioElement.pause();
appleFirstCloudPlay = false;
}
const speakAlertTimeoutId = setCloudSpeakAlertTimeout();
// set voice to speak
azureSynthesizer.properties.setProperty(
Expand Down Expand Up @@ -251,6 +267,7 @@ const tts = {
msg.rate = rate;
msg.volume = volume;
msg.onend = onend;
synth.cancel();
synth.speak(msg);
}
}
Expand Down
Loading

0 comments on commit 5680e22

Please sign in to comment.