Skip to content
This repository has been archived by the owner on Jun 28, 2021. It is now read-only.

Commit

Permalink
fix Sentry issues:
Browse files Browse the repository at this point in the history
148215060
148224454
148214061
148215931
  • Loading branch information
thabti committed Aug 29, 2016
1 parent f852044 commit 67b932f
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 13 deletions.
8 changes: 6 additions & 2 deletions src/components/Audioplayer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ export class Audioplayer extends Component {
return buildOnClient(surah.id);
}

return this.handleAddFileListeners(currentFile);
if (currentFile) {
return this.handleAddFileListeners(currentFile);
}

return false;
}

componentWillReceiveProps(nextProps) {
Expand Down Expand Up @@ -247,7 +251,7 @@ export class Audioplayer extends Component {

handleAddFileListeners(file) {
const { update, currentTime } = this.props; // eslint-disable-line no-shadow
debug('component:Audioplayer', `Attaching listeners to ${file.src}`);
console.log('component:Audioplayer', `Attaching listeners to ${file.src}`);

// Preload file
file.setAttribute('preload', 'auto');
Expand Down
4 changes: 3 additions & 1 deletion src/containers/Surah/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,9 @@ class Surah extends Component {

if (ayahNum > (this.getLast() + 10) || ayahNum < this.getFirst()) {
// This is beyond lazy loading next page.
return actions.push.push(`/${surah.id}/${ayahNum}-${ayahNum + 10}`);
if (actions.push) {
return actions.push.push(`/${surah.id}/${ayahNum}-${ayahNum + 10}`);
}
}

return this.handleLazyLoadAyahs(() => setTimeout(() =>
Expand Down
33 changes: 23 additions & 10 deletions src/redux/modules/audioplayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,19 +152,32 @@ export default function reducer(state = initialState, action = {}) {
};
}
case PLAY: {
state.currentFile.play();
return {
...state,
isPlaying: true
};

if (state.currentFile) {
state.currentFile.play();
return {
...state,
isPlaying: true
};
}

return state;

}
case PAUSE: {
state.currentFile.pause();

return {
...state,
isPlaying: false
};
if (state.currentFile) {
state.currentFile.pause();

return {
...state,
isPlaying: false
};
}

return state;


}
case NEXT: {
const [surahId, ayahNum] = action.currentAyah.split(':');
Expand Down

0 comments on commit 67b932f

Please sign in to comment.