Skip to content

Commit

Permalink
Revert disabling wbw audio data
Browse files Browse the repository at this point in the history
  • Loading branch information
osamasayed committed Nov 24, 2024
1 parent dea7794 commit 2e73d43
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 18 deletions.
2 changes: 1 addition & 1 deletion locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@
},
"recitation": "Recitation",
"reciter": "Reciter",
"reciter-summary": "Word by word reciter: <span>{{reciterName}}</span>. Click on a word to listen to its recitation.",
"reciter-summary": "(With kind permission of Tafsir Center)",
"reciters": "Reciters",
"reflect": "Reflect",
"reflections": "Reflections",
Expand Down
10 changes: 8 additions & 2 deletions src/components/Navbar/SettingsDrawer/WordByWordSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,17 @@ const WordByWordSection = () => {
checked={wordClickFunctionality === WordClickFunctionality.PlayAudio}
id="wbw-recitation"
name="wbw-recitation"
label={`${t('recitation')} (${t('unavailable')})`}
label={t('recitation')}
onChange={onRecitationChange}
disabled
/>
</div>

<Section.Footer>
<Trans
components={{ span: <span className={styles.source} /> }}
i18nKey="common:reciter-summary"
/>
</Section.Footer>
</div>
</Section.Row>
<Separator className={styles.separator} />
Expand Down
15 changes: 1 addition & 14 deletions src/redux/Provider.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable react-func/max-lines-per-function */
import { useContext, useMemo } from 'react';

import setLanguage from 'next-translate/setLanguage';
Expand All @@ -9,7 +8,6 @@ import { PersistGate } from 'redux-persist/integration/react';
import getStore from './store';

import syncUserPreferences from '@/redux/actions/sync-user-preferences';
import { WordClickFunctionality } from '@/types/QuranReader';
import { getUserPreferences } from '@/utils/auth/api';
import { isLoggedIn } from '@/utils/auth/login';
import { setLocaleCookie } from '@/utils/cookies';
Expand Down Expand Up @@ -38,23 +36,12 @@ const ReduxProvider = ({ children, locale }) => {
const onBeforeLift = async () => {
if (isClient && isLoggedIn()) {
try {
const remotePreferences = await getUserPreferences();
const userPreferences = { ...remotePreferences };
const userPreferences = await getUserPreferences();
const remoteLocale = userPreferences[PreferenceGroup.LANGUAGE];
if (remoteLocale) {
await setLanguage(remoteLocale[PreferenceGroup.LANGUAGE]);
setLocaleCookie(remoteLocale[PreferenceGroup.LANGUAGE]);
}
// TODO: this is a temporary fix to prevent playing wbw if the user has their preference set to play audio
if (
userPreferences[PreferenceGroup.READING]?.wordClickFunctionality ===
WordClickFunctionality.PlayAudio
) {
userPreferences[PreferenceGroup.READING] = {
...userPreferences[PreferenceGroup.READING],
wordClickFunctionality: WordClickFunctionality.NoAudio,
};
}
store.dispatch(syncUserPreferences(userPreferences, locale));
const audioPlayerContext = audioService.getSnapshot().context;
const playbackRate =
Expand Down
2 changes: 1 addition & 1 deletion src/redux/defaultSettings/defaultSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const READING_PREFERENCES_INITIAL_STATE: ReadingPreferences = {
isUsingDefaultWordByWordLocale: true,
wordByWordContentType: [WordByWordType.Translation],
wordByWordDisplay: [WordByWordDisplay.TOOLTIP],
wordClickFunctionality: WordClickFunctionality.NoAudio,
wordClickFunctionality: WordClickFunctionality.PlayAudio,
};

const THEME_INITIAL_STATE: Theme = {
Expand Down

0 comments on commit 2e73d43

Please sign in to comment.