Skip to content

Commit

Permalink
add langsFetched to blacklist
Browse files Browse the repository at this point in the history
  • Loading branch information
tomivm committed Mar 24, 2022
1 parent f4aca2d commit 96e1d3b
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 29 deletions.
6 changes: 3 additions & 3 deletions src/components/Settings/Language/Language.container.js
Original file line number Diff line number Diff line change
Expand Up @@ -445,14 +445,14 @@ export class LanguageContainer extends Component {
const downloadingLangState = {
isdownloading: false
};
setDownloadingLang(downloadingLangState);
this.setState({
downloadingLangError: {
ttsError: false,
langError: false
}
},
selectedLang: selectedLang
});
setDownloadingLang(downloadingLangState);
this.setState({ selectedLang: selectedLang });
this.refreshLanguageList();
if (isDiferentTts) return;
await this.handleSubmit(selectedLang);
Expand Down
7 changes: 0 additions & 7 deletions src/providers/LanguageProvider/LanguageProvider.actions.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
CHANGE_LANG,
START_FETCHING_LANGS,
SET_LANGS,
SET_DOWNLOADING_LANG
} from './LanguageProvider.constants';
Expand All @@ -14,12 +13,6 @@ export function changeLang(lang) {
};
}

export function startFetchingLangs() {
return {
type: START_FETCHING_LANGS
};
}

export function setLangs(langs, localLangs) {
return {
type: SET_LANGS,
Expand Down
2 changes: 0 additions & 2 deletions src/providers/LanguageProvider/LanguageProvider.constants.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
export const CHANGE_LANG = 'cboard/LanguageProvider/CHANGE_LANG';
export const START_FETCHING_LANGS =
'cboard/LanguageProvider/START_FETCHING_LANGS';
export const SET_LANGS = 'cboard/LanguageProvider/SET_LANGS';
export const SET_DOWNLOADING_LANG =
'cboard/LanguageProvider/SET_DOWNLOADING_LANG';
6 changes: 0 additions & 6 deletions src/providers/LanguageProvider/LanguageProvider.reducer.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
CHANGE_LANG,
START_FETCHING_LANGS,
SET_LANGS,
SET_DOWNLOADING_LANG
} from './LanguageProvider.constants';
Expand Down Expand Up @@ -42,11 +41,6 @@ function languageProviderReducer(state = initialState, action) {
lang: action.lang ? action.lang : state.lang,
dir: action.lang ? getDir(action.lang) : state.dir
};
case START_FETCHING_LANGS:
return {
...state,
langsFetched: false
};
case SET_LANGS:
return {
...state,
Expand Down
9 changes: 1 addition & 8 deletions src/providers/SpeechProvider/SpeechProvider.container.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
updateLangSpeechStatus,
setTtsEngine
} from './SpeechProvider.actions';
import { startFetchingLangs } from '../LanguageProvider/LanguageProvider.actions';
import { isAndroid } from '../../cordova-util';

export class SpeechProvider extends Component {
Expand All @@ -20,11 +19,6 @@ export class SpeechProvider extends Component {
setTtsEngine: PropTypes.func
};

constructor(props) {
super(props);
this.props.startFetchingLangs();
}

async componentDidMount() {
const {
getVoices,
Expand Down Expand Up @@ -73,8 +67,7 @@ const mapDispatchToProps = {
getTtsEngines,
getTtsDefaultEngine,
setTtsEngine,
updateLangSpeechStatus,
startFetchingLangs
updateLangSpeechStatus
};

export default connect(
Expand Down
13 changes: 10 additions & 3 deletions src/reducers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { persistCombineReducers } from 'redux-persist';
import { persistCombineReducers, persistReducer } from 'redux-persist';

import appReducer from './components/App/App.reducer';
import languageProviderReducer from './providers/LanguageProvider/LanguageProvider.reducer';
Expand All @@ -11,13 +11,20 @@ import storage from 'redux-persist/lib/storage';

const config = {
key: 'root',
storage
storage,
blacklist: ['language']
};

const languagePersistConfig = {
key: 'language',
storage: storage,
blacklist: ['langsFetched']
};

export default function createReducer() {
return persistCombineReducers(config, {
app: appReducer,
language: languageProviderReducer,
language: persistReducer(languagePersistConfig, languageProviderReducer),
speech: speechProviderReducer,
board: boardReducer,
communicator: communicatorReducer,
Expand Down

0 comments on commit 96e1d3b

Please sign in to comment.