From 66047d92916ce749e20fc09eef0163700c5697eb Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Thu, 23 Jan 2014 11:11:56 -0800 Subject: [PATCH] Experimental features --- clientapp/helpers/xmppEventHandlers.js | 1 + clientapp/models/state.js | 13 ++++++++++++- clientapp/views/main.js | 3 +++ package.json | 4 ++-- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/clientapp/helpers/xmppEventHandlers.js b/clientapp/helpers/xmppEventHandlers.js index 2172f5f..ed7bb6e 100644 --- a/clientapp/helpers/xmppEventHandlers.js +++ b/clientapp/helpers/xmppEventHandlers.js @@ -109,6 +109,7 @@ module.exports = function (client, app) { me.jid = jid; app.state.connected = true; + window.readyForDeviceID = true; client.getRoster(function (err, resp) { resp = resp.toJSON(); diff --git a/clientapp/models/state.js b/clientapp/models/state.js index 907ac18..9fec57a 100644 --- a/clientapp/models/state.js +++ b/clientapp/models/state.js @@ -28,6 +28,10 @@ module.exports = HumanModel.define({ self.cacheStatus = state; }); + document.addEventListener('deviceid', function (event) { + self.deviceID = event.deviceid; + }); + this.markActive(); }, session: { @@ -41,7 +45,8 @@ module.exports = HumanModel.define({ badge: 'string', pageTitle: 'string', hasActiveCall: ['boolean', false, false], - cacheStatus: 'string' + cacheStatus: 'string', + deviceID: 'string' }, derived: { title: { @@ -53,6 +58,12 @@ module.exports = HumanModel.define({ } return base; } + }, + deviceIDReady: { + deps: ['connected', 'deviceID'], + fn: function () { + return (this.connected && this.deviceID); + } } }, markActive: function () { diff --git a/clientapp/views/main.js b/clientapp/views/main.js index 8df7302..5d595d5 100644 --- a/clientapp/views/main.js +++ b/clientapp/views/main.js @@ -13,6 +13,9 @@ module.exports = HumanView.extend({ initialize: function () { this.listenTo(app.state, 'change:title', this.handleTitle); app.desktop.updateBadge(''); + app.state.on('change:deviceID', function () { + console.log('DEVICE ID>>>', app.state.deviceID); + }); }, events: { 'click a[href]': 'handleLinkClick', diff --git a/package.json b/package.json index e135983..54fb66d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "otalk.im", - "version": "0.0.14", + "version": "0.0.15", "description": "Otalk: WebRTC Enabled XMPP Client, in the Browser", "repository": { "type": "git", @@ -27,7 +27,7 @@ "oembed": "0.1.0", "semi-static": "0.0.4", "sound-effect-manager": "0.0.5", - "stanza.io": "3.0.4", + "stanza.io": "3.0.5", "staydown": "1.0.3", "templatizer": "0.1.2", "underscore": "1.5.1",