diff --git a/client/.angular-cli.json b/client/.angular-cli.json index 1d3d0d0..7b76092 100755 --- a/client/.angular-cli.json +++ b/client/.angular-cli.json @@ -7,7 +7,12 @@ { "root": "src", "outDir": "dist", - "assets": ["assets", "favicon.ico"], + "assets": [ + "assets", + "favicon.ico", + "firebase-messaging-sw.js", + "manifest.json" + ], "index": "index.html", "main": "main.ts", "polyfills": "polyfills.ts", @@ -15,7 +20,6 @@ "tsconfig": "tsconfig.app.json", "testTsconfig": "tsconfig.spec.json", "prefix": "app", - "serviceWorker": true, "styles": [ "../node_modules/font-awesome/css/font-awesome.css", "../node_modules/simple-line-icons/css/simple-line-icons.css", @@ -58,6 +62,5 @@ "defaults": { "styleExt": "css", "component": {} - } } diff --git a/client/package-lock.json b/client/package-lock.json index 6efafd7..9a8939e 100755 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -231,19 +231,162 @@ "tslib": "1.9.0" } }, - "@angular/service-worker": { - "version": "5.2.9", - "resolved": "https://registry.npmjs.org/@angular/service-worker/-/service-worker-5.2.9.tgz", - "integrity": "sha512-gni6t7rU8wGoRsCoXkQBO1p3cfPjpRXWxef1VeMnlRVL5EYhasLalR2zVSTqHJGQ1IPAw52bHhivGTVaLlErqQ==", - "requires": { - "tslib": "1.9.0" - } - }, "@aspnet/signalr": { "version": "1.0.0-preview3-30392", "resolved": "https://dotnet.myget.org/F/aspnetcore-dev/npm/@aspnet/signalr/-/@aspnet/signalr-1.0.0-preview3-30392.tgz", "integrity": "sha1-Xrob5UzkCw8SBTPRjaBfjRaTPOg=" }, + "@firebase/app": { + "version": "0.1.10", + "resolved": "https://registry.npmjs.org/@firebase/app/-/app-0.1.10.tgz", + "integrity": "sha512-2GTXt3b2QZXkmx6/5nNJq+pEN/VTjAG55MFJS1WMoLVZkwKuNpWNk65QVyPaoL88x1iHtuLqAMFgJUOnhOg+Pw==", + "requires": { + "@firebase/app-types": "0.1.2", + "@firebase/util": "0.1.10", + "tslib": "1.9.0" + } + }, + "@firebase/app-types": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@firebase/app-types/-/app-types-0.1.2.tgz", + "integrity": "sha512-bCIZGeMtP0ibrXNNaU214/1tRNw0jHnir/cfiAao1gjUyIS7RzOTQoH+zbwPJNEwUqJ0T3ykw/Tv4/khGqbVBg==" + }, + "@firebase/auth": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@firebase/auth/-/auth-0.4.0.tgz", + "integrity": "sha512-+ocmny3Ja6WOrucmnu7iwedI0G3AqOMCSwqlC9cMpKPQubQhmOPogTD8GZsY4t/nkBxmcRTUjQWfV7UsNwY4+w==", + "requires": { + "@firebase/auth-types": "0.2.0" + } + }, + "@firebase/auth-types": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@firebase/auth-types/-/auth-types-0.2.0.tgz", + "integrity": "sha512-3Ny3xP0DeeeFz92093PHyloIDSFhzajib0X6BZZkz3hS3c/qt+xvACTKpz1jHrQTQAhNL8fGBvO8LsZHrnDT0Q==" + }, + "@firebase/database": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/@firebase/database/-/database-0.2.1.tgz", + "integrity": "sha512-IxONy7MM+Vmnx7bupBujmUyaTqE0n9Jt5xW/2gyLRc9i2wOxNR0XDlJ3Oc12+bksW/zMXHJU1hNO1jxRmIKmsw==", + "requires": { + "@firebase/database-types": "0.2.0", + "@firebase/logger": "0.1.0", + "@firebase/util": "0.1.10", + "faye-websocket": "0.11.1", + "tslib": "1.9.0" + }, + "dependencies": { + "faye-websocket": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.11.1.tgz", + "integrity": "sha1-8O/hjE9W5PQK/H4Gxxn9XuYYjzg=", + "requires": { + "websocket-driver": "0.7.0" + } + } + } + }, + "@firebase/database-types": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@firebase/database-types/-/database-types-0.2.0.tgz", + "integrity": "sha512-QFrxlLABVbZAVJqw1XNkSYZK22qPjpE3U5eM1SO7Htx69TrIgX7tb1/+BJnFkb3AKUD33tAr22Z4XVth5Ys46A==" + }, + "@firebase/firestore": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/@firebase/firestore/-/firestore-0.3.6.tgz", + "integrity": "sha512-omMsncTflPW3Tm6Xbq/4u7lofkttN5yv12RslpQ+ts4BHSeWHan2KYToChup451ViC/8zqmSS8669vOQ5Y3YFg==", + "requires": { + "@firebase/firestore-types": "0.2.2", + "@firebase/logger": "0.1.0", + "@firebase/webchannel-wrapper": "0.2.6", + "grpc": "1.10.0", + "tslib": "1.9.0" + } + }, + "@firebase/firestore-types": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/@firebase/firestore-types/-/firestore-types-0.2.2.tgz", + "integrity": "sha512-yuC07Zi8p0myCQoU62O0fnGcNEcWZnKEGcQ1tj71Qh3E3Dw7qPJ75kXeeL95Bh1PHI0+TqAcDTEb9yVG9xIUVw==" + }, + "@firebase/functions": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@firebase/functions/-/functions-0.1.0.tgz", + "integrity": "sha512-cZpD4NO8v84pbgR6Fk8+DW4KGLKltmu20+WF8lJQao7H3M+10QecCvOfaXanUjxjVZzCFXOJ3EIqoNLT/HQciQ==", + "requires": { + "@firebase/functions-types": "0.1.0", + "@firebase/messaging-types": "0.1.2", + "isomorphic-fetch": "2.2.1" + } + }, + "@firebase/functions-types": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@firebase/functions-types/-/functions-types-0.1.0.tgz", + "integrity": "sha512-Mm0e1OJqLaGJoBxhKC/eYfSo+yE39GpR1fRszintKmW5VKf3JMgmLrHTs/lxvtg03RQXgjdqJIJnRGFic5Z4kg==" + }, + "@firebase/logger": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@firebase/logger/-/logger-0.1.0.tgz", + "integrity": "sha512-/abxM9/l0V9WzNXvSonI2imVqORVhyCVS8yJ1O2rsRmNzw3FIPPIt0BuTvmCBH1oh1uDtZIn2Aar1p7zF69KWg==" + }, + "@firebase/messaging": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/@firebase/messaging/-/messaging-0.2.2.tgz", + "integrity": "sha512-Xl0ZVF+OszdV1p0FM0haqkxXtSOoQyN7cMeoByN85qU2OCZ/+oe9KHkvvfpjV8yjysaZyhPr5GouX7x6iQW3Jg==", + "requires": { + "@firebase/messaging-types": "0.1.2", + "@firebase/util": "0.1.10", + "tslib": "1.9.0" + } + }, + "@firebase/messaging-types": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@firebase/messaging-types/-/messaging-types-0.1.2.tgz", + "integrity": "sha512-4Oycm2JiDaLp9jUy4O25gD/B9Hqdy11hGjSNE0rzhVox5d0e1RF08QCwVt9xpjtBLRgEpPLyD9dPeSu4YK0Y4Q==" + }, + "@firebase/polyfill": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@firebase/polyfill/-/polyfill-0.3.0.tgz", + "integrity": "sha512-nE8LMXBhvWdHBlxtjkZkid8WzowBbxUC+mcYdsEbvx5A7hWswisFZO8XwoKnM1jYYSOpDrtxFmyqWBAc15DmRg==", + "requires": { + "promise-polyfill": "7.1.1", + "tslib": "1.9.0", + "whatwg-fetch": "2.0.3" + }, + "dependencies": { + "whatwg-fetch": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz", + "integrity": "sha1-nITsLc9oGH/wC8ZOEnS0QhduHIQ=" + } + } + }, + "@firebase/storage": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/@firebase/storage/-/storage-0.1.8.tgz", + "integrity": "sha512-g0xYwJbgOuAaAJy5iAoEymS77m3oVqFh9IAF3A4LvqOC9q3v3ubSSYjpNHRPZstO68pMDKsNrqb2TcJgx92kSA==", + "requires": { + "@firebase/storage-types": "0.1.2", + "tslib": "1.9.0" + } + }, + "@firebase/storage-types": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@firebase/storage-types/-/storage-types-0.1.2.tgz", + "integrity": "sha512-/nL93m2lIqzx4FajVnskn2YTDEj0ym53LCZegZpAPxm4GIkOQ8UhzzfHFfHJJCygb58xRszDkDuRlpJlakO4pA==" + }, + "@firebase/util": { + "version": "0.1.10", + "resolved": "https://registry.npmjs.org/@firebase/util/-/util-0.1.10.tgz", + "integrity": "sha512-XEogRfUQBZ4T37TMq/3ZbuiTdRAKX8hF3TgJglUZNCJf/6QnQ+jlupCuMAXBqCGfw2Mw0m2matoCUBWpsyevOA==", + "requires": { + "tslib": "1.9.0" + } + }, + "@firebase/webchannel-wrapper": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/@firebase/webchannel-wrapper/-/webchannel-wrapper-0.2.6.tgz", + "integrity": "sha512-Uv9ieuHVogIOOzpGmdjV3/0asMJPdssq2vrOYJ/UTlvekT6aGdv+sx2WWvIrGRWfFxWIkOxCqpqaGMYbhc88Pg==" + }, "@ngrx/effects": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ngrx/effects/-/effects-5.1.0.tgz", @@ -536,6 +679,11 @@ "moment": "2.21.0" } }, + "angularfire2": { + "version": "5.0.0-rc.6", + "resolved": "https://registry.npmjs.org/angularfire2/-/angularfire2-5.0.0-rc.6.tgz", + "integrity": "sha1-md/sr3/Z5peePAn03PfmdoqPkdE=" + }, "ansi-html": { "version": "0.0.7", "resolved": "https://registry.npmjs.org/ansi-html/-/ansi-html-0.0.7.tgz", @@ -545,8 +693,7 @@ "ansi-regex": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" }, "ansi-styles": { "version": "3.2.1", @@ -717,6 +864,15 @@ "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=" }, + "ascli": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ascli/-/ascli-1.0.1.tgz", + "integrity": "sha1-vPpZdKYvGOgcq660lzKrSoj5Brw=", + "requires": { + "colour": "0.7.1", + "optjs": "3.2.2" + } + }, "asn1": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", @@ -1048,8 +1204,7 @@ "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" }, "base": { "version": "0.11.2", @@ -1302,7 +1457,6 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, "requires": { "balanced-match": "1.0.0", "concat-map": "0.0.1" @@ -1614,6 +1768,14 @@ "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=", "dev": true }, + "bytebuffer": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/bytebuffer/-/bytebuffer-5.0.1.tgz", + "integrity": "sha1-WC7qSxqHO20CCkjVjfhfC7ps/d0=", + "requires": { + "long": "3.2.0" + } + }, "bytes": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", @@ -1707,8 +1869,7 @@ "camelcase": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", - "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=", - "dev": true + "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=" }, "camelcase-keys": { "version": "2.1.0", @@ -2003,7 +2164,6 @@ "version": "3.2.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", - "dev": true, "requires": { "string-width": "1.0.2", "strip-ansi": "3.0.1", @@ -2062,8 +2222,7 @@ "code-point-at": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "dev": true + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" }, "codelyzer": { "version": "4.2.1", @@ -2149,6 +2308,11 @@ "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=", "dev": true }, + "colour": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/colour/-/colour-0.7.1.tgz", + "integrity": "sha1-nLFpkX7F0SwHNtPoaFdG3xyt93g=" + }, "combine-lists": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/combine-lists/-/combine-lists-1.0.1.tgz", @@ -2273,8 +2437,7 @@ "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, "concat-stream": { "version": "1.6.1", @@ -2952,8 +3115,7 @@ "decamelize": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", - "dev": true + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" }, "decode-uri-component": { "version": "0.2.0", @@ -3251,6 +3413,11 @@ } } }, + "dom-storage": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/dom-storage/-/dom-storage-2.0.2.tgz", + "integrity": "sha1-7RfL9oq9EOCu+BgnE+KXxeS1ALA=" + }, "domain-browser": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz", @@ -4104,6 +4271,23 @@ "locate-path": "2.0.0" } }, + "firebase": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/firebase/-/firebase-4.12.0.tgz", + "integrity": "sha512-mH9KWOtpY8y/jL2P8Wf/YNDOi4jmnj2l7KgskPwKHVGEMOx8/pO8AilGbZfF69VGmAAJ321KfJEqJ5jNd4i4Gg==", + "requires": { + "@firebase/app": "0.1.10", + "@firebase/auth": "0.4.0", + "@firebase/database": "0.2.1", + "@firebase/firestore": "0.3.6", + "@firebase/functions": "0.1.0", + "@firebase/messaging": "0.2.2", + "@firebase/polyfill": "0.3.0", + "@firebase/storage": "0.1.8", + "dom-storage": "2.0.2", + "xmlhttprequest": "1.8.0" + } + }, "flatten": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/flatten/-/flatten-1.0.2.tgz", @@ -4253,8 +4437,7 @@ "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, "fsevents": { "version": "1.1.3", @@ -5311,7 +5494,6 @@ "version": "7.1.2", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", - "dev": true, "requires": { "fs.realpath": "1.0.0", "inflight": "1.0.6", @@ -5378,6 +5560,727 @@ "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", "dev": true }, + "grpc": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/grpc/-/grpc-1.10.0.tgz", + "integrity": "sha512-g6Na2dgNusGvSM1ud4hwDaajNP4VSPQhGHnRXzbGNbQJIqGpJhRl7GRgYxTP8rYozqCx2NaT74UL37o8nb0GKA==", + "requires": { + "lodash": "4.17.5", + "nan": "2.9.2", + "node-pre-gyp": "0.6.39", + "protobufjs": "5.0.2" + }, + "dependencies": { + "abbrev": { + "version": "1.1.1", + "bundled": true + }, + "ajv": { + "version": "4.11.8", + "bundled": true, + "requires": { + "co": "4.6.0", + "json-stable-stringify": "1.0.1" + } + }, + "ansi-regex": { + "version": "2.1.1", + "bundled": true + }, + "aproba": { + "version": "1.2.0", + "bundled": true + }, + "are-we-there-yet": { + "version": "1.1.4", + "bundled": true, + "requires": { + "delegates": "1.0.0", + "readable-stream": "2.3.3" + } + }, + "asn1": { + "version": "0.2.3", + "bundled": true + }, + "assert-plus": { + "version": "0.2.0", + "bundled": true + }, + "asynckit": { + "version": "0.4.0", + "bundled": true + }, + "aws-sign2": { + "version": "0.6.0", + "bundled": true + }, + "aws4": { + "version": "1.6.0", + "bundled": true + }, + "balanced-match": { + "version": "1.0.0", + "bundled": true + }, + "bcrypt-pbkdf": { + "version": "1.0.1", + "bundled": true, + "optional": true, + "requires": { + "tweetnacl": "0.14.5" + } + }, + "block-stream": { + "version": "0.0.9", + "bundled": true, + "requires": { + "inherits": "2.0.3" + } + }, + "boom": { + "version": "2.10.1", + "bundled": true, + "requires": { + "hoek": "2.16.3" + } + }, + "brace-expansion": { + "version": "1.1.8", + "bundled": true, + "requires": { + "balanced-match": "1.0.0", + "concat-map": "0.0.1" + } + }, + "caseless": { + "version": "0.12.0", + "bundled": true + }, + "co": { + "version": "4.6.0", + "bundled": true + }, + "code-point-at": { + "version": "1.1.0", + "bundled": true + }, + "combined-stream": { + "version": "1.0.5", + "bundled": true, + "requires": { + "delayed-stream": "1.0.0" + } + }, + "concat-map": { + "version": "0.0.1", + "bundled": true + }, + "console-control-strings": { + "version": "1.1.0", + "bundled": true + }, + "core-util-is": { + "version": "1.0.2", + "bundled": true + }, + "cryptiles": { + "version": "2.0.5", + "bundled": true, + "requires": { + "boom": "2.10.1" + } + }, + "dashdash": { + "version": "1.14.1", + "bundled": true, + "requires": { + "assert-plus": "1.0.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "bundled": true + } + } + }, + "debug": { + "version": "2.6.9", + "bundled": true, + "requires": { + "ms": "2.0.0" + } + }, + "deep-extend": { + "version": "0.4.2", + "bundled": true + }, + "delayed-stream": { + "version": "1.0.0", + "bundled": true + }, + "delegates": { + "version": "1.0.0", + "bundled": true + }, + "detect-libc": { + "version": "1.0.3", + "bundled": true + }, + "ecc-jsbn": { + "version": "0.1.1", + "bundled": true, + "optional": true, + "requires": { + "jsbn": "0.1.1" + } + }, + "extend": { + "version": "3.0.1", + "bundled": true + }, + "extsprintf": { + "version": "1.3.0", + "bundled": true + }, + "forever-agent": { + "version": "0.6.1", + "bundled": true + }, + "form-data": { + "version": "2.1.4", + "bundled": true, + "requires": { + "asynckit": "0.4.0", + "combined-stream": "1.0.5", + "mime-types": "2.1.17" + } + }, + "fs.realpath": { + "version": "1.0.0", + "bundled": true + }, + "fstream": { + "version": "1.0.11", + "bundled": true, + "requires": { + "graceful-fs": "4.1.11", + "inherits": "2.0.3", + "mkdirp": "0.5.1", + "rimraf": "2.6.2" + } + }, + "fstream-ignore": { + "version": "1.0.5", + "bundled": true, + "requires": { + "fstream": "1.0.11", + "inherits": "2.0.3", + "minimatch": "3.0.4" + } + }, + "gauge": { + "version": "2.7.4", + "bundled": true, + "requires": { + "aproba": "1.2.0", + "console-control-strings": "1.1.0", + "has-unicode": "2.0.1", + "object-assign": "4.1.1", + "signal-exit": "3.0.2", + "string-width": "1.0.2", + "strip-ansi": "3.0.1", + "wide-align": "1.1.2" + } + }, + "getpass": { + "version": "0.1.7", + "bundled": true, + "requires": { + "assert-plus": "1.0.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "bundled": true + } + } + }, + "glob": { + "version": "7.1.2", + "bundled": true, + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "graceful-fs": { + "version": "4.1.11", + "bundled": true + }, + "har-schema": { + "version": "1.0.5", + "bundled": true + }, + "har-validator": { + "version": "4.2.1", + "bundled": true, + "requires": { + "ajv": "4.11.8", + "har-schema": "1.0.5" + } + }, + "has-unicode": { + "version": "2.0.1", + "bundled": true + }, + "hawk": { + "version": "3.1.3", + "bundled": true, + "requires": { + "boom": "2.10.1", + "cryptiles": "2.0.5", + "hoek": "2.16.3", + "sntp": "1.0.9" + } + }, + "hoek": { + "version": "2.16.3", + "bundled": true + }, + "http-signature": { + "version": "1.1.1", + "bundled": true, + "requires": { + "assert-plus": "0.2.0", + "jsprim": "1.4.1", + "sshpk": "1.13.1" + } + }, + "inflight": { + "version": "1.0.6", + "bundled": true, + "requires": { + "once": "1.4.0", + "wrappy": "1.0.2" + } + }, + "inherits": { + "version": "2.0.3", + "bundled": true + }, + "ini": { + "version": "1.3.5", + "bundled": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "bundled": true, + "requires": { + "number-is-nan": "1.0.1" + } + }, + "is-typedarray": { + "version": "1.0.0", + "bundled": true + }, + "isarray": { + "version": "1.0.0", + "bundled": true + }, + "isstream": { + "version": "0.1.2", + "bundled": true + }, + "jsbn": { + "version": "0.1.1", + "bundled": true, + "optional": true + }, + "json-schema": { + "version": "0.2.3", + "bundled": true + }, + "json-stable-stringify": { + "version": "1.0.1", + "bundled": true, + "requires": { + "jsonify": "0.0.0" + } + }, + "json-stringify-safe": { + "version": "5.0.1", + "bundled": true + }, + "jsonify": { + "version": "0.0.0", + "bundled": true + }, + "jsprim": { + "version": "1.4.1", + "bundled": true, + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "bundled": true + } + } + }, + "mime-db": { + "version": "1.30.0", + "bundled": true + }, + "mime-types": { + "version": "2.1.17", + "bundled": true, + "requires": { + "mime-db": "1.30.0" + } + }, + "minimatch": { + "version": "3.0.4", + "bundled": true, + "requires": { + "brace-expansion": "1.1.8" + } + }, + "mkdirp": { + "version": "0.5.1", + "bundled": true, + "requires": { + "minimist": "0.0.8" + }, + "dependencies": { + "minimist": { + "version": "0.0.8", + "bundled": true + } + } + }, + "ms": { + "version": "2.0.0", + "bundled": true + }, + "node-pre-gyp": { + "version": "0.6.39", + "bundled": true, + "requires": { + "detect-libc": "1.0.3", + "hawk": "3.1.3", + "mkdirp": "0.5.1", + "nopt": "4.0.1", + "npmlog": "4.1.2", + "rc": "1.2.4", + "request": "2.81.0", + "rimraf": "2.6.2", + "semver": "5.5.0", + "tar": "2.2.1", + "tar-pack": "3.4.1" + } + }, + "nopt": { + "version": "4.0.1", + "bundled": true, + "requires": { + "abbrev": "1.1.1", + "osenv": "0.1.4" + } + }, + "npmlog": { + "version": "4.1.2", + "bundled": true, + "requires": { + "are-we-there-yet": "1.1.4", + "console-control-strings": "1.1.0", + "gauge": "2.7.4", + "set-blocking": "2.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "bundled": true + }, + "oauth-sign": { + "version": "0.8.2", + "bundled": true + }, + "object-assign": { + "version": "4.1.1", + "bundled": true + }, + "once": { + "version": "1.4.0", + "bundled": true, + "requires": { + "wrappy": "1.0.2" + } + }, + "os-homedir": { + "version": "1.0.2", + "bundled": true + }, + "os-tmpdir": { + "version": "1.0.2", + "bundled": true + }, + "osenv": { + "version": "0.1.4", + "bundled": true, + "requires": { + "os-homedir": "1.0.2", + "os-tmpdir": "1.0.2" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "bundled": true + }, + "performance-now": { + "version": "0.2.0", + "bundled": true + }, + "process-nextick-args": { + "version": "1.0.7", + "bundled": true + }, + "punycode": { + "version": "1.4.1", + "bundled": true + }, + "qs": { + "version": "6.4.0", + "bundled": true + }, + "rc": { + "version": "1.2.4", + "bundled": true, + "requires": { + "deep-extend": "0.4.2", + "ini": "1.3.5", + "minimist": "1.2.0", + "strip-json-comments": "2.0.1" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "bundled": true + } + } + }, + "readable-stream": { + "version": "2.3.3", + "bundled": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "1.0.7", + "safe-buffer": "5.1.1", + "string_decoder": "1.0.3", + "util-deprecate": "1.0.2" + } + }, + "request": { + "version": "2.81.0", + "bundled": true, + "requires": { + "aws-sign2": "0.6.0", + "aws4": "1.6.0", + "caseless": "0.12.0", + "combined-stream": "1.0.5", + "extend": "3.0.1", + "forever-agent": "0.6.1", + "form-data": "2.1.4", + "har-validator": "4.2.1", + "hawk": "3.1.3", + "http-signature": "1.1.1", + "is-typedarray": "1.0.0", + "isstream": "0.1.2", + "json-stringify-safe": "5.0.1", + "mime-types": "2.1.17", + "oauth-sign": "0.8.2", + "performance-now": "0.2.0", + "qs": "6.4.0", + "safe-buffer": "5.1.1", + "stringstream": "0.0.5", + "tough-cookie": "2.3.3", + "tunnel-agent": "0.6.0", + "uuid": "3.2.1" + } + }, + "rimraf": { + "version": "2.6.2", + "bundled": true, + "requires": { + "glob": "7.1.2" + } + }, + "safe-buffer": { + "version": "5.1.1", + "bundled": true + }, + "semver": { + "version": "5.5.0", + "bundled": true + }, + "set-blocking": { + "version": "2.0.0", + "bundled": true + }, + "signal-exit": { + "version": "3.0.2", + "bundled": true + }, + "sntp": { + "version": "1.0.9", + "bundled": true, + "requires": { + "hoek": "2.16.3" + } + }, + "sshpk": { + "version": "1.13.1", + "bundled": true, + "requires": { + "asn1": "0.2.3", + "assert-plus": "1.0.0", + "bcrypt-pbkdf": "1.0.1", + "dashdash": "1.14.1", + "ecc-jsbn": "0.1.1", + "getpass": "0.1.7", + "jsbn": "0.1.1", + "tweetnacl": "0.14.5" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "bundled": true + } + } + }, + "string-width": { + "version": "1.0.2", + "bundled": true, + "requires": { + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" + } + }, + "string_decoder": { + "version": "1.0.3", + "bundled": true, + "requires": { + "safe-buffer": "5.1.1" + } + }, + "stringstream": { + "version": "0.0.5", + "bundled": true + }, + "strip-ansi": { + "version": "3.0.1", + "bundled": true, + "requires": { + "ansi-regex": "2.1.1" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "bundled": true + }, + "tar": { + "version": "2.2.1", + "bundled": true, + "requires": { + "block-stream": "0.0.9", + "fstream": "1.0.11", + "inherits": "2.0.3" + } + }, + "tar-pack": { + "version": "3.4.1", + "bundled": true, + "requires": { + "debug": "2.6.9", + "fstream": "1.0.11", + "fstream-ignore": "1.0.5", + "once": "1.4.0", + "readable-stream": "2.3.3", + "rimraf": "2.6.2", + "tar": "2.2.1", + "uid-number": "0.0.6" + } + }, + "tough-cookie": { + "version": "2.3.3", + "bundled": true, + "requires": { + "punycode": "1.4.1" + } + }, + "tunnel-agent": { + "version": "0.6.0", + "bundled": true, + "requires": { + "safe-buffer": "5.1.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "bundled": true, + "optional": true + }, + "uid-number": { + "version": "0.0.6", + "bundled": true + }, + "util-deprecate": { + "version": "1.0.2", + "bundled": true + }, + "uuid": { + "version": "3.2.1", + "bundled": true + }, + "verror": { + "version": "1.10.0", + "bundled": true, + "requires": { + "assert-plus": "1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "1.3.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "bundled": true + } + } + }, + "wide-align": { + "version": "1.1.2", + "bundled": true, + "requires": { + "string-width": "1.0.2" + } + }, + "wrappy": { + "version": "1.0.2", + "bundled": true + } + } + }, "handle-thing": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/handle-thing/-/handle-thing-1.2.5.tgz", @@ -5852,8 +6755,7 @@ "http-parser-js": { "version": "0.4.10", "resolved": "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.4.10.tgz", - "integrity": "sha1-ksnBN0w1CF912zWexWzCV8u5P6Q=", - "dev": true + "integrity": "sha1-ksnBN0w1CF912zWexWzCV8u5P6Q=" }, "http-proxy": { "version": "1.16.2", @@ -6107,7 +7009,6 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, "requires": { "once": "1.4.0", "wrappy": "1.0.2" @@ -6253,8 +7154,7 @@ "invert-kv": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", - "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", - "dev": true + "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=" }, "ip": { "version": "1.1.5", @@ -6414,7 +7314,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "dev": true, "requires": { "number-is-nan": "1.0.1" } @@ -7163,7 +8062,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", - "dev": true, "requires": { "invert-kv": "1.0.0" } @@ -7775,6 +8673,11 @@ "integrity": "sha1-4PyVEztu8nbNyIh82vJKpvFW+Po=", "dev": true }, + "long": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/long/-/long-3.2.0.tgz", + "integrity": "sha1-2CG3E4yhy1gcFymQ7xTbIAtcR0s=" + }, "longest": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", @@ -8210,7 +9113,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, "requires": { "brace-expansion": "1.1.11" } @@ -8394,9 +9296,7 @@ "nan": { "version": "2.9.2", "resolved": "https://registry.npmjs.org/nan/-/nan-2.9.2.tgz", - "integrity": "sha512-ltW65co7f3PQWBDbqVvaU1WtFJUsNW7sWWm4HINhbMQIyVyzIeyZ8toX5TC5eeooE6piZoaEh4cZkueSKG3KYw==", - "dev": true, - "optional": true + "integrity": "sha512-ltW65co7f3PQWBDbqVvaU1WtFJUsNW7sWWm4HINhbMQIyVyzIeyZ8toX5TC5eeooE6piZoaEh4cZkueSKG3KYw==" }, "nanomatch": { "version": "1.2.9", @@ -8972,8 +9872,7 @@ "number-is-nan": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "dev": true + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" }, "oauth-sign": { "version": "0.8.2", @@ -9135,7 +10034,6 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, "requires": { "wrappy": "1.0.2" } @@ -9186,6 +10084,11 @@ "integrity": "sha1-7CLTEoBrtT5zF3Pnza788cZDEo8=", "dev": true }, + "optjs": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/optjs/-/optjs-3.2.2.tgz", + "integrity": "sha1-aabOicRCpEQDFBrS+bNwvVu29O4=" + }, "original": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/original/-/original-1.0.0.tgz", @@ -9223,7 +10126,6 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", - "dev": true, "requires": { "lcid": "1.0.0" } @@ -9467,8 +10369,7 @@ "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" }, "path-is-inside": { "version": "1.0.2", @@ -11681,6 +12582,11 @@ "integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM=", "dev": true }, + "promise-polyfill": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/promise-polyfill/-/promise-polyfill-7.1.1.tgz", + "integrity": "sha512-k1ArwERleWt59+JZuPp5Asd4+Eo3R6g4SDWKl8ozLYZE6K5pZULl1e4hlg112OYVgQcJ6IwBlBHP6JkCDUrayA==" + }, "prop-types": { "version": "15.6.1", "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.6.1.tgz", @@ -11712,6 +12618,43 @@ } } }, + "protobufjs": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-5.0.2.tgz", + "integrity": "sha1-WXSNfc8D0tsiwT2p/rAk4Wq4DJE=", + "requires": { + "ascli": "1.0.1", + "bytebuffer": "5.0.1", + "glob": "7.1.2", + "yargs": "3.32.0" + }, + "dependencies": { + "window-size": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.4.tgz", + "integrity": "sha1-+OGqHuWlPsW/FR/6CXQqatdpeHY=" + }, + "y18n": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", + "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=" + }, + "yargs": { + "version": "3.32.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.32.0.tgz", + "integrity": "sha1-AwiOnr+edWtpdRYR0qXvWRSCyZU=", + "requires": { + "camelcase": "2.1.1", + "cliui": "3.2.0", + "decamelize": "1.2.0", + "os-locale": "1.4.0", + "string-width": "1.0.2", + "window-size": "0.1.4", + "y18n": "3.2.1" + } + } + } + }, "protractor": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/protractor/-/protractor-5.3.0.tgz", @@ -13709,7 +14652,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dev": true, "requires": { "code-point-at": "1.1.0", "is-fullwidth-code-point": "1.0.0", @@ -13733,7 +14675,6 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, "requires": { "ansi-regex": "2.1.1" } @@ -16053,7 +16994,6 @@ "version": "0.7.0", "resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.7.0.tgz", "integrity": "sha1-DK+dLXVdk67gSdS90NP+LMoqJOs=", - "dev": true, "requires": { "http-parser-js": "0.4.10", "websocket-extensions": "0.1.3" @@ -16062,8 +17002,7 @@ "websocket-extensions": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.3.tgz", - "integrity": "sha512-nqHUnMXmBzT0w570r2JpJxfiSD1IzoI+HGVdd3aZ0yNi3ngvQ4jv1dtHt5VGxfI2yj5yqImPhOK4vmIh2xMbGg==", - "dev": true + "integrity": "sha512-nqHUnMXmBzT0w570r2JpJxfiSD1IzoI+HGVdd3aZ0yNi3ngvQ4jv1dtHt5VGxfI2yj5yqImPhOK4vmIh2xMbGg==" }, "whatwg-fetch": { "version": "0.9.0", @@ -16136,7 +17075,6 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", - "dev": true, "requires": { "string-width": "1.0.2", "strip-ansi": "3.0.1" @@ -16145,8 +17083,7 @@ "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, "ws": { "version": "3.3.3", @@ -16181,6 +17118,11 @@ "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=", "dev": true }, + "xmlhttprequest": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz", + "integrity": "sha1-Z/4HXFwk/vOfnWX197f+dRcZaPw=" + }, "xmlhttprequest-ssl": { "version": "1.5.5", "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.5.tgz", diff --git a/client/package.json b/client/package.json index 65b9b62..586d177 100755 --- a/client/package.json +++ b/client/package.json @@ -24,7 +24,6 @@ "@angular/platform-browser": "^5.2.7", "@angular/platform-browser-dynamic": "^5.2.7", "@angular/router": "^5.2.7", - "@angular/service-worker": "^5.2.9", "@aspnet/signalr": "^1.0.0-preview3-30392", "@ngrx/effects": "^5.1.0", "@ngrx/store": "^5.1.0", @@ -32,12 +31,14 @@ "@qontu/ngx-inline-editor": "^0.2.0-alpha.12", "angular2-jwt": "^0.2.3", "angular2-moment": "^1.8.0", + "angularfire2": "^5.0.0-rc.6", "applicationinsights-js": "^1.0.15", "auth0": "^2.9.1", "auth0-lock": "^11.4.0", "bootstrap": "4.0.0", "core-js": "^2.5.3", "dropzone": "^5.3.0", + "firebase": "^4.12.0", "font-awesome": "^4.7.0", "jquery": "^3.3.1", "lodash": "^4.17.5", diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts index bd0d0b4..0d465a0 100755 --- a/client/src/app/app.component.ts +++ b/client/src/app/app.component.ts @@ -1,11 +1,12 @@ import { GlobalsService } from './services/globals.service'; import { Component, HostBinding, OnInit } from '@angular/core'; import { Store } from '@ngrx/store'; +import { ToastyService } from 'ng2-toasty'; import { AuthService } from 'app/services/auth.service'; import { AppInsightsService } from 'app/services/app-insights.service'; import { SignalRService } from 'app/services/signalr.service'; import { ProfileService } from './services/profile.service'; -import { PushNotificationsService } from 'app/services/push-notifications.service'; +import { MessagingService } from 'app/services/messaging.service'; @Component({ selector: 'app-root', @@ -15,9 +16,10 @@ import { PushNotificationsService } from 'app/services/push-notifications.servic export class AppComponent implements OnInit { constructor( private _authService: AuthService, + private _toastyService: ToastyService, private _signalrService: SignalRService, private _profileService: ProfileService, - private _pushNotifications: PushNotificationsService, + private _messagingService: MessagingService, _appInsights: AppInsightsService ) { _authService.handleAuthentication(); @@ -33,6 +35,8 @@ export class AppComponent implements OnInit { if (this.loggedIn()) { const user = this._profileService.getProfile().subscribe(u => { if (u) { + this._messagingService.getPermission(); + this._messagingService.receiveMessage(); const chatterChannel = `${u.uid}_chatter`; this._signalrService .init('chatter') @@ -45,10 +49,7 @@ export class AppComponent implements OnInit { this._signalrService.connection.on( chatterChannel, result => { - this._pushNotifications.createNotification( - 'PodNoms', - result - ); + this._toastyService.info(result); } ); }) diff --git a/client/src/app/app.module.ts b/client/src/app/app.module.ts index ff55808..710473a 100755 --- a/client/src/app/app.module.ts +++ b/client/src/app/app.module.ts @@ -9,6 +9,9 @@ import { HttpModule, Http, RequestOptions } from '@angular/http'; import { FormsModule } from '@angular/forms'; import { ToastyModule } from 'ng2-toasty'; import { ProgressbarModule } from 'ngx-bootstrap/progressbar'; +import { AngularFireDatabaseModule } from 'angularfire2/database'; +import { AngularFireAuthModule } from 'angularfire2/auth'; +import { AngularFireModule } from 'angularfire2'; import { ModalModule } from 'ngx-bootstrap/modal'; import { AuthGuard } from './services/auth.guard'; @@ -23,7 +26,6 @@ import { StoreModule } from '@ngrx/store'; import { EffectsModule } from '@ngrx/effects'; import { StoreDevtoolsModule } from '@ngrx/store-devtools'; import { ClipboardModule } from 'ngx-clipboard'; -import { ServiceWorkerModule } from '@angular/service-worker'; import { AppComponent } from './app.component'; import { HomeComponent } from './components/home/home.component'; @@ -51,9 +53,9 @@ import { ProfileComponent } from './components/profile/profile.component'; import { AboutComponent } from './components/about/about.component'; import { FooterComponent } from './components/footer/footer.component'; import { JobsService } from 'app/services/jobs.service'; -import { PushService } from 'app/services/push.service'; +import { PushRegistrationService } from 'app/services/push-registration.service'; import { AppInsightsService } from 'app/services/app-insights.service'; -import { PushNotificationsService } from './services/push-notifications.service'; +import { MessagingService } from './services/messaging.service'; import { environment } from 'environments/environment'; @@ -95,7 +97,17 @@ export function authHttpServiceFactory(http: Http, options: RequestOptions) { ], imports: [ BrowserModule, - ServiceWorkerModule.register('/ngsw-worker.js', {enabled: environment.production}), + AngularFireModule.initializeApp({ + apiKey: 'AIzaSyAaIm8LTB0ZgJ-g7RXEjtVa1EOQB381QLI', + authDomain: 'podnoms-797e3.firebaseapp.com', + databaseURL: 'https://podnoms-797e3.firebaseio.com', + projectId: 'podnoms-797e3', + storageBucket: 'podnoms-797e3.appspot.com', + messagingSenderId: '777042345082' + }), + AngularFireDatabaseModule, + AngularFireAuthModule, + AppRoutingModule, HttpModule, FormsModule, @@ -130,9 +142,9 @@ export function authHttpServiceFactory(http: Http, options: RequestOptions) { ProfileService, PodcastService, ImageService, - PushService, + PushRegistrationService, DebugService, - PushNotificationsService, + MessagingService, ChatterService, AppInsightsService, JobsService, diff --git a/client/src/app/components/debug/debug.component.html b/client/src/app/components/debug/debug.component.html index adfadfe..e84519e 100755 --- a/client/src/app/components/debug/debug.component.html +++ b/client/src/app/components/debug/debug.component.html @@ -7,35 +7,31 @@ Desktop Notifications
- - + +
+
+
{{ message.notification.title}}
+ +

{{ message.notification.body}}

+
+ +
-
- Realtime -
+
Debug Info
- - -
    -
  • - {{message}} -
  • -
-
-
-
-
-
-
- Chatter -
-
- +
+
+                    
+
+
+ API Host: {{apiHost}} +
SignalR Host: {{signalrHost}} +
Ping: {{pingPong}}
@@ -52,20 +48,5 @@
-
-
-
Debug Info
-
-
-
-                    
-
-
- API Host: {{apiHost}} -
SignalR Host: {{signalrHost}} -
Ping: {{pingPong}}
-
-
-
diff --git a/client/src/app/components/debug/debug.component.ts b/client/src/app/components/debug/debug.component.ts index 4c1825c..58c58c0 100755 --- a/client/src/app/components/debug/debug.component.ts +++ b/client/src/app/components/debug/debug.component.ts @@ -5,7 +5,8 @@ import { DebugService } from 'app/services/debug.service'; import { environment } from 'environments/environment'; import { JobsService } from 'app/services/jobs.service'; import { ChatterService } from 'app/services/chatter.service'; -import { PushNotificationsService } from 'app/services/push-notifications.service'; +import { MessagingService } from 'app/services/messaging.service'; +import { BehaviorSubject } from 'rxjs/BehaviorSubject'; @Component({ selector: 'app-debug', @@ -13,10 +14,7 @@ import { PushNotificationsService } from 'app/services/push-notifications.servic styleUrls: ['./debug.component.css'] }) export class DebugComponent implements OnInit { - realtimeMessage: string; - notificationMessage: string; - - messagesReceived: string[] = []; + message$: BehaviorSubject; debugInfo$: Observable; apiHost = environment.API_HOST; @@ -27,52 +25,24 @@ export class DebugComponent implements OnInit { private _debugService: DebugService, private _chatterService: ChatterService, private _jobsService: JobsService, - private _pushNotifications: PushNotificationsService, + private _pushNotifications: MessagingService, private _signalrService: SignalRService ) {} ngOnInit() { - // this._signalrService - // .init(`${environment.SIGNALR_HOST}hubs/debug`) - // .then(() => { - // this._signalrService.connection.on('Send', data => { - // console.log('DebugService', 'signalr', data); - // this.messagesReceived.push(data); - // this.realtimeMessage = ''; - // }); - // this.debugInfo$ = this._debugService.getDebugInfo(); - // }) - // .catch(err => - // console.error('debug.component.ts', '_signalrService.init', err) - // ); this._debugService.ping().subscribe(r => (this.pingPong = r)); } - sendMessage() { + subscribeToServerPush() { + this._pushNotifications.getPermission(); + this._pushNotifications.receiveMessage(); + this.message$ = this._pushNotifications.currentMessage; + } + sendServerPush() { this._debugService - .sendRealtime(this.realtimeMessage) - .subscribe(r => console.log(r)); - } - doSomething() { - alert('doSomething was did'); - } - sendChatter() { - this._chatterService.ping('Pong').subscribe(r => { - this._pushNotifications.createNotification('PodNoms', r); - }); - } - sendDesktopNotification() { - console.log( - 'debug.component', - 'sendDesktopFunction', - this.notificationMessage - ); - this._pushNotifications.createNotification( - 'PodNoms', - this.notificationMessage - ); - } - subscribeToServerPush(){ - this._pushNotifications.subscribeToServerPush(); + .sendPush() + .subscribe(r => + console.log('debug.component', 'sendServerPush', r) + ); } processOrphans() { this._jobsService diff --git a/client/src/app/components/podcast/podcast.component.ts b/client/src/app/components/podcast/podcast.component.ts index 489b385..6d192e5 100755 --- a/client/src/app/components/podcast/podcast.component.ts +++ b/client/src/app/components/podcast/podcast.component.ts @@ -3,6 +3,8 @@ import { ActivatedRoute } from '@angular/router'; import { Component } from '@angular/core'; import { PodcastModel, PodcastEntryModel } from 'app/models/podcasts.models'; import { ToastyService } from 'ng2-toasty'; +import { PodcastService } from 'app/services/podcast.service'; +import { MessagingService } from 'app/services/messaging.service'; import { AppComponent } from 'app/app.component'; import { Store } from '@ngrx/store'; import { ApplicationState } from 'app/store'; @@ -13,8 +15,6 @@ import { UpdateAction, AddAction } from 'app/actions/entries.actions'; import * as fromPodcast from 'app/reducers'; import * as fromPodcastActions from 'app/actions/podcast.actions'; import * as fromEntriesActions from 'app/actions/entries.actions'; -import { PodcastService } from 'app/services/podcast.service'; -import { PushNotificationsService } from 'app/services/push-notifications.service'; @Component({ selector: 'app-podcast', @@ -102,12 +102,13 @@ export class PodcastComponent { } processPlaylist() { if (this.pendingEntry) { - this._service.addPlaylist(this.pendingEntry) - .subscribe(e => { - if (e) { - this._toasty.info('Playlist added, check back here (and on your device) for new episodes'); - } - }); + this._service.addPlaylist(this.pendingEntry).subscribe(e => { + if (e) { + this._toasty.info( + 'Playlist added, check back here (and on your device) for new episodes' + ); + } + }); } } dismissPlaylist() { diff --git a/client/src/app/services/debug.service.ts b/client/src/app/services/debug.service.ts index 6c20323..1f371c8 100755 --- a/client/src/app/services/debug.service.ts +++ b/client/src/app/services/debug.service.ts @@ -16,6 +16,9 @@ export class DebugService { } ping(): Observable { - return this._http.get(environment.API_HOST + '/debug/ping').map(r => r.text()); + return this._http.get(environment.API_HOST + '/ping').map(r => r.text()); + } + sendPush(): Observable{ + return this._http.get(environment.API_HOST + '/debug/serverpush').map(r => r.text()); } } diff --git a/client/src/app/services/messaging.service.ts b/client/src/app/services/messaging.service.ts new file mode 100644 index 0000000..2aa85d7 --- /dev/null +++ b/client/src/app/services/messaging.service.ts @@ -0,0 +1,65 @@ +import { Injectable } from '@angular/core'; +import { AngularFireDatabase } from 'angularfire2/database'; +import { AngularFireAuth } from 'angularfire2/auth'; + +import * as firebase from 'firebase'; +import 'rxjs/add/operator/take'; +import { BehaviorSubject } from 'rxjs/BehaviorSubject'; +import { PushRegistrationService } from 'app/services/push-registration.service'; + +@Injectable() +export class MessagingService { + messaging = firebase.messaging(); + currentMessage = new BehaviorSubject(null); + + constructor( + private db: AngularFireDatabase, + private afAuth: AngularFireAuth, + private _pushRegistrationServer: PushRegistrationService + ) { + this.messaging.usePublicVapidKey( + 'BKyhUqIVZLauKNA-DXPXbIVLj5XiWurHbRV_0Rd3BOjY5cU9GOrd5ptXVJ2CNExxdveKYzZevrep2CflKeqkyqo' + ); + } + + private updateToken(token) { + this.afAuth.authState.take(1).subscribe(user => { + if (!user) return; + + const data = { [user.uid]: token }; + this.db.object('fcmTokens/').update(data); + }); + const registration = { + endpoint: token, + keys: { + p256dh: token + } + }; + this._pushRegistrationServer.addSubscriber(registration) + .subscribe(e => console.log('messaging.service', 'updateToken', 'addSubscriber', e)); + } + + public getPermission() { + this.messaging + .requestPermission() + .then(() => { + console.log('Notification permission granted.'); + const token = this.messaging.getToken(); + return token; + }) + .then(token => { + console.log(token); + this.updateToken(token); + }) + .catch(err => { + console.error('Unable to get permission to notify', err); + }); + } + + receiveMessage() { + this.messaging.onMessage(payload => { + console.log('Message received', payload); + this.currentMessage.next(payload); + }); + } +} diff --git a/client/src/app/services/push-notifications.service.ts b/client/src/app/services/push-notifications.service.ts deleted file mode 100644 index 9078a55..0000000 --- a/client/src/app/services/push-notifications.service.ts +++ /dev/null @@ -1,79 +0,0 @@ -import { Injectable } from '@angular/core'; -import { SwPush } from '@angular/service-worker'; -import { PushService } from 'app/services/push.service'; - -export type Permission = 'denied' | 'granted' | 'default'; - -@Injectable() -export class PushNotificationsService { - permission: Permission; - pushSupported: boolean = 'serviceWorker' in navigator && 'PushManager' in window; - vapidPublicKey: string = 'BKrxiuL9AJo5rrKEzMQIOvIacDnbg6JI8hJiT00JfKytur395xL8CROvR_zC2XM9f5oxGiMLxpUyjgLWlEPeSbU'; - - constructor(private _pushService: PushService, private _pushServiceWorker: SwPush) {} - - private _urlBase64ToUint8Array(base64String) { - const padding = '='.repeat((4 - base64String.length % 4) % 4); - const base64 = (base64String + padding) - .replace(/\-/g, '+') - .replace(/_/g, '/'); - const rawData = window.atob(base64); - const outputArray = new Uint8Array(rawData.length); - for (let i = 0; i < rawData.length; ++i) { - outputArray[i] = rawData.charCodeAt(i); - } - return outputArray; - } - - requestPermissions() { - if ('Notification' in window) { - Notification.requestPermission((status: any) => { - console.log( - 'push-notifications.service', - 'requestPermissions', - status - ); - this.permission = status; - }); - } - } - - isSupported() { - return 'Notification' in window && this.permission == 'granted'; - } - - subscribeToServerPush() { - console.log('PushNotificationsService', 'subscribeToServerPush', this.vapidPublicKey); - this._pushServiceWorker.requestSubscription({ - serverPublicKey: this.vapidPublicKey - }).then(pushSubscription => { - console.log('PushNotificationsService', 'subscribeToServerPush', pushSubscription); - this._pushService.addSubscriber(pushSubscription) - .subscribe(res => { - console.log('PushNotificationsService', 'subscribeToServerPush', res); - }, err => { - console.error('PushNotificationsService', 'subscribeToServerPush', err); - }); - }).catch(err => { - console.error('PushNotificationsService', 'subscribeToServerPush', err); - }); - } - - createNotification(subject: string, text: string) { - console.log('PushNotificationsService', 'createNotification', subject, text); - if (this.isSupported()) { - const options = { - body: text, - icon: 'https://podnoms.com/assets/img/logo-icon.png' - }; - const n = new Notification(subject, options); - } else { - console.error( - 'push-notifications.service', - 'createNotification', - 'Notifications are not supported' - ); - } - } -} - diff --git a/client/src/app/services/push.service.ts b/client/src/app/services/push-registration.service.ts similarity index 97% rename from client/src/app/services/push.service.ts rename to client/src/app/services/push-registration.service.ts index d4675c5..4890e0e 100644 --- a/client/src/app/services/push.service.ts +++ b/client/src/app/services/push-registration.service.ts @@ -9,7 +9,7 @@ import 'rxjs/add/observable/throw'; import { environment } from 'environments/environment'; @Injectable() -export class PushService { +export class PushRegistrationService { private API_URL: string; constructor(private http: AuthHttp) { this.API_URL = environment.API_HOST; @@ -27,14 +27,11 @@ export class PushService { } addSubscriber(subscription) { - - const url = `${this.API_URL}/webpush/subscribe`; console.log('[Push Service] Adding subscriber') - + const url = `${this.API_URL}/webpush/subscribe`; return this.http .post(url, subscription) .catch(this.handleError); - } deleteSubscriber(subscription) { diff --git a/client/src/environments/environment.ts b/client/src/environments/environment.ts index 873e134..6058a36 100755 --- a/client/src/environments/environment.ts +++ b/client/src/environments/environment.ts @@ -1,10 +1,13 @@ export const environment = { production: false, - API_HOST: 'https://dev.podnoms.com:5001', - SIGNALR_HOST: 'https://dev.podnoms.com:5001/', - AUTH0_REDIRECT_URL: 'http://dev.podnoms.com:4200/callback', - BASE_URL: 'http://dev.podnoms.com:4200/', + API_HOST: 'http://localhost:5000', + SIGNALR_HOST: 'http://localhost:5000/', + AUTH0_REDIRECT_URL: 'http://localhost:4200/callback', + BASE_URL: 'http://localhost:4200/', appInsights: { instrumentationKey: '020b002a-bd3d-4b25-8a74-cab16fd39dfc' + }, + messaging: { + endpoint: 'https://fcm.googleapis.com/fcm/send' } }; diff --git a/client/src/firebase-messaging-sw.js b/client/src/firebase-messaging-sw.js new file mode 100644 index 0000000..700edb4 --- /dev/null +++ b/client/src/firebase-messaging-sw.js @@ -0,0 +1,8 @@ +importScripts('https://www.gstatic.com/firebasejs/3.9.0/firebase-app.js'); +importScripts('https://www.gstatic.com/firebasejs/3.9.0/firebase-messaging.js'); + +firebase.initializeApp({ + messagingSenderId: '777042345082' +}); + +const messaging = firebase.messaging(); diff --git a/client/src/index.html b/client/src/index.html index 66ce69e..9453e9d 100755 --- a/client/src/index.html +++ b/client/src/index.html @@ -5,10 +5,10 @@