start adding push notifications

This commit is contained in:
or-else
2018-09-16 20:20:22 +03:00
parent 1e268b3eae
commit 3064c0ec2a
4 changed files with 13 additions and 8 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ Single-page web chat application built with [Tinode](https://github.com/tinode/c
and [icons](https://google.github.io/material-design-icons/#icon-font-for-the-web). The [Tinode javascript SDK](https://github.com/tinode/tinode-js/) has no external dependencies. and [icons](https://google.github.io/material-design-icons/#icon-font-for-the-web). The [Tinode javascript SDK](https://github.com/tinode/tinode-js/) has no external dependencies.
Overall it's a lot like open source WhatsApp or Telegram web apps. Overall it's a lot like open source WhatsApp or Telegram web apps.
The app is very small: all in all less than 150KB minified and gzipped. That includes React, ReactDOM, fonts, graphics, css etc. The app is about 200KB minified and gzipped. That includes all dependencies (React, ReactDOM), fonts, graphics, css etc.
Although the app is generally usable, keep in mind that this is work in progress. Some bugs probably exist. The app was tested in the latest Chrome & Firefox only. NPM [is available](https://www.npmjs.com/package/tinode-webapp). Although the app is generally usable, keep in mind that this is work in progress. Some bugs probably exist. The app was tested in the latest Chrome & Firefox only. NPM [is available](https://www.npmjs.com/package/tinode-webapp).
+7 -2
View File
@@ -9,8 +9,8 @@
<title>Tinode</title> <title>Tinode</title>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="application-name" content="Tinode"> <meta name="application-name" content="TinodeWeb">
<meta name="description" content="Instant messenger"> <meta name="description" content="Tinode instant messenger">
<meta name="application-url" content="https://api.tinode.co/"> <meta name="application-url" content="https://api.tinode.co/">
<!-- Browser styling for Chrome, FF, Opera --> <!-- Browser styling for Chrome, FF, Opera -->
<meta name="theme-color" content="#3949AB"> <meta name="theme-color" content="#3949AB">
@@ -32,7 +32,11 @@
<script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script> <script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script> <script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<script crossorigin src="https://unpkg.com/@babel/standalone/babel.min.js"></script> <script crossorigin src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<!-- Firebase push notifications. -->
<script crossorigin src="https://unpkg.com/firebase@5/firebase-app.js"></script>
<script crossorigin src="https://unpkg.com/firebase@5/firebase-messaging.js"></script>
</head> </head>
<body> <body>
<div id="mountPoint"></div> <div id="mountPoint"></div>
<script> <script>
@@ -42,6 +46,7 @@
<!-- core tinode libraries --> <!-- core tinode libraries -->
<script src="src/drafty.js"></script> <script src="src/drafty.js"></script>
<script src="src/tinode.js"></script> <script src="src/tinode.js"></script>
<script src="src/firebase-push.js"></script>
<!-- the application --> <!-- the application -->
<script type="text/babel" src="src/webapp.jsx"></script> <script type="text/babel" src="src/webapp.jsx"></script>
<script type="text/babel"> <script type="text/babel">
+3 -2
View File
@@ -1,6 +1,6 @@
{ {
"short_name": "Tinode chat", "short_name": "Tinode chat",
"name": "Tinode chat", "name": "Tinode Web chat",
"icons": [ "icons": [
{ {
"src":"img/logo96.png", "src":"img/logo96.png",
@@ -21,5 +21,6 @@
"start_url": "/", "start_url": "/",
"background_color": "silver", "background_color": "silver",
"theme_color": "#3949AB", "theme_color": "#3949AB",
"display": "standalone" "display": "standalone",
"gcm_sender_id": "103953800507"
} }
+2 -3
View File
@@ -4209,14 +4209,13 @@ class SendMessage extends React.PureComponent {
/* This is just a static page to display when no conversation is selected. */ /* This is just a static page to display when no conversation is selected. */
class LogoView extends React.PureComponent { class LogoView extends React.PureComponent {
render() { render() {
var version = APP_NAME + " (" + Tinode.getLibrary() + "-" + var version = APP_NAME + " (" + Tinode.getLibrary() + ")";
(new Date(document.lastModified)).toISOString() + ")";
return ( return (
<div id="dummy-view" className={this.props.hideSelf ? 'nodisplay' : null}> <div id="dummy-view" className={this.props.hideSelf ? 'nodisplay' : null}>
<div> <div>
<a href="https://github.com/tinode/chat/"> <a href="https://github.com/tinode/chat/">
<img id="logo" alt="logo" src="img/logo.svg" /> <img id="logo" alt="logo" src="img/logo.svg" />
<h2>Tinode Demo Chat</h2> <h2>Tinode Web</h2>
</a> </a>
<p>Client: {version}</p> <p>Client: {version}</p>
<p>Server: {this.props.serverVersion} ({this.props.serverAddress})</p> <p>Server: {this.props.serverVersion} ({this.props.serverAddress})</p>