remove rocket chat

This commit is contained in:
Peter Maquiran
2024-08-09 10:50:32 +01:00
parent 45e829bec3
commit 6cbd8d903c
67 changed files with 962 additions and 5618 deletions
-4
View File
@@ -20,10 +20,6 @@
"name": "grayLog",
"path": "../grayLog"
},
{
"name": "equilibriumito-gabinete-digital-fo-23cf0fc4cbaa",
"path": "../../../Downloads/equilibriumito-gabinete-digital-fo-23cf0fc4cbaa/equilibriumito-gabinete-digital-fo-23cf0fc4cbaa"
},
{
"path": "../../../Downloads/nestjs-microservice-boilerplate-api-master"
},
+297
View File
@@ -98,6 +98,7 @@
"@ngx-translate/core": "^13.0.0",
"@ngxs/store": "^3.8.2",
"@opentelemetry/exporter-metrics-otlp-http": "^0.52.1",
"@opentelemetry/exporter-trace-otlp-http": "^0.52.1",
"@opentelemetry/exporter-zipkin": "^1.25.1",
"@opentelemetry/resources": "^1.25.1",
"@opentelemetry/sdk-metrics": "^1.25.1",
@@ -193,6 +194,7 @@
"ts-jest": "^27.0.3",
"ts-jest-puppeteer": "^0.0.5",
"tslib": "^2.0.0",
"typedoc": "^0.26.5",
"uuidv4": "^6.2.11",
"videogular2": "^7.0.2",
"webpack": "^5.88.2",
@@ -7794,6 +7796,24 @@
"@opentelemetry/api": "^1.3.0"
}
},
"node_modules/@opentelemetry/exporter-trace-otlp-http": {
"version": "0.52.1",
"resolved": "https://registry.npmjs.org/@opentelemetry/exporter-trace-otlp-http/-/exporter-trace-otlp-http-0.52.1.tgz",
"integrity": "sha512-05HcNizx0BxcFKKnS5rwOV+2GevLTVIRA0tRgWYyw4yCgR53Ic/xk83toYKts7kbzcI+dswInUg/4s8oyA+tqg==",
"dependencies": {
"@opentelemetry/core": "1.25.1",
"@opentelemetry/otlp-exporter-base": "0.52.1",
"@opentelemetry/otlp-transformer": "0.52.1",
"@opentelemetry/resources": "1.25.1",
"@opentelemetry/sdk-trace-base": "1.25.1"
},
"engines": {
"node": ">=14"
},
"peerDependencies": {
"@opentelemetry/api": "^1.0.0"
}
},
"node_modules/@opentelemetry/exporter-zipkin": {
"version": "1.25.1",
"resolved": "https://registry.npmjs.org/@opentelemetry/exporter-zipkin/-/exporter-zipkin-1.25.1.tgz",
@@ -8324,6 +8344,14 @@
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz",
"integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q=="
},
"node_modules/@shikijs/core": {
"version": "1.12.1",
"resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.12.1.tgz",
"integrity": "sha512-biCz/mnkMktImI6hMfMX3H9kOeqsInxWEyCHbSlL8C/2TR1FqfmGxTLRNwYCKsyCyxWLbB8rEqXRVZuyxuLFmA==",
"dependencies": {
"@types/hast": "^3.0.4"
}
},
"node_modules/@sideway/address": {
"version": "4.1.4",
"resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.4.tgz",
@@ -8597,6 +8625,14 @@
"resolved": "https://registry.npmjs.org/@types/hammerjs/-/hammerjs-2.0.40.tgz",
"integrity": "sha512-VbjwR1fhsn2h2KXAY4oy1fm7dCxaKy0D+deTb8Ilc3Eo3rc5+5eA4rfYmZaHgNJKxVyI0f6WIXzO2zLkVmQPHA=="
},
"node_modules/@types/hast": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz",
"integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==",
"dependencies": {
"@types/unist": "*"
}
},
"node_modules/@types/istanbul-lib-coverage": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz",
@@ -8757,6 +8793,11 @@
"resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz",
"integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw=="
},
"node_modules/@types/unist": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.2.tgz",
"integrity": "sha512-dqId9J8K/vGi5Zr7oo212BGii5m3q5Hxlkwy3WpYuKPklmBEvsbMYYyLxAQpSffdLl/gdW0XUpKWFvYmyoWCoQ=="
},
"node_modules/@types/uuid": {
"version": "8.3.1",
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.1.tgz",
@@ -26135,6 +26176,14 @@
"resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz",
"integrity": "sha512-8ZmlJFVK9iCmtLz19HpSsR8HaAMWBT284VMNednLwlIMDP2hJDCIhUp0IZ2xUcZ+Ob6BM0VvCSJwzASDM45NLQ=="
},
"node_modules/linkify-it": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.0.tgz",
"integrity": "sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==",
"dependencies": {
"uc.micro": "^2.0.0"
}
},
"node_modules/listr2": {
"version": "3.14.0",
"resolved": "https://registry.npmjs.org/listr2/-/listr2-3.14.0.tgz",
@@ -26546,6 +26595,11 @@
"node": ">=10"
}
},
"node_modules/lunr": {
"version": "2.3.9",
"resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz",
"integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow=="
},
"node_modules/luxon": {
"version": "3.4.4",
"resolved": "https://registry.npmjs.org/luxon/-/luxon-3.4.4.tgz",
@@ -26665,6 +26719,38 @@
"node": ">=0.10.0"
}
},
"node_modules/markdown-it": {
"version": "14.1.0",
"resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.1.0.tgz",
"integrity": "sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==",
"dependencies": {
"argparse": "^2.0.1",
"entities": "^4.4.0",
"linkify-it": "^5.0.0",
"mdurl": "^2.0.0",
"punycode.js": "^2.3.1",
"uc.micro": "^2.1.0"
},
"bin": {
"markdown-it": "bin/markdown-it.mjs"
}
},
"node_modules/markdown-it/node_modules/argparse": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="
},
"node_modules/markdown-it/node_modules/entities": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz",
"integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==",
"engines": {
"node": ">=0.12"
},
"funding": {
"url": "https://github.com/fb55/entities?sponsor=1"
}
},
"node_modules/md5-file": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/md5-file/-/md5-file-5.0.0.tgz",
@@ -26693,6 +26779,11 @@
"integrity": "sha512-dn6wd0uw5GsdswPFfsgMp5NSB0/aDe6fK94YJV/AJDYXL6HVLWBsxeq7js7Ad+mU2K9LAlwpk6kN2D5mwCPVow==",
"dev": true
},
"node_modules/mdurl": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz",
"integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w=="
},
"node_modules/media-typer": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
@@ -32306,6 +32397,14 @@
"node": ">=6"
}
},
"node_modules/punycode.js": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/punycode.js/-/punycode.js-2.3.1.tgz",
"integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==",
"engines": {
"node": ">=6"
}
},
"node_modules/pupa": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/pupa/-/pupa-2.1.1.tgz",
@@ -34551,6 +34650,15 @@
"optional": true,
"peer": true
},
"node_modules/shiki": {
"version": "1.12.1",
"resolved": "https://registry.npmjs.org/shiki/-/shiki-1.12.1.tgz",
"integrity": "sha512-nwmjbHKnOYYAe1aaQyEBHvQymJgfm86ZSS7fT8OaPRr4sbAcBNz7PbfAikMEFSDQ6se2j2zobkXvVKcBOm0ysg==",
"dependencies": {
"@shikijs/core": "1.12.1",
"@types/hast": "^3.0.4"
}
},
"node_modules/side-channel": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
@@ -41794,6 +41902,60 @@
"is-typedarray": "^1.0.0"
}
},
"node_modules/typedoc": {
"version": "0.26.5",
"resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.26.5.tgz",
"integrity": "sha512-Vn9YKdjKtDZqSk+by7beZ+xzkkr8T8CYoiasqyt4TTRFy5+UHzL/mF/o4wGBjRF+rlWQHDb0t6xCpA3JNL5phg==",
"dependencies": {
"lunr": "^2.3.9",
"markdown-it": "^14.1.0",
"minimatch": "^9.0.5",
"shiki": "^1.9.1",
"yaml": "^2.4.5"
},
"bin": {
"typedoc": "bin/typedoc"
},
"engines": {
"node": ">= 18"
},
"peerDependencies": {
"typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x || 5.5.x"
}
},
"node_modules/typedoc/node_modules/brace-expansion": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
"dependencies": {
"balanced-match": "^1.0.0"
}
},
"node_modules/typedoc/node_modules/minimatch": {
"version": "9.0.5",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",
"integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==",
"dependencies": {
"brace-expansion": "^2.0.1"
},
"engines": {
"node": ">=16 || 14 >=14.17"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/typedoc/node_modules/yaml": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.5.0.tgz",
"integrity": "sha512-2wWLbGbYDiSqqIKoPjar3MPgB94ErzCtrNE1FdqGuaO0pi2JGjmE8aW8TDZwzU7vuxcGRdL/4gPQwQ7hD5AMSw==",
"bin": {
"yaml": "bin.mjs"
},
"engines": {
"node": ">= 14"
}
},
"node_modules/typescript": {
"version": "4.3.5",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.5.tgz",
@@ -41825,6 +41987,11 @@
"node": "*"
}
},
"node_modules/uc.micro": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz",
"integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A=="
},
"node_modules/uglify-js": {
"version": "1.3.5",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-1.3.5.tgz",
@@ -49820,6 +49987,18 @@
"@opentelemetry/sdk-metrics": "1.25.1"
}
},
"@opentelemetry/exporter-trace-otlp-http": {
"version": "0.52.1",
"resolved": "https://registry.npmjs.org/@opentelemetry/exporter-trace-otlp-http/-/exporter-trace-otlp-http-0.52.1.tgz",
"integrity": "sha512-05HcNizx0BxcFKKnS5rwOV+2GevLTVIRA0tRgWYyw4yCgR53Ic/xk83toYKts7kbzcI+dswInUg/4s8oyA+tqg==",
"requires": {
"@opentelemetry/core": "1.25.1",
"@opentelemetry/otlp-exporter-base": "0.52.1",
"@opentelemetry/otlp-transformer": "0.52.1",
"@opentelemetry/resources": "1.25.1",
"@opentelemetry/sdk-trace-base": "1.25.1"
}
},
"@opentelemetry/exporter-zipkin": {
"version": "1.25.1",
"resolved": "https://registry.npmjs.org/@opentelemetry/exporter-zipkin/-/exporter-zipkin-1.25.1.tgz",
@@ -50235,6 +50414,14 @@
}
}
},
"@shikijs/core": {
"version": "1.12.1",
"resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.12.1.tgz",
"integrity": "sha512-biCz/mnkMktImI6hMfMX3H9kOeqsInxWEyCHbSlL8C/2TR1FqfmGxTLRNwYCKsyCyxWLbB8rEqXRVZuyxuLFmA==",
"requires": {
"@types/hast": "^3.0.4"
}
},
"@sideway/address": {
"version": "4.1.4",
"resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.4.tgz",
@@ -50484,6 +50671,14 @@
"resolved": "https://registry.npmjs.org/@types/hammerjs/-/hammerjs-2.0.40.tgz",
"integrity": "sha512-VbjwR1fhsn2h2KXAY4oy1fm7dCxaKy0D+deTb8Ilc3Eo3rc5+5eA4rfYmZaHgNJKxVyI0f6WIXzO2zLkVmQPHA=="
},
"@types/hast": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz",
"integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==",
"requires": {
"@types/unist": "*"
}
},
"@types/istanbul-lib-coverage": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz",
@@ -50645,6 +50840,11 @@
"resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz",
"integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw=="
},
"@types/unist": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.2.tgz",
"integrity": "sha512-dqId9J8K/vGi5Zr7oo212BGii5m3q5Hxlkwy3WpYuKPklmBEvsbMYYyLxAQpSffdLl/gdW0XUpKWFvYmyoWCoQ=="
},
"@types/uuid": {
"version": "8.3.1",
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.1.tgz",
@@ -64086,6 +64286,14 @@
"resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz",
"integrity": "sha512-8ZmlJFVK9iCmtLz19HpSsR8HaAMWBT284VMNednLwlIMDP2hJDCIhUp0IZ2xUcZ+Ob6BM0VvCSJwzASDM45NLQ=="
},
"linkify-it": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.0.tgz",
"integrity": "sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==",
"requires": {
"uc.micro": "^2.0.0"
}
},
"listr2": {
"version": "3.14.0",
"resolved": "https://registry.npmjs.org/listr2/-/listr2-3.14.0.tgz",
@@ -64409,6 +64617,11 @@
"yallist": "^4.0.0"
}
},
"lunr": {
"version": "2.3.9",
"resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz",
"integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow=="
},
"luxon": {
"version": "3.4.4",
"resolved": "https://registry.npmjs.org/luxon/-/luxon-3.4.4.tgz",
@@ -64500,6 +64713,31 @@
"object-visit": "^1.0.0"
}
},
"markdown-it": {
"version": "14.1.0",
"resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.1.0.tgz",
"integrity": "sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==",
"requires": {
"argparse": "^2.0.1",
"entities": "^4.4.0",
"linkify-it": "^5.0.0",
"mdurl": "^2.0.0",
"punycode.js": "^2.3.1",
"uc.micro": "^2.1.0"
},
"dependencies": {
"argparse": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="
},
"entities": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz",
"integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw=="
}
}
},
"md5-file": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/md5-file/-/md5-file-5.0.0.tgz",
@@ -64522,6 +64760,11 @@
"integrity": "sha512-dn6wd0uw5GsdswPFfsgMp5NSB0/aDe6fK94YJV/AJDYXL6HVLWBsxeq7js7Ad+mU2K9LAlwpk6kN2D5mwCPVow==",
"dev": true
},
"mdurl": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz",
"integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w=="
},
"media-typer": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
@@ -68812,6 +69055,11 @@
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
},
"punycode.js": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/punycode.js/-/punycode.js-2.3.1.tgz",
"integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA=="
},
"pupa": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/pupa/-/pupa-2.1.1.tgz",
@@ -70498,6 +70746,15 @@
"optional": true,
"peer": true
},
"shiki": {
"version": "1.12.1",
"resolved": "https://registry.npmjs.org/shiki/-/shiki-1.12.1.tgz",
"integrity": "sha512-nwmjbHKnOYYAe1aaQyEBHvQymJgfm86ZSS7fT8OaPRr4sbAcBNz7PbfAikMEFSDQ6se2j2zobkXvVKcBOm0ysg==",
"requires": {
"@shikijs/core": "1.12.1",
"@types/hast": "^3.0.4"
}
},
"side-channel": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
@@ -76164,6 +76421,41 @@
"is-typedarray": "^1.0.0"
}
},
"typedoc": {
"version": "0.26.5",
"resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.26.5.tgz",
"integrity": "sha512-Vn9YKdjKtDZqSk+by7beZ+xzkkr8T8CYoiasqyt4TTRFy5+UHzL/mF/o4wGBjRF+rlWQHDb0t6xCpA3JNL5phg==",
"requires": {
"lunr": "^2.3.9",
"markdown-it": "^14.1.0",
"minimatch": "^9.0.5",
"shiki": "^1.9.1",
"yaml": "^2.4.5"
},
"dependencies": {
"brace-expansion": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
"requires": {
"balanced-match": "^1.0.0"
}
},
"minimatch": {
"version": "9.0.5",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",
"integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==",
"requires": {
"brace-expansion": "^2.0.1"
}
},
"yaml": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.5.0.tgz",
"integrity": "sha512-2wWLbGbYDiSqqIKoPjar3MPgB94ErzCtrNE1FdqGuaO0pi2JGjmE8aW8TDZwzU7vuxcGRdL/4gPQwQ7hD5AMSw=="
}
}
},
"typescript": {
"version": "4.3.5",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.5.tgz",
@@ -76175,6 +76467,11 @@
"integrity": "sha512-qLK/Xe9E2uzmYI3qLeOmI0tEOt+TBBQyUIAh4aAgU05FVYzeZrKUdkAZfBNVGRaHVgV0TDkdEngJSw/SyQchkQ==",
"dev": true
},
"uc.micro": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz",
"integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A=="
},
"uglify-js": {
"version": "1.3.5",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-1.3.5.tgz",
+2
View File
@@ -114,6 +114,7 @@
"@ngx-translate/core": "^13.0.0",
"@ngxs/store": "^3.8.2",
"@opentelemetry/exporter-metrics-otlp-http": "^0.52.1",
"@opentelemetry/exporter-trace-otlp-http": "^0.52.1",
"@opentelemetry/exporter-zipkin": "^1.25.1",
"@opentelemetry/resources": "^1.25.1",
"@opentelemetry/sdk-metrics": "^1.25.1",
@@ -209,6 +210,7 @@
"ts-jest": "^27.0.3",
"ts-jest-puppeteer": "^0.0.5",
"tslib": "^2.0.0",
"typedoc": "^0.26.5",
"uuidv4": "^6.2.11",
"videogular2": "^7.0.2",
"webpack": "^5.88.2",
-3
View File
@@ -1,3 +0,0 @@
import { Animation, AnimationController } from '@ionic/angular';
/* export const enterAnimation = (base) */
-8
View File
@@ -1,8 +0,0 @@
/* This file stores all the keys */
export class AuthConnstants{
/* My reference key */
public static readonly AUTH = 'userDataKey';
public static readonly PROFILE = 'profile';
public static readonly USER = 'userId';
public static readonly USERCHAT = 'userChat';
}
-29
View File
@@ -1,29 +0,0 @@
import { ChatSystemService } from "../services/chat/chat-system.service";
export class ChatController {
static ChatSystemService: ChatSystemService
static async createGroup(name) {
let data: any = await this.ChatSystemService.createGroup(name)
if(data?.error?.error == 'error-invalid-room-name') {
name = name.slice(0, 12)
data = await this.ChatSystemService.createGroup(name)
return {
data,
roomName: name
}
}
return {
data,
roomName: name
}
}
static async createOrFindGroup(name) {
let data: any = await this.createGroup(name)
}
}
+8 -8
View File
@@ -11,7 +11,7 @@ import { PermissionService } from '../services/permission.service';
import { BackgroundService } from 'src/app/services/background.service';
import { Storage } from '@ionic/storage';
import { EventsService } from 'src/app/services/events.service';
import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service';
// import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service';
import { ProcessesService } from 'src/app/services/processes.service';
import { RoleIdService } from 'src/app/services/role-id.service';
import { ActiveTabService } from 'src/app/services/active-tab.service';
@@ -98,7 +98,7 @@ export class HomePage implements OnInit {
private eventservice: EventsService,
private processservice: ProcessesService,
public RouteService: RouteService,
private RochetChatConnectorService: RochetChatConnectorService,
// private RochetChatConnectorService: RochetChatConnectorService,
private NetworkServiceService: NetworkServiceService,
public eventService: EventsService,
public ActiveTabService: ActiveTabService,
@@ -214,12 +214,12 @@ export class HomePage implements OnInit {
}
});
this.RochetChatConnectorService.registerCallback({
type: 'reConnect',
funx: async () => {
this.backgroundservice.online()
}
})
// this.RochetChatConnectorService.registerCallback({
// type: 'reConnect',
// funx: async () => {
// this.backgroundservice.online()
// }
// })
this.NetworkServiceService.onNetworkChange().subscribe((status) => {
if (status == ConnectionStatus.Online) {
@@ -0,0 +1,26 @@
import { Injectable } from '@angular/core';
import { FileType } from 'src/app/models/fileType';
@Injectable({
providedIn: 'root'
})
export class FilePickerWebService {
constructor() { }
getFileFromDevice(types: typeof FileType[]): Promise<File> {
let input = document.createElement('input');
input.type = 'file';
input.accept = types.join(', ')
input.click();
return new Promise((resolve, reject)=>{
input.onchange = async () => {
const file = Array.from(input.files)
resolve(file[0] as File);
};
})
}
}
@@ -16,7 +16,7 @@ import { SessionStore } from '../store/session.service';
import { environment } from "src/environments/environment";
import { PermissionService } from '../services/permission.service';
import { NetworkServiceService, ConnectionStatus } from 'src/app/services/network-service.service';
import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service';
// import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service';
@Injectable()
export class ChatTokenInterceptor implements HttpInterceptor {
@@ -29,8 +29,7 @@ export class ChatTokenInterceptor implements HttpInterceptor {
private excludedDomains = ['Login',environment.apiURL];// Add other domains as needed
constructor(private http: HttpClient, private router: Router, private p: PermissionService, private NetworkServiceService: NetworkServiceService,
private RochetChatConnectorService: RochetChatConnectorService) { }
constructor(private http: HttpClient, private router: Router, private p: PermissionService, private NetworkServiceService: NetworkServiceService) { }
intercept(
request: HttpRequest<any>,
-64
View File
@@ -1,64 +0,0 @@
import { AES, SHA1, enc } from "crypto-js";
import { environment } from 'src/environments/environment'
function prefix() {
return environment.version.lastCommitNumber + environment.id+"-";
}
export function GET({key, instance}) {
if(environment.storageProduction) {
try {
const newKey = prefix() + SHA1(key).toString()
const cipherText = localStorage.getItem(newKey)
const bytes = AES.decrypt(cipherText, newKey)
var decryptedData = bytes.toString(enc.Utf8);
const restoredData = JSON.parse(decryptedData)
Object.assign(instance, restoredData);
return restoredData
} catch(error) {
console.log(error)
return {}
}
} else {
const newKey = prefix() + key
const restoredData = JSON.parse(localStorage.getItem(newKey))
Object.assign(instance, restoredData);
return restoredData
}
}
export function SAVE({key, instance, dataToSave}) {
if(environment.storageProduction) {
const newKey = prefix() + SHA1(key).toString()
const stringifyData = JSON.stringify(dataToSave)
const cipherText = AES.encrypt(stringifyData, newKey).toString();
localStorage.setItem(newKey, cipherText)
} else {
const stringifyData = JSON.stringify(dataToSave)
const newKey = prefix() + key
localStorage.setItem(newKey, stringifyData)
}
}
export function DELETE({key, instance}) {
if(environment.storageProduction) {
const newKey = prefix() + SHA1(key).toString()
localStorage.removeItem(newKey)
} else {
const newKey = prefix() + key
localStorage.removeItem(newKey)
}
}
-116
View File
@@ -1,116 +0,0 @@
//import { models } from 'beast-orm'
import { environment } from 'src/environments/environment'
import { models } from 'src/plugin/src'
const { ArrayField, JsonField} = models.indexedDB.fields
export class MessageModel extends models.Model {
channels = ArrayField()
mentions = ArrayField()
msg = models.CharField()
sendAttempt = models.IntegerField()
rid = models.CharField()
t = models.CharField({default:'', blank: true})
ts = JsonField({blank:true})
u = JsonField()
_id = models.CharField({blank:true})
origin = models.CharField({blank:true})
_updatedAt = models.IntegerField()
messageSend = models.BooleanField()
offline = models.BooleanField()
hasFile = models.BooleanField({blank:true})
viewed = ArrayField({blank:true})
received = ArrayField({blank:true})
localReference = models.CharField({blank:true, unique: true})
attachments = ArrayField({blank:true})
file = JsonField({blank:true})
UploadAttachmentsTemp = models.IntegerField()
async getAttachments() {
console.log('this[id]', this['id'])
const _attachments = await attachments.filter({messageId: this['id']}).execute()
return _attachments[0]
}
}
export class attachments extends models.Model {
messageId = models.IntegerField()
attachments = ArrayField({blank:true})
file = JsonField({blank:true})
}
export class DeleteMessageModel extends models.Model {
messageId = models.CharField()
rid = models.CharField()
u = JsonField()
needToReceiveBy = ArrayField()
}
models.register({
databaseName: 'chat-storage'+environment.version.lastCommitNumber + environment.id + Number(environment.storageProduction),
type: 'indexedDB',
version: 11,
models: [MessageModel, DeleteMessageModel, attachments]
})
// // acçoes
export class ActionModel extends models.Model{
static $tableName = 'ActionModel11'
ProcessId = models.IntegerField({unique: true})
Description = models.CharField()
Detail = models.CharField()
DateBegin = models.CharField()
DateEnd = models.CharField()
ActionType = models.CharField()
}
export class PublicationFolderModel extends models.Model{
DateBegin = models.CharField()
Description = models.CharField()
Detail = models.CharField()
}
export class PublicationDetailsModel extends models.Model{
DateIndex = models.CharField()
DocumentId = models.IntegerField({unique: true})
ProcessId = models.CharField()
Title = models.CharField()
Message = models.CharField()
DatePublication = models.CharField()
OriginalFileName = models.CharField()
FileBase64 = models.CharField()
FileExtension = models.CharField()
OrganicEntityId = models.IntegerField()
}
export class WebtrixUserModel extends models.Model {
FullName = models.CharField()
Role = models.CharField()
}
models.register({
databaseName: 'webtrix'+environment.version.lastCommitNumber + environment.id + Number(environment.storageProduction),
type: 'indexedDB',
version: 1,
models: [WebtrixUserModel]
})
models.register({
databaseName: 'actions'+environment.version.lastCommitNumber + environment.id + Number(environment.storageProduction),
type: 'indexedDB',
version: 14,
models: [PublicationDetailsModel, ActionModel, PublicationFolderModel]
})
window["MessageModel"] = MessageModel
@@ -1,4 +1,5 @@
import { z } from "zod";
import { MessageAttachmentFileType, MessageAttachmentSource } from "./messageOutputDTO";
export const MessageInputDTOSchema = z.object({
roomId: z.string().uuid(),
@@ -8,7 +9,15 @@ export const MessageInputDTOSchema = z.object({
canEdit: z.boolean(),
oneShot: z.boolean(),
requireUnlock: z.boolean(),
requestId: z.string()
requestId: z.string(),
attachments: z.array(z.object({
fileType: z.nativeEnum(MessageAttachmentFileType),
source: z.nativeEnum(MessageAttachmentSource),
file: z.string(),
fileName: z.string(),
applicationId: z.string(),
docId: z.string()
})).optional()
});
@@ -41,8 +41,8 @@ export const MessageOutPutDataDTOSchema = z.object({
source: z.nativeEnum(MessageAttachmentSource),
file: z.string(),
fileName: z.string(),
applicationId: z.string(),
docId: z.string()
applicationId: z.string().optional(),
docId: z.string().optional()
}))
});
+19 -1
View File
@@ -1,4 +1,5 @@
import { z } from "zod";
import { MessageAttachmentFileType, MessageAttachmentSource } from "../../data/dto/message/messageOutputDTO";
const MessageEntitySchema = z.object({
$id: z.any().optional(),
@@ -16,7 +17,15 @@ const MessageEntitySchema = z.object({
wxeMail: z.string(),
userPhoto: z.string(),
}),
sending: z.boolean().optional()
sending: z.boolean().optional(),
attachments: z.array(z.object({
fileType: z.nativeEnum(MessageAttachmentFileType),
source: z.nativeEnum(MessageAttachmentSource),
file: z.string(),
fileName: z.string(),
applicationId: z.string(),
docId: z.string()
}))
})
type Message = z.infer<typeof MessageEntitySchema>;
@@ -41,6 +50,15 @@ export class MessageEntity implements Message {
sending: boolean = false
sendAttemp = 0
attachments: {
fileType: MessageAttachmentFileType,
source: MessageAttachmentSource,
file: string,
fileName: string,
applicationId?: string,
docId?: string
}[]
constructor() {}
get messageStatus() {
@@ -1,6 +1,7 @@
import { MessageInputDTO } from "../../data/dto/message/messageInputDtO";
import { MessageOutPutDataDTO } from "../../data/dto/message/messageOutputDTO";
import { MessageEntity } from "../entity/message";
import { attachments } from '../../../../../../../../../Downloads/equilibriumito-gabinete-digital-fo-23cf0fc4cbaa/equilibriumito-gabinete-digital-fo-23cf0fc4cbaa/src/app/models/beast-orm';
export class MessageMapper {
static toDomain(DTO: MessageOutPutDataDTO) : MessageEntity {
@@ -16,7 +17,8 @@ export class MessageMapper {
requireUnlock: entity.requireUnlock,
roomId: entity.roomId,
senderId: entity.sender.wxUserId,
requestId: requestId
requestId: requestId,
attachments: entity.attachments
}
}
}
@@ -20,7 +20,7 @@ export class MessageDeleteLiveUseCaseService {
public repository: MessageRepositoryService
) { }
@SafeValidateSchema(MessageDeleteInputDTOSchema, 'MessageDeleteLiveUseCaseService')
@SafeValidateSchema(MessageDeleteInputDTOSchema, 'MessageDeleteUseCaseService')
async execute(data: MessageDeleteInputDTO) {
return this.repository.sendMessageDelete(data)
}
@@ -41,7 +41,7 @@ export class SignalRService {
this.deadConnectionBackGround = new Subject()
this.deadConnectionBackGround.pipe(
switchMap(() => timer(300000)),
switchMap(() => timer(150000)),
).subscribe(() => {
this.newConnection()
})
@@ -16,7 +16,7 @@ import { ThemeService } from 'src/app/services/theme.service';
import { NgxMatDateFormats } from '@angular-material-components/datetime-picker';
import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker';
import { SessionStore } from 'src/app/store/session.service';
import { ChatMethodsService } from 'src/app/services/chat/chat-methods.service';
// import { ChatMethodsService } from 'src/app/services/chat/chat-methods.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
import { environment } from 'src/environments/environment';
import { ProcessesService } from 'src/app/services/processes.service';
@@ -124,7 +124,7 @@ export class NewEventPage implements OnInit {
private toastService: ToastService,
public ThemeService: ThemeService,
private platform: Platform,
private chatMethodService: ChatMethodsService,
// private chatMethodService: ChatMethodsService,
private hhtpErrorHandle: HttpErrorHandle,
private processeService: ProcessesService,
public TaskService: TaskService,
@@ -514,9 +514,9 @@ export class NewEventPage implements OnInit {
"calendarId": CalendarId
}
if (this.roomId) {
this.chatMethodService.sendMessage(this.roomId, data1);
}
// if (this.roomId) {
// this.chatMethodService.sendMessage(this.roomId, data1);
// }
this.hhtpErrorHandle.httpsSucessMessagge('new event');
let data = Object.assign(this.postEvent, { id: eventId })
@@ -823,9 +823,9 @@ export class NewEventPage implements OnInit {
"id": id,
"calendarId": CalendarId
}
if (this.roomId) {
this.chatMethodService.sendMessage(this.roomId, data);
}
// if (this.roomId) {
// this.chatMethodService.sendMessage(this.roomId, data);
// }
let dataa = Object.assign(this.postEvent, { id: eventId })
this.modalController.dismiss(dataa);
@@ -900,13 +900,13 @@ export class NewEventPage implements OnInit {
this.postEvent.IsAllDayEvent = this.allDayCheck;
this.postEvent.StartDate = this.setAlldayTime(this.postEvent.StartDate)
this.postEvent.EndDate = this.setAlldayTimeEndDate(this.postEvent.EndDate)
console.log('Recurso ativado!!');
} else {
this.postEvent.IsAllDayEvent = this.allDayCheck;
this.postEvent.EndDate = this.setAlldayTimeEndDateNotAlday(this.postEvent.EndDate)
console.log('Recurso desativado');
}
}
+14 -14
View File
@@ -10,7 +10,7 @@ import {
import { ModalController, Platform } from '@ionic/angular';
import { AuthService } from 'src/app/services/auth.service';
import { ChatService } from 'src/app/services/chat.service';
import { ChatSystemService } from 'src/app/services/chat/chat-system.service'
// import { ChatSystemService } from 'src/app/services/chat/chat-system.service'
import { GroupMessagesPage } from './group-messages/group-messages.page';
import { ContactsPage } from './messages/contacts/contacts.page';
import { MessagesPage } from './messages/messages.page';
@@ -117,7 +117,7 @@ export class ChatPage implements OnInit {
public ThemeService: ThemeService,
private dataService: DataService,
private router: Router,
public ChatSystemService: ChatSystemService,
// public ChatSystemService: ChatSystemService,
public RouteService: RouteService,
private RoomRepositoryService: RoomRepositoryService,
private messageLiveDataSourceService: MessageLiveDataSourceService,
@@ -272,7 +272,7 @@ export class ChatPage implements OnInit {
this.hideRefreshBtn = false;
this.closeAllDesktopComponents()
this.ChatSystemService.getRoomById(this.roomId)?.roomLeave()
// this.ChatSystemService.getRoomById(this.roomId)?.roomLeave()
}
else {
this.hideRefreshBtn = true;
@@ -446,19 +446,19 @@ export class ChatPage implements OnInit {
async closeNewEventComponentAndOpenChat({ roomId }) {
this.closeAllDesktopComponents();
this.ChatSystemService._group.forEach((room) => {
if (room.id == roomId) {
// this.ChatSystemService._group.forEach((room) => {
// if (room.id == roomId) {
this.openGroupMessagesPage(roomId)
}
})
// this.openGroupMessagesPage(roomId)
// }
// })
this.ChatSystemService._dm.forEach((room) => {
if (room.id == roomId) {
this.openMessagesPage(roomId)
}
})
// this.ChatSystemService._dm.forEach((room) => {
// if (room.id == roomId) {
// this.openMessagesPage(roomId)
// }
// })
}
@@ -582,7 +582,7 @@ export class ChatPage implements OnInit {
});
modal.onDidDismiss().then(() => {
this.ChatSystemService.currentRoom.roomLeave()
// this.ChatSystemService.currentRoom.roomLeave()
});
await modal.present();
}
@@ -7,7 +7,7 @@ import { ChatService } from 'src/app/services/chat.service';
import { GroupMessagesPage } from '../group-messages.page';
import { ThemeService } from 'src/app/services/theme.service'
import { SessionStore } from 'src/app/store/session.service';
import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
// import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
@Component({
selector: 'app-group-contacts',
@@ -44,7 +44,7 @@ export class GroupContactsPage implements OnInit {
private authService: AuthService,
private navParams: NavParams,
public ThemeService: ThemeService,
public ChatSystemService: ChatSystemService,
// public ChatSystemService: ChatSystemService,
)
{
@@ -25,7 +25,7 @@ import { SearchPage } from 'src/app/pages/search/search.page';
import { VoiceRecorder, RecordingData, GenericResponse } from 'capacitor-voice-recorder';
import { Filesystem, Directory } from '@capacitor/filesystem';
import { DomSanitizer } from '@angular/platform-browser';
import { MessageService } from 'src/app/services/chat/message.service';
// import { MessageService } from 'src/app/services/chat/message.service';
import { File } from '@awesome-cordova-plugins/file/ngx';
import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx';
import { SessionStore } from 'src/app/store/session.service';
@@ -1186,7 +1186,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
});
}
downloadFileMsg(msg: MessageService) {
downloadFileMsg(msg: any) {
msg.downloadFileMsg()
}
@@ -1198,7 +1198,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
downloadLink.click();
}
async openPreview(msg: MessageService) {
async openPreview(msg: any) {
if (msg?.file?.type === "application/webtrix") {
this.viewDocument(msg.file, msg.attachments.image_url)
@@ -5,7 +5,7 @@ import { AuthService } from 'src/app/services/auth.service';
import { ChatService } from 'src/app/services/chat.service';
import { MessagesPage } from '../messages.page';
import { ThemeService } from 'src/app/services/theme.service'
import { ChatSystemService} from 'src/app/services/chat/chat-system.service'
// import { ChatSystemService} from 'src/app/services/chat/chat-system.service'
import { SessionStore } from 'src/app/store/session.service';
@Component({
@@ -23,7 +23,7 @@ export class ContactsPage implements OnInit {
room:any;
dm:any;
sessionStore = SessionStore
userList = this.ChatSystemService.users
userList = []
constructor(
private modalController: ModalController,
@@ -31,7 +31,7 @@ export class ContactsPage implements OnInit {
private chatService: ChatService,
private authService: AuthService,
public ThemeService: ThemeService,
public ChatSystemService: ChatSystemService,
// public ChatSystemService: ChatSystemService,
)
{
this.loggedUser = SessionStore.user.ChatData['data'];
@@ -44,7 +44,7 @@ export class ContactsPage implements OnInit {
ngOnInit() {
// this.chatService.refreshtoken();
// this.loadUsers();
this.ChatSystemService.getUser()
// this.ChatSystemService.getUser()
}
@@ -52,10 +52,10 @@ export class ContactsPage implements OnInit {
this.textSearch = event.detail.value.toLowerCase();
this.userList = this.ChatSystemService.users.filter((e) => {
const username = e.name.toLowerCase()
return username.includes(this.textSearch)
})
// this.userList = this.ChatSystemService.users.filter((e) => {
// const username = e.name.toLowerCase()
// return username.includes(this.textSearch)
// })
}
@@ -97,10 +97,10 @@ export class ContactsPage implements OnInit {
this.chatService.createRoom(body).subscribe(async(res) => {
this.room = res['room'];
this.ChatSystemService.getAllRooms(() => {
this.getDirectMessage(this.room._id);
this.loading = false
}, this.room._id);
// this.ChatSystemService.getAllRooms(() => {
// this.getDirectMessage(this.room._id);
// this.loading = false
// }, this.room._id);
}, ()=> {
+124 -125
View File
@@ -19,8 +19,8 @@ import { ThemeService } from 'src/app/services/theme.service'
import { VoiceRecorder, RecordingData, GenericResponse } from 'capacitor-voice-recorder';
import { Haptics, ImpactStyle } from '@capacitor/haptics';
import { ViewEventPage } from 'src/app/modals/view-event/view-event.page';
import { ChatSystemService } from 'src/app/services/chat/chat-system.service'
import { MessageService } from 'src/app/services/chat/message.service';
// import { ChatSystemService } from 'src/app/services/chat/chat-system.service'
// import { MessageService } from 'src/app/services/chat/message.service';
import { FileType } from 'src/app/models/fileType';
import { SearchPage } from 'src/app/pages/search/search.page';
import { Storage } from '@ionic/storage';
@@ -33,7 +33,7 @@ import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx';
import { Filesystem, Directory, Encoding } from '@capacitor/filesystem';
import { NewEventPage } from '../../agenda/new-event/new-event.page';
import { NotificationsService } from 'src/app/services/notifications.service';
import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service'
// import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service'
import { FileValidatorService } from "src/app/services/file/file-validator.service"
import { sanitize } from "sanitize-filename-ts";
import { FilePicker } from '@capawesome/capacitor-file-picker';
@@ -141,7 +141,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
private gestureController: GestureController,
public ThemeService: ThemeService,
private platform: Platform,
public ChatSystemService: ChatSystemService,
// public ChatSystemService: ChatSystemService,
private storage: Storage,
//private fileOpener: FileOpener,
private sanitiser: DomSanitizer,
@@ -149,7 +149,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
private file: File,
private fileOpener: FileOpener,
private router: Router,
public RochetChatConnectorService: RochetChatConnectorService,
// public RochetChatConnectorService: RochetChatConnectorService,
private FileValidatorService: FileValidatorService,
///
private roomRepositoryService: RoomRepositoryService,
@@ -208,11 +208,11 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
// console.log(this.router.url);
this.createDirectoryImage()
// this.chatService.refreshtoken();
this.ChatSystemService.getUserOfRoom(this.roomId).then((value) => {
// this.ChatSystemService.getUserOfRoom(this.roomId).then((value) => {
}).catch((error) => {
console.error(error)
})
// }).catch((error) => {
// console.error(error)
// })
this.getChatMembers();
} catch (error) {
@@ -354,8 +354,8 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
}
deleteMessage(msgId: string) {
const room = this.ChatSystemService.getDmRoom(this.roomId)
this.alertService.confirmDeleteMessage(msgId, room);
// const room = this.ChatSystemService.getDmRoom(this.roomId)
// this.alertService.confirmDeleteMessage(msgId, room);
}
@@ -439,8 +439,8 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
}
sendMessage() {
this.ChatSystemService.getDmRoom(this.roomId).send({}).then(() => {
})
// this.ChatSystemService.getDmRoom(this.roomId).send({}).then(() => {
// })
}
/* sendMessage(msg) {
@@ -480,22 +480,22 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
const formData = new FormData();
formData.append("blobFile", blob);
this.ChatSystemService.getDmRoom(roomId).send({
file: {
"type": "application/audio",
"msDuration": audioFile.value.msDuration,
"mimeType": audioFile.value.mimeType,
},
attachments: [{
"title": sanitize(fileName),
"title_link_download": true,
"type": "audio"
}],
temporaryData: formData,
attachmentsModelData: {
fileBase64: encodedData,
}
})
// this.ChatSystemService.getDmRoom(roomId).send({
// file: {
// "type": "application/audio",
// "msDuration": audioFile.value.msDuration,
// "mimeType": audioFile.value.mimeType,
// },
// attachments: [{
// "title": sanitize(fileName),
// "title_link_download": true,
// "type": "audio"
// }],
// temporaryData: formData,
// attachmentsModelData: {
// fileBase64: encodedData,
// }
// })
});
this.deleteRecording();
@@ -575,8 +575,8 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
// this.showLoader = false;
// });
this.members = this.ChatSystemService.getDmRoom(this.roomId).members
this.dmUsers = this.ChatSystemService.getDmRoom(this.roomId).membersExcludeMe
// this.members = this.ChatSystemService.getDmRoom(this.roomId).members
// this.dmUsers = this.ChatSystemService.getDmRoom(this.roomId).membersExcludeMe
}
showDateDuration(start: any) {
@@ -644,20 +644,20 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
}
async bookMeeting() {
let attendees = this.ChatSystemService.getDmRoom(this.roomId).members.map((val) => {
return {
Name: val.name,
EmailAddress: val.username + "@" + environment.domain,
IsRequired: "true",
}
});
// let attendees = this.ChatSystemService.getDmRoom(this.roomId).members.map((val) => {
// return {
// Name: val.name,
// EmailAddress: val.username + "@" + environment.domain,
// IsRequired: "true",
// }
// });
this.popoverController.dismiss();
if (window.innerWidth <= 1024) {
const modal = await this.modalController.create({
component: NewEventPage,
componentProps: {
attendees: attendees,
// attendees: attendees,
roomId: this.roomId
},
cssClass: 'modal modal-desktop',
@@ -719,21 +719,21 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
const formData = new FormData();
formData.append("blobFile", blob);
this.ChatSystemService.getDmRoom(roomId).send({
file: {
"type": "application/img",
"guid": ''
},
attachments: [{
"title": "file.jpg",
"text": "description",
"title_link_download": false,
}],
temporaryData: formData,
attachmentsModelData: {
fileBase64: imageBase64,
}
})
// this.ChatSystemService.getDmRoom(roomId).send({
// file: {
// "type": "application/img",
// "guid": ''
// },
// attachments: [{
// "title": "file.jpg",
// "text": "description",
// "title_link_download": false,
// }],
// temporaryData: formData,
// attachmentsModelData: {
// fileBase64: imageBase64,
// }
// })
}
@@ -791,26 +791,26 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
if (data.selected) {
this.ChatSystemService.getDmRoom(roomId).send({
file: {
"name": res.data.selected.Assunto,
"type": "application/webtrix",
"ApplicationId": res.data.selected.ApplicationType,
"DocId": res.data.selected.Id,
"Assunto": res.data.selected.Assunto,
},
temporaryData: res,
attachments: [{
"title": res.data.selected.Assunto,
"description": res.data.selected.DocTypeDesc,
// "title_link": url_no_options,
"title_link_download": true,
"thumb_url": "https://static.ichimura.ed.jp/uploads/2017/10/pdf-icon.png",
// "message_link": url_no_options,
"text": res.data.selected.DocTypeDesc,
"type": "webtrix"
}],
})
// this.ChatSystemService.getDmRoom(roomId).send({
// file: {
// "name": res.data.selected.Assunto,
// "type": "application/webtrix",
// "ApplicationId": res.data.selected.ApplicationType,
// "DocId": res.data.selected.Id,
// "Assunto": res.data.selected.Assunto,
// },
// temporaryData: res,
// attachments: [{
// "title": res.data.selected.Assunto,
// "description": res.data.selected.DocTypeDesc,
// // "title_link": url_no_options,
// "title_link_download": true,
// "thumb_url": "https://static.ichimura.ed.jp/uploads/2017/10/pdf-icon.png",
// // "message_link": url_no_options,
// "text": res.data.selected.DocTypeDesc,
// "type": "webtrix"
// }],
// })
}
});
@@ -852,21 +852,21 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
formData.append("blobFile", blob);
//console.log('add file', formData)
this.ChatSystemService.getDmRoom(roomId).send({
file: {
"type": "application/img",
"guid": ''
},
temporaryData: formData,
attachments: [{
"title": file.path,
"text": "description",
"title_link_download": false,
}],
attachmentsModelData: {
fileBase64: imageBase64,
}
})
// this.ChatSystemService.getDmRoom(roomId).send({
// file: {
// "type": "application/img",
// "guid": ''
// },
// temporaryData: formData,
// attachments: [{
// "title": file.path,
// "text": "description",
// "title_link_download": false,
// }],
// attachmentsModelData: {
// fileBase64: imageBase64,
// }
// })
}
@@ -913,22 +913,22 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
formDataa.append('blobFile', blobb);
/* console.log('add file', fileBase64) */
this.ChatSystemService.getDmRoom(roomId).send({
file: {
"type": resultt.files[0].mimeType,
"guid": '',
},
attachments: [{
"title": sanitize(resultt.files[0].name),
"name": sanitize(resultt.files[0].name),
// "text": "description",
"title_link_download": false,
}],
temporaryData: formDataa,
attachmentsModelData: {
fileBase64: '',
}
})
// this.ChatSystemService.getDmRoom(roomId).send({
// file: {
// "type": resultt.files[0].mimeType,
// "guid": '',
// },
// attachments: [{
// "title": sanitize(resultt.files[0].name),
// "name": sanitize(resultt.files[0].name),
// // "text": "description",
// "title_link_download": false,
// }],
// temporaryData: formDataa,
// attachmentsModelData: {
// fileBase64: '',
// }
// })
return
}
@@ -964,22 +964,22 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
formData.append('blobFile', blob);
/* console.log('add file', fileBase64) */
this.ChatSystemService.getDmRoom(roomId).send({
file: {
"type": file.type,
"guid": '',
},
attachments: [{
"title": sanitize(fileName),
"name": sanitize(fileName),
// "text": "description",
"title_link_download": false,
}],
temporaryData: formData,
attachmentsModelData: {
fileBase64: encodedData,
}
});
// this.ChatSystemService.getDmRoom(roomId).send({
// file: {
// "type": file.type,
// "guid": '',
// },
// attachments: [{
// "title": sanitize(fileName),
// "name": sanitize(fileName),
// // "text": "description",
// "title_link_download": false,
// }],
// temporaryData: formData,
// attachmentsModelData: {
// fileBase64: encodedData,
// }
// });
} else {
this.toastService._badRequest("Ficheiro inválido")
}
@@ -1120,7 +1120,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
} */
downloadFileMsg(msg: MessageService) {
downloadFileMsg(msg: any) {
msg.downloadFileMsg();
}
@@ -1387,11 +1387,10 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
}
messageDelete({messageId}) {
messageDelete(message: MessageEntity) {
// this.messageRepositoryService.sendMessageDelete()
console.log('messageId', messageId)
this.chatServiceService.messageDelete({
messageId: messageId,
messageId: message.id,
roomId: this.roomId,
})
}
+94 -95
View File
@@ -3,7 +3,6 @@ import { ModalController, NavParams, PickerController, PopoverController } from
import { GroupDurationPage } from 'src/app/shared/popover/group-duration/group-duration.page';
import { GroupContactsPage } from '../group-messages/group-contacts/group-contacts.page';
import { ThemeService } from 'src/app/services/theme.service';
import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
import { SessionStore } from 'src/app/store/session.service';
import { ToastService } from 'src/app/services/toast.service';
import { catchError } from 'rxjs/operators';
@@ -30,7 +29,7 @@ export class NewGroupPage implements OnInit {
private modalController: ModalController,
private navParams: NavParams,
public ThemeService: ThemeService,
public ChatSystemService: ChatSystemService,
// public ChatSystemService: ChatSystemService,
private toastService: ToastService,
) {
this.loggedUserChat = SessionStore.user.ChatData['data'];
@@ -60,133 +59,133 @@ export class NewGroupPage implements OnInit {
async createGroup() {
let name = this.groupName.split(' ').join('-');
//Take out all special characters in string
name = name.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
// let name = this.groupName.split(' ').join('-');
// //Take out all special characters in string
// name = name.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
let customFields = {}
let res: any;
// let customFields = {}
// let res: any;
if(!SessionStore.user?.ChatData?.data) {
this.toastService._successMessage("Chat temporariamente indisponível")
}
// if(!SessionStore.user?.ChatData?.data) {
// this.toastService._successMessage("Chat temporariamente indisponível")
// }
try {
// try {
if (this.thedate) {
let customFields = {
"countDownDate": this.thedate
}
res = await this.ChatSystemService.createPrivateRoom(name, SessionStore.user.UserName, customFields);
}
else {
res = await this.ChatSystemService.createPrivateRoom(name, SessionStore.user.UserName, customFields);
}
// if (this.thedate) {
// let customFields = {
// "countDownDate": this.thedate
// }
// res = await this.ChatSystemService.createPrivateRoom(name, SessionStore.user.UserName, customFields);
// }
// else {
// res = await this.ChatSystemService.createPrivateRoom(name, SessionStore.user.UserName, customFields);
// }
try {
this.isGroupCreated = true;
this.addContacts(res.result);
this.ChatSystemService.getRoom([res.result]);
// try {
// this.isGroupCreated = true;
// this.addContacts(res.result);
// this.ChatSystemService.getRoom([res.result]);
setTimeout(() => {
this.ChatSystemService.subscribeToRoomUpdate(res.result.rid, res.result);
}, 10)
// setTimeout(() => {
// this.ChatSystemService.subscribeToRoomUpdate(res.result.rid, res.result);
// }, 10)
} catch (error) {
await this.ChatSystemService.getUser();
await this.ChatSystemService.getAllRooms();
await this.ChatSystemService.subscribeToRoom();
// } catch (error) {
// await this.ChatSystemService.getUser();
// await this.ChatSystemService.getAllRooms();
// await this.ChatSystemService.subscribeToRoom();
this.isGroupCreated = true;
this.addContacts(res.result);
this.ChatSystemService.getRoom([res.result]);
// this.isGroupCreated = true;
// this.addContacts(res.result);
// this.ChatSystemService.getRoom([res.result]);
setTimeout(() => {
this.ChatSystemService.subscribeToRoomUpdate(res.result.rid, res.result);
}, 10)
// setTimeout(() => {
// this.ChatSystemService.subscribeToRoomUpdate(res.result.rid, res.result);
// }, 10)
}
// }
if (res?.result?.rid) {
// if (res?.result?.rid) {
this.ChatSystemService.getAllRooms(() => {
if (!this.ChatSystemService.getGroupRoom(res.result.rid)) {
this.createGroupWithAttachmentsCath(res)
} else {
setTimeout(() => {
// this.ChatSystemService.getAllRooms(() => {
// if (!this.ChatSystemService.getGroupRoom(res.result.rid)) {
// this.createGroupWithAttachmentsCath(res)
// } else {
// setTimeout(() => {
this.createGroupWithAttachments(res)
// this.createGroupWithAttachments(res)
}, 500)
}
}, res.result.rid);
// }, 500)
// }
// }, res.result.rid);
} else {
// } else {
this.toastService._badRequest('Existe um grupo com este nome!');
// this.toastService._badRequest('Existe um grupo com este nome!');
}
// }
} catch(error) {
this.toastService._successMessage("Chat temporariamente indisponível")
}
// } catch(error) {
// this.toastService._successMessage("Chat temporariamente indisponível")
// }
}
createGroupWithAttachmentsCath(res: any) {
if (!this.ChatSystemService.getGroupRoom(res.result.rid)) {
setTimeout(() => {
this.createGroupWithAttachmentsCath(res)
}, 1500)
} else {
this.createGroupWithAttachments(res)
}
// if (!this.ChatSystemService.getGroupRoom(res.result.rid)) {
// setTimeout(() => {
// this.createGroupWithAttachmentsCath(res)
// }, 1500)
// } else {
// this.createGroupWithAttachments(res)
// }
}
createGroupWithAttachments(res: any) {
this.ChatSystemService.getGroupRoom(res.result.rid).hasLoadHistory = true;
// this.ChatSystemService.getGroupRoom(res.result.rid).hasLoadHistory = true;
if (this.documents) {
this.documents.forEach(element => {
this.ChatSystemService.getGroupRoom(res.result.rid).send({
file: {
"name": element.Assunto,
"type": "application/webtrix",
"ApplicationId": element.ApplicationId,
"DocId": element.DocId,
"Assunto": element.Assunto,
},
temporaryData: {
data: {
selected: {
Id: element.DocId,
ApplicationType: element.ApplicationId
}
}
},
attachments: [{
"title": element.Assunto,
"description": element.Assunto,
"title_link_download": true,
"type": "webtrix",
"text": element.Assunto,
"thumb_url": "https://static.ichimura.ed.jp/uploads/2017/10/pdf-icon.png",
}],
})
});
}
// if (this.documents) {
// this.documents.forEach(element => {
// this.ChatSystemService.getGroupRoom(res.result.rid).send({
// file: {
// "name": element.Assunto,
// "type": "application/webtrix",
// "ApplicationId": element.ApplicationId,
// "DocId": element.DocId,
// "Assunto": element.Assunto,
// },
// temporaryData: {
// data: {
// selected: {
// Id: element.DocId,
// ApplicationType: element.ApplicationId
// }
// }
// },
// attachments: [{
// "title": element.Assunto,
// "description": element.Assunto,
// "title_link_download": true,
// "type": "webtrix",
// "text": element.Assunto,
// "thumb_url": "https://static.ichimura.ed.jp/uploads/2017/10/pdf-icon.png",
// }],
// })
// });
// }
this.ChatSystemService.getAllRooms();
// this.ChatSystemService.getAllRooms();
setTimeout(() => {
this.groupName = ""
}, 150);
// setTimeout(() => {
// this.groupName = ""
// }, 150);
}
async addContacts(room) {
+3 -17
View File
@@ -11,15 +11,12 @@ import { ClearStoreService } from 'src/app/services/clear-store.service';
import { ChangeProfileService } from 'src/app/services/change-profile.service';
import { ThemeService } from 'src/app/services/theme.service';
import { PermissionService } from 'src/app/services/permission.service';
import { MessageModel, DeleteMessageModel } from '../../models/beast-orm';
import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service';
import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
// import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
import { ChatService } from 'src/app/services/chat.service';
import { NotificationHolderService } from 'src/app/store/notification-holder.service';
import { Platform } from '@ionic/angular';
import { FirstEnterService } from '../../services/first-enter.service';
import { Storage } from '@ionic/storage';
import { CPSession } from 'src/app/store/documentManagement';
import { StorageService } from 'src/app/services/storage.service';
import { DeviceService } from 'src/app/services/device.service'
import { Cy } from 'cypress/enum'
@@ -54,8 +51,7 @@ export class LoginPage implements OnInit {
private changeProfileService: ChangeProfileService,
public ThemeService: ThemeService,
public p: PermissionService,
private RochetChatConnectorService: RochetChatConnectorService,
public ChatSystemService: ChatSystemService,
// public ChatSystemService: ChatSystemService,
private ChatService: ChatService,
private platform: Platform,
private FirstEnterService: FirstEnterService,
@@ -141,16 +137,11 @@ export class LoginPage implements OnInit {
if (attempt.UserId == SessionStore.user.UserId) {
await this.authService.SetSession(attempt, this.userattempt);
/* CPSession.save(data) */
this.changeProfileService.run();
if (attempt.ChatData) {
try {
await MessageModel.deleteAll();
await DeleteMessageModel.deleteAll();
this.ChatSystemService.clearChat();
this.NotificationHolderService.clear()
await this.authService.loginToChatWs();
this.ChatService.setheader()
@@ -172,19 +163,14 @@ export class LoginPage implements OnInit {
} else {
this.RochetChatConnectorService.logout();
this.clearStoreService.clear();
this.ChatSystemService.clearChat();
// this.ChatSystemService.clearChat();
this.NotificationHolderService.clear()
SessionStore.delete();
window.localStorage.clear();
await MessageModel.deleteAll();
await DeleteMessageModel.deleteAll();
CPSession.clear();
this.storage.clear();
await this.authService.SetSession(attempt, this.userattempt);
/* CPSession.save(data) */
this.changeProfileService.run();
+5 -5
View File
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { AlertController, AnimationController } from '@ionic/angular';
import { ChatSystemService } from './chat/chat-system.service';
// import { ChatSystemService } from './chat/chat-system.service';
import { ToastService } from './toast.service';
@Injectable({
@@ -12,7 +12,7 @@ export class AlertService {
public alertController: AlertController,
private animationController: AnimationController,
private toastService: ToastService,
public ChatSystemService: ChatSystemService,
// public ChatSystemService: ChatSystemService,
) { }
async presentAlert(message:string) {
@@ -58,9 +58,9 @@ export class AlertService {
handler: () => {
//const loader = this.toastService.loading();
this.ChatSystemService.deleteMessage(msgId).then(() => {
room.deleteMessage(msgId)
}).catch((error) => console.error(error))
// this.ChatSystemService.deleteMessage(msgId).then(() => {
// room.deleteMessage(msgId)
// }).catch((error) => console.error(error))
//this.ChatSystemService.subscribeToRoomUpdate(room._id, room);
//loader.remove();
}
+50 -98
View File
@@ -7,20 +7,19 @@ import { BehaviorSubject, of } from 'rxjs';
import { AlertController, Platform } from '@ionic/angular';
import { SessionStore } from '../store/session.service';
import { AESEncrypt } from '../services/aesencrypt.service';
import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service';
// import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service';
import { Router } from '@angular/router';
import { NfService } from 'src/app/services/chat/nf.service';
import { MessageService } from 'src/app/services/chat/message.service';
// import { NfService } from 'src/app/services/chat/nf.service';
//import { MessageService } from 'src/app/services/chat/message.service';
import { ProcessesService } from 'src/app/services/processes.service';
import { AttachmentsService } from 'src/app/services/attachments.service';
import { RoomService } from './chat/room.service';
//import { RoomService } from './chat/room.service';
import { Storage } from '@ionic/storage';
import { InitialsService } from './functions/initials.service';
import { PermissionService } from './permission.service';
import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
// import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
import { captureException } from '@sentry/angular';
import { CPSession } from '../store/documentManagement';
import { catchError, tap } from 'rxjs/operators';
@Injectable({
providedIn: 'root'
@@ -40,15 +39,15 @@ export class AuthService {
private storageService: StorageService,
public alertController: AlertController,
private aesencrypt: AESEncrypt,
private RochetChatConnectorService: RochetChatConnectorService,
// private RochetChatConnectorService: RochetChatConnectorService,
private router: Router,
private NfService: NfService,
// private NfService: NfService,
private processesService: ProcessesService,
private AttachmentsService: AttachmentsService,
private storage: Storage,
private initialsService: InitialsService,
public p: PermissionService,
public ChatSystemService: ChatSystemService,
// public ChatSystemService: ChatSystemService,
private httpErroHandle: HttpErrorHandle,
private errorHandler: ErrorHandler,
private platform: Platform,) {
@@ -183,110 +182,63 @@ export class AuthService {
setTimeout(() => {
if (SessionStore.user.ChatData?.data) {
this.RochetChatConnectorService.logout();
this.RochetChatConnectorService.connect();
this.RochetChatConnectorService.login().then((message: any) => {
console.log('Chat login', message)
// this.RochetChatConnectorService.logout();
// this.RochetChatConnectorService.connect();
// this.RochetChatConnectorService.login().then((message: any) => {
// console.log('Chat login', message)
SessionStore.user.RochetChatUserId = message.result.id
SessionStore.save()
// SessionStore.user.RochetChatUserId = message.result.id
// SessionStore.save()
this.ChatSystemService.loadChat()
this.RochetChatConnectorService.setStatus('online')
window['RochetChatConnectorService'] = this.RochetChatConnectorService
setTimeout(() => {
this.ChatSystemService.getAllRooms();
this.RochetChatConnectorService.setStatus('online')
}, 200);
// this.ChatSystemService.loadChat()
// this.RochetChatConnectorService.setStatus('online')
// window['RochetChatConnectorService'] = this.RochetChatConnectorService
// setTimeout(() => {
// this.ChatSystemService.getAllRooms();
// this.RochetChatConnectorService.setStatus('online')
// }, 200);
}).catch((error) => {
console.error(SessionStore.user.ChatData, 'web socket login', error)
// }).catch((error) => {
// console.error(SessionStore.user.ChatData, 'web socket login', error)
if(window.location.pathname.includes('/home/')) {
setTimeout(() => {
this.loginToChatWs();
}, 4000)
}
// if(window.location.pathname.includes('/home/')) {
// setTimeout(() => {
// this.loginToChatWs();
// }, 4000)
// }
})
// })
}
// before sending a message with a attachment
this.NfService.beforeSendAttachment = async (message: MessageService, room?: RoomService) => {
8
// this.NfService.downloadFileMsg = async (message: MessageService, room?: RoomService) => {
if (message.hasFile) {
if (message.file.type != 'application/webtrix') {
const formData = message.temporaryData
// //
// let downloadFile = "";
// if (message.file.type == "application/img") {
// const event: any = await this.AttachmentsService.downloadFile(message.file.guid).toPromise();
try {
let guid: any = await this.AttachmentsService.uploadFile(formData).toPromise()
message.file.guid = guid.path
// if (event.type === HttpEventType.DownloadProgress) {
// //this.downloadProgess = Math.round((100 * event.loaded) / event.total);
// return true
// } else if (event.type === HttpEventType.Response) {
// downloadFile = 'data:image/jpeg;base64,' + btoa(new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), ''));
message.downloadFileMsg()
message.uploadingFile = false
// message.file = {
// guid: message.file.guid,
// image_url: downloadFile,
// type: message.file.type
// }
return true
} catch (e) {
window['e'] = e
console.error('BeforesendAtachment', e)
message.uploadingFile = false
this.httpErroHandle.httpStatusHandleUploadFile(e);
return false
}
} else {
try {
const res = message.temporaryData
let url = await this.processesService.GetDocumentUrl(res.data.selected.Id, res.data.selected.ApplicationType).toPromise();
let url_no_options: string = url.replace("webTRIX.Viewer", "webTRIX.Viewer.Branch1");
message.attachments[0].title_link = url_no_options
message.attachments[0].message_link = url_no_options
message.uploadingFile = false
return true
} catch (e) {
window['e'] = e
console.error('BeforesendAtachment', e)
message.uploadingFile = false
this.httpErroHandle.httpStatusHandleUploadFile(e);
return false
}
}
}
return false
}
this.NfService.downloadFileMsg = async (message: MessageService, room?: RoomService) => {
//
let downloadFile = "";
if (message.file.type == "application/img") {
const event: any = await this.AttachmentsService.downloadFile(message.file.guid).toPromise();
if (event.type === HttpEventType.DownloadProgress) {
//this.downloadProgess = Math.round((100 * event.loaded) / event.total);
return true
} else if (event.type === HttpEventType.Response) {
downloadFile = 'data:image/jpeg;base64,' + btoa(new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), ''));
message.file = {
guid: message.file.guid,
image_url: downloadFile,
type: message.file.type
}
return true
}
return false
}
};
// return true
// }
// return false
// }
// };
}, 1)
}
+3 -2
View File
@@ -9,7 +9,7 @@ import { PermissionService } from './permission.service';
import { SessionStore } from '../store/session.service';
import { ChangeProfileService } from 'src/app/services/change-profile.service';
import { NetworkServiceService , ConnectionStatus} from 'src/app/services/network-service.service';
import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service';
// import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service';
@Injectable({
providedIn: 'root'
@@ -31,7 +31,8 @@ export class ChatService {
public p: PermissionService,
private changeProfileService: ChangeProfileService,
private NetworkServiceService: NetworkServiceService,
private RochetChatConnectorService: RochetChatConnectorService) {
// private RochetChatConnectorService: RochetChatConnectorService
) {
this.changeProfileService.registerCallback(() => {
this.setheader();
@@ -1,16 +0,0 @@
import { TestBed } from '@angular/core/testing';
import { ChangeMessageQueueService } from './change-message-queue.service';
describe('ChangeMessageQueueService', () => {
let service: ChangeMessageQueueService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(ChangeMessageQueueService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
@@ -1,8 +0,0 @@
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class ChangeMessageQueueService {
constructor() {}
}
@@ -1,16 +0,0 @@
import { TestBed } from '@angular/core/testing';
import { ChatMethodsService } from './chat-methods.service';
describe('ChatMethodsService', () => {
let service: ChatMethodsService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(ChatMethodsService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
@@ -1,55 +0,0 @@
import { Injectable } from '@angular/core';
import { ChatService } from '../chat.service';
import { v4 as uuidv4 } from 'uuid'
@Injectable({
providedIn: 'root'
})
export class ChatMethodsService {
constructor(
private chatService: ChatService) {
}
sendMessage(roomId:string, data:any) {
let body = {
"message":
{
"rid": roomId,
"msg":"",
"file": {
"type": "application/meeting",
"subject": data.subject,
"start_date": data.start,
"end_date": data.end,
"venue": data.venue,
"id": data.id,
"calendarId": data.calendarId
}
}
}
this.chatService.sendMessage(body).subscribe(res=> {});
}
send({roomId, msg, attachments = null, file = null, localReference = null}) {
let body = {
"message":
{
rid: roomId,
localReference: localReference,
msg: msg,
attachments,
file
}
}
return this.chatService.sendMessage(body)
}
deleteMessage(body) {
return this.chatService.deleteMessage(body)
}
}
@@ -1,16 +0,0 @@
import { TestBed } from '@angular/core/testing';
import { ChatSystemService } from './chat-system.service';
describe('ChatSystemService', () => {
let service: ChatSystemService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(ChatSystemService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
@@ -1,813 +0,0 @@
import { Injectable } from '@angular/core';
import { RoomService } from './room.service';
import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service';
import { MessageService } from 'src/app/services/chat/message.service';
import { SessionStore } from 'src/app/store/session.service';
import { capitalizeTxt } from 'src/plugin/text';
import { Update as room } from 'src/app/models/chatMethod';
import { Storage } from '@ionic/storage';
import { ModalController, NavController, Platform } from '@ionic/angular';
import { SqliteService } from 'src/app/services/sqlite.service';
import { ChatService } from 'src/app/services/chat.service';
import { NativeNotificationService } from 'src/app/services/native-notification.service';
import { SortService } from '../functions/sort.service';
import { chatUser } from 'src/app/models/chatMethod';
import { NfService } from 'src/app/services/chat/nf.service'
import { ChangeProfileService } from '../change-profile.service';
import { ChatMethodsService } from './chat-methods.service';
import { AESEncrypt } from '../aesencrypt.service'
import { AttachmentsService } from 'src/app/services/attachments.service';
import { NetworkServiceService } from 'src/app/services/network-service.service';
import { ViewedMessageService } from './viewed-message.service'
import { NotificationsService } from '../notifications.service';
import { Subscribe } from '../subcribe';
import { Plugins } from '@capacitor/core';
const { App } = Plugins;
@Injectable({
providedIn: 'root'
})
export class ChatSystemService {
dm: { [key: string]: RoomService } = {}
group: { [key: string]: RoomService } = {}
_dm: RoomService[] = []
_group: RoomService[] = []
loadingWholeList = false;
dmCount = 0;
groupCount = 0;
currentRoom: RoomService = null
users: chatUser[] = []
sessionStore = SessionStore
delete = []
loadingUsers = false
onRoomsLoad = new Subscribe({ execute: false, deleteOnExecute: true })
private mainChangeDetector: Function = () => {}
constructor(
private RochetChatConnectorService: RochetChatConnectorService,
private storage: Storage,
private platform: Platform,
private sqlservice: SqliteService,
private NativeNotificationService: NativeNotificationService,
private sortService: SortService,
private ChatService: ChatService,
private NfService: NfService,
private changeProfileService: ChangeProfileService,
private chatService: ChatService,
private ChatMethodsService: ChatMethodsService,
private AESEncrypt: AESEncrypt,
private AttachmentsService: AttachmentsService,
private NetworkServiceService: NetworkServiceService,
private ViewedMessageService: ViewedMessageService,
private notificationService: NotificationsService,
private modalController: ModalController,
private navController: NavController
) {
// this.RochetChatConnectorService.registerCallback({
// type: 'reConnect',
// funx: async () => {
// /**
// * @description when the phone is in the background for a long time it could disconnects from the socket then the socket reconnects automatically,
// * when the connection is lost the subscribe is also lost, so we have to subscribe again when reconnection is establish.
// */
// this.RochetChatConnectorService.setStatus('online')
// this.getUserStatus();
// await this.chatService.refreshtoken();
// this.getUser();
// this.getAllRooms();
// this.subscribeToRoom();
// //
// if (this.currentRoom) {
// this.currentRoom.loadHistory({ forceUpdate: true })
// }
// for (const id in this.dm) {
// this.dm[id].hasLoadHistory = false
// }
// for (const id in this.group) {
// this.group[id].hasLoadHistory = false
// }
// }
// })
// if (this.sessionStore.user.Inactivity) {
// this.loadChat();
// }
// if (SessionStore.user?.ChatData?.data) {
// this.restoreRooms();
// }
// document.addEventListener('resume', () => {
// this.RochetChatConnectorService.setStatus('online')
// if (this._dm?.length == 0 && this._group?.length == 0) {
// if (SessionStore.user?.ChatData?.data) {
// this.getAllRooms();
// }
// }
// });
// try {
// if (!this.platform.is('desktop')) {
// App.addListener('appStateChange', ({ isActive }) => {
// if (isActive) {
// // The app is in the foreground.
// console.log('App is in the foreground');
// if (SessionStore.user?.ChatData?.data) {
// this.currentRoom?.loadHistory({ forceUpdate: true })
// }
// setTimeout(() => {
// if (SessionStore.user?.ChatData?.data) {
// this.subscribeToRoom()
// this.RochetChatConnectorService.setStatus('online')
// }
// }, 1000);
// /* this.reloadComponent(true) */
// } else {
// // The app is in the background.
// console.log('App is in the background');
// // You can perform actions specific to the background state here.
// }
// });
// }
// } catch(error) {}
}
loadChat() {
// if (SessionStore.user?.ChatData?.data) {
// this.ReLoadChat()
// }
}
private async ReLoadChat() {
// if (SessionStore.user?.ChatData?.data) {
// this.getUserStatus();
// await this.chatService.refreshtoken();
// this.restoreUsers();
// await this.getUser();
// await this.restoreRooms();
// await this.getAllRooms();
// this.subscribeToRoom();
// }
//
}
clearChat() {
// this.dm = {}
// this.group = {}
// this._dm = []
// this._group = []
// this.loadingWholeList = false;
// this.dmCount = 0;
// this.groupCount = 0;
// this.currentRoom = null
// this.users = []
// this.storage.remove('Users');
}
openRoom(roomId) {
if (this.currentRoom) {
this.currentRoom.roomLeave()
}
if (this.getDmRoom(roomId)) {
this.currentRoom = this.getDmRoom(roomId)
} else if (this.getGroupRoom(roomId)) {
this.currentRoom = this.getGroupRoom(roomId)
}
this.currentRoom.open()
}
getRoomById(roomId) {
if (this.getDmRoom(roomId)) {
return this.getDmRoom(roomId)
} else if (this.getGroupRoom(roomId)) {
return this.getGroupRoom(roomId)
}
}
async restoreRooms() {
// try {
// const _rooms = await this.storage.get('Rooms');
// if (_rooms) {
// for (let roomData of this.sortArrayISODate(_rooms)) {
// await this.prepareRoom(roomData);
// }
// }
// } catch (e) { }
}
async restoreUsers() {
const users = await this.storage.get('Users');
if (users) {
this.users = users
}
}
sortArrayISODate(messages: any): any[] {
return messages.sort((a, b) =>
new Date(b._updatedAt).getTime()
-
new Date(a._updatedAt).getTime())
}
async getAllRooms(callback: Function = () => { }, roomIdCallback = "") {
this.loadingWholeList = true
var rooms;
if (this.RochetChatConnectorService.isLogin) {
try {
rooms = await this.RochetChatConnectorService.getRooms();
} catch (error) {
this.loadingWholeList = false
console.error('chatgetrooms', error)
}
try {
await this.storage.remove('Rooms');
} catch (e) { }
}
let index = 0
let _rooms = rooms?.result?.update
if (_rooms) {
_rooms = _rooms.map(e => {
e["_updatedAt"] = e._updatedAt || e._updatedAt['$date']
return e
})
for (let roomData of this.sortArrayISODate(_rooms)) {
const roomId = this.getRoomId(roomData);
if (roomData.t == 'd') {
await this.prepareRoom(roomData);
} else {
if (roomData.t === 'p') {
await this.prepareRoom(roomData);
}
else {
await this.prepareRoom(roomData);
}
}
if (roomId == roomIdCallback) {
callback()
}
index++;
}
}
this.loadingWholeList = false
this.sortRoomList()
await this.storage.set('Rooms', _rooms);
this.onRoomsLoad.executor()
}
async getRoom(_rooms: any) {
this.loadingWholeList = true
let index = 0
if (_rooms) {
_rooms = _rooms.map(e => {
e["_updatedAt"] = e._updatedAt || e._updatedAt['$date']
return e
})
for (let roomData of this.sortArrayISODate(_rooms)) {
if (roomData.t == 'd') {
await this.prepareRoom(roomData);
} else {
if (roomData.t === 'p') {
await this.prepareRoom(roomData);
}
else {
await this.prepareRoom(roomData);
}
}
index++;
}
}
this.loadingWholeList = false
this.sortRoomList()
this.onRoomsLoad.executor()
}
/**
* @description sort room list by last message date
*/
sortRoomList = () => {
this._dm = this.sortService.sortDate(this._dm, '_updatedAt').reverse()
this._group = this.sortService.sortDate(this._group, '_updatedAt').reverse()
}
/**
* @description subscribe all room
*/
subscribeToRoom() {
// if (SessionStore.user?.ChatData?.data) {
// for (const id in this.dm) {
// this.defaultSubtribe(id)
// }
// for (const id in this.group) {
// this.defaultSubtribe(id)
// }
// this.RochetChatConnectorService.streamNotifyLogged().then((subscription => { }))
// this.RochetChatConnectorService.subStreamMessageUser().then((subscription => {
// console.log({subscription})
// }))
// } else {
// setTimeout(() => {
// throw ('No chat data');
// }, 1000)
// }
}
/**
* @description when a new room is create, needs to subtribe in order to receive updates
* @param id
* @param roomData
*/
subscribeToRoomUpdate(id, roomData) {
// this.defaultSubtribe(id);
// this.prepareRoom(roomData);
// this.getGroupRoom(id).loadHistory({});
}
/**
* @deprecated things a room need to subscribe on
* @param id room id
*/
private defaultSubtribe(id: any) {
// const room = this.getRoomById(id);
// if (!room.subscribeAttempt) {
// try {
// room.subscribeAttempt = true;
// } catch (error) {
// console.log("error")
// }
// this.RochetChatConnectorService.streamRoomMessages(id).then((subscription) => {
// room.status.receive.message = true;
// })
// this.RochetChatConnectorService.subStreamNotifyRoom(id, 'typing', false).then((subscription) => {
// room.status.receive.typing = true;
// //
// })
// this.RochetChatConnectorService.subStreamNotifyRoom(id, 'readMessage', false).then((subscription) => {
// room.status.receive.readMessage = true;
// })
// this.RochetChatConnectorService.streamNotifyRoomDeleteMessage(id).then((subscription) => {
// room.status.receive.deleteMessage = true;
// })
// }
}
private fix_updatedAt(message) {
if (message.result) {
message.result._updatedAt = message.result._updatedAt['$date']
} else if (message._updatedAt) {
if (message._updatedAt.hasOwnProperty('$date')) {
message._updatedAt = message._updatedAt['$date']
}
}
return message
}
/**
* @description create a representation of an room in these instance this.dm, this.group ...
* @param roomData
*/
prepareRoom(roomData) {
/**
* @description data used to define or create room
*/
roomData = this.fix_updatedAt(roomData)
const setData = {
customFields: roomData.customFields,
id: this.getRoomId(roomData),
name: this.getRoomName(roomData),
t: roomData.t,
lastMessage: this.getRoomLastMessage(roomData),
_updatedAt: new Date(roomData._updatedAt || roomData._updatedAt['$date']),
u: roomData.u || {},
members: [],
membersExcludeMe: []
}
let roomId = this.getRoomId(roomData);
let chat = false
if (roomData?.usernames) {
if (roomData?.usernames?.includes("chat.admin")) {
chat = true
}
}
if (setData.name != 'Rocket Cat' && setData.name != 'general' && chat == false) {
// create room
if (!this.roomExist(roomId)) {
let room: RoomService = new RoomService(this.RochetChatConnectorService, new MessageService(this.NfService, this.RochetChatConnectorService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService, this.NetworkServiceService, this, this.notificationService), this.storage, this.platform, this.sqlservice, this.NativeNotificationService, this.sortService, this.ChatService, this.NfService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService, this.NetworkServiceService, this, this.ViewedMessageService, this.notificationService,this.modalController,this.navController)
room.setData(setData)
room.receiveMessage()
room.getAllUsers = this.getUsers
room.receiveMessageDelete();
room.sortRoomList = this.sortRoomList
room.chatServiceDeleteRoom = this.deleteRoom
room.isGroup = !this.isIndividual(roomData)
room.info()
// create individual room
if (this.isIndividual(roomData)) {
this.dm[roomId] = room
this._dm.push(room)
this.dmCount++
} else {
// create group room
this.group[roomId] = room
this._group.push(room)
this.groupCount++
}
this.defaultSubtribe(roomId)
} else {
// in this case room is already present, therefor it will only be necessary,
// to redefine
if (this.dm[roomId]) {
this.dm[roomId].setData(setData)
} else if (this.group[roomId]) {
this.group[roomId].setData(setData)
}
}
}
}
deleteRoom = (roomId) => {
this.delete.push(roomId)
delete this.group[roomId];
this._group = this._group.filter((e) => e.id != roomId);
}
deleteRecently(roomId) {
return this.delete.includes(roomId)
}
roomExist(roomId) {
return this.dm[roomId]?.id || this.group[roomId]?.id
}
getReceptorName(roomData) {
try {
return roomData.usernames.find((e) => e != SessionStore.user.UserName)
} catch (e) {
return '*'
}
}
/**
* @description update user status. this method is called once only
* @param id user ID
*/
private getUserStatus(id?: string) {
this.RochetChatConnectorService.getUserStatus(async (d) => {
const userId = d.fields.args[0][0]
const username = d.fields.args[0][1]
let statusNum = d.fields.args[0][2]
const statusText = this.statusNumberToText(statusNum)
for (const user in this.users) {
if (this.users[user]._id == userId) {
this.users[user].status = statusText
}
}
this.getUser()
})
}
getUserByName(username) {
return this.users.find((user) => user.username == username)
}
/**
* @description convert rocketchat statues num to readable string
* @param text
* @returns
*/
statusNumberToText(text) {
if (text == '0') {
return "offline"
}
else if (text == '1') {
return "online"
}
else if (text == '2') {
return "away"
}
else if (text == '3') {
return "busy"
}
}
deleteMessage(id?) {
return this.RochetChatConnectorService.deleteMessage(id);
}
leaveRoom(id?) {
return this.RochetChatConnectorService.leaveRoom(id);
}
async hideRoom(id) {
this._dm.forEach((md, index) => {
if (md.id == id) {
this._dm.splice(index, 1)
delete this.dm[id]
}
});
this._group.forEach((group, index) => {
if (group.id == id) {
this._group.splice(index, 1)
delete this.group[id]
}
})
}
hidingRoom(id?) {
return this.RochetChatConnectorService.hidingRoom(id).then(() => {
// this.hideRoom(id)
})
}
addRoomOwner(roomid, userId) {
return this.RochetChatConnectorService.addRoomOwner(roomid, userId);
}
createPrivateRoom(groupName, username, customFields) {
return this.RochetChatConnectorService.createPrivateRoom(groupName, username, customFields);
}
getDmRoom(id): RoomService {
try {
return this.dm[id]
} catch (e) { }
}
getGroupRoom(id): RoomService {
try {
return this.group[id]
} catch (e) { }
}
getRoomName(roomData: room): string {
if (this.isIndividual(roomData)) {
const names: String[] = roomData.usernames
if (roomData.t == 'd') {
const username = roomData.usernames.find(e => e != SessionStore.user.UserName)
try {
const firstName = capitalizeTxt(username.split('.')[0])
const lastName = capitalizeTxt(username.split('.')[1])
return firstName + ' ' + lastName
} catch (error) {
const username = roomData.usernames.find(e => e != SessionStore.user.UserName)
const firstName = capitalizeTxt(username.split('.')[0])
return firstName
}
} else {
if (roomData.t === 'p') {
return 'Loading'
}
else {
return 'Loading'
}
}
} else {
return roomData.fname
}
}
getRoomId(roomData: room) {
return roomData._id
}
getRoomLastMessage(roomData: room): any {
return roomData.lastMessage
}
private isIndividual(roomData: room) {
return !roomData.fname
}
getUsers = () => {
return this.users
}
async getUser() {
this.loadingUsers = true
let _res
try {
_res = await this.ChatService.getAllUsers().toPromise();
} catch (error) {
await this.chatService.refreshtoken();
_res = await this.ChatService.getAllUsers().toPromise();
}
let users: chatUser[] = _res['users'].filter(data => data.username != SessionStore.user.UserName);
users = users.filter((data) => !(data.name == 'Rocket.Cat' || data.name == 'Administrator'))
const userIds = this.users.map((user) => user._id)
for (let UserUpdate of users) {
if (userIds.includes(UserUpdate._id)) {
for (var index = 0; index < this.users.length; index++) {
if (UserUpdate._id == this.users[index]._id) {
this.users[index] = UserUpdate
}
}
} else {
this.users.push(UserUpdate)
}
}
this.users = this.users.sort((a, b) => {
if (a.name < b.name) {
return -1;
}
if (a.name > b.name) {
return 1;
}
return 0;
});
await this.storage.set('Users', this.users);
this.loadingUsers = false
}
getUserOfRoom(roomId) {
return this.RochetChatConnectorService.getUserOfRoom(roomId);
}
async createGroup(name) {
const res: any = await this.createPrivateRoom(name, SessionStore.user.UserName, {});
if (res?.result?.rid) {
try {
await this.getAllRooms();
} catch (e) { }
return res
} else {
return res
}
}
async createGroup__(name, customFields = {}) {
const res: any = await this.createPrivateRoom(name, SessionStore.user.UserName, customFields);
console.log('room is created', res)
if (res?.result?.rid) {
try {
await this.getAllRooms();
return res
} catch (e) { }
console.log('room is loaded')
return res
} else {
return res
}
}
getGroupByName(name) {
return this._group.find(e => e.name == name)
}
async waitRoomToCreate(rid): Promise<RoomService> {
return new Promise(async (resolve, reject) => {
let sub;
sub = this.onRoomsLoad.subscribe(() => {
const room = this.getRoomById(rid)
if (room) {
resolve(room)
sub.unSubscribe()
}
})
try {
await this.getAllRooms();
} catch (e) { }
})
}
searchContact(name, username) {
return this.users.find(e => e.name == name || e.username == username)
}
}
@@ -1,16 +0,0 @@
import { TestBed } from '@angular/core/testing';
import { MessageService } from './message.service';
describe('MessageService', () => {
let service: MessageService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(MessageService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
File diff suppressed because it is too large Load Diff
-16
View File
@@ -1,16 +0,0 @@
import { TestBed } from '@angular/core/testing';
import { NfService } from './nf.service';
describe('NfService', () => {
let service: NfService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(NfService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
-25
View File
@@ -1,25 +0,0 @@
import { Injectable } from '@angular/core';
import { MessageService } from './message.service';
import { RoomService } from './room.service';
@Injectable({
providedIn: 'root'
})
export class NfService {
beforeSendAttachment = async (message: MessageService, room?: RoomService): Promise<boolean> => new Promise ((resolve, reject)=> (resolve(true)));
downloadFileMsg = async (message: MessageService, room?: RoomService): Promise<boolean> => new Promise ((resolve, reject)=> (resolve(true)));
fix_updatedAt(message) {
if (message?.result) {
message.result._updatedAt = message.result._updatedAt['$date']
} else if(message?._updatedAt) {
if(message._updatedAt.hasOwnProperty('$date')) {
message._updatedAt = message._updatedAt['$date']
}
}
return message
}
constructor() { }
}
@@ -1,16 +0,0 @@
import { TestBed } from '@angular/core/testing';
import { RochetChatConnectorService } from './rochet-chat-connector.service';
describe('RochetChatConnectorService', () => {
let service: RochetChatConnectorService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(RochetChatConnectorService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
@@ -1,961 +0,0 @@
import { Injectable } from '@angular/core';
import { v4 as uuidv4 } from 'uuid'
import { wsCallbacksParams, msgQueue, send } from 'src/app/models/rochet-chat-cliente-service'
import { deepFind } from 'src/plugin/deep'
import { environment } from 'src/environments/environment';
import { SessionStore } from 'src/app/store/session.service';
import { chatHistory, Rooms } from 'src/app/models/chatMethod';
import { BackgroundService } from '../background.service';
@Injectable({
providedIn: 'root'
})
export class RochetChatConnectorService {
isLogin = false;
loginResponse = {}
constructor(private backgroundservice: BackgroundService,) {
}
reConnect() {
}
connect() {
// dont connect if is already connected
if (this.ws.connected == true) {
return false
}
this.ws.connect();
const message = {
msg: "connect",
version: "1",
support: ["1"]
}
this.ws.send({ message, loginRequired: false, requestId: 'connectMessage' })
this.ws.send({ message: { msg: "pong" }, loginRequired: false, requestId: 'connectPong' })
this.ws.registerCallback({
type: 'Onmessage',
key: 'ping-pong',
funx: (message: any) => {
if (message.msg == "ping") {
this.ws.send({ message: { msg: "pong" }, loginRequired: false })
}
}
})
}
wsSend({ message, requestId = uuidv4(), loginRequired = true }: send) {
// this.ws.send({ message: { msg: "pong" }, loginRequired: false })
}
login() {
// dont login if is already login
if (this.isLogin == true) {
return new Promise((resolve, reject) => {
resolve(this.loginResponse)
})
}
const requestId = uuidv4()
//
const message = {
msg: "method",
method: "login",
id: requestId,
params: [
{
user: { email: SessionStore.user.Email },
password: SessionStore.user.Password
}
]
}
this.ws.send({ message, requestId: 'login', loginRequired: false })
return new Promise((resolve, reject) => {
//
this.ws.registerCallback({
type: 'Onmessage', funx: (message) => {
//
if (message.id == requestId) { // same request send
//
//
if (message.result) {
if (message.result.token) {
this.isLogin = true
this.loginResponse = message
setTimeout(() => {
this.ws.wsMsgQueue()
}, 10)
resolve(message)
//
}
} else {
this.isLogin = false
//
reject(message)
}
reject(message)
return true
}
}
})
});
}
getRooms(roomOlder = 1480377601) {
//const requestId = uuidv4()
const requestId = uuidv4()
const message = {
"msg": "method",
"method": "rooms/get",
"id": requestId,
"params": [{ "$date": 1480377601 }]
}
this.ws.send({ message, requestId })
return new Promise<Rooms>((resolve, reject) => {
this.ws.registerCallback({
type: 'Onmessage', funx: (message) => {
if (message.id == requestId) { // same request send
resolve(message)
return true
}
}
})
});
}
readMessage(roomId) {
//const requestId = uuidv4()
const requestId = uuidv4()
const message = {
"msg": "method",
"method": "readMessages",
"params": [roomId, []],
"id": requestId
}
this.ws.send({ message, requestId })
return new Promise<Rooms>((resolve, reject) => {
this.ws.registerCallback({
type: 'Onmessage', funx: (message) => {
if (message.id == requestId) { // same request send
resolve(message)
return true
}
}
})
});
}
getUserOfRoom(roomId) {
//const requestId = uuidv4()
const requestId = uuidv4()
const message = {
"msg": "method",
"method": "getUsersOfRoom",
"id": requestId,
"params": [
roomId,
false,
{
"limit": 100,
"skip": 0
}]
}
this.ws.send({ message, requestId })
return new Promise<Rooms>((resolve, reject) => {
this.ws.registerCallback({
type: 'Onmessage', funx: (message) => {
if (message.id == requestId) { // same request send
resolve(message)
return true
}
}
})
});
}
logout() {
this.isLogin = false
this.ws.connected = false
this.ws.disconnect()
}
// send message to room
send({ roomId, msg, attachments = null, file = null, localReference = null }) {
//const requestId = uuidv4()
const requestId = uuidv4()
var message = {
msg: "method",
method: "sendMessage",
id: requestId,
params: [{
rid: roomId,
localReference: localReference,
msg: msg,
attachments,
file
}]
}
//
// this.ws.send({ message, requestId });
return new Promise((resolve, reject) => {
this.ws.registerCallback({
type: 'Onmessage', funx: (message) => {
if (message.id == requestId) { // same request send
resolve({ message, requestId })
return true
}
}
})
});
}
updateMessage(messageObject) {
//const requestId = uuidv4()
const requestId = uuidv4()
var message = {
msg: "method",
method: "updateMessage",
id: requestId,
params: [messageObject]
}
this.ws.send({ message, requestId });
return new Promise((resolve, reject) => {
this.ws.registerCallback({
type: 'Onmessage', funx: (message) => {
if (message.id == requestId) { // same request send
resolve({ message, requestId })
return true
}
}
})
})
}
leaveRoom(roomId) {
const requestId = uuidv4()
var message = {
msg: "method",
method: "leaveRoom",
id: requestId,
params: [
roomId,
]
}
this.ws.send({ message, requestId });
return new Promise((resolve, reject) => {
this.ws.registerCallback({
type: 'Onmessage', funx: (message) => {
if (message.id == requestId) { // same request send
resolve(message)
return true
}
}
})
});
}
addRoomOwner(roomId, userId) {
const requestId = uuidv4()
var message = {
msg: "method",
method: "addRoomOwner",
id: requestId,
params: [
roomId,
userId
]
}
this.ws.send({ message, requestId });
return new Promise((resolve, reject) => {
this.ws.registerCallback({
type: 'Onmessage', funx: (message) => {
if (message.id == requestId) { // same request send
resolve(message)
return true
}
}
})
});
}
hidingRoom(roomId) {
const requestId = uuidv4()
var message = {
msg: "method",
method: "hideRoom",
id: requestId,
params: [roomId]
}
this.ws.send({ message, requestId });
return new Promise((resolve, reject) => {
this.ws.registerCallback({
type: 'Onmessage', funx: (message) => {
if (message.id == requestId) { // same request send
resolve(message)
//
return true
}
}
})
});
}
joinRoom() { }
deleteMessage(msgId) {
//const requestId = uuidv4();
const requestId = uuidv4()
var message = {
msg: "method",
method: "deleteMessage",
id: requestId,
params: [{ "_id": msgId }]
}
this.ws.send({ message, requestId });
return new Promise((resolve, reject) => {
this.ws.registerCallback({
type: 'Onmessage', funx: (message) => {
if (message.id == requestId) {
resolve(message)
return true
}
}
})
});
}
createPrivateRoom(groupName, username, customFields) {
const requestId = uuidv4()
var message = {
msg: "method",
method: "createPrivateGroup",
id: requestId,
params: [
groupName,
[username],
false,
customFields,
{
"broadcast": false,
"encrypted": false
}
]
}
this.ws.send({ message, requestId });
return new Promise((resolve, reject) => {
this.ws.registerCallback({
type: 'Onmessage', funx: (message) => {
if (message.id == requestId) { // same request send
resolve(message)
return true
}
}
})
});
}
sendStreamNotifyRoom(roomId: string, username, event: 'typing', param: any) {
const requestId = uuidv4()
let message = {
msg: "method",
method: "stream-notify-room",
id: requestId,
params: [
`${roomId}/${event}`,
username,
param
]
};
this.ws.send({ message, requestId })
return new Promise((resolve, reject) => {
this.ws.registerCallback({
type: 'Onmessage', funx: (message) => {
if (message.id == requestId) { // same request send
resolve(message)
return true
}
}
})
});
}
subStreamNotifyRoom(roomId: string, event: 'typing' | 'deleteMessage' | 'readMessage', param: any) {
const requestId = uuidv4()
let message = {
msg: "sub",
id: requestId,
name: "stream-notify-room",
params: [
`${roomId}/${event}`,
param
]
}
this.ws.send({ message, requestId })
return new Promise((resolve, reject) => {
this.ws.registerCallback({
type: 'Onmessage', funx: (message) => {
if (message.id == requestId) { // same request send
resolve(message)
return true
}
if (message.id == requestId || message?.subs?.[0] == requestId) { // same request send
resolve(message)
return true
}
}
})
});
}
subStreamNotifyUser(param?: any) {
const requestId = uuidv4()
let message = {
msg: "sub",
id: requestId,
name: "stream-notify-user",
params: [
`${SessionStore.user.ChatData.data.userId}/notification`,
param
]
}
this.ws.send({ message, requestId })
return new Promise((resolve, reject) => {
this.ws.registerCallback({
type: 'Onmessage', funx: (message) => {
if (message.id == requestId) { // same request send
resolve(message)
return true
}
}
})
});
}
subStreamMessageUser(param?: any) {
const requestId = uuidv4()
try {
let message = {
msg: "sub",
id: requestId,
name: "stream-notify-user",
params: [
`${SessionStore.user.ChatData.data.userId}/message`,
param
]
}
this.ws.send({ message, requestId })
return new Promise((resolve, reject) => {
this.ws.registerCallback({
type: 'Onmessage', funx: (message) => {
if (message.id == requestId) { // same request send
resolve(message)
return true
}
}
})
});
} catch (error) {
throw (SessionStore)
}
}
receiveStreamNotifyRoom(funx: Function) {
this.ws.registerCallback({
type: 'Onmessage',
funx: (message) => {
if (message.collection == "stream-notify-room" && message.msg == 'changed') {
funx(message)
}
}
})
}
getUserStatus(funx: Function) {
this.ws.registerCallback({
type: 'Onmessage',
funx: (message) => {
if (message.msg == 'changed' && message.collection == "stream-notify-logged") {
funx(message)
}
}
})
}
loadHistory(roomId, limit: number = 50) {
const requestId = uuidv4()
const message = {
msg: "method",
method: "loadHistory",
id: requestId,
params: [
roomId,
null,
limit,
{
"$date": 1480377601
}
]
}
this.ws.send({ message, requestId: 'loadHistory' })
return new Promise<chatHistory>((resolve, reject) => {
this.ws.registerCallback({
type: 'Onmessage', funx: (message) => {
//
if (message.id == requestId) { // same request send
resolve(message)
return true
}
}
})
});
}
loadHistoryUnread(roomId, limit: number = 50) {
const requestId = uuidv4()
const message = {
msg: "method",
method: "loadHistory",
id: requestId,
params: [
roomId,
null,
limit,
{
"$date": 1480377601
}
]
}
this.ws.send({ message, requestId: 'loadHistory' })
return new Promise<chatHistory>((resolve, reject) => {
this.ws.registerCallback({
type: 'Onmessage', funx: (message) => {
//
if (message.id == requestId) { // same request send
resolve(message)
return true
}
}
})
});
}
setStatus(status: 'online' | 'busy' | 'away' | 'offline') {
const requestId = uuidv4()
const message = {
msg: "method",
method: `UserPresence:setDefaultStatus`,
id: requestId,
params: [status]
}
this.ws.send({ message, requestId })
}
subscribeNotifyRoom(roomId: string) {
const requestId = uuidv4()
var message = {
"msg": "sub",
"id": requestId,
"name": "stream-notify-room",
"params": [
`${roomId}/event`,
false
]
}
this.ws.send({ message, requestId });
return new Promise((resolve, reject) => {
this.ws.registerCallback({
type: 'Onmessage', funx: (message) => {
if (message.msg == 'ready' || deepFind(message, 'subs.0') == requestId) { // same request send
resolve(message)
return true
}
}
})
});
}
updateRoomEventss(roomId, collection: string, funx: Function,) {
this.ws.registerCallback({
type: 'Onmessage',
funx: (message) => {
//
if (message.msg == 'changed' && message.collection == collection) {
if (message.fields.args[0].rid == roomId) {
funx(message)
}
else if (message.fields.eventName == `${roomId}/deleteMessage`) {
funx(message)
}
}
}
})
}
streamRoomMessages(roomId: string) {
const requestId = "streamRoomMessages" + uuidv4()
const message = {
"msg": "sub",
"id": requestId,
"name": "stream-room-messages",
"params": [
`${roomId}`,
false
]
}
this.ws.send({ message, requestId });
return new Promise((resolve, reject) => {
this.ws.registerCallback({
type: 'Onmessage', funx: (message) => {
if (message.id == requestId || message?.subs?.[0] == requestId) { // same request send
resolve(message)
return true
}
}
})
});
}
streamNotifyLogged() {
const requestId = uuidv4()
const message = {
"msg": "sub",
"id": requestId,
"name": "stream-notify-logged",
"params": [
"user-status",
false
]
}
this.ws.send({ message, requestId });
return new Promise((resolve, reject) => {
this.ws.registerCallback({
type: 'Onmessage', funx: (message) => {
if (message.id == requestId) { // same request send
resolve(message)
return true
}
}
})
});
}
streamNotifyRoom(roomId: string) {
const requestId = uuidv4()
let message = {
"msg": "method",
"method": "stream-notify-room",
"id": requestId,
"params": [
`null/typing`,
"paulo.pinto",
true
]
};
this.ws.send({ message, requestId })
return new Promise((resolve, reject) => {
this.ws.registerCallback({
type: 'Onmessage', funx: (message) => {
if (message.id == requestId) { // same request send
resolve(message)
return true
}
}
})
});
}
streamNotifyRoomDeleteMessage(roomId: string) {
const requestId = uuidv4()
let message = {
"msg": "sub",
"id": requestId,
"name": "stream-notify-room",
"params": [
`${roomId}/deleteMessage`,
true
]
};
this.ws.send({ message, requestId })
return new Promise((resolve, reject) => {
this.ws.registerCallback({
type: 'Onmessage', funx: (message) => {
if (message.id == requestId) { // same request send
resolve(message)
return true
}
}
})
});
}
registerCallback(data: wsCallbacksParams) {
return this.ws.registerCallback(data)
}
// socket class ==================================================================
private socket!: WebSocket;
private wsMsgQueue: { [key: string]: msgQueue } = {}
private wsCallbacks: { [key: string]: wsCallbacksParams } = {}
private wsReconnect = 0
private n = 0
ws = {
connected: false,
registerCallback: (params: wsCallbacksParams) => {
let id = params.requestId || params.key || uuidv4()
//
this.wsCallbacks[id] = params
this.n++
return id
},
connect: () => {
this.socket = new WebSocket(environment.apiWsChatUrl);
// bind function
this.socket.onopen = this.ws.onopen;
this.socket.onmessage = this.ws.onmessage;
this.socket.onclose = this.ws.onclose;
this.socket.onerror = this.ws.onerror;
},
onopen: async () => {
this.ws.connected = true
this.backgroundservice.online();
setTimeout(() => {
this.ws.wsMsgQueue()
}, 10)
console.log('rec conect')
if (this.wsReconnect >= 1) {
for (const [key, value] of Object.entries(this.wsCallbacks)) {
if (value.type == 'reConnect') {
const dontRepeat = await value.funx()
if (dontRepeat) {
this.n--
delete this.wsCallbacks[key]
}
}
}
}
this.wsReconnect++;
},
wsMsgQueue: () => {
for (const [key, item] of Object.entries(this.wsMsgQueue)) {
if (item.loginRequired == true && this.isLogin == true) {
//
this.ws.send(item);
delete this.wsMsgQueue[key]
} else if (item.loginRequired == false) {
//
this.ws.send(item);
delete this.wsMsgQueue[key]
}
}
},
send: ({ message, requestId = uuidv4(), loginRequired = true }: send) => {
if (this.ws.connected == false || loginRequired == true && this.isLogin == false) { // save data to send when back online
//
//
this.wsMsgQueue[requestId] = { message, requestId, loginRequired }
} else {
let messageStr = JSON.stringify(message)
this.socket.send(messageStr)
}
return requestId
},
onmessage: async (event: any) => {
this.backgroundservice.online();
const data = JSON.parse(event.data)
for (const [key, value] of Object.entries(this.wsCallbacks)) {
if (value.type == 'Onmessage') {
const dontRepeat = await value.funx(data)
if (dontRepeat) {
delete this.wsCallbacks[key]
this.n--
}
}
}
},
onclose: async (event: any) => {
this.ws.connected = false
this.isLogin = false
this.connect()
this.login()
for (const [key, value] of Object.entries(this.wsCallbacks)) {
if (value.type == 'Offline') {
const dontRepeat = await value.funx()
if (dontRepeat) {
delete this.wsCallbacks[key]
this.n--
}
}
}
},
onerror: (event: any) => {
},
disconnect: () => {
if (this.socket) {
this.socket.onopen = (event: any) => { }
this.socket.onmessage = (event: any) => { }
this.socket.onclose = (event: any) => { }
this.socket.onerror = (event: any) => { }
this.socket.close()
}
}
}
}
@@ -1,16 +0,0 @@
import { TestBed } from '@angular/core/testing';
import { RoomService } from './room.service';
describe('RoomService', () => {
let service: RoomService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(RoomService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
File diff suppressed because it is too large Load Diff
@@ -1,16 +0,0 @@
import { TestBed } from '@angular/core/testing';
import { ViewedMessageService } from './viewed-message.service';
describe('ViewedMessageService', () => {
let service: ViewedMessageService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(ViewedMessageService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
@@ -1,81 +0,0 @@
import { Injectable } from '@angular/core';
import * as FIFOProcessQueue from 'fifo-process-queue';
import { RoomService } from './room.service';
@Injectable({
providedIn: 'root'
})
export class ViewedMessageService {
constructor() {
}
viewQueue = FIFOProcessQueue(async ({room, userId, statusNum, statusText}, callback) => {
if(room.membersExcludeMe?.map) {
const membersIds = room.membersExcludeMe.map((user)=> user._id)
if(membersIds.includes(userId)) {
if(statusText != 'offline') {
room.deleteMessageToReceive(userId)
}
let n = 0
for (const message of room.messages) {
if(message.online) {
for(let id of membersIds) {
if(message.addReceived(id)) {
n++
// setTimeout(async() => {
await message.saveChanges()
// }, 100 * n)
}
}
}
}
setTimeout(function () {
callback();
}, 100);
}
}
})
viewReadQueue = FIFOProcessQueue(async ({room}, callback) => {
const membersIds: string[] = room.membersExcludeMe.map((user)=> user._id)
let n = 0
for (const message of room.messages) {
if(message.online) {
for(let id of membersIds) {
if(message.addViewed(id)) {
message.addReceived(id)
n++
// setTimeout(async() => {
await message.saveChanges()
// }, 100 * n)
}
}
}
}
setTimeout(() => {
callback()
},100)
})
request(room:RoomService, userId, statusNum, statusText) {
this.viewQueue.push({room, userId, statusNum, statusText})
}
requestReadAll(room:RoomService) {
this.viewReadQueue.push({room})
}
}
+10 -15
View File
@@ -78,12 +78,12 @@ export class FileService {
path: IMAGE_DIR,
directory: Directory.Data,
}).then(result => {
let lastphoto = result.files[result.files.length - 1]
resolve(lastphoto)
},
async (err) => {
reject('ERROR FILE DOSENT EXIST')
// Folder does not yet exists!
await Filesystem.mkdir({
@@ -127,7 +127,7 @@ export class FileService {
//new method 4
async loadFileData(fileName: string) {
// for (let f of fileNames) {
const filePath = `${IMAGE_DIR}/${fileName}`;
@@ -139,7 +139,7 @@ export class FileService {
data: `data:image/jpeg;base64,${readFile.data}`,
};
const capturedImage = image.data
@@ -150,9 +150,7 @@ export class FileService {
}
getFileFromDevice(types: typeof FileType[]) {
getFileFromDevice(types: typeof FileType[]): Promise<File> {
const input = this.fileLoaderService.createInput({
accept: types
})
@@ -168,9 +166,6 @@ export class FileService {
}
getFileFromDeviceBase64(types: typeof FileType[]) {
const input = this.fileLoaderService.createInput({
accept: types
@@ -199,7 +194,7 @@ export class FileService {
})
}
viewDocumentByUrl(url) {
const browser = this.iab.create(url,"_parent");
@@ -254,8 +249,8 @@ export class FileService {
dataURLtoFile(dataurl, filename) {
var arr = dataurl.split(','),
mime = arr[0].match(/:(.*?);/)[1],
bstr = atob(arr[arr.length - 1]),
n = bstr.length,
bstr = atob(arr[arr.length - 1]),
n = bstr.length,
u8arr = new Uint8Array(n);
while(n--){
u8arr[n] = bstr.charCodeAt(n);
@@ -267,11 +262,11 @@ export class FileService {
contentType = contentType || '';
const byteCharacters = atob(base64Data);
const byteArray = new Uint8Array(byteCharacters.length);
for (let i = 0; i < byteCharacters.length; i++) {
byteArray[i] = byteCharacters.charCodeAt(i);
}
return new Blob([byteArray], { type: contentType });
}
+21 -19
View File
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { ChatService } from '../chat.service';
import { ChatSystemService } from '../chat/chat-system.service';
// import { ChatSystemService } from '../chat/chat-system.service';
@Injectable({
providedIn: 'root'
@@ -9,8 +9,10 @@ export class TimeService {
countDownTime: any;
room: any;
constructor(private chatService: ChatService,
public ChatSystemService: ChatSystemService,) { }
constructor(
//private chatService: ChatService,
//public ChatSystemService: ChatSystemService,
) { }
showDateDuration(start:any) {
let end;
@@ -42,7 +44,7 @@ export class TimeService {
}
countDownDate(date:any, roomId:string){
let difference = new Date(date).getTime() - new Date().getTime();
let c_day = Math.floor(difference/(1000*60*60*24));
let c_hours = Math.floor((difference % (1000*60*60*24)) / (1000*60*60));
@@ -55,22 +57,22 @@ export class TimeService {
this.countDownTime = "Expired";
let body = { "roomId":roomId, }
this.chatService.getRoomInfo(roomId).subscribe(room=>{
this.room = room['room'];
// this.chatService.getRoomInfo(roomId).subscribe(room=>{
// this.room = room['room'];
if(this.room.t === 'p'){
this.chatService.deleteGroup(body).subscribe(res=>{
});
}
else{
this.chatService.deleteChannel(body).subscribe(res=>{
});
}
});
// if(this.room.t === 'p'){
// this.chatService.deleteGroup(body).subscribe(res=>{
// });
// }
// else{
// this.chatService.deleteChannel(body).subscribe(res=>{
// });
// }
// });
}
return this.countDownTime;
}
@@ -97,7 +99,7 @@ export class TimeService {
// });
// }
// else{
// this.chatService.deleteChannel(body).subscribe(res=>{
// this.ChatSystemService.deleteRoom(roomId)
// });
@@ -8,7 +8,6 @@ import { context, trace, propagation } from '@opentelemetry/api';
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
// const { OTLPTraceExporter: OTLPTraceExporterProto } = require("@opentelemetry/exporter-trace-otlp-proto");
function createProvider(serviceName) {
const provider = new WebTracerProvider({
resource: new Resource({
@@ -1,16 +0,0 @@
import { TestBed } from '@angular/core/testing';
import { NewChatSystemService } from './new-chat-system.service';
describe('NewChatSystemService', () => {
let service: NewChatSystemService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(NewChatSystemService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
@@ -1,11 +0,0 @@
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class NewChatSystemService {
constructor(
) { }
}
+1 -4
View File
@@ -16,8 +16,7 @@ import { AngularFireMessaging } from '@angular/fire/messaging';
import { NotificationHolderService } from 'src/app/store/notification-holder.service';
import { ChatService } from 'src/app/services/chat.service';
import { FCM } from '@capacitor-community/fcm';
import { ChatSystemService } from './chat/chat-system.service';
import {ChatController} from 'src/app/controller/chat'
// import { ChatSystemService } from './chat/chat-system.service';
@Injectable({
providedIn: 'root'
@@ -43,8 +42,6 @@ export class NotificationsService {
notificationReceived: EventEmitter<void> = new EventEmitter<void>();
token = ''
ChatController = ChatController
constructor(
private http: HttpClient,
private storageService: StorageService,
-1
View File
@@ -10,7 +10,6 @@ import { GetTasksListType } from '../models/GetTasksListType';
import { fullTaskList } from '../models/dailyworktask.model';
import { ChangeProfileService } from './change-profile.service';
import { SessionStore } from '../store/session.service';
import { CPSession } from '../store/documentManagement';
@Injectable({
providedIn: 'root'
})
@@ -1,16 +0,0 @@
import { TestBed } from '@angular/core/testing';
import { WebNotificationsService } from './webnotifications.service';
describe('WebNotificationsService', () => {
let service: WebNotificationsService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(WebNotificationsService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
@@ -1,213 +0,0 @@
import { Injectable, NgZone } from '@angular/core';
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
import { environment } from 'src/environments/environment';
import { StorageService } from 'src/app/services/storage.service';
import { AuthConnstants } from 'src/app/config/auth-constants';
import { Tokenn } from '../models/token.model';
import { ModalController, AlertController, AnimationController, Platform } from '@ionic/angular';
import { NavigationExtras, Router } from '@angular/router';
import { ToastService } from './toast.service';
@Injectable({
providedIn: 'root'
})
export class WebNotificationsService {
adding: "intervenient" | "CC" = "intervenient";
folderId: string;
constructor(
private http: HttpClient,
private storageService: StorageService,
private modalController: ModalController,
public modalCtrl: AlertController,
private animationController: AnimationController,
private platform: Platform,
private router: Router,
private toastService: ToastService) { }
webconnection() {
var inicializeObj = {
appId: "com.gpr.gabinetedigital",
mfpContextRoot: "/mfp",
/* serverUrl: "http://gpr-dev-10.gabinetedigital.local:9080",
safariWebsitePushId: "http://gpr-dev-10.gabinetedigital.local:9080", */
}
/* MFPPush.initialize({
appId: "com.gpr.gabinetedigital",
mfpContextRoot: "/mfp",
}); */
/* MFPPush.registerDevice()
.then((res) => {
setTimeout(()=>{
MFPPush.registerDevice()
.then((res) => {
})
.catch((err) => {
});
}, 1000)
})
.catch((err) => {
}); */
}
/* getTokenByUserIdAndId(user, userID) {
const geturl = environment.apiURL + 'notifications/user/' + userID;
return this.http.get<Token[]>(`${geturl}`);
} */
/* getAndpostToken(username) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
} else {
const geturl = environment.apiURL + 'notifications/token'; */
/*
window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then(
(token) => {
MFPPush.initialize(
function (successResponse) {
},
function (failureResponse) {
}
);
MFPPush.registerDevice(null, (successResponse) => {
this.storageService.store(username, successResponse.deviceId);
this.storageService.get(username).then(value => {
this.storageService.get(AuthConnstants.USER).then(res => {
const headers = { 'Authorization': 'Basic cGF1bG8ucGludG9AZ2FiaW5ldGVkaWdpdGFsLmxvY2FsOnRhYnRlc3RlQDAwNg==' };
const body = {
UserId: res.UserId,
TokenId: successResponse.deviceId,
Status: 1,
Service: 1
};
this.http.post<Token>(`${geturl}`, body, { headers }).subscribe(data => {
})
});
});
},
function (failureResponse) {
}
);
}, (error) => {
}
);
}
} */
/*
async onReceviNotification() {
window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then(
(token) => {
MFPPush.initialize(
function (successResponse) {
MFPPush.registerNotificationsCallback(notificationReceived);
},
function (failureResponse) {
}
);
var notificationReceived = (message) => {
var data = JSON.parse(message.payload);
if(message.actionName){
this.notificatinsRoutes(data);
} else {
this.toastService.notificationMessage(message.alert,this.notificatinsRoutes, data);
}
}
}, (error) => {
}
);
} */
/* notificatinsRoutes = (data) => {
if (data.Service === "agenda") {
this.zone.run(() => this.router.navigate(['/home/agenda', data.IdObject, 'agenda']));
}
else if (data.Service === "gabinete-digital" && data.Object === "expediente") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expediente',data.IdObject,'gabinete-digital']));
}
else if (data.Service === "gabinete-digital" && data.Object === "event-list") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/event-list/approve-event',data.IdObject, 'gabinete-digital']));
}else if (data.Service === "gabinete-digital" && data.Object === "despachos") {
let navigationExtras: NavigationExtras = {
queryParams: {
"serialNumber": data.IdObject,
}
};
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos/despacho'], navigationExtras));
}
else if (data.Service === "gabinete-digital" && data.Object === "parecer") {
let navigationExtras: NavigationExtras = {
queryParams: {
enterAnimation: "",
serialNumber: data.IdObject,
}
};
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos/pedido'], navigationExtras));
}
else if (data.Service === "gabinete-digital" && data.Object === "deferimento") {
let navigationExtras: NavigationExtras = {
queryParams: {
enterAnimation: "",
serialNumber: data.IdObject,
}
};
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos/pedido'], navigationExtras));
}
else if (data.Service === "accoes" && data.Object === "accao") {
this.zone.run(() => this.router.navigate(['/home/publications',data.IdObject]));
}
else if (data.Service === "accoes" && data.Object === "publicacao") {
this.zone.run(() => this.router.navigate(['/home/publications/view-publications',data.FolderId,data.IdObject]));
}
}
platformVerify() {
if (this.platform.is('cordova')) {
} else {
}
} */
}
@@ -24,7 +24,7 @@ import { ViewChild } from '@angular/core';
import { FormGroup, Validators } from '@angular/forms';
import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker';
import { ThemeService } from 'src/app/services/theme.service'
import { ChatMethodsService } from 'src/app/services/chat/chat-methods.service';
//import { ChatMethodsService } from 'src/app/services/chat/chat-methods.service';
import { SessionStore } from 'src/app/store/session.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
import { environment } from 'src/environments/environment';
@@ -142,7 +142,7 @@ export class NewEventPage implements OnInit {
private toastService: ToastService,
private dateAdapter: DateAdapter<any>,
public ThemeService: ThemeService,
private chatMethodService: ChatMethodsService,
// private chatMethodService: ChatMethodsService,
private hhtpErrorHandle: HttpErrorHandle,
private processeService: ProcessesService,
public TaskService: TaskService,
@@ -579,9 +579,9 @@ export class NewEventPage implements OnInit {
"calendarId": CalendarId
}
if (this.roomId) {
this.chatMethodService.sendMessage(this.roomId, data);
}
// if (this.roomId) {
// this.chatMethodService.sendMessage(this.roomId, data);
// }
},
error => {
@@ -637,9 +637,9 @@ export class NewEventPage implements OnInit {
"id": id,
"calendarId": CalendarId
}
if (this.roomId) {
this.chatMethodService.sendMessage(this.roomId, data);
}
// if (this.roomId) {
// this.chatMethodService.sendMessage(this.roomId, data);
// }
}, (error) => {
//const connectionToServer = this.ServerConnectionService.BaseAPI()
@@ -812,9 +812,9 @@ export class NewEventPage implements OnInit {
"id": id,
"calendarId": CalendarId
}
if (this.roomId) {
this.chatMethodService.sendMessage(this.roomId, data);
}
// if (this.roomId) {
// this.chatMethodService.sendMessage(this.roomId, data);
// }
}, (error) => {
loader.remove()
@@ -878,9 +878,9 @@ export class NewEventPage implements OnInit {
"id": id,
"calendarId": CalendarId
}
if (this.roomId) {
this.chatMethodService.sendMessage(this.roomId, data);
}
// if (this.roomId) {
// this.chatMethodService.sendMessage(this.roomId, data);
// }
}, (error) => {
loader.remove()
@@ -1,6 +1,6 @@
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { ThemeService } from 'src/app/services/theme.service'
import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
// import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
import { ContactRepositoryService } from 'src/app/services/Repositorys/contacts/repository/contacts-repository.service';
import { UserContacts } from 'src/app/services/Repositorys/contacts/data-source/contacts-data-source.service';
import { RoomRepositoryService } from 'src/app/module/chat/data/repository/room-repository.service'
@@ -36,7 +36,7 @@ export class GroupContactsPage implements OnInit {
constructor(
public ThemeService: ThemeService,
public ChatSystemService: ChatSystemService,
// public ChatSystemService: ChatSystemService,
private contactsRepositoryService: ContactRepositoryService,
private RoomRepositoryService: RoomRepositoryService,
private httpErrorHandle: HttpErrorHandle,
@@ -14,8 +14,8 @@ import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.pag
import { ThemeService } from 'src/app/services/theme.service'
import { ViewEventPage } from 'src/app/modals/view-event/view-event.page';
import { Storage } from '@ionic/storage';
import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
import { MessageService } from 'src/app/services/chat/message.service';
// import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
// simport { MessageService } from 'src/app/services/chat/message.service';
import { CameraService } from 'src/app/services/camera.service';
import { FileType } from 'src/app/models/fileType';
@@ -84,7 +84,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
groupNameFormart = "";
constructor(
public ChatSystemService: ChatSystemService,
// public ChatSystemService: ChatSystemService,
private modalController: ModalController,
public popoverController: PopoverController,
private chatService: ChatService,
@@ -104,7 +104,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
private FileValidatorService: FileValidatorService
) {
this.ChatSystemService.getUser()
// this.ChatSystemService.getUser()
this.loggedUserChat = SessionStore.user.ChatData['data'];
this.isGroupCreated = true;
@@ -113,11 +113,11 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
ngOnChanges(changes: SimpleChanges): void {
this.getRoomInfo();
this.ChatSystemService.getGroupRoom(this.roomId).loadHistory({});
//
this.ChatSystemService.openRoom(this.roomId)
this.ChatSystemService.getGroupRoom(this.roomId).scrollDown = this.scrollToBottomClicked
this.groupNameFormart = this.ChatSystemService.getGroupRoom(this.roomId).name.split('-').join(' ')
// this.ChatSystemService.getGroupRoom(this.roomId).loadHistory({});
// //
// this.ChatSystemService.openRoom(this.roomId)
// this.ChatSystemService.getGroupRoom(this.roomId).scrollDown = this.scrollToBottomClicked
// this.groupNameFormart = this.ChatSystemService.getGroupRoom(this.roomId).name.split('-').join(' ')
this.showAvatar = false
setTimeout(() => {
@@ -128,11 +128,11 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
this.deleteRecording();
if (SessionStore.user.ChatData.data.userId == this.ChatSystemService.getGroupRoom(this.roomId).u._id) {
this.isAdmin = true
} else {
this.isAdmin = false
}
// if (SessionStore.user.ChatData.data.userId == this.ChatSystemService.getGroupRoom(this.roomId).u._id) {
// this.isAdmin = true
// } else {
// this.isAdmin = false
// }
}
@@ -340,9 +340,9 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
// });
if(this.ChatSystemService.users.length == 0) {
this.ChatSystemService.getUser()
}
// if(this.ChatSystemService.users.length == 0) {
// this.ChatSystemService.getUser()
// }
}
@@ -375,9 +375,9 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
async getRoomInfo() {
if(this.ChatSystemService.getGroupRoom(this.roomId)) {
this.ChatSystemService.getGroupRoom(this.roomId).loadHistory({});
}
// if(this.ChatSystemService.getGroupRoom(this.roomId)) {
// this.ChatSystemService.getGroupRoom(this.roomId).loadHistory({});
// }
this.getGroupContacts(this.room);
}
@@ -401,11 +401,11 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
// });
// }
this.members = this.ChatSystemService.getGroupRoom(this.roomId).members
// this.members = this.ChatSystemService.getGroupRoom(this.roomId).members
}
sendMessage() {
this.ChatSystemService.getGroupRoom(this.roomId).send({})
// this.ChatSystemService.getGroupRoom(this.roomId).send({})
}
@@ -429,30 +429,30 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
const formData = new FormData();
formData.append("blobFile", blob);
this.ChatSystemService.getGroupRoom(roomId).send({
file: {
"type": "application/audio",
"msDuration": audioFile.value.msDuration,
"mimeType": audioFile.value.mimeType,
},
attachments: [{
"title": fileName,
"title_link_download": true,
"type": "audio"
}],
temporaryData: formData,
attachmentsModelData: {
fileBase64: encodedData,
}
})
// this.ChatSystemService.getGroupRoom(roomId).send({
// file: {
// "type": "application/audio",
// "msDuration": audioFile.value.msDuration,
// "mimeType": audioFile.value.mimeType,
// },
// attachments: [{
// "title": fileName,
// "title_link_download": true,
// "type": "audio"
// }],
// temporaryData: formData,
// attachmentsModelData: {
// fileBase64: encodedData,
// }
// })
});
this.deleteRecording();
}
deleteMessage(msgId: string) {
const room = this.ChatSystemService.getGroupRoom(this.roomId)
this.alertService.confirmDeleteMessage(msgId, room);
// const room = this.ChatSystemService.getGroupRoom(this.roomId)
// this.alertService.confirmDeleteMessage(msgId, room);
}
async openGroupMessagesOptions() {
@@ -497,7 +497,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
this.getRoomInfo();
this.closeAllDesktopComponents.emit();
this.showEmptyContainer.emit();
this.ChatSystemService.hidingRoom(this.roomId).catch((error) => console.error(error));
// this.ChatSystemService.hidingRoom(this.roomId).catch((error) => console.error(error));
}
else if (res.data == 'delete') {
this.closeAllDesktopComponents.emit();
@@ -711,22 +711,22 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
const formData = new FormData();
formData.append("blobFile", blob);
this.ChatSystemService.getGroupRoom(roomId).send({
file: {
"type": "application/img",
"guid": '',
},
temporaryData: formData,
attachments: [{
"title": file.path,
"image_url": 'data:image/jpeg;base64,' + file.base64String,
"text": "description",
"title_link_download": false,
}],
attachmentsModelData: {
fileBase64: base64,
}
})
// this.ChatSystemService.getGroupRoom(roomId).send({
// file: {
// "type": "application/img",
// "guid": '',
// },
// temporaryData: formData,
// attachments: [{
// "title": file.path,
// "image_url": 'data:image/jpeg;base64,' + file.base64String,
// "text": "description",
// "title_link_download": false,
// }],
// attachmentsModelData: {
// fileBase64: base64,
// }
// })
}
@@ -760,21 +760,21 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
const formData = new FormData();
formData.append("blobFile", blob);
this.ChatSystemService.getGroupRoom(roomId).send({
file: {
"type": "application/img",
"guid": ''
},
attachments: [{
"title": 'file.jpg',
"text": "description",
"title_link_download": false,
}],
temporaryData: formData,
attachmentsModelData: {
fileBase64: imageBase64,
}
})
// this.ChatSystemService.getGroupRoom(roomId).send({
// file: {
// "type": "application/img",
// "guid": ''
// },
// attachments: [{
// "title": 'file.jpg',
// "text": "description",
// "title_link_download": false,
// }],
// temporaryData: formData,
// attachmentsModelData: {
// fileBase64: imageBase64,
// }
// })
}
@@ -804,28 +804,28 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
if (data.selected) {
this.ChatSystemService.getGroupRoom(roomId).send({
file: {
"name": res.data.selected.Assunto,
"type": "application/webtrix",
"ApplicationId": res.data.selected.ApplicationType,
"DocId": res.data.selected.Id,
"Assunto": res.data.selected.Assunto,
},
attachments: [{
"title": res.data.selected.Assunto,
"description": res.data.selected.DocTypeDesc,
// "title_link": url_no_options,
"title_link_download": true,
//"thumb_url": "assets/images/webtrix-logo.png",
// "message_link": url_no_options,
"type": "webtrix",
//"thumb_url": "assets/images/webtrix-logo.png",
"text": res.data.selected.DocTypeDesc,
"thumb_url": "https://static.ichimura.ed.jp/uploads/2017/10/pdf-icon.png",
}],
temporaryData: res
})
// this.ChatSystemService.getGroupRoom(roomId).send({
// file: {
// "name": res.data.selected.Assunto,
// "type": "application/webtrix",
// "ApplicationId": res.data.selected.ApplicationType,
// "DocId": res.data.selected.Id,
// "Assunto": res.data.selected.Assunto,
// },
// attachments: [{
// "title": res.data.selected.Assunto,
// "description": res.data.selected.DocTypeDesc,
// // "title_link": url_no_options,
// "title_link_download": true,
// //"thumb_url": "assets/images/webtrix-logo.png",
// // "message_link": url_no_options,
// "type": "webtrix",
// //"thumb_url": "assets/images/webtrix-logo.png",
// "text": res.data.selected.DocTypeDesc,
// "thumb_url": "https://static.ichimura.ed.jp/uploads/2017/10/pdf-icon.png",
// }],
// temporaryData: res
// })
}
@@ -851,22 +851,22 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
const formData = new FormData();
formData.append("blobFile", blob);
this.ChatSystemService.getGroupRoom(roomId).send({
file: {
"type": "application/img",
"guid": ''
},
temporaryData: formData,
attachments: [{
"title": file.path,
"image_url": 'data:image/jpeg;base64,' + file.base64String,
"text": "description",
"title_link_download": false,
}],
attachmentsModelData: {
fileBase64: imageBase64,
}
})
// this.ChatSystemService.getGroupRoom(roomId).send({
// file: {
// "type": "application/img",
// "guid": ''
// },
// temporaryData: formData,
// attachments: [{
// "title": file.path,
// "image_url": 'data:image/jpeg;base64,' + file.base64String,
// "text": "description",
// "title_link_download": false,
// }],
// attachmentsModelData: {
// fileBase64: imageBase64,
// }
// })
}
@@ -907,23 +907,23 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
formData.append('blobFile', file);
}
this.ChatSystemService.getGroupRoom(roomId).send({
file: {
"type": file.type,
"guid": '',
},
attachments: [{
"title": file.name,
"name": file.name,
//"image_url": res,
// "text": "description",
"title_link_download": false,
}],
temporaryData: formData,
attachmentsModelData: {
fileBase64: fileBase64,
}
})
// this.ChatSystemService.getGroupRoom(roomId).send({
// file: {
// "type": file.type,
// "guid": '',
// },
// attachments: [{
// "title": file.name,
// "name": file.name,
// //"image_url": res,
// // "text": "description",
// "title_link_download": false,
// }],
// temporaryData: formData,
// attachmentsModelData: {
// fileBase64: fileBase64,
// }
// })
} else {
this.toastService._badRequest("Ficheiro inválido")
}
@@ -1033,7 +1033,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
}
downloadFileMsg(msg: MessageService) {
downloadFileMsg(msg: any) {
msg.downloadFileMsg()
}
@@ -3,7 +3,7 @@ import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { ModalController } from '@ionic/angular';
import { MessagesPage } from '../messages.page';
import { ThemeService } from 'src/app/services/theme.service'
import { ChatSystemService } from 'src/app/services/chat/chat-system.service'
// import { ChatSystemService } from 'src/app/services/chat/chat-system.service'
import { SessionStore } from 'src/app/store/session.service';
import { ContactRepositoryService } from 'src/app/services/Repositorys/contacts/repository/contacts-repository.service';
import { UserContacts } from 'src/app/services/Repositorys/contacts/data-source/contacts-data-source.service';
@@ -46,7 +46,7 @@ export class ContactsPage implements OnInit {
constructor(
private modalController: ModalController,
public ThemeService: ThemeService,
public ChatSystemService: ChatSystemService,
// public ChatSystemService: ChatSystemService,
private contactsRepositoryService: ContactRepositoryService,
private roomRepositoryService: RoomRepositoryService,
private httpErrorHandle: HttpErrorHandle,
+36 -65
View File
@@ -13,8 +13,8 @@ import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.pag
import { ThemeService } from 'src/app/services/theme.service';
import { ViewEventPage } from 'src/app/modals/view-event/view-event.page';
import { Storage } from '@ionic/storage';
import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service'
import { MessageService } from 'src/app/services/chat/message.service';
// import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service'
// simport { MessageService } from 'src/app/services/chat/message.service';
import { FileType } from 'src/app/models/fileType';
import { SearchPage } from 'src/app/pages/search/search.page';
import { Camera, CameraResultType, CameraSource } from '@capacitor/camera';
@@ -46,6 +46,8 @@ import { tap } from 'rxjs/operators';
import { MessageEntity } from 'src/app/module/chat/domain/entity/message';
import { MemberTable } from 'src/app/module/chat/infra/database/dexie/schema/members';
import { TypingTable } from 'src/app/module/chat/infra/database/dexie/schema/typing';
import { MessageAttachmentFileType, MessageAttachmentSource } from 'src/app/module/chat/data/dto/message/messageOutputDTO';
import { JSFileToBase64 } from 'src/app/utils/ToBase64';
const IMAGE_DIR = 'stored-images';
@@ -92,7 +94,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
longPressActive = false;
frameUrl: any;
downloadFile: string;
massages: MessageService[] = []
massages = []
showAvatar = true;
@@ -145,7 +147,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
private gestureController: GestureController,
public ThemeService: ThemeService,
private storage: Storage,
public RochetChatConnectorService: RochetChatConnectorService,
// public RochetChatConnectorService: RochetChatConnectorService,
private sanitiser: DomSanitizer,
private file: File,
private platform: Platform,
@@ -155,7 +157,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
private roomRepositoryService: RoomRepositoryService,
private messageRepositoryService: MessageRepositoryService,
private userTypingServiceRepository: UserTypingServiceRepository,
private chatServiceService: ChatServiceService
private chatServiceService: ChatServiceService,
) {
// update
this.checkAudioPermission()
@@ -201,7 +203,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
}
toggleEmojiPicker(message: any) {
toggleEmojiPicker(message: MessageEntity) {
if (this.selectedMessage === message) {
this.selectedMessage = null; // Close the picker if it's already open
} else {
@@ -209,7 +211,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
}
}
addReaction(message: any, emoji: string) {
addReaction(message: MessageEntity, emoji: string) {
// Logic to add reaction to the message
console.log(`Reacting to message ${message.id} with emoji ${emoji.codePointAt(0).toString(16)}`);
this.selectedMessage = null; // Close the picker after adding reaction
@@ -235,7 +237,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
this.userTypingServiceRepository.addUserTyping(this.roomId)
}
async editMessage(message: any) {
async editMessage(message: MessageEntity) {
const modal = await this.modalController.create({
component: EditMessagePage,
@@ -888,7 +890,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
}
async addFile() {
this.addFileToChat(['.doc', '.docx', '.pdf'])
this.addFileToChat(['.doc', '.docx', '.pdf'], MessageAttachmentFileType.Doc)
}
async addFileWebtrix() {
@@ -991,20 +993,17 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
}
messageDelete({messageId}) {
messageDelete(message: MessageEntity) {
// this.messageRepositoryService.sendMessageDelete()
this.chatServiceService.messageDelete({
messageId: messageId,
messageId: message.id,
roomId: this.roomId,
})
}
async addFileToChat(types: typeof FileType[]) {
async addFileToChat(types: typeof FileType[], attachmentFileType:MessageAttachmentFileType) {
const roomId = this.roomId
const file: any = await this.fileService.getFileFromDevice(types);
const file = await this.fileService.getFileFromDevice(types);
if (file.type == 'application/pdf' || file.type == 'application/doc' || file.type == 'application/docx' ||
file.type == 'application/xls' || file.type == 'application/xlsx' || file.type == 'application/ppt' ||
@@ -1014,56 +1013,33 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
const fileName = file.name
const validation = this.FileValidatorService.fileNameValidation(fileName)
const FilenameValidation = this.FileValidatorService.fileNameValidation(fileName)
if (validation.isOk) {
if (FilenameValidation.isOk) {
let fileBase64 = await JSFileToBase64(file);
const encodedData = btoa(JSON.stringify(await this.getBase64(file).catch((error) => {
console.error(error);
})));
if(fileBase64.isOk()) {
let blob;
let formData
let fileBase64
if (this.platform.is("tablet")) {
const message = new MessageEntity();
message.roomId = this.roomId
blob = this.fileService.base64toBlob(encodedData, file.type)
console.log('BLOB BLOB', blob)
message.sender = {
userPhoto: '',
wxeMail: SessionStore.user.Email,
wxFullName: SessionStore.user.FullName,
wxUserId: SessionStore.user.UserId
}
formData = new FormData();
formData.append('blobFile', file);
/* console.log('add file', fileBase64) */
message.attachments = [{
file: fileBase64.value,
fileName: file.name,
source: MessageAttachmentSource.Device,
fileType: MessageAttachmentFileType.Doc
}]
} else {
console.log('encode data', encodedData)
blob = this.fileService.base64toBlob(encodedData, file.type)
fileBase64 = await this._getBase64(file)
formData = new FormData();
formData.append('blobFile', file);
this.chatServiceService.sendMessage(message)
}
// this.ChatSystemService.getDmRoom(roomId).send({
// file: {
// "type": file.type,
// "guid": '',
// },
// attachments: [{
// "title": file.name,
// "name": file.name,
// //"image_url": res,
// // "text": "description",
// "title_link_download": false,
// }],
// temporaryData: formData,
// attachmentsModelData: {
// fileBase64: fileBase64,
// }
// })
} else {
this.toastService._badRequest("Ficheiro inválido")
}
@@ -1197,11 +1173,6 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
downloadFileMsg(msg: MessageService) {
msg.downloadFileMsg()
}
pdfPreview() {
const options: DocumentViewerOptions = {
title: 'My App'
@@ -1212,7 +1183,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
async audioPreview(msg) {
if (!msg.attachments[0].title_link || msg.attachments[0].title_link === null || msg.attachments[0].title_link === '') {
this.downloadFileMsg(msg)
// this.downloadFileMsg(msg)
} else { }
}
@@ -1294,7 +1265,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
} else {
if (!msg.attachments[0].image_url || msg.attachments[0].image_url === null || msg.attachments[0].image_url === '') {
this.downloadFileMsg(msg)
// this.downloadFileMsg(msg)
} else {
@@ -36,7 +36,7 @@
</ion-item>
</ion-list> -->
<ion-virtual-scroll [items]="ChatSystemService.users" approxItemHeight="70px" [headerFn]="separateLetter">
<!-- <ion-virtual-scroll [items]="ChatSystemService.users" approxItemHeight="70px" [headerFn]="separateLetter">
<div class="item-divider" *virtualHeader="let header">
<ion-label>{{header}}</ion-label>
@@ -48,7 +48,7 @@
<ion-icon name="ellipse"></ion-icon>
</div>
</ion-virtual-scroll>
</ion-virtual-scroll> -->
</div>
</ion-content>
@@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core';
import { ModalController } from '@ionic/angular';
import { GroupMessagesPage } from '../../group-messages/group-messages.page';
import { ThemeService } from 'src/app/services/theme.service'
import { ChatSystemService } from 'src/app/services/chat/chat-system.service'
// import { ChatSystemService } from 'src/app/services/chat/chat-system.service'
@Component({
selector: 'app-contacts',
@@ -15,9 +15,9 @@ export class ContactsPage implements OnInit {
constructor(
private modalController: ModalController,
public ThemeService: ThemeService,
public ChatSystemService: ChatSystemService
)
{
// public ChatSystemService: ChatSystemService
)
{
}
@@ -27,7 +27,7 @@ export class ContactsPage implements OnInit {
}
loadUsers(){
this.ChatSystemService.getUser()
// sthis.ChatSystemService.getUser()
}
separateLetter(record, recordIndex, records){
@@ -55,13 +55,13 @@ export class ContactsPage implements OnInit {
}
clicked(){
}
async groupMessages(){
const modal = await this.modalController.create({
component: GroupMessagesPage,
componentProps: {},
componentProps: {},
cssClass: 'contacts',
backdropDismiss: false
});
@@ -1,6 +1,6 @@
import { Component, EventEmitter, Input, OnInit, Output,ViewContainerRef } from '@angular/core';
import { PickerController, PopoverController } from '@ionic/angular';
import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
// import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
import { DataService } from 'src/app/services/data.service';
import { GroupDurationPage } from 'src/app/shared/popover/group-duration/group-duration.page';
import { SessionStore } from 'src/app/store/session.service';
@@ -46,7 +46,7 @@ export class NewGroupPage implements OnInit{
private pickerController: PickerController,
private popoverController: PopoverController,
private dataService:DataService,
public ChatSystemService: ChatSystemService,
// public ChatSystemService: ChatSystemService,
public ThemeService: ThemeService,
private RouteService: RouteService,
private viewContainerRef: ViewContainerRef,
@@ -136,13 +136,13 @@ export class NewGroupPage implements OnInit{
}
createGroupWithAttachmentsCath(res: any) {
if(!this.ChatSystemService.getGroupRoom(res.result.rid)) {
setTimeout(() => {
this.createGroupWithAttachmentsCath(res)
}, 1500)
} else {
this.createGroupWithAttachments(res)
}
// if(!this.ChatSystemService.getGroupRoom(res.result.rid)) {
// setTimeout(() => {
// this.createGroupWithAttachmentsCath(res)
// }, 1500)
// } else {
// this.createGroupWithAttachments(res)
// }
}
createGroupWithAttachments(res: any) {
@@ -1,4 +1,4 @@
<ion-content>
<!-- <ion-content>
<ul>
<li>Chat login</li>
<li>Chat user list {{ ChatSystemService.users | json }}</li>
@@ -6,4 +6,4 @@
<ul>
<li *ngFor="let room of ChatSystemService._dm">chat Name: {{room.name}}; subcribe: {{room.status.receive.message}}; </li>
</ul>
</ion-content>
</ion-content> -->
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
// import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
@Component({
selector: 'app-chat-debugging',
@@ -9,7 +9,7 @@ import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
export class ChatDebuggingPage implements OnInit {
constructor(
public ChatSystemService: ChatSystemService
// public ChatSystemService: ChatSystemService
) { }
ngOnInit() {}
@@ -1,6 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { NavParams } from '@ionic/angular';
import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
// import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
@Component({
selector: 'app-chat-message-debugging',
@@ -12,18 +12,18 @@ export class ChatMessageDebuggingPage implements OnInit {
roomId: string
constructor(
public ChatSystemService: ChatSystemService,
// public ChatSystemService: ChatSystemService,
private navParams: NavParams
) { }
ngOnInit() {
this.roomId = this.navParams.get('roomId')
}
loadHistory() {
this.ChatSystemService.getDmRoom(this.roomId).loadHistory({});
// this.ChatSystemService.getDmRoom(this.roomId).loadHistory({});
}
}
-33
View File
@@ -1,33 +0,0 @@
import { models } from 'src/plugin/src';
import { DELETE, GET, SAVE } from '../models/beast-orm-function';
const { rewriteSave, rewriteGet, rewriteDelete } = models.core.localStorage.rewrite;
export class CPSession extends models.LocalStorage {
static UserId: number = models.preset()
static Email: string = models.preset()
static UserName: string = models.preset()
static FullName: string = models.preset()
static RoleID: number = models.preset()
static RoleDescription: string = models.preset()
static OrganicEntityID: number = models.preset()
static OrganicEntityName: string = models.preset()
static Status: string = models.preset()
static Authorization: string = models.preset()
static AuthorizationJwt: string = models.preset()
}
// content production
models.migrate({
databaseName:'content-production',
type: 'localStorage',
version: 1,
models: [CPSession],
})
// rewrite
rewriteGet.connect(GET, [CPSession])
rewriteSave.connect(SAVE, [CPSession])
rewriteDelete.connect(DELETE, [CPSession])
// get function
console.log('get')
CPSession.get()
+30
View File
@@ -0,0 +1,30 @@
import { err, ok, Result } from "neverthrow";
/**
* Retrieves a `FileReader` instance, accounting for potential Zone.js modifications.
* @returns {FileReader} The original `FileReader` instance or a modified one if applicable.
*/
function getFileReader(): FileReader {
const fileReader = new FileReader();
const zoneOriginalInstance = (fileReader as any)["__zone_symbol__originalInstance"];
return zoneOriginalInstance || fileReader;
}
/**
* Converts a `File` object to a Base64 encoded string.
* @param {File} file - The file to be converted.
* @returns {Promise<Result<string, any>>} A promise that resolves with a `Result` object containing either the Base64 encoded string or an error.
*/
export function JSFileToBase64(file: File): Promise<Result<string, any>> {
return new Promise((resolve, reject) => {
var reader = getFileReader();
reader.readAsDataURL(file);
reader.onload = function () {
resolve(ok(reader.result as string));
};
reader.onerror = function (error) {
console.log('Error: ', error);
resolve(err(error));
};
});
}