mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1055747 - Fix Loop UI showcase for Chrome to avoid visual regressions, r=andrei.br92@gmail.com
This commit is contained in:
parent
dfae414b64
commit
6d4a32dbc5
@ -10,18 +10,20 @@ loop.Client = (function($) {
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// The expected properties to be returned from the POST /call-url/ request.
|
// The expected properties to be returned from the POST /call-url/ request.
|
||||||
const expectedCallUrlProperties = ["callUrl", "expiresAt"];
|
var expectedCallUrlProperties = ["callUrl", "expiresAt"];
|
||||||
|
|
||||||
// The expected properties to be returned from the GET /calls request.
|
// The expected properties to be returned from the GET /calls request.
|
||||||
const expectedCallProperties = ["calls"];
|
var expectedCallProperties = ["calls"];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loop server client.
|
* Loop server client.
|
||||||
*
|
*
|
||||||
* @param {Object} settings Settings object.
|
* @param {Object} settings Settings object.
|
||||||
*/
|
*/
|
||||||
function Client(settings = {}) {
|
function Client(settings) {
|
||||||
|
if (!settings) {
|
||||||
|
settings = {};
|
||||||
|
}
|
||||||
// allowing an |in| test rather than a more type || allows us to dependency
|
// allowing an |in| test rather than a more type || allows us to dependency
|
||||||
// inject a non-existent mozLoop
|
// inject a non-existent mozLoop
|
||||||
if ("mozLoop" in settings) {
|
if ("mozLoop" in settings) {
|
||||||
@ -108,7 +110,7 @@ loop.Client = (function($) {
|
|||||||
*/
|
*/
|
||||||
_requestCallUrlInternal: function(nickname, cb) {
|
_requestCallUrlInternal: function(nickname, cb) {
|
||||||
this.mozLoop.hawkRequest("/call-url/", "POST", {callerId: nickname},
|
this.mozLoop.hawkRequest("/call-url/", "POST", {callerId: nickname},
|
||||||
(error, responseText) => {
|
function (error, responseText) {
|
||||||
if (error) {
|
if (error) {
|
||||||
this._failureHandler(cb, error);
|
this._failureHandler(cb, error);
|
||||||
return;
|
return;
|
||||||
@ -124,7 +126,7 @@ loop.Client = (function($) {
|
|||||||
console.log("Error requesting call info", err);
|
console.log("Error requesting call info", err);
|
||||||
cb(err);
|
cb(err);
|
||||||
}
|
}
|
||||||
});
|
}.bind(this));
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -149,7 +151,7 @@ loop.Client = (function($) {
|
|||||||
|
|
||||||
_deleteCallUrlInternal: function(token, cb) {
|
_deleteCallUrlInternal: function(token, cb) {
|
||||||
this.mozLoop.hawkRequest("/call-url/" + token, "DELETE", null,
|
this.mozLoop.hawkRequest("/call-url/" + token, "DELETE", null,
|
||||||
(error, responseText) => {
|
function (error, responseText) {
|
||||||
if (error) {
|
if (error) {
|
||||||
this._failureHandler(cb, error);
|
this._failureHandler(cb, error);
|
||||||
return;
|
return;
|
||||||
@ -163,7 +165,7 @@ loop.Client = (function($) {
|
|||||||
console.log("Error deleting call info", err);
|
console.log("Error deleting call info", err);
|
||||||
cb(err);
|
cb(err);
|
||||||
}
|
}
|
||||||
});
|
}.bind(this));
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -207,7 +209,7 @@ loop.Client = (function($) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.mozLoop.hawkRequest("/calls?version=" + version, "GET", null,
|
this.mozLoop.hawkRequest("/calls?version=" + version, "GET", null,
|
||||||
(error, responseText) => {
|
function (error, responseText) {
|
||||||
if (error) {
|
if (error) {
|
||||||
this._failureHandler(cb, error);
|
this._failureHandler(cb, error);
|
||||||
return;
|
return;
|
||||||
@ -221,8 +223,8 @@ loop.Client = (function($) {
|
|||||||
console.log("Error requesting calls info", err);
|
console.log("Error requesting calls info", err);
|
||||||
cb(err);
|
cb(err);
|
||||||
}
|
}
|
||||||
});
|
}.bind(this));
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return Client;
|
return Client;
|
||||||
|
@ -49,10 +49,10 @@ loop.conversation = (function(OT, mozL10n) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_handleAccept: function(callType) {
|
_handleAccept: function(callType) {
|
||||||
return () => {
|
return function() {
|
||||||
this.props.model.set("selectedCallType", callType);
|
this.props.model.set("selectedCallType", callType);
|
||||||
this.props.model.trigger("accept");
|
this.props.model.trigger("accept");
|
||||||
};
|
}.bind(this);
|
||||||
},
|
},
|
||||||
|
|
||||||
_handleDecline: function() {
|
_handleDecline: function() {
|
||||||
@ -175,17 +175,17 @@ loop.conversation = (function(OT, mozL10n) {
|
|||||||
incoming: function(loopVersion) {
|
incoming: function(loopVersion) {
|
||||||
navigator.mozLoop.startAlerting();
|
navigator.mozLoop.startAlerting();
|
||||||
this._conversation.set({loopVersion: loopVersion});
|
this._conversation.set({loopVersion: loopVersion});
|
||||||
this._conversation.once("accept", () => {
|
this._conversation.once("accept", function() {
|
||||||
this.navigate("call/accept", {trigger: true});
|
this.navigate("call/accept", {trigger: true});
|
||||||
});
|
}.bind(this));
|
||||||
this._conversation.once("decline", () => {
|
this._conversation.once("decline", function() {
|
||||||
this.navigate("call/decline", {trigger: true});
|
this.navigate("call/decline", {trigger: true});
|
||||||
});
|
}.bind(this));
|
||||||
this._conversation.once("declineAndBlock", () => {
|
this._conversation.once("declineAndBlock", function() {
|
||||||
this.navigate("call/declineAndBlock", {trigger: true});
|
this.navigate("call/declineAndBlock", {trigger: true});
|
||||||
});
|
}.bind(this));
|
||||||
this._conversation.once("call:incoming", this.startCall, this);
|
this._conversation.once("call:incoming", this.startCall, this);
|
||||||
this._client.requestCallsInfo(loopVersion, (err, sessionData) => {
|
this._client.requestCallsInfo(loopVersion, function(err, sessionData) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error("Failed to get the sessionData", err);
|
console.error("Failed to get the sessionData", err);
|
||||||
// XXX Not the ideal response, but bug 1047410 will be replacing
|
// XXX Not the ideal response, but bug 1047410 will be replacing
|
||||||
@ -202,7 +202,7 @@ loop.conversation = (function(OT, mozL10n) {
|
|||||||
this._conversation.setIncomingSessionData(sessionData[0]);
|
this._conversation.setIncomingSessionData(sessionData[0]);
|
||||||
|
|
||||||
this._setupWebSocketAndCallView();
|
this._setupWebSocketAndCallView();
|
||||||
});
|
}.bind(this));
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -49,10 +49,10 @@ loop.conversation = (function(OT, mozL10n) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_handleAccept: function(callType) {
|
_handleAccept: function(callType) {
|
||||||
return () => {
|
return function() {
|
||||||
this.props.model.set("selectedCallType", callType);
|
this.props.model.set("selectedCallType", callType);
|
||||||
this.props.model.trigger("accept");
|
this.props.model.trigger("accept");
|
||||||
};
|
}.bind(this);
|
||||||
},
|
},
|
||||||
|
|
||||||
_handleDecline: function() {
|
_handleDecline: function() {
|
||||||
@ -175,17 +175,17 @@ loop.conversation = (function(OT, mozL10n) {
|
|||||||
incoming: function(loopVersion) {
|
incoming: function(loopVersion) {
|
||||||
navigator.mozLoop.startAlerting();
|
navigator.mozLoop.startAlerting();
|
||||||
this._conversation.set({loopVersion: loopVersion});
|
this._conversation.set({loopVersion: loopVersion});
|
||||||
this._conversation.once("accept", () => {
|
this._conversation.once("accept", function() {
|
||||||
this.navigate("call/accept", {trigger: true});
|
this.navigate("call/accept", {trigger: true});
|
||||||
});
|
}.bind(this));
|
||||||
this._conversation.once("decline", () => {
|
this._conversation.once("decline", function() {
|
||||||
this.navigate("call/decline", {trigger: true});
|
this.navigate("call/decline", {trigger: true});
|
||||||
});
|
}.bind(this));
|
||||||
this._conversation.once("declineAndBlock", () => {
|
this._conversation.once("declineAndBlock", function() {
|
||||||
this.navigate("call/declineAndBlock", {trigger: true});
|
this.navigate("call/declineAndBlock", {trigger: true});
|
||||||
});
|
}.bind(this));
|
||||||
this._conversation.once("call:incoming", this.startCall, this);
|
this._conversation.once("call:incoming", this.startCall, this);
|
||||||
this._client.requestCallsInfo(loopVersion, (err, sessionData) => {
|
this._client.requestCallsInfo(loopVersion, function(err, sessionData) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error("Failed to get the sessionData", err);
|
console.error("Failed to get the sessionData", err);
|
||||||
// XXX Not the ideal response, but bug 1047410 will be replacing
|
// XXX Not the ideal response, but bug 1047410 will be replacing
|
||||||
@ -202,7 +202,7 @@ loop.conversation = (function(OT, mozL10n) {
|
|||||||
this._conversation.setIncomingSessionData(sessionData[0]);
|
this._conversation.setIncomingSessionData(sessionData[0]);
|
||||||
|
|
||||||
this._setupWebSocketAndCallView();
|
this._setupWebSocketAndCallView();
|
||||||
});
|
}.bind(this));
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user