diff --git a/README.md b/README.md index 97e18d02..b19635f1 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,6 @@ Background pattern from http://subtlepatterns.com/, commercial and non-commercia ## Missing functionality * Previews not generated for videos, audio, links or docs. -* Browser push notifications are not implemented. * No end-to-end encryption. * Editing chat permissions is incomplete. * Emoji support is weak. diff --git a/css/base.css b/css/base.css index 8e338436..ee66304e 100644 --- a/css/base.css +++ b/css/base.css @@ -180,17 +180,26 @@ textarea { input[type="text"], input[type="email"], input[type="password"], +input[type="search"], textarea { height: 2.5rem; border-bottom: 1px solid #ccc; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1); transition: all 0.1s ease-in-out; +} + +input[type="text"], +input[type="email"], +input[type="password"], +textarea { width: 100%; } + textarea:focus, input[type="text"]:focus, input[type="email"]:focus, -input[type="password"]:focus { +input[type="password"]:focus, +input[type="search"]:focus { border-bottom: 1px solid #2196f3; box-shadow: 0 1px 0 rgba(33, 150, 243, 0.25); } @@ -198,6 +207,7 @@ input[type="password"]:focus { input[type="text"]::placeholder, input[type="email"]::placeholder, input[type="password"]::placeholder, +input[type="search"]::placeholder, textarea::placeholder { color: #bbb; } @@ -401,7 +411,7 @@ li.right:hover .menuTrigger { /* Quoted div */ .quoted { - padding-left: 1.5rem; + margin-left: 1.5rem; } /* BEGIN InPlaceEdit styles */ diff --git a/package.json b/package.json index b9c8466f..2b9cca94 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "url": "https://github.com/tinode/example-react-js.git" }, "scripts": { - "build": "npm run build:babel && npm run build:prod && npm run build:dev && npm run build:css", + "build": "npm run vers && npm run build:babel && npm run build:prod && npm run build:dev && npm run build:css", "build:prod": "browserify ./src/index.js --standalone Webapp | uglifyjs --compress --mangle > ./umd/index.prod.js", "build:dev": "browserify ./src/index.js --standalone Webapp > ./umd/index.dev.js", "build:babel": "babel ./src/webapp.jsx --presets react --out-file ./src/webapp.js", @@ -66,6 +66,6 @@ "firebase": "^5.5.0", "react": "^16.5.1", "react-dom": "^16.4.2", - "tinode-sdk": "^0.15.6-rc3" + "tinode-sdk": "^0.15.6-rc4" } } diff --git a/service-worker.js b/service-worker.js index 14617e71..a952cae9 100644 --- a/service-worker.js +++ b/service-worker.js @@ -18,6 +18,7 @@ firebase.messaging().setBackgroundMessageHandler(function(payload) { body: payload.notification.body || "", icon: '/img/logo96.png' }; - + console.log("background message", payload); + return self.registration.showNotification(title, options); }); diff --git a/src/webapp.jsx b/src/webapp.jsx index 2bbe5b0b..01dbf738 100644 --- a/src/webapp.jsx +++ b/src/webapp.jsx @@ -15,10 +15,11 @@ if (typeof require == 'function') { var firebase = require('firebase/app'); require('firebase/messaging'); } + var package_version = require('../version.json').version; } // Name of this application, used in the User-Agent. -const APP_NAME = "TinodeWeb/0.15"; +const APP_NAME = "TinodeWeb/" + (package_version || "0.15"); const KNOWN_HOSTS = {hosted: "api.tinode.co", local: "localhost:6060"}; // Default host name and port to connect to. @@ -81,13 +82,21 @@ const MIME_EXTENSIONS = ['jpg', 'gif', 'png', 'svg', // Helper functions for storing values in localStorage. // By default localStorage can store only strings, not objects or other types. + +// Replace old object with the new one. Storage.prototype.setObject = function(key, value) { this.setItem(key, JSON.stringify(value)); } +// Get stored object. Storage.prototype.getObject = function(key) { - var value = this.getItem(key); + let value = this.getItem(key); return value && JSON.parse(value); } +// Partially or wholly update stored object. +Storage.prototype.updateObject = function(key, value) { + let oldVal = this.getObject(key); + this.setObject(key, Object.assign(oldVal || {}, value)); +} // Short representation of time in the past. function shortDateFormat(then) { @@ -856,15 +865,15 @@ class HostSelector extends React.PureComponent { ); } return ( -