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

Commit

Permalink
Fixes #1
Browse files Browse the repository at this point in the history
  • Loading branch information
paullewis committed May 18, 2015
1 parent ab17be3 commit 0b0d011
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Voice Memos",
"version": "0.1.22",
"version": "0.1.23",
"private": true,
"engines": {
"node": ">=0.10.0"
Expand Down
17 changes: 17 additions & 0 deletions src/scripts/controller/RecordController.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import Controller from './Controller';
import MemoModel from '../model/MemoModel';
import PubSubInstance from '../libs/PubSub';
import RouterInstance from '../libs/Router';
import DialogInstance from '../libs/Dialog';

export default class RecordController extends Controller {

Expand Down Expand Up @@ -271,6 +272,22 @@ export default class RecordController extends Controller {
// }
});

this.recorder.addEventListener('streamError', () => {

DialogInstance()
.then(dialog => {

var hideCancelButton = true;

return dialog.show(
'Booooo!',
'There is a problem getting access to the microphone.',
hideCancelButton);

})
.catch( () => {});

});
}

stopRecording () {
Expand Down
7 changes: 6 additions & 1 deletion src/scripts/libs/Dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,17 @@ class Dialog {
this.okayButton = this.view.querySelector('.js-okay');
}

show (title, message) {
show (title, message, hideCancel) {

this.title.textContent = title;
this.message.textContent = message;
this.view.classList.add('dialog-view--visible');

if (hideCancel)
this.cancelButton.classList.add('hidden');
else
this.cancelButton.classList.remove('hidden');

return new Promise((resolve, reject) => {

var removeEventListenersAndHide = () => {
Expand Down

0 comments on commit 0b0d011

Please sign in to comment.