Bug 1011472 - Add audio alert for incoming call r=florian,standard8

This commit is contained in:
Adam Roach [:abr]
2014-06-26 18:55:03 -05:00
parent c809ffde16
commit c7c126a64c
6 changed files with 120 additions and 8 deletions

View File

@@ -53,8 +53,7 @@ loop.conversation = (function(OT, mozL10n) {
*/
handleDecline: function(event) {
event.preventDefault();
// XXX For now, we just close the window.
window.close();
this.model.trigger("decline");
}
});
@@ -95,6 +94,7 @@ loop.conversation = (function(OT, mozL10n) {
routes: {
"incoming/:version": "incoming",
"call/accept": "accept",
"call/decline": "decline",
"call/ongoing": "conversation",
"call/ended": "ended"
},
@@ -120,10 +120,14 @@ loop.conversation = (function(OT, mozL10n) {
* by the router from the URL.
*/
incoming: function(loopVersion) {
window.navigator.mozLoop.startAlerting();
this._conversation.set({loopVersion: loopVersion});
this._conversation.once("accept", function() {
this.navigate("call/accept", {trigger: true});
}.bind(this));
this._conversation.once("decline", function() {
this.navigate("call/decline", {trigger: true});
}.bind(this));
this.loadView(new IncomingCallView({model: this._conversation}));
},
@@ -131,12 +135,22 @@ loop.conversation = (function(OT, mozL10n) {
* Accepts an incoming call.
*/
accept: function() {
window.navigator.mozLoop.stopAlerting();
this._conversation.initiate({
baseServerUrl: window.navigator.mozLoop.serverUrl,
outgoing: false
});
},
/**
* Declines an incoming call.
*/
decline: function() {
window.navigator.mozLoop.stopAlerting();
// XXX For now, we just close the window
window.close();
},
/**
* conversation is the route when the conversation is active. The start
* route should be navigated to first.