From 848289a9e54e099d8babad3365fd76e31213eeea Mon Sep 17 00:00:00 2001 From: Joachim Bauch Date: Mon, 10 Aug 2015 20:56:24 +0200 Subject: [PATCH] Log initialization result in service and use result directly from API. --- static/js/mediastream/api.js | 8 +------- static/js/services/endtoendencryption.js | 8 +++++--- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/static/js/mediastream/api.js b/static/js/mediastream/api.js index 945a8fcf..dac6ff2b 100644 --- a/static/js/mediastream/api.js +++ b/static/js/mediastream/api.js @@ -29,13 +29,7 @@ define(['jquery', 'underscore', 'ua-parser'], function($, _, uaparser) { this.sid = null; this.session = {}; this.connector = connector; - if (!endToEndEncryption.initialize(this)) { - console.warn("Encryption services failed to initialize"); - this.endToEndEncryption = null; - } else { - console.log("Encryption services initialized"); - this.endToEndEncryption = endToEndEncryption; - } + this.endToEndEncryption = endToEndEncryption.initialize(this); this.iids= 0; var ua = uaparser(); diff --git a/static/js/services/endtoendencryption.js b/static/js/services/endtoendencryption.js index b0d2a479..cb11e638 100644 --- a/static/js/services/endtoendencryption.js +++ b/static/js/services/endtoendencryption.js @@ -668,14 +668,16 @@ define([ var endToEndEncryptionApi = { "initialize": function(api) { if (endToEndEncryption) { - return true; + return endToEndEncryption; } endToEndEncryption = new EndToEndEncryption(api); if (!endToEndEncryption.isSupported()) { + console.warn("EndToEnd encryption services not supported"); endToEndEncryption = null; - return false; + return null; } - return true; + console.log("EndToEnd encryption services initialized"); + return endToEndEncryption; }, "encrypt": function(peer, type, message, callback) { if (!endToEndEncryption) {