Bug 1074702 - Part 1 Implement join/refresh/leave with the Loop server on the standalone UI. r=nperriault
This commit is contained in:
@@ -273,6 +273,12 @@ loop.shared.actions = (function() {
|
||||
sessionToken: String,
|
||||
sessionId: String,
|
||||
expires: Number
|
||||
}),
|
||||
|
||||
/**
|
||||
* Used to indicate the user wishes to leave the room.
|
||||
*/
|
||||
LeaveRoom: Action.define("leaveRoom", {
|
||||
})
|
||||
};
|
||||
})();
|
||||
|
||||
@@ -52,10 +52,12 @@ loop.store.ActiveRoomStore = (function() {
|
||||
this._dispatcher.register(this, [
|
||||
"roomFailure",
|
||||
"setupWindowData",
|
||||
"fetchServerData",
|
||||
"updateRoomInfo",
|
||||
"joinRoom",
|
||||
"joinedRoom",
|
||||
"windowUnload"
|
||||
"windowUnload",
|
||||
"leaveRoom"
|
||||
]);
|
||||
|
||||
/**
|
||||
@@ -151,6 +153,26 @@ loop.store.ActiveRoomStore = (function() {
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
/**
|
||||
* Execute fetchServerData event action from the dispatcher. Although
|
||||
* this is to fetch the server data - for rooms on the standalone client,
|
||||
* we don't actually need to get any data. Therefore we just save the
|
||||
* data that is given to us for when the user chooses to join the room.
|
||||
*
|
||||
* @param {sharedActions.FetchServerData} actionData
|
||||
*/
|
||||
fetchServerData: function(actionData) {
|
||||
if (actionData.windowType !== "room") {
|
||||
// Nothing for us to do here, leave it to other stores.
|
||||
return;
|
||||
}
|
||||
|
||||
this.setStoreState({
|
||||
roomToken: actionData.token,
|
||||
roomState: ROOM_STATES.READY
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Handles the updateRoomInfo action. Updates the room data and
|
||||
* sets the state to `READY`.
|
||||
@@ -213,6 +235,13 @@ loop.store.ActiveRoomStore = (function() {
|
||||
this._leaveRoom();
|
||||
},
|
||||
|
||||
/**
|
||||
* Handles a room being left.
|
||||
*/
|
||||
leaveRoom: function() {
|
||||
this._leaveRoom();
|
||||
},
|
||||
|
||||
/**
|
||||
* Handles setting of the refresh timeout callback.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user