Bug 1088672 - Part 1. Rewrite Loop's incoming call handling in the flux style. Rename some views for better naming. r=mikedeboer

This commit is contained in:
Mark Banner 2015-03-12 14:01:37 +00:00
parent 4483998360
commit 02805dc9f1
6 changed files with 27 additions and 27 deletions

View File

@ -17,7 +17,7 @@ loop.conversation = (function(mozL10n) {
var sharedActions = loop.shared.actions;
var IncomingConversationView = loop.conversationViews.IncomingConversationView;
var OutgoingConversationView = loop.conversationViews.OutgoingConversationView;
var CallControllerView = loop.conversationViews.CallControllerView;
var CallIdentifierView = loop.conversationViews.CallIdentifierView;
var DesktopRoomConversationView = loop.roomViews.DesktopRoomConversationView;
var GenericFailureView = loop.conversationViews.GenericFailureView;
@ -61,7 +61,7 @@ loop.conversation = (function(mozL10n) {
));
}
case "outgoing": {
return (React.createElement(OutgoingConversationView, {
return (React.createElement(CallControllerView, {
dispatcher: this.props.dispatcher}
));
}

View File

@ -17,7 +17,7 @@ loop.conversation = (function(mozL10n) {
var sharedActions = loop.shared.actions;
var IncomingConversationView = loop.conversationViews.IncomingConversationView;
var OutgoingConversationView = loop.conversationViews.OutgoingConversationView;
var CallControllerView = loop.conversationViews.CallControllerView;
var CallIdentifierView = loop.conversationViews.CallIdentifierView;
var DesktopRoomConversationView = loop.roomViews.DesktopRoomConversationView;
var GenericFailureView = loop.conversationViews.GenericFailureView;
@ -61,7 +61,7 @@ loop.conversation = (function(mozL10n) {
/>);
}
case "outgoing": {
return (<OutgoingConversationView
return (<CallControllerView
dispatcher={this.props.dispatcher}
/>);
}

View File

@ -140,7 +140,7 @@ loop.conversationViews = (function(mozL10n) {
// Matches strings of the form "<nonspaces>@<nonspaces>" or "+<digits>"
var EMAIL_OR_PHONE_RE = /^(:?\S+@\S+|\+\d+)$/;
var IncomingCallView = React.createClass({displayName: "IncomingCallView",
var AcceptCallView = React.createClass({displayName: "AcceptCallView",
mixins: [sharedMixins.DropdownMenuMixin, sharedMixins.AudioMixin],
propTypes: {
@ -397,7 +397,7 @@ loop.conversationViews = (function(mozL10n) {
document.title = mozL10n.get("incoming_call_title2");
return (
React.createElement(IncomingCallView, {
React.createElement(AcceptCallView, {
model: this.props.conversation,
video: this.props.conversation.hasVideoStream("incoming")}
)
@ -924,7 +924,7 @@ loop.conversationViews = (function(mozL10n) {
* Master View Controller for outgoing calls. This manages
* the different views that need displaying.
*/
var OutgoingConversationView = React.createClass({displayName: "OutgoingConversationView",
var CallControllerView = React.createClass({displayName: "CallControllerView",
mixins: [
sharedMixins.AudioMixin,
loop.store.StoreMixin("conversationStore"),
@ -1011,10 +1011,10 @@ loop.conversationViews = (function(mozL10n) {
CallFailedView: CallFailedView,
_getContactDisplayName: _getContactDisplayName,
GenericFailureView: GenericFailureView,
IncomingCallView: IncomingCallView,
AcceptCallView: AcceptCallView,
IncomingConversationView: IncomingConversationView,
OngoingConversationView: OngoingConversationView,
OutgoingConversationView: OutgoingConversationView
CallControllerView: CallControllerView
};
})(document.mozL10n || navigator.mozL10n);

View File

@ -140,7 +140,7 @@ loop.conversationViews = (function(mozL10n) {
// Matches strings of the form "<nonspaces>@<nonspaces>" or "+<digits>"
var EMAIL_OR_PHONE_RE = /^(:?\S+@\S+|\+\d+)$/;
var IncomingCallView = React.createClass({
var AcceptCallView = React.createClass({
mixins: [sharedMixins.DropdownMenuMixin, sharedMixins.AudioMixin],
propTypes: {
@ -397,7 +397,7 @@ loop.conversationViews = (function(mozL10n) {
document.title = mozL10n.get("incoming_call_title2");
return (
<IncomingCallView
<AcceptCallView
model={this.props.conversation}
video={this.props.conversation.hasVideoStream("incoming")}
/>
@ -924,7 +924,7 @@ loop.conversationViews = (function(mozL10n) {
* Master View Controller for outgoing calls. This manages
* the different views that need displaying.
*/
var OutgoingConversationView = React.createClass({
var CallControllerView = React.createClass({
mixins: [
sharedMixins.AudioMixin,
loop.store.StoreMixin("conversationStore"),
@ -1011,10 +1011,10 @@ loop.conversationViews = (function(mozL10n) {
CallFailedView: CallFailedView,
_getContactDisplayName: _getContactDisplayName,
GenericFailureView: GenericFailureView,
IncomingCallView: IncomingCallView,
AcceptCallView: AcceptCallView,
IncomingConversationView: IncomingConversationView,
OngoingConversationView: OngoingConversationView,
OutgoingConversationView: OutgoingConversationView
CallControllerView: CallControllerView
};
})(document.mozL10n || navigator.mozL10n);

View File

@ -578,12 +578,12 @@ describe("loop.conversationViews", function () {
});
});
describe("OutgoingConversationView", function() {
describe("CallControllerView", function() {
var store, feedbackStore;
function mountTestComponent() {
return TestUtils.renderIntoDocument(
React.createElement(loop.conversationViews.OutgoingConversationView, {
React.createElement(loop.conversationViews.CallControllerView, {
dispatcher: dispatcher,
}));
}
@ -756,7 +756,7 @@ describe("loop.conversationViews", function () {
windowData: fakeSessionData
});
stubComponent(loop.conversationViews, "IncomingCallView");
stubComponent(loop.conversationViews, "AcceptCallView");
stubComponent(sharedView, "ConversationView");
});
@ -1206,7 +1206,7 @@ describe("loop.conversationViews", function () {
});
});
describe("IncomingCallView", function() {
describe("AcceptCallView", function() {
var view, model, fakeAudio;
beforeEach(function() {
@ -1225,7 +1225,7 @@ describe("loop.conversationViews", function () {
sandbox.stub(window, "Audio").returns(fakeAudio);
view = TestUtils.renderIntoDocument(
React.createElement(loop.conversationViews.IncomingCallView, {
React.createElement(loop.conversationViews.AcceptCallView, {
model: model,
video: true
}));
@ -1234,7 +1234,7 @@ describe("loop.conversationViews", function () {
describe("default answer mode", function() {
it("should display video as primary answer mode", function() {
view = TestUtils.renderIntoDocument(
React.createElement(loop.conversationViews.IncomingCallView, {
React.createElement(loop.conversationViews.AcceptCallView, {
model: model,
video: true
}));
@ -1246,7 +1246,7 @@ describe("loop.conversationViews", function () {
it("should display audio as primary answer mode", function() {
view = TestUtils.renderIntoDocument(
React.createElement(loop.conversationViews.IncomingCallView, {
React.createElement(loop.conversationViews.AcceptCallView, {
model: model,
video: false
}));
@ -1258,7 +1258,7 @@ describe("loop.conversationViews", function () {
it("should accept call with video", function() {
view = TestUtils.renderIntoDocument(
React.createElement(loop.conversationViews.IncomingCallView, {
React.createElement(loop.conversationViews.AcceptCallView, {
model: model,
video: true
}));
@ -1275,7 +1275,7 @@ describe("loop.conversationViews", function () {
it("should accept call with audio", function() {
view = TestUtils.renderIntoDocument(
React.createElement(loop.conversationViews.IncomingCallView, {
React.createElement(loop.conversationViews.AcceptCallView, {
model: model,
video: false
}));
@ -1293,7 +1293,7 @@ describe("loop.conversationViews", function () {
it("should accept call with video when clicking on secondary btn",
function() {
view = TestUtils.renderIntoDocument(
React.createElement(loop.conversationViews.IncomingCallView, {
React.createElement(loop.conversationViews.AcceptCallView, {
model: model,
video: false
}));
@ -1311,7 +1311,7 @@ describe("loop.conversationViews", function () {
it("should accept call with audio when clicking on secondary btn",
function() {
view = TestUtils.renderIntoDocument(
React.createElement(loop.conversationViews.IncomingCallView, {
React.createElement(loop.conversationViews.AcceptCallView, {
model: model,
video: true
}));

View File

@ -186,13 +186,13 @@ describe("loop.conversation", function() {
document.title = oldTitle;
});
it("should display the OutgoingConversationView for outgoing calls", function() {
it("should display the CallControllerView for outgoing calls", function() {
conversationAppStore.setStoreState({windowType: "outgoing"});
ccView = mountTestComponent();
TestUtils.findRenderedComponentWithType(ccView,
loop.conversationViews.OutgoingConversationView);
loop.conversationViews.CallControllerView);
});
it("should display the IncomingConversationView for incoming calls", function() {