Skip to content
This repository was archived by the owner on Jun 28, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 5 additions & 17 deletions src/helpers/buildAudio.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
/* eslint-disable */
const firefox = /firefox/i;
const opera = /opera/i;
const chrome = /chrome/i;

export function testIfSupported(ayah, agent) {
const { audio } = ayah;

const testOperaOrFirefox = __SERVER__ ?
(agent.isOpera || agent.isFirefox) :
(opera.test(window.navigator.userAgent) || firefox.test(window.navigator.userAgent));
const testChrome = __SERVER__ ? agent.isChrome : chrome.test(window.navigator.userAgent);
const testOperaOrFirefox = (agent.isOpera || agent.isFirefox);
const testChrome = agent.isChrome;

if(!audio) {
return false;
Expand Down Expand Up @@ -42,10 +35,9 @@ export function buildAudioForAyah(audio, agent) {

scopedAudio.preload = 'none';

const testOperaOrFirefox = __SERVER__ ?
(agent.isOpera || agent.isFirefox) :
(opera.test(window.navigator.userAgent) || firefox.test(window.navigator.userAgent));
const testChrome = __SERVER__ ? agent.isChrome : chrome.test(window.navigator.userAgent);
const testOperaOrFirefox = (agent.isOpera || agent.isFirefox);
const testChrome = agent.isChrome;


if (testOperaOrFirefox) {
if (audio.ogg.url) {
Expand Down Expand Up @@ -89,10 +81,6 @@ export default function buildAudio(ayahs) {
return;
}

// const errorMessage = 'The current reciter does not have audio that suits' +
// ' your browser. Either select another reciter or try' +
// ' on another browser.';

return ayahs.map(ayah => {
return buildAudioForAyah(ayah);
});
Expand Down
6 changes: 4 additions & 2 deletions src/redux/modules/surahs.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ export default function reducer(state = initialState, action = {}) {
...state,
loaded: true,
errored: false,
entities: Object.assign({}, state.entities, action.result.entities.surahs),
result: Object.assign({}, state.result, action.result.result)
entities: {
...state.entities,
...action.result.entities.surahs
},
};
case LOAD_FAIL:
console.log(action);
Expand Down