Adds confirmation dialog when closing shared video.

This commit is contained in:
damencho 2016-03-18 17:04:13 -05:00
parent a1ac18a632
commit ba01733c4f
2 changed files with 28 additions and 1 deletions

View File

@ -163,6 +163,8 @@
"Remove": "Remove",
"shareVideoTitle": "Share a video",
"shareVideoLinkError": "Please provide a correct youtube link.",
"removeSharedVideoTitle": "Remove shared video",
"removeSharedVideoMsg": "Are you sure you would like to remove your shared video?",
"WaitingForHost": "Waiting for the host ...",
"WaitForHostMsg": "The conference <b>__room__ </b> has not yet started. If you are the host then please authenticate. Otherwise, please wait for the host to arrive.",
"IamHost": "I am the host",

View File

@ -43,7 +43,8 @@ export default class SharedVideoManager {
return;
}
this.emitter.emit(UIEvents.UPDATE_SHARED_VIDEO, null, 'stop');
proposeToClose().then(() =>
this.emitter.emit(UIEvents.UPDATE_SHARED_VIDEO, null, 'stop'));
}
/**
@ -424,6 +425,30 @@ function getYoutubeLink(url) {
return (url.match(p)) ? RegExp.$1 : false;
}
/**
* Ask user if he want to close shared video.
*/
function proposeToClose() {
return new Promise(function (resolve, reject) {
messageHandler.openTwoButtonDialog(
"dialog.removeSharedVideoTitle",
null,
"dialog.removeSharedVideoMsg",
null,
false,
"dialog.Remove",
function(e,v,m,f) {
if (v) {
resolve();
} else {
reject();
}
}
);
});
}
/**
* Ask user for shared video url to share with others.
* Dialog validates client input to allow only youtube urls.