diff --git a/README.md b/README.md index 36e11a0f..145913f7 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ and [icons](https://google.github.io/material-design-icons/#icon-font-for-the-we This is work in progress. Bugs are expected. The app was tested in the latest Chrome & Firefox only. -Try it (possibly newer or older version) live at https://api.tinode.co/x/example-react-js/. Login as one of `alice`, `bob`, `carol`, `dave`, `frank`. Password is `123`, e.g. password for `alice` is `alice123`. You can discover other users by email or phone by prefixing them with `email:` or `tel:` respectively. Emails are `@example.com`, e.g. `alice@example.com`, phones are `17025550001` through `17025550009`. The demo is reset every night at 2:15 am Pacific time. +Try possibly newer or older version live at https://api.tinode.co/x/example-react-js/. Login as one of `alice`, `bob`, `carol`, `dave`, `frank`. Password is `123`, e.g. password for `alice` is `alice123`. You can discover other users by email or phone by prefixing them with `email:` or `tel:` respectively. Emails are `@example.com`, e.g. `alice@example.com`, phones are `17025550001` through `17025550009`. The demo is reset every night at 2:15am Pacific time. License: [Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0) @@ -20,7 +20,7 @@ Background pattern from http://subtlepatterns.com/, commercial and non-commercia * Cannot delete messages. * No indication of chat status (muted, blocked, etc.). * Browser push notifications are missing. -* No encryption. +* No end-to-end encryption. * Editing chat permissions is incomplete. ## Responsive design diff --git a/img/logo32x32.png b/img/logo32x32.png index 98636712..cd4d256b 100644 Binary files a/img/logo32x32.png and b/img/logo32x32.png differ diff --git a/index.html b/index.html index ec4501f0..9b7cfbdf 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ Tinode example: chat web application in react.js - + @@ -75,6 +75,20 @@ 'data:image/' + photo.type + ';base64,' + photo.data : null; } + // Make shortcut icon appear with a green dot. + function updateFavicon(on) { + var oldIcon = document.getElementById("shortcut-icon"); + if (oldIcon) { + var head = document.head || document.getElementsByTagName('head')[0]; + var newIcon = document.createElement('link'); + newIcon.type = "image/png"; + newIcon.id = "shortcut-icon"; + newIcon.rel = "shortcut icon"; + newIcon.href = "img/logo32x32" + (on ? 'a' : '') + ".png"; + head.removeChild(oldIcon); + head.appendChild(newIcon); + } + } // Get 32 bit integer hash value for a string. Ideally it should produce the same value // as Java's String#hash(). function stringHash(value) { @@ -1067,7 +1081,6 @@ this.props.state === 'contacts' ? : @@ -1355,11 +1368,15 @@ prepareContactList: function() { var contacts = []; + var totalUnread = 0; Tinode.getMeTopic().contacts(function(c) { c.unread = c.seq - (c.read > 0 ? c.read : 0); + totalUnread += c.unread; contacts.push(c); }, this); + updateFavicon(totalUnread > 0); + return contacts; }, @@ -2800,7 +2817,6 @@ liveConnection: navigator.onLine, topicSelected: '', loginDisabled: false, - subscriptions: {}, displayMobile: (window.innerWidth <= MEDIA_BREAKPOINT), showInfoPanel: false, infoPanelShowMembers: false, @@ -3272,7 +3288,6 @@ state={this.state.sidePanelSelected} title={this.state.sidePanelTitle} avatar={this.state.sidePanelAvatar} - subscriptions={this.state.subscriptions} login={this.state.login} myUserId={this.state.myUserId} loginDisabled={this.state.loginDisabled}