Bug 1079941: implement LoopContacts.search to allow searching for contacts by query and use that to find out if a contact who's trying to call you is blocked. r=abr

This commit is contained in:
Mike de Boer
2014-10-16 16:35:10 +02:00
parent 70e8077ae5
commit e1dde85cff
5 changed files with 195 additions and 29 deletions

View File

@@ -86,12 +86,15 @@ loop.contacts = (function(_, mozL10n) {
return (
React.DOM.ul({className: cx({ "dropdown-menu": true,
"dropdown-menu-up": this.state.openDirUp })},
React.DOM.li({className: cx({ "dropdown-menu-item": true }),
onClick: this.onItemClick, 'data-action': "video-call"},
React.DOM.li({className: cx({ "dropdown-menu-item": true,
"disabled": this.props.blocked }),
onClick: this.onItemClick,
'data-action': "video-call"},
React.DOM.i({className: "icon icon-video-call"}),
mozL10n.get("video_call_menu_button")
),
React.DOM.li({className: cx({ "dropdown-menu-item": true }),
React.DOM.li({className: cx({ "dropdown-menu-item": true,
"disabled": this.props.blocked }),
onClick: this.onItemClick, 'data-action': "audio-call"},
React.DOM.i({className: "icon icon-audio-call"}),
mozL10n.get("audio_call_menu_button")
@@ -388,10 +391,14 @@ loop.contacts = (function(_, mozL10n) {
});
break;
case "video-call":
navigator.mozLoop.startDirectCall(contact, CALL_TYPES.AUDIO_VIDEO);
if (!contact.blocked) {
navigator.mozLoop.startDirectCall(contact, CALL_TYPES.AUDIO_VIDEO);
}
break;
case "audio-call":
navigator.mozLoop.startDirectCall(contact, CALL_TYPES.AUDIO_ONLY);
if (!contact.blocked) {
navigator.mozLoop.startDirectCall(contact, CALL_TYPES.AUDIO_ONLY);
}
break;
default:
console.error("Unrecognized action: " + actionName);