Bug 1102170 - Share a room url by email when Loop direct call fails. r=Standard8
This commit is contained in:
@@ -76,10 +76,12 @@ loop.shared.actions = (function() {
|
||||
}),
|
||||
|
||||
/**
|
||||
* Fetch a new call url from the server, intended to be sent over email when
|
||||
* Fetch a new room url from the server, intended to be sent over email when
|
||||
* a contact can't be reached.
|
||||
*/
|
||||
FetchEmailLink: Action.define("fetchEmailLink", {
|
||||
FetchRoomEmailLink: Action.define("fetchRoomEmailLink", {
|
||||
roomOwner: String,
|
||||
roomName: String
|
||||
}),
|
||||
|
||||
/**
|
||||
|
||||
@@ -210,7 +210,7 @@ loop.store = loop.store || {};
|
||||
"retryCall",
|
||||
"mediaConnected",
|
||||
"setMute",
|
||||
"fetchEmailLink"
|
||||
"fetchRoomEmailLink"
|
||||
]);
|
||||
|
||||
this.setStoreState({
|
||||
@@ -323,18 +323,21 @@ loop.store = loop.store || {};
|
||||
},
|
||||
|
||||
/**
|
||||
* Fetches a new call URL intended to be sent over email when a contact
|
||||
* Fetches a new room URL intended to be sent over email when a contact
|
||||
* can't be reached.
|
||||
*/
|
||||
fetchEmailLink: function() {
|
||||
// XXX This is an empty string as a conversation identifier. Bug 1015938 implements
|
||||
// a user-set string.
|
||||
this.client.requestCallUrl("", function(err, callUrlData) {
|
||||
fetchRoomEmailLink: function(actionData) {
|
||||
this.mozLoop.rooms.create({
|
||||
roomName: actionData.roomName,
|
||||
roomOwner: actionData.roomOwner,
|
||||
maxSize: loop.store.MAX_ROOM_CREATION_SIZE,
|
||||
expiresIn: loop.store.DEFAULT_EXPIRES_IN
|
||||
}, function(err, createdRoomData) {
|
||||
if (err) {
|
||||
this.trigger("error:emailLink");
|
||||
return;
|
||||
}
|
||||
this.setStoreState({"emailLink": callUrlData.callUrl});
|
||||
this.setStoreState({"emailLink": createdRoomData.roomUrl});
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
|
||||
@@ -16,6 +16,20 @@ loop.store = loop.store || {};
|
||||
*/
|
||||
var sharedActions = loop.shared.actions;
|
||||
|
||||
/**
|
||||
* Maximum size given to createRoom; only 2 is supported (and is
|
||||
* always passed) because that's what the user-experience is currently
|
||||
* designed and tested to handle.
|
||||
* @type {Number}
|
||||
*/
|
||||
var MAX_ROOM_CREATION_SIZE = loop.store.MAX_ROOM_CREATION_SIZE = 2;
|
||||
|
||||
/**
|
||||
* The number of hours for which the room will exist - default 8 weeks
|
||||
* @type {Number}
|
||||
*/
|
||||
var DEFAULT_EXPIRES_IN = loop.store.DEFAULT_EXPIRES_IN = 24 * 7 * 8;
|
||||
|
||||
/**
|
||||
* Room validation schema. See validate.js.
|
||||
* @type {Object}
|
||||
@@ -61,13 +75,13 @@ loop.store = loop.store || {};
|
||||
* designed and tested to handle.
|
||||
* @type {Number}
|
||||
*/
|
||||
maxRoomCreationSize: 2,
|
||||
maxRoomCreationSize: MAX_ROOM_CREATION_SIZE,
|
||||
|
||||
/**
|
||||
* The number of hours for which the room will exist - default 8 weeks
|
||||
* @type {Number}
|
||||
*/
|
||||
defaultExpiresIn: 24 * 7 * 8,
|
||||
defaultExpiresIn: DEFAULT_EXPIRES_IN,
|
||||
|
||||
/**
|
||||
* Registered actions.
|
||||
|
||||
Reference in New Issue
Block a user