Bug 1088672 - Part 5. Rewrite Loop's incoming call handling in the flux style. Correct the Call failed view to show only what's needed for incoming calls. r=mikedeboer

This commit is contained in:
Mark Banner 2015-03-12 14:01:38 +00:00
parent 991f1d95d0
commit bcc90954ad
2 changed files with 57 additions and 9 deletions

View File

@ -746,6 +746,7 @@ loop.conversationViews = (function(mozL10n) {
contact: React.PropTypes.object.isRequired,
// This is used by the UI showcase.
emailLinkError: React.PropTypes.bool,
outgoing: React.PropTypes.bool.isRequired
},
getInitialState: function() {
@ -827,13 +828,35 @@ loop.conversationViews = (function(mozL10n) {
}));
},
_renderMessage: function() {
if (this.props.outgoing) {
return (React.createElement("p", {className: "btn-label"}, mozL10n.get("generic_failure_with_reason2")));
}
return null;
},
render: function() {
var cx = React.addons.classSet;
var retryClasses = cx({
btn: true,
"btn-info": true,
"btn-retry": true,
hide: !this.props.outgoing
});
var emailClasses = cx({
btn: true,
"btn-info": true,
"btn-email": true,
hide: !this.props.outgoing
});
return (
React.createElement("div", {className: "call-window"},
React.createElement("h2", null, this._getTitleMessage() ),
React.createElement("p", {className: "btn-label"}, mozL10n.get("generic_failure_with_reason2")),
this._renderMessage(),
this._renderError(),
React.createElement("div", {className: "btn-group call-action-group"},
@ -841,11 +864,11 @@ loop.conversationViews = (function(mozL10n) {
onClick: this.cancelCall},
mozL10n.get("cancel_button")
),
React.createElement("button", {className: "btn btn-info btn-retry",
React.createElement("button", {className: retryClasses,
onClick: this.retryCall},
mozL10n.get("retry_call_button")
),
React.createElement("button", {className: "btn btn-info btn-email",
React.createElement("button", {className: emailClasses,
onClick: this.emailLink,
disabled: this.state.emailLinkButtonDisabled},
mozL10n.get("share_button2")
@ -1018,7 +1041,8 @@ loop.conversationViews = (function(mozL10n) {
case CALL_STATES.TERMINATED: {
return (React.createElement(CallFailedView, {
dispatcher: this.props.dispatcher,
contact: this.state.contact}
contact: this.state.contact,
outgoing: this.state.outgoing}
));
}
case CALL_STATES.ONGOING: {

View File

@ -746,6 +746,7 @@ loop.conversationViews = (function(mozL10n) {
contact: React.PropTypes.object.isRequired,
// This is used by the UI showcase.
emailLinkError: React.PropTypes.bool,
outgoing: React.PropTypes.bool.isRequired
},
getInitialState: function() {
@ -827,13 +828,35 @@ loop.conversationViews = (function(mozL10n) {
}));
},
_renderMessage: function() {
if (this.props.outgoing) {
return (<p className="btn-label">{mozL10n.get("generic_failure_with_reason2")}</p>);
}
return null;
},
render: function() {
var cx = React.addons.classSet;
var retryClasses = cx({
btn: true,
"btn-info": true,
"btn-retry": true,
hide: !this.props.outgoing
});
var emailClasses = cx({
btn: true,
"btn-info": true,
"btn-email": true,
hide: !this.props.outgoing
});
return (
<div className="call-window">
<h2>{ this._getTitleMessage() }</h2>
<p className="btn-label">{mozL10n.get("generic_failure_with_reason2")}</p>
{this._renderMessage()}
{this._renderError()}
<div className="btn-group call-action-group">
@ -841,11 +864,11 @@ loop.conversationViews = (function(mozL10n) {
onClick={this.cancelCall}>
{mozL10n.get("cancel_button")}
</button>
<button className="btn btn-info btn-retry"
<button className={retryClasses}
onClick={this.retryCall}>
{mozL10n.get("retry_call_button")}
</button>
<button className="btn btn-info btn-email"
<button className={emailClasses}
onClick={this.emailLink}
disabled={this.state.emailLinkButtonDisabled}>
{mozL10n.get("share_button2")}
@ -1019,6 +1042,7 @@ loop.conversationViews = (function(mozL10n) {
return (<CallFailedView
dispatcher={this.props.dispatcher}
contact={this.state.contact}
outgoing={this.state.outgoing}
/>);
}
case CALL_STATES.ONGOING: {