Bug 1047410 - Desktop client should display Call Failed if an incoming call fails during set-up. r=nperriault

This commit is contained in:
Mark Banner 2014-10-24 15:01:20 +01:00
parent cb2a1c8330
commit b2edf9d9a8
3 changed files with 72 additions and 8 deletions

View File

@ -178,6 +178,35 @@ loop.conversation = (function(mozL10n) {
}
});
/**
* Incoming Call failed view. Displayed when a call fails.
*
* XXX Based on CallFailedView, but built specially until we flux-ify the
* incoming call views (bug 1088672).
*/
var IncomingCallFailedView = React.createClass({displayName: 'IncomingCallFailedView',
propTypes: {
cancelCall: React.PropTypes.func.isRequired
},
render: function() {
document.title = mozL10n.get("generic_failure_title");
return (
React.DOM.div({className: "call-window"},
React.DOM.h2(null, mozL10n.get("generic_failure_title")),
React.DOM.div({className: "btn-group call-action-group"},
React.DOM.button({className: "btn btn-cancel",
onClick: this.props.cancelCall},
mozL10n.get("cancel_button")
)
)
)
);
}
});
/**
* This view manages the incoming conversation views - from
* call initiation through to the actual conversation and call end.
@ -254,11 +283,13 @@ loop.conversation = (function(mozL10n) {
case "end": {
// XXX To be handled with the "failed" view state when bug 1047410 lands
if (this.state.callFailed) {
document.title = mozL10n.get("generic_failure_title");
} else {
document.title = mozL10n.get("conversation_has_ended");
return IncomingCallFailedView({
cancelCall: this.closeWindow.bind(this)}
)
}
document.title = mozL10n.get("conversation_has_ended");
var feebackAPIBaseUrl = navigator.mozLoop.getLoopCharPref(
"feedback.baseUrl");
@ -649,6 +680,7 @@ loop.conversation = (function(mozL10n) {
AppControllerView: AppControllerView,
IncomingConversationView: IncomingConversationView,
IncomingCallView: IncomingCallView,
IncomingCallFailedView: IncomingCallFailedView,
init: init
};
})(document.mozL10n);

View File

@ -178,6 +178,35 @@ loop.conversation = (function(mozL10n) {
}
});
/**
* Incoming Call failed view. Displayed when a call fails.
*
* XXX Based on CallFailedView, but built specially until we flux-ify the
* incoming call views (bug 1088672).
*/
var IncomingCallFailedView = React.createClass({
propTypes: {
cancelCall: React.PropTypes.func.isRequired
},
render: function() {
document.title = mozL10n.get("generic_failure_title");
return (
<div className="call-window">
<h2>{mozL10n.get("generic_failure_title")}</h2>
<div className="btn-group call-action-group">
<button className="btn btn-cancel"
onClick={this.props.cancelCall}>
{mozL10n.get("cancel_button")}
</button>
</div>
</div>
);
}
});
/**
* This view manages the incoming conversation views - from
* call initiation through to the actual conversation and call end.
@ -254,11 +283,13 @@ loop.conversation = (function(mozL10n) {
case "end": {
// XXX To be handled with the "failed" view state when bug 1047410 lands
if (this.state.callFailed) {
document.title = mozL10n.get("generic_failure_title");
} else {
document.title = mozL10n.get("conversation_has_ended");
return <IncomingCallFailedView
cancelCall={this.closeWindow.bind(this)}
/>
}
document.title = mozL10n.get("conversation_has_ended");
var feebackAPIBaseUrl = navigator.mozLoop.getLoopCharPref(
"feedback.baseUrl");
@ -649,6 +680,7 @@ loop.conversation = (function(mozL10n) {
AppControllerView: AppControllerView,
IncomingConversationView: IncomingConversationView,
IncomingCallView: IncomingCallView,
IncomingCallFailedView: IncomingCallFailedView,
init: init
};
})(document.mozL10n);

View File

@ -693,12 +693,12 @@ describe("loop.conversation", function() {
});
describe("session:network-disconnected", function() {
it("should navigate to call/feedback when network disconnects",
it("should navigate to call failed when network disconnects",
function() {
conversation.trigger("session:network-disconnected");
TestUtils.findRenderedComponentWithType(icView,
sharedView.FeedbackView);
loop.conversation.IncomingCallFailedView);
});
it("should update the conversation window toolbar title",