From 0dd4fd665b7c7bfaa0dc7aa6a5e6c4a167fb660f Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Mon, 7 Oct 2024 13:27:49 +0100 Subject: [PATCH] remove expired room --- gabinete-digital-fo.code-workspace | 6 + src/app/app.module.ts | 13 +- .../actions/repository/actionsRepository.ts | 28 + ...dential-actions-create-use-case.service.ts | 29 + .../presidential-actions-get.service.ts | 30 + .../attachment-remote-repository.ts | 7 +- .../distribution-local-repository.ts | 2 +- .../dexie/{ => instance/chat}/service.ts | 6 +- .../instance/logs/schema/SentryErrors.ts | 210 +++ .../database/dexie/instance/logs/service.ts | 17 + src/app/infra/http/adapter.ts | 14 +- src/app/infra/http/http.service.ts | 21 +- src/app/infra/repository/adapter.ts | 7 +- .../dexie/dexie-repository.service.ts | 32 +- src/app/infra/socket/signalR/signalR.ts | 6 +- .../repository/actions-repository.service.ts | 61 + src/app/module/chat/chat.module.ts | 1 - .../attachment-local-repository.service.ts | 2 +- .../attachment-remote-repository.service.ts | 9 +- .../repository/bold/bold-local-repository.ts | 2 +- .../destribution-local-repository.ts | 2 +- .../member-list-local-repository.service.ts | 2 +- .../message-local-data-source.service.ts | 2 +- .../room/room-local-repository.service.ts | 2 +- .../user-typing-local-data-source.service.ts | 2 +- .../user-photo-local-repository.service.ts | 2 +- .../chat/domain/chat-service.service.ts | 1 - ...essage-attachment-by-message-id.service.ts | 20 +- ...e-download-attachment-user-case.service.ts | 8 +- .../message-local-get-by-id.service.ts | 1 + .../message-mark-as-read-use-case.service.ts | 2 +- .../room/room-bold-sync-use-case.service.ts | 34 +- .../room/room-get-by-id-use-case.service.ts | 25 +- ...oom-get-list-on-create-use-case.service.ts | 24 +- .../room/room-get-list-use-case.service.ts | 39 +- .../monitoring/opentelemetry/matrix.ts | 2 +- .../monitoring/opentelemetry/opentelemetry.ts | 3 + src/app/ui/chat/chat-routing.module.ts | 12 - src/app/ui/chat/chat.module.ts | 4 +- src/app/ui/chat/chat.page.ts | 19 - .../component/contacts/contacts.module.ts | 9 +- .../component/contacts/contacts.page.scss | 16 +- .../chat/component/contacts/contacts.page.ts | 1 - .../group-contacts-routing.module.ts | 0 .../group-contacts/group-contacts.module.ts | 0 .../group-contacts/group-contacts.page.html | 0 .../group-contacts/group-contacts.page.scss | 0 .../group-contacts.page.spec.ts | 0 .../group-contacts/group-contacts.page.ts | 12 +- .../group-messages-routing.module.ts | 21 - .../group-messages/group-messages.module.ts | 36 - .../group-messages/group-messages.page.html | 0 .../group-messages/group-messages.page.scss | 350 ----- .../group-messages.page.spec.ts | 24 - .../group-messages/group-messages.page.ts | 1196 ---------------- .../contacts/contacts-routing.module.ts | 17 - .../messages/contacts/contacts.module.ts | 25 - .../messages/contacts/contacts.page.html | 49 - .../messages/contacts/contacts.page.scss | 136 -- .../messages/contacts/contacts.page.spec.ts | 24 - .../messages/contacts/contacts.page.ts | 203 --- .../messages/messages-routing.module.ts | 37 +- .../component/messages/messages.page.html | 2 +- .../chat/component/messages/messages.page.ts | 34 +- .../chat-debugging-routing.module.ts | 17 - .../chat-debugging/chat-debugging.module.ts | 20 - .../chat-debugging/chat-debugging.page.html | 9 - .../chat-debugging/chat-debugging.page.scss | 0 .../chat-debugging.page.spec.ts | 24 - .../chat-debugging/chat-debugging.page.ts | 17 - .../chat-message-debugging-routing.module.ts | 17 - .../chat-message-debugging.module.ts | 20 - .../chat-message-debugging.page.html | 10 - .../chat-message-debugging.page.scss | 0 .../chat-message-debugging.page.spec.ts | 24 - .../chat-message-debugging.page.ts | 29 - .../group-contacts-routing.module.ts | 0 .../group-contacts/group-contacts.module.ts | 0 .../group-contacts/group-contacts.page.html | 0 .../group-contacts/group-contacts.page.scss | 0 .../group-contacts.page.spec.ts | 0 .../group-contacts/group-contacts.page.ts | 12 +- .../group-messages-routing.module.ts | 21 - .../group-messages/group-messages.module.ts | 36 - .../group-messages/group-messages.page.html | 0 .../group-messages/group-messages.page.scss | 441 ------ .../group-messages.page.spec.ts | 24 - .../group-messages/group-messages.page.ts | 1269 ----------------- .../modal/messages/contacts/contacts.page.ts | 2 +- .../ui/chat/modal/messages/messages.page.ts | 2 +- .../contacts/contacts-routing.module.ts | 17 - .../new-group/contacts/contacts.module.ts | 25 - .../new-group/contacts/contacts.page.html | 57 - .../new-group/contacts/contacts.page.scss | 128 -- .../new-group/contacts/contacts.page.spec.ts | 24 - .../modal/new-group/contacts/contacts.page.ts | 120 -- .../new-group/new-group-routing.module.ts | 4 - .../ui/chat/modal/new-group/new-group.page.ts | 61 +- .../chat/modal/room-info/room-info.page.html | 8 +- src/app/ui/chat/store/roomStore.ts | 29 +- version/git-version.ts | 12 +- 101 files changed, 698 insertions(+), 4682 deletions(-) create mode 100644 src/app/core/actions/repository/actionsRepository.ts create mode 100644 src/app/core/actions/use-case/presidential-actions-create-use-case.service.ts create mode 100644 src/app/core/actions/use-case/presidential-actions-get.service.ts rename src/app/infra/database/dexie/{ => instance/chat}/service.ts (90%) create mode 100644 src/app/infra/database/dexie/instance/logs/schema/SentryErrors.ts create mode 100644 src/app/infra/database/dexie/instance/logs/service.ts create mode 100644 src/app/module/actions/data/repository/actions-repository.service.ts rename src/app/ui/chat/component/{group-messages => }/group-contacts/group-contacts-routing.module.ts (100%) rename src/app/ui/chat/component/{group-messages => }/group-contacts/group-contacts.module.ts (100%) rename src/app/ui/chat/component/{group-messages => }/group-contacts/group-contacts.page.html (100%) rename src/app/ui/chat/component/{group-messages => }/group-contacts/group-contacts.page.scss (100%) rename src/app/ui/chat/component/{group-messages => }/group-contacts/group-contacts.page.spec.ts (100%) rename src/app/ui/chat/component/{group-messages => }/group-contacts/group-contacts.page.ts (91%) delete mode 100644 src/app/ui/chat/component/group-messages/group-messages-routing.module.ts delete mode 100644 src/app/ui/chat/component/group-messages/group-messages.module.ts delete mode 100644 src/app/ui/chat/component/group-messages/group-messages.page.html delete mode 100644 src/app/ui/chat/component/group-messages/group-messages.page.scss delete mode 100644 src/app/ui/chat/component/group-messages/group-messages.page.spec.ts delete mode 100644 src/app/ui/chat/component/group-messages/group-messages.page.ts delete mode 100644 src/app/ui/chat/component/messages/contacts/contacts-routing.module.ts delete mode 100644 src/app/ui/chat/component/messages/contacts/contacts.module.ts delete mode 100644 src/app/ui/chat/component/messages/contacts/contacts.page.html delete mode 100644 src/app/ui/chat/component/messages/contacts/contacts.page.scss delete mode 100644 src/app/ui/chat/component/messages/contacts/contacts.page.spec.ts delete mode 100644 src/app/ui/chat/component/messages/contacts/contacts.page.ts delete mode 100644 src/app/ui/chat/modal/chat-debugging/chat-debugging-routing.module.ts delete mode 100644 src/app/ui/chat/modal/chat-debugging/chat-debugging.module.ts delete mode 100644 src/app/ui/chat/modal/chat-debugging/chat-debugging.page.html delete mode 100644 src/app/ui/chat/modal/chat-debugging/chat-debugging.page.scss delete mode 100644 src/app/ui/chat/modal/chat-debugging/chat-debugging.page.spec.ts delete mode 100644 src/app/ui/chat/modal/chat-debugging/chat-debugging.page.ts delete mode 100644 src/app/ui/chat/modal/chat-message-debugging/chat-message-debugging-routing.module.ts delete mode 100644 src/app/ui/chat/modal/chat-message-debugging/chat-message-debugging.module.ts delete mode 100644 src/app/ui/chat/modal/chat-message-debugging/chat-message-debugging.page.html delete mode 100644 src/app/ui/chat/modal/chat-message-debugging/chat-message-debugging.page.scss delete mode 100644 src/app/ui/chat/modal/chat-message-debugging/chat-message-debugging.page.spec.ts delete mode 100644 src/app/ui/chat/modal/chat-message-debugging/chat-message-debugging.page.ts rename src/app/ui/chat/modal/{group-messages => }/group-contacts/group-contacts-routing.module.ts (100%) rename src/app/ui/chat/modal/{group-messages => }/group-contacts/group-contacts.module.ts (100%) rename src/app/ui/chat/modal/{group-messages => }/group-contacts/group-contacts.page.html (100%) rename src/app/ui/chat/modal/{group-messages => }/group-contacts/group-contacts.page.scss (100%) rename src/app/ui/chat/modal/{group-messages => }/group-contacts/group-contacts.page.spec.ts (100%) rename src/app/ui/chat/modal/{group-messages => }/group-contacts/group-contacts.page.ts (94%) delete mode 100644 src/app/ui/chat/modal/group-messages/group-messages-routing.module.ts delete mode 100644 src/app/ui/chat/modal/group-messages/group-messages.module.ts delete mode 100644 src/app/ui/chat/modal/group-messages/group-messages.page.html delete mode 100644 src/app/ui/chat/modal/group-messages/group-messages.page.scss delete mode 100644 src/app/ui/chat/modal/group-messages/group-messages.page.spec.ts delete mode 100644 src/app/ui/chat/modal/group-messages/group-messages.page.ts delete mode 100644 src/app/ui/chat/modal/new-group/contacts/contacts-routing.module.ts delete mode 100644 src/app/ui/chat/modal/new-group/contacts/contacts.module.ts delete mode 100644 src/app/ui/chat/modal/new-group/contacts/contacts.page.html delete mode 100644 src/app/ui/chat/modal/new-group/contacts/contacts.page.scss delete mode 100644 src/app/ui/chat/modal/new-group/contacts/contacts.page.spec.ts delete mode 100644 src/app/ui/chat/modal/new-group/contacts/contacts.page.ts diff --git a/gabinete-digital-fo.code-workspace b/gabinete-digital-fo.code-workspace index a43274b99..10c377788 100644 --- a/gabinete-digital-fo.code-workspace +++ b/gabinete-digital-fo.code-workspace @@ -4,6 +4,12 @@ "name": "gabinete-digital-fo", "path": "." }, + { + "path": "../sentium" + }, + { + "path": "../../../Desktop/contacts" + } ], "settings": { "nuxt.isNuxtApp": false, diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 46ae5c12c..4b7a59784 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -107,6 +107,7 @@ import { openTelemetryLogging, OpenTelemetryLogging } from './services/monitorin import { registerLocaleData } from '@angular/common'; import localePt from '@angular/common/locales/pt'; +import { LogsDatabase } from './infra/database/dexie/instance/logs/service'; // Register the locale data registerLocaleData(localePt, 'pt'); @@ -126,8 +127,14 @@ registerLocaleData(localePt, 'pt'); }) as Integration, ], beforeSend(event) { + console.log('event.exception.values[0].value', event.exception.values[0].value); + if (event.level === 'error') { - // console.log(event.exception.values[0].value) + + LogsDatabase.sentryError.add(event as any).then(() => { + console.log('event', event) + }) + openTelemetryLogging.send({ type: 'graylog', payload: { @@ -143,9 +150,7 @@ registerLocaleData(localePt, 'pt'); // Return event to send it to Sentry return event; }, - }, - // Forward the init method to the sibling Framework. - SentrySibling.init, + } ); export const increment = createAction('[Counter Component] Increment'); diff --git a/src/app/core/actions/repository/actionsRepository.ts b/src/app/core/actions/repository/actionsRepository.ts new file mode 100644 index 000000000..9340d36e2 --- /dev/null +++ b/src/app/core/actions/repository/actionsRepository.ts @@ -0,0 +1,28 @@ +import { HttpErrorResponse } from "@angular/common/http"; +import { Result } from "neverthrow"; +import { HttpResult } from "src/app/infra/http/type"; +import { PresidentialActionsCreateInput } from "../use-case/presidential-actions-create-use-case.service"; + + +export abstract class IActionsRepository { + + // POST /api/v2/PresidentialActions + abstract createPresidentialAction(body: PresidentialActionsCreateInput): Promise, HttpErrorResponse>> + + // GET /api/v2/PresidentialActions + abstract getPresidentialActions(): Promise, HttpErrorResponse>> + + // GET /api/v2/PresidentialActions/{processId} + abstract getPresidentialActionById(processId: number): Promise, HttpErrorResponse>> + // DELETE /api/v2/PresidentialActions/{processId} + abstract deletePresidentialAction(processId: number): Promise, HttpErrorResponse>> + + // PUT /api/v2/PresidentialActions/{processId} + abstract updatePresidentialAction(processId: number, body: any): Promise, HttpErrorResponse>> + + // GET /api/v2/PresidentialActions/{processId}/Posts + abstract getPostsByProcessId(processId: number): Promise, HttpErrorResponse>> + + // DELETE /api/v2/PresidentialActions/{processId}/Posts/{documentId} + abstract deletePostByDocumentId(processId: number, documentId: number): Promise, HttpErrorResponse>> +} diff --git a/src/app/core/actions/use-case/presidential-actions-create-use-case.service.ts b/src/app/core/actions/use-case/presidential-actions-create-use-case.service.ts new file mode 100644 index 000000000..ecadfd39d --- /dev/null +++ b/src/app/core/actions/use-case/presidential-actions-create-use-case.service.ts @@ -0,0 +1,29 @@ +import { Injectable } from '@angular/core'; +import { z } from 'zod'; + + +const PresidentialActionsCreateInputSchema = z.object({ + userId: z.number(), + description: z.string(), + detail: z.string(), + location: z.string(), + dateBegin: z.string().datetime(), // or use `.refine` for specific date format validation + dateEnd: z.string().datetime(), // or use `.refine` for specific date format validation + actionType: z.string(), +}); + +// Type inference (optional, but useful if you need the TypeScript type) +export type PresidentialActionsCreateInput = z.infer; + + +const PresidentialActionsCreateOutputSchema = z.object({}); +export type PresidentialActionsCreateOutput = z.infer; + + +@Injectable({ + providedIn: 'root' +}) +export class PresidentialActionsCreateUseCaseService { + + constructor() { } +} diff --git a/src/app/core/actions/use-case/presidential-actions-get.service.ts b/src/app/core/actions/use-case/presidential-actions-get.service.ts new file mode 100644 index 000000000..40020dd75 --- /dev/null +++ b/src/app/core/actions/use-case/presidential-actions-get.service.ts @@ -0,0 +1,30 @@ +import { Injectable } from '@angular/core'; +import { z } from 'zod'; + + +const PresidentialActionsGetCreateInputSchema = z.object({ + userId: z.number(), + description: z.string(), + detail: z.string(), + location: z.string(), + dateBegin: z.string().datetime(), // or use `.refine` for specific date format validation + dateEnd: z.string().datetime(), // or use `.refine` for specific date format validation + actionType: z.string(), +}); + +// Type inference (optional, but useful if you need the TypeScript type) +export type PresidentialActionsGetCreateInput = z.infer; + + +const PresidentialActionsGetCreateOutputSchema = z.object({}); +export type PresidentialActionsGetCreateOutput = z.infer; + + + +@Injectable({ + providedIn: 'root' +}) +export class PresidentialActionsGetGetService { + + constructor() { } +} diff --git a/src/app/core/chat/repository/attachment/attachment-remote-repository.ts b/src/app/core/chat/repository/attachment/attachment-remote-repository.ts index 38118f350..d99bcb9f7 100644 --- a/src/app/core/chat/repository/attachment/attachment-remote-repository.ts +++ b/src/app/core/chat/repository/attachment/attachment-remote-repository.ts @@ -1,5 +1,8 @@ +import { HttpErrorResponse } from "@angular/common/http"; +import { Result } from "neverthrow"; +import { HttpResult } from "src/app/infra/http/type"; import { DataSourceReturn } from "src/app/services/Repositorys/type"; export abstract class IAttachmentRemoteRepository { - abstract getAttachment(id: string | number): DataSourceReturn -} \ No newline at end of file + abstract getAttachment(id: string | number): Promise, HttpErrorResponse>> +} diff --git a/src/app/core/chat/repository/distribution/distribution-local-repository.ts b/src/app/core/chat/repository/distribution/distribution-local-repository.ts index d9593e3d2..210f9e93a 100644 --- a/src/app/core/chat/repository/distribution/distribution-local-repository.ts +++ b/src/app/core/chat/repository/distribution/distribution-local-repository.ts @@ -1,5 +1,5 @@ import { DistributionTable, DistributionTableSchema } from "src/app/infra/database/dexie/instance/chat/schema/destribution"; -import { chatDatabase } from "src/app/infra/database/dexie/service"; +import { chatDatabase } from "src/app/infra/database/dexie/instance/chat/service"; import { DexieRepository } from "src/app/infra/repository/dexie/dexie-repository.service"; diff --git a/src/app/infra/database/dexie/service.ts b/src/app/infra/database/dexie/instance/chat/service.ts similarity index 90% rename from src/app/infra/database/dexie/service.ts rename to src/app/infra/database/dexie/instance/chat/service.ts index 784f768a1..173f833bb 100644 --- a/src/app/infra/database/dexie/service.ts +++ b/src/app/infra/database/dexie/instance/chat/service.ts @@ -6,9 +6,9 @@ import { DexieRoomsTable, RoomTableColumn } from 'src/app/infra/database/dexie/i import { DexieTypingsTable, TypingTableColumn } from 'src/app/infra/database/dexie/instance/chat/schema/typing'; import { MessageEntity } from 'src/app/core/chat/entity/message'; import { AttachmentTableColumn, DexieAttachmentsTableSchema } from 'src/app/infra/database/dexie/instance/chat/schema/attachment'; -import { DexieDistributionTable, DistributionTable, DistributionTableColumn } from './instance/chat/schema/destribution'; -import { BoldTableColumn, DexieBoldTable } from './instance/chat/schema/bold'; -import { DexieUserPhotoTable, UserPhotoTable, UserPhotoTableColumn } from './instance/chat/schema/user-foto'; +import { DexieDistributionTable, DistributionTable, DistributionTableColumn } from './schema/destribution'; +import { BoldTableColumn, DexieBoldTable } from './schema/bold'; +import { DexieUserPhotoTable, UserPhotoTable, UserPhotoTableColumn } from './schema/user-foto'; // import FDBFactory from 'fake-indexeddb/lib/FDBFactory'; // import FDBKeyRange from 'fake-indexeddb/lib/FDBKeyRange'; diff --git a/src/app/infra/database/dexie/instance/logs/schema/SentryErrors.ts b/src/app/infra/database/dexie/instance/logs/schema/SentryErrors.ts new file mode 100644 index 000000000..d72cc6457 --- /dev/null +++ b/src/app/infra/database/dexie/instance/logs/schema/SentryErrors.ts @@ -0,0 +1,210 @@ +import { EntityTable } from 'Dexie'; +import { z } from 'zod'; + + +const DscSchema = z.object({ + environment: z.string(), + public_key: z.string(), + release: z.string(), + replay_id: z.any(), + sample_rate: z.string(), + sampled: z.boolean(), + trace_id: z.string(), + transaction: z.any(), +}); + +const MetaSchema = z.object({ + breadcrumbs: z.object({ + values: z.record(z.string(), z.any()), + }), +}); + +const Breadcrumbs2Schema = z.object({ + values: z.array(z.object({ + timestamp: z.number(), + type: z.string(), + category: z.string(), + level: z.string(), + message: z.string().optional(), + data: z.object({ + method: z.string().optional(), + status_code: z.number().optional(), + url: z.string().optional(), + arguments: z.array(z.any()).optional(), + logger: z.string().optional(), + from: z.string().optional(), + to: z.string().optional(), + __span: z.string().optional(), + }).optional(), + event_id: z.string().optional(), + })), +}); + +const MetricsSchema = z.object({ + "bytes.ingested.event": z.number(), + "bytes.stored.event": z.number(), +}); + +const ContextsSchema = z.object({ + angular: z.object({ + type: z.string(), + version: z.number(), + }), + browser: z.object({ + name: z.string(), + version: z.string(), + type: z.string(), + }), + os: z.object({ + name: z.string(), + version: z.string(), + type: z.string(), + }), + trace: z.object({ + trace_id: z.string(), + span_id: z.string(), + op: z.string(), + status: z.string(), + client_sample_rate: z.number(), + type: z.string(), + }), +}); + +const ExceptionSchema = z.object({ + values: z.array(z.object({ + type: z.string(), + value: z.string(), + stacktrace: z.object({ + frames: z.array(z.object({ + function: z.string(), + module: z.string(), + filename: z.string(), + abs_path: z.string(), + lineno: z.number().optional(), + colno: z.number().optional(), + pre_context: z.array(z.string()).optional(), + context_line: z.string().optional(), + post_context: z.array(z.string()).optional(), + in_app: z.boolean(), + data: z.object({ + sourcemap: z.string(), + resolved_with: z.string(), + sourcemap_origin: z.object({ + scraped_file: z.string(), + }), + symbolicated: z.boolean(), + orig_in_app: z.number().optional(), + }).optional(), + })), + }), + raw_stacktrace: z.object({ + frames: z.array(z.object({ + function: z.string().optional(), + filename: z.string(), + abs_path: z.string(), + lineno: z.number().optional(), + colno: z.number().optional(), + context_line: z.string().optional(), + post_context: z.array(z.string()).optional(), + in_app: z.boolean(), + })), + }), + mechanism: z.object({ + type: z.string(), + handled: z.boolean(), + }), + })), +}); + +const GroupingConfigSchema = z.object({ + enhancements: z.string(), + id: z.string(), +}); + +const IngestPathSchema = z.array(z.object({ + version: z.string(), + public_key: z.string(), +})); + +const MetadataSchema = z.object({ + display_title_with_tree_label: z.boolean(), + filename: z.string(), + function: z.string(), + in_app_frame_mix: z.string(), + type: z.string(), + value: z.string(), +}); + +const RequestSchema = z.object({ + url: z.string(), + headers: z.array(z.tuple([z.string(), z.string()])), +}); + +const ScrapingAttemptSchema = z.array(z.object({ + status: z.string(), + url: z.string(), +})); + +const SdkSchema = z.object({ + name: z.string(), + version: z.string(), + integrations: z.array(z.string()), + packages: z.array(z.object({ + name: z.string(), + version: z.string(), + })), +}); + +const UserSchema = z.object({ + ip_address: z.string(), + geo: z.object({ + country_code: z.string(), + city: z.string(), + subdivision: z.string(), + region: z.string(), + }), + sentry_user: z.string(), +}); + +const SentryErrorTableSchema = z.object({ + event_id: z.string(), + project: z.number(), + release: z.string(), + dist: z.string(), + platform: z.string(), + message: z.string(), + datetime: z.string(), + tags: z.array(z.array(z.string())), + _dsc: DscSchema, + _meta: MetaSchema, + _metrics: MetricsSchema, + breadcrumbs: Breadcrumbs2Schema, + contexts: ContextsSchema, + culprit: z.string(), + environment: z.string(), + exception: ExceptionSchema, + fingerprint: z.array(z.string()), + grouping_config: GroupingConfigSchema, + hashes: z.array(z.string()), + ingest_path: IngestPathSchema, + key_id: z.string(), + level: z.string(), + location: z.string(), + logger: z.string(), + metadata: MetadataSchema, + nodestore_insert: z.number(), + received: z.number(), + request: RequestSchema, + scraping_attempts: ScrapingAttemptSchema, + sdk: SdkSchema, + timestamp: z.number(), + title: z.string(), + type: z.string(), + user: UserSchema, + version: z.string(), +}); + +export type SentryErrorTable = z.infer; +export type DexieSentryErrorTable = EntityTable; +export const SentryErrorTableColumn = 'event_id'; + diff --git a/src/app/infra/database/dexie/instance/logs/service.ts b/src/app/infra/database/dexie/instance/logs/service.ts new file mode 100644 index 000000000..81184a4fc --- /dev/null +++ b/src/app/infra/database/dexie/instance/logs/service.ts @@ -0,0 +1,17 @@ +import { Dexie } from 'Dexie'; +import { DexieSentryErrorTable, SentryErrorTableColumn } from './schema/SentryErrors'; +// import FDBFactory from 'fake-indexeddb/lib/FDBFactory'; +// import FDBKeyRange from 'fake-indexeddb/lib/FDBKeyRange'; + +// Database declaration (move this to its own module also) +export const LogsDatabase = new Dexie('logs-analytics', { + // indexedDB: new FDBFactory, + // IDBKeyRange: FDBKeyRange, // Mocking IDBKeyRange +}) as Dexie & { + sentryError: DexieSentryErrorTable +}; + +LogsDatabase.version(1).stores({ + sentryError: SentryErrorTableColumn +}); + \ No newline at end of file diff --git a/src/app/infra/http/adapter.ts b/src/app/infra/http/adapter.ts index dea156c06..d23b407b6 100644 --- a/src/app/infra/http/adapter.ts +++ b/src/app/infra/http/adapter.ts @@ -6,9 +6,17 @@ import { Observable } from 'rxjs'; export abstract class HttpAdapter { abstract post(url: string, body: any): Promise, HttpErrorResponse>> - abstract get(url: string, options?: Object): Promise, HttpErrorResponse>> + abstract get(url: string, options?: IHttpOptions): Promise, HttpErrorResponse>> abstract put(url: string, body: any): Promise, HttpErrorResponse>> - abstract patch(url: string, body?: Object): Promise, HttpErrorResponse>> + abstract patch(url: string, body?: Object): Promise, HttpErrorResponse>> abstract delete(url: string, body?: Object): Promise, HttpErrorResponse>> abstract listen():Observable, HttpErrorResponse>> -} \ No newline at end of file +} + + +// Define the interface for HTTP options +export interface IHttpOptions { + params?: { [param: string]: string | number }; + headers?: HttpHeaders; + responseType?: 'json' | 'text' | 'blob' | 'arraybuffer'; +} diff --git a/src/app/infra/http/http.service.ts b/src/app/infra/http/http.service.ts index c6c06967f..852c5514f 100644 --- a/src/app/infra/http/http.service.ts +++ b/src/app/infra/http/http.service.ts @@ -3,7 +3,9 @@ import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { ok, err, Result } from 'neverthrow'; import { HttpResult } from './type'; -import { BehaviorSubject } from 'rxjs'; +import { BehaviorSubject, Observable } from 'rxjs'; +import { catchError, map } from 'rxjs/operators'; +import { IHttpOptions } from './adapter'; @Injectable({ providedIn: 'root' @@ -32,9 +34,22 @@ export class HttpService { } } - async get(url: string, options = {}): Promise, HttpErrorResponse>> { + async get(url: string, options?: IHttpOptions): Promise, HttpErrorResponse>> { try { - const response = await this.http.get(url, { ...options, observe: 'response' }).toPromise(); + let httpParams = new HttpParams(); + if (options?.params) { + Object.keys(options.params).forEach(key => { + httpParams = httpParams.append(key, String(options.params[key])); + }); + } + + const httpOptions = { + params: httpParams, + headers: options?.headers || new HttpHeaders(), + responseType: options?.responseType || 'json' as any, + }; + + const response = await this.http.get(url, { ...httpOptions, observe: 'response', responseType: httpOptions.responseType }).toPromise(); const data = { method: 'GET', diff --git a/src/app/infra/repository/adapter.ts b/src/app/infra/repository/adapter.ts index 338e4ea2d..3444b1133 100644 --- a/src/app/infra/repository/adapter.ts +++ b/src/app/infra/repository/adapter.ts @@ -20,7 +20,7 @@ export abstract class IDexieRepository> { abstract find(filter: Partial): Promise> - abstract findOne(filter: Partial): Promise> + abstract findOne(filter: Partial): Promise> abstract findAll(): Promise> @@ -28,3 +28,8 @@ export abstract class IDexieRepository> { abstract clear(): Promise> } + +export abstract class ILocalModel{ + abstract save() + abstract delete() +} diff --git a/src/app/infra/repository/dexie/dexie-repository.service.ts b/src/app/infra/repository/dexie/dexie-repository.service.ts index 0e528367d..69fa338af 100644 --- a/src/app/infra/repository/dexie/dexie-repository.service.ts +++ b/src/app/infra/repository/dexie/dexie-repository.service.ts @@ -2,7 +2,7 @@ import { Result, ok, err } from 'neverthrow'; import Dexie, { EntityTable, Table } from 'Dexie'; import { ZodError, ZodObject, ZodSchema } from 'zod'; import { Logger } from 'src/app/services/logger/main/service'; -import { IDexieRepository, RepositoryResult } from '../adapter' +import { IDexieRepository, ILocalModel, RepositoryResult } from '../adapter' import { IDBError, IDBErrorParams, IDexieError } from '../types'; // Define a type for the Result of repository operations @@ -150,6 +150,10 @@ export class DexieRepository> implements IDexieR const schema = this.ZodSchema.array() const dataValidation = schema.safeParse(updatedDocument) + if(updatedDocument.length == 0) { + console.log(`dexie.js failed to update many into ${this.table.name}, empty array)`) + } + if(dataValidation.success) { try { const updatedCount = await this.table.bulkPut(dataValidation.data); @@ -157,7 +161,7 @@ export class DexieRepository> implements IDexieR } catch (_error) { const error: IDexieError = _error return err(new DBError({ - message: `dexie.js Failed to update into ${this.table.name}, ${error.message} `, + message: `dexie.js Failed to update many into ${this.table.name}, ${error.message} `, parameters: document, error: error })) @@ -214,7 +218,7 @@ export class DexieRepository> implements IDexieR } } - async findOne(filter: Partial): Promise> { + async findOne(filter: Partial): Promise> { try { const document = await this.table.where(filter).first(); return ok(document); @@ -228,7 +232,7 @@ export class DexieRepository> implements IDexieR } } - async findAll(): Promise> { + async findAll(): Promise> { try { const documents = await this.table.toArray() return ok(documents); @@ -265,3 +269,23 @@ export class DexieRepository> implements IDexieR } } } + +export class LocalModel> implements ILocalModel { + + constructor( + private table: EntityTable, + private repository: DexieRepository, + private db?:Dexie, + ) {} + + save() { + const primaryKey = this.db[this.table.name].schema.primKey.name + return this.repository.update(primaryKey, this as any) + } + + delete() { + const primaryKey = this.db[this.table.name].schema.primKey.name + return this.repository.delete(primaryKey) + } + +} diff --git a/src/app/infra/socket/signalR/signalR.ts b/src/app/infra/socket/signalR/signalR.ts index c2cc527ad..bdb3f3c13 100644 --- a/src/app/infra/socket/signalR/signalR.ts +++ b/src/app/infra/socket/signalR/signalR.ts @@ -2,11 +2,11 @@ import * as signalR from '@microsoft/signalr'; import { BehaviorSubject, Observable, race, timer } from 'rxjs'; import { ok, Result, err } from 'neverthrow'; import { SessionStore } from 'src/app/store/session.service'; -import { filter, first } from 'rxjs/operators'; +import { filter, first, map } from 'rxjs/operators'; import { v4 as uuidv4 } from 'uuid' import { ISignalRInput } from '../type'; import { MessageOutPutDataDTO } from 'src/app/core/chat/repository/dto/messageOutputDTO'; - +import { Subject } from 'rxjs'; export interface SocketMessage { method: string, data: T @@ -170,7 +170,7 @@ export class SignalRConnection { } public getConnectionState(): Observable { - return this.connectionStateSubject.asObservable(); + return this.connectionStateSubject.asObservable() } public getDisconnectTrigger(): Observable { diff --git a/src/app/module/actions/data/repository/actions-repository.service.ts b/src/app/module/actions/data/repository/actions-repository.service.ts new file mode 100644 index 000000000..bd92afaa0 --- /dev/null +++ b/src/app/module/actions/data/repository/actions-repository.service.ts @@ -0,0 +1,61 @@ +import { HttpErrorResponse } from '@angular/common/http'; +import { Injectable } from '@angular/core'; +import { Result } from 'neverthrow'; +import { IActionsRepository } from 'src/app/core/actions/repository/actionsRepository'; +import { HttpAdapter } from 'src/app/infra/http/adapter' +import { HttpResult } from 'src/app/infra/http/type'; + +@Injectable({ + providedIn: 'root' +}) +export class ActionsRepositoryService implements IActionsRepository { + + + private readonly baseUrl = '/api/v2/PresidentialActions'; + + constructor( + private HttpAdapter: HttpAdapter + ) {} + + // POST /api/v2/PresidentialActions + async createPresidentialAction(body: any): Promise, HttpErrorResponse>> { + const url = `${this.baseUrl}`; + return this.HttpAdapter.post(url, body); + } + + // GET /api/v2/PresidentialActions + async getPresidentialActions(): Promise, HttpErrorResponse>> { + const url = `${this.baseUrl}`; + return this.HttpAdapter.get(url); + } + + // GET /api/v2/PresidentialActions/{processId} + async getPresidentialActionById(processId: number): Promise, HttpErrorResponse>> { + const url = `${this.baseUrl}/${processId}`; + return this.HttpAdapter.get(url); + } + + // DELETE /api/v2/PresidentialActions/{processId} + async deletePresidentialAction(processId: number): Promise, HttpErrorResponse>> { + const url = `${this.baseUrl}/${processId}`; + return this.HttpAdapter.delete(url); + } + + // PUT /api/v2/PresidentialActions/{processId} + async updatePresidentialAction(processId: number, body: any): Promise, HttpErrorResponse>> { + const url = `${this.baseUrl}/${processId}`; + return this.HttpAdapter.put(url, body); + } + + // GET /api/v2/PresidentialActions/{processId}/Posts + async getPostsByProcessId(processId: number): Promise, HttpErrorResponse>> { + const url = `${this.baseUrl}/${processId}/Posts`; + return this.HttpAdapter.get(url); + } + + // DELETE /api/v2/PresidentialActions/{processId}/Posts/{documentId} + async deletePostByDocumentId(processId: number, documentId: number): Promise, HttpErrorResponse>> { + const url = `${this.baseUrl}/${processId}/Posts/${documentId}`; + return this.HttpAdapter.delete(url); + } +} diff --git a/src/app/module/chat/chat.module.ts b/src/app/module/chat/chat.module.ts index d9ed36f19..6d367bd11 100644 --- a/src/app/module/chat/chat.module.ts +++ b/src/app/module/chat/chat.module.ts @@ -165,7 +165,6 @@ export class ChatModule { const connection = this.SignalRService.getConnectionState() connection.pipe( - skip(1) // Skip the first value ).subscribe((value: boolean)=> { if(value) { // on reconnect diff --git a/src/app/module/chat/data/repository/attachment/attachment-local-repository.service.ts b/src/app/module/chat/data/repository/attachment/attachment-local-repository.service.ts index 587a71806..d336871c4 100644 --- a/src/app/module/chat/data/repository/attachment/attachment-local-repository.service.ts +++ b/src/app/module/chat/data/repository/attachment/attachment-local-repository.service.ts @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core'; import { Subject } from 'rxjs'; import { IAttachmentLocalRepository } from 'src/app/core/chat/repository/typing/typing-local-repository'; import { AttachmentTable, AttachmentTableSchema } from 'src/app/infra/database/dexie/instance/chat/schema/attachment'; -import { chatDatabase } from 'src/app/infra/database/dexie/service'; +import { chatDatabase } from 'src/app/infra/database/dexie/instance/chat/service'; import { DexieRepository } from 'src/app/infra/repository/dexie/dexie-repository.service'; @Injectable({ diff --git a/src/app/module/chat/data/repository/attachment/attachment-remote-repository.service.ts b/src/app/module/chat/data/repository/attachment/attachment-remote-repository.service.ts index db31e99b7..44eb36d2e 100644 --- a/src/app/module/chat/data/repository/attachment/attachment-remote-repository.service.ts +++ b/src/app/module/chat/data/repository/attachment/attachment-remote-repository.service.ts @@ -2,7 +2,7 @@ import { Injectable, Input } from '@angular/core'; import { IAttachmentRemoteRepository } from 'src/app/core/chat/repository/attachment/attachment-remote-repository'; import { HttpService } from 'src/app/services/http.service'; import { DataSourceReturn } from 'src/app/services/Repositorys/type'; - +import { HttpAdapter } from 'src/app/infra/http/adapter' @Injectable({ providedIn: 'root' }) @@ -10,11 +10,12 @@ export class AttachmentRemoteDataSourceService implements IAttachmentRemoteRepos private baseUrl = 'https://gdapi-dev.dyndns.info/stage/api/v2/Chat'; // Your base URL constructor( - private httpService: HttpService + private httpService: HttpService, + private HttpAdapter: HttpAdapter ) { } - async getAttachment(id: string | number): DataSourceReturn { - return await this.httpService.getFile(`${this.baseUrl}/attachment/${id}`, { responseType: 'blob' }); + async getAttachment(id: string | number) { + return await this.HttpAdapter.get(`${this.baseUrl}/attachment/${id}`, { responseType: 'blob' }) } } diff --git a/src/app/module/chat/data/repository/bold/bold-local-repository.ts b/src/app/module/chat/data/repository/bold/bold-local-repository.ts index a93bfdda6..cc921cc6b 100644 --- a/src/app/module/chat/data/repository/bold/bold-local-repository.ts +++ b/src/app/module/chat/data/repository/bold/bold-local-repository.ts @@ -3,7 +3,7 @@ import { from } from "rxjs"; import { DexieRepository } from "src/app/infra/repository/dexie/dexie-repository.service"; import { Dexie, EntityTable, liveQuery, Observable } from 'Dexie'; import { BoldTable, BoldTableSchema } from "src/app/infra/database/dexie/instance/chat/schema/bold"; -import { chatDatabase } from "src/app/infra/database/dexie/service"; +import { chatDatabase } from "src/app/infra/database/dexie/instance/chat/service"; import { IBoldLocalRepository } from "src/app/core/chat/repository/bold/bold-local-repository"; @Injectable({ diff --git a/src/app/module/chat/data/repository/destribution/destribution-local-repository.ts b/src/app/module/chat/data/repository/destribution/destribution-local-repository.ts index 922f9e7d6..017b988b8 100644 --- a/src/app/module/chat/data/repository/destribution/destribution-local-repository.ts +++ b/src/app/module/chat/data/repository/destribution/destribution-local-repository.ts @@ -1,5 +1,5 @@ import { DistributionTable, DistributionTableSchema,DistributionTableColumn } from "src/app/infra/database/dexie/instance/chat/schema/destribution"; -import { chatDatabase } from "src/app/infra/database/dexie/service"; +import { chatDatabase } from "src/app/infra/database/dexie/instance/chat/service"; import { DexieRepository } from "src/app/infra/repository/dexie/dexie-repository.service"; diff --git a/src/app/module/chat/data/repository/member/member-list-local-repository.service.ts b/src/app/module/chat/data/repository/member/member-list-local-repository.service.ts index 3bd3d1572..74c172e0b 100644 --- a/src/app/module/chat/data/repository/member/member-list-local-repository.service.ts +++ b/src/app/module/chat/data/repository/member/member-list-local-repository.service.ts @@ -7,7 +7,7 @@ import { err, Result } from 'neverthrow'; import { MemberListUPdateStatusInputDTO } from '../../../domain/use-case/socket/member-list-update-status-use-case.service'; import { from } from 'rxjs'; import { MemberTable, MemberTableSchema } from 'src/app/infra/database/dexie/instance/chat/schema/members'; -import { chatDatabase } from 'src/app/infra/database/dexie/service'; +import { chatDatabase } from 'src/app/infra/database/dexie/instance/chat/service'; import { IDirectMemberInput, IGetMemberLive, IMemberLocalRepository } from 'src/app/core/chat/repository/member/member-local-repository'; @Injectable({ diff --git a/src/app/module/chat/data/repository/message/message-local-data-source.service.ts b/src/app/module/chat/data/repository/message/message-local-data-source.service.ts index 548ae104e..63deda75f 100644 --- a/src/app/module/chat/data/repository/message/message-local-data-source.service.ts +++ b/src/app/module/chat/data/repository/message/message-local-data-source.service.ts @@ -4,7 +4,7 @@ import { MessageEntity } from '../../../../../core/chat/entity/message'; import { DexieRepository } from 'src/app/infra/repository/dexie/dexie-repository.service'; import { Observable as DexieObservable, PromiseExtended } from 'Dexie'; import { DexieMessageTable, MessageTable, MessageTableSchema } from 'src/app/infra/database/dexie/instance/chat/schema/message'; -import { chatDatabase } from 'src/app/infra/database/dexie/service'; +import { chatDatabase } from 'src/app/infra/database/dexie/instance/chat/service'; import { IDirectMessages, IMessageLocalRepository } from 'src/app/core/chat/repository/message/message-local-repository'; import { BehaviorSubject, combineLatest, from, Observable } from 'rxjs'; import { filter, map } from 'rxjs/operators'; diff --git a/src/app/module/chat/data/repository/room/room-local-repository.service.ts b/src/app/module/chat/data/repository/room/room-local-repository.service.ts index 83451cb3d..1c7b5b2f0 100644 --- a/src/app/module/chat/data/repository/room/room-local-repository.service.ts +++ b/src/app/module/chat/data/repository/room/room-local-repository.service.ts @@ -3,7 +3,7 @@ import { liveQuery, Observable } from 'Dexie'; import { DexieRepository } from 'src/app/infra/repository/dexie/dexie-repository.service'; import { BehaviorSubject, from } from 'rxjs'; import { RoomTable, RoomTableSchema } from 'src/app/infra/database/dexie/instance/chat/schema/room'; -import { chatDatabase } from 'src/app/infra/database/dexie/service'; +import { chatDatabase } from 'src/app/infra/database/dexie/instance/chat/service'; import { IRoomLocalRepository } from 'src/app/core/chat/repository/room/room-local-repository'; import { IDBoolean } from 'src/app/infra/database/dexie/type'; import { RoomType } from 'src/app/core/chat/entity/group'; diff --git a/src/app/module/chat/data/repository/typing/user-typing-local-data-source.service.ts b/src/app/module/chat/data/repository/typing/user-typing-local-data-source.service.ts index e12b71e6e..044ab46ff 100644 --- a/src/app/module/chat/data/repository/typing/user-typing-local-data-source.service.ts +++ b/src/app/module/chat/data/repository/typing/user-typing-local-data-source.service.ts @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core'; import { z } from 'zod'; import { Dexie, EntityTable, liveQuery, Observable } from 'Dexie'; import { err, ok } from 'neverthrow'; -import { chatDatabase } from 'src/app/infra/database/dexie/service'; +import { chatDatabase } from 'src/app/infra/database/dexie/instance/chat/service'; import { TypingTable, TypingTableSchema } from 'src/app/infra/database/dexie/instance/chat/schema/typing'; import { ITypingLocalRepository } from 'src/app/core/chat/repository/attachment/attachment-local-repository'; import { DexieRepository } from 'src/app/infra/repository/dexie/dexie-repository.service'; diff --git a/src/app/module/chat/data/repository/user-foto/user-photo-local-repository.service.ts b/src/app/module/chat/data/repository/user-foto/user-photo-local-repository.service.ts index 4a9f9ef38..360ca719b 100644 --- a/src/app/module/chat/data/repository/user-foto/user-photo-local-repository.service.ts +++ b/src/app/module/chat/data/repository/user-foto/user-photo-local-repository.service.ts @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core'; import Dexie, { PromiseExtended } from 'Dexie'; import { IUserPhotoLocalRepository } from 'src/app/core/chat/repository/user-photo/user-photo-local-repository'; import { UserPhotoTable, UserPhotoTableSchema } from 'src/app/infra/database/dexie/instance/chat/schema/user-foto'; -import { chatDatabase } from 'src/app/infra/database/dexie/service'; +import { chatDatabase } from 'src/app/infra/database/dexie/instance/chat/service'; import { DexieRepository } from 'src/app/infra/repository/dexie/dexie-repository.service'; @Injectable({ diff --git a/src/app/module/chat/domain/chat-service.service.ts b/src/app/module/chat/domain/chat-service.service.ts index 9e59ccc5c..6e6b9d588 100644 --- a/src/app/module/chat/domain/chat-service.service.ts +++ b/src/app/module/chat/domain/chat-service.service.ts @@ -164,7 +164,6 @@ export class ChatServiceService { } async start() { - this.chatSync() this.SocketConnectUseCaseService.execute(); } diff --git a/src/app/module/chat/domain/use-case/message/message-attachment-by-message-id.service.ts b/src/app/module/chat/domain/use-case/message/message-attachment-by-message-id.service.ts index 52b2161d5..8bc73b250 100644 --- a/src/app/module/chat/domain/use-case/message/message-attachment-by-message-id.service.ts +++ b/src/app/module/chat/domain/use-case/message/message-attachment-by-message-id.service.ts @@ -64,24 +64,24 @@ export class MessageAttachmentByMessageIdUseCase { tracing.setAttribute('download', 'true') tracing.setAttribute('attachmentId', input.attachments[0].id.toString()) - const result = await this.AttachmentRemoteDataSourceService.getAttachment(input.attachments[0].id) - if(result.isErr()) { + const httpResult = await this.AttachmentRemoteDataSourceService.getAttachment(input.attachments[0].id) + if(httpResult.isErr()) { tracing.hasError('failed to download message attachment', { - error: result.error, + error: httpResult.error, data: 'document id '+ input.attachments[0].id, messageId: input.id, $messageId: input.$id }) - if(isHttpResponse(result.error)) { - tracing.setAttribute('attachmentUrl', result.error.message) + if(isHttpResponse(httpResult.error)) { + tracing.setAttribute('attachmentUrl', httpResult.error.message) } } - if(result.isOk()) { + if(httpResult.isOk()) { - const dataUrl = await createBlobUrl(result.value) + const dataUrl = await createBlobUrl(httpResult.value.data) if(dataUrl.isOk()) { @@ -92,7 +92,7 @@ export class MessageAttachmentByMessageIdUseCase { this.AttachmentLocalDataSource.insert({ $messageId: input.$id, - file: result.value, + file: httpResult.value.data, fileType: input.attachments[0].fileType, source: input.attachments[0].source, fileName: input.attachments[0].fileName, @@ -110,13 +110,13 @@ export class MessageAttachmentByMessageIdUseCase { return dataUrl } else { - console.log('dataUrl eerror', dataUrl.error) + console.log('dataUrl eerror', dataUrl.error, 'url:,', httpResult.value) return err(false) } } else { - return result as any + return httpResult as any } } diff --git a/src/app/module/chat/domain/use-case/message/message-download-attachment-user-case.service.ts b/src/app/module/chat/domain/use-case/message/message-download-attachment-user-case.service.ts index df5a81c9a..9d093b02f 100644 --- a/src/app/module/chat/domain/use-case/message/message-download-attachment-user-case.service.ts +++ b/src/app/module/chat/domain/use-case/message/message-download-attachment-user-case.service.ts @@ -31,10 +31,10 @@ export class DownloadMessageAttachmentUserCaseService { if(validation.isOk()) { - const result = await this.AttachmentRemoteDataSourceService.getAttachment(input.id) - return result.asyncMap(async (blob) => { + const httpResult = await this.AttachmentRemoteDataSourceService.getAttachment(input.id) + return httpResult.asyncMap(async (response) => { - const dataUrl = await createBlobUrl(blob) + const dataUrl = await createBlobUrl(response.data) if(dataUrl.isOk()) { @@ -46,7 +46,7 @@ export class DownloadMessageAttachmentUserCaseService { this.AttachmentLocalDataSource.insert({ $messageId: input.$messageId, id: input.id, - file: blob, + file: response.data, }) return dataUrl.value diff --git a/src/app/module/chat/domain/use-case/message/message-local-get-by-id.service.ts b/src/app/module/chat/domain/use-case/message/message-local-get-by-id.service.ts index db4219bd1..2c00a0cf4 100644 --- a/src/app/module/chat/domain/use-case/message/message-local-get-by-id.service.ts +++ b/src/app/module/chat/domain/use-case/message/message-local-get-by-id.service.ts @@ -27,6 +27,7 @@ export class MessageLocalGetByIdService { }) } else if(input.roomId) { + console.log('find(') return this.messageLocalRepository.find({roomId: input.roomId}) } else if (input.receiverId) { return this.messageLocalRepository.find({receiverId: parseInt(input.receiverId)}) diff --git a/src/app/module/chat/domain/use-case/message/message-mark-as-read-use-case.service.ts b/src/app/module/chat/domain/use-case/message/message-mark-as-read-use-case.service.ts index 99084bf82..cf0861ce2 100644 --- a/src/app/module/chat/domain/use-case/message/message-mark-as-read-use-case.service.ts +++ b/src/app/module/chat/domain/use-case/message/message-mark-as-read-use-case.service.ts @@ -22,7 +22,7 @@ export class MessageMarkAsReadUseCaseService { ) { } - @XTracerAsync({name:'MessageMarkAsReadUseCaseService', module:'chat', bugPrint: true}) + @XTracerAsync({name:'MessageMarkAsReadUseCaseService', module:'chat', bugPrint: true, waitNThrow: 5000}) async execute(sendReadAt: MessageMarkAsReadInput, tracing?: TracingType) { const result = await this.MessageSocketRepositoryService.sendReadAt(sendReadAt as any) diff --git a/src/app/module/chat/domain/use-case/room/room-bold-sync-use-case.service.ts b/src/app/module/chat/domain/use-case/room/room-bold-sync-use-case.service.ts index 9f4bdb221..71ac61676 100644 --- a/src/app/module/chat/domain/use-case/room/room-bold-sync-use-case.service.ts +++ b/src/app/module/chat/domain/use-case/room/room-bold-sync-use-case.service.ts @@ -105,31 +105,25 @@ export class RoomBoldSyncUseCaseService { const room = await this.roomLocalDataSourceService.findOne({id: roomId}) - if(room.isOk() && room.value) { - const roomEntity = new RoomEntity(room.value) - if (roomEntity.hasLastMessage()) { + const message = Object.assign(new MessageEntity(), loadHistoryFirstMessage) + const haveSeen = message.haveSeen() - const message = Object.assign(new MessageEntity(), roomEntity.messages[0]) - const haveSeen = message.haveSeen() + if(haveSeen ===false && message.meSender() == false) { + await this.boldLocalRepository.open() + const result = await this.boldLocalRepository.findOne({roomId: roomId}) - if(!haveSeen && !message.meSender()) { - await this.boldLocalRepository.open() - const result = await this.boldLocalRepository.findOne({roomId: roomEntity.id}) - - if(result.isOk() && !result.value) { - const result = await this.boldLocalRepository.insert({roomId: roomEntity.id, bold: 1}) - } else if(result.isOk() && result.value.bold == 0) { - const result = await this.boldLocalRepository.update(roomEntity.id, {bold: 1}) - } else { - // tracing.hasError("failed to set bold",{}) - } - } else { - const result = await this.boldLocalRepository.update(roomEntity.id, {bold: 0}) - } + if(result.isOk() && !result.value) { + const result = await this.boldLocalRepository.insert({roomId: roomId, bold: 1}) + } else if(result.isOk() && result.value.bold == 0) { + const result = await this.boldLocalRepository.update(roomId, {bold: 1}) + } else { + // tracing.hasError("failed to set bold",{}) } - + } else { + const result = await this.boldLocalRepository.update(roomId, {bold: 0}) } + } }) } diff --git a/src/app/module/chat/domain/use-case/room/room-get-by-id-use-case.service.ts b/src/app/module/chat/domain/use-case/room/room-get-by-id-use-case.service.ts index ad0181373..576edf355 100644 --- a/src/app/module/chat/domain/use-case/room/room-get-by-id-use-case.service.ts +++ b/src/app/module/chat/domain/use-case/room/room-get-by-id-use-case.service.ts @@ -9,6 +9,7 @@ import { GetRoomByIdMapper } from 'src/app/core/chat/mapper/getRoomByIdMapper'; import { RoomEntity, RoomType } from 'src/app/core/chat/entity/group'; import { diff, addedDiff, deletedDiff, updatedDiff, detailedDiff } from 'deep-object-diff'; import { zodSafeValidation } from 'src/app/utils/zodValidation'; +import { CronJobService } from 'src/app/utils/task-scheduler' const UserSchema = z.object({ wxUserId: z.number(), @@ -54,13 +55,13 @@ export class GetRoomByIdUseCaseService { constructor( private roomRemoteDataSourceService: IRoomRemoteRepository, private roomLocalDataSourceService: IRoomLocalRepository, - private MemberListLocalRepository: IMemberLocalRepository + private MemberListLocalRepository: IMemberLocalRepository, + private CronJobService: CronJobService ) { } @captureAndReraiseAsync('RoomRepositoryService/getRoomById') async execute(id: RoomByIdInputDTO) { - console.log('iiiiiiiiiiii', id) const result = await this.roomRemoteDataSourceService.getRoom(id) if(result.isOk()) { @@ -92,16 +93,30 @@ export class GetRoomByIdUseCaseService { } else if (getRoomById.isOk() && !getRoomById.value) { const room = GetRoomByIdMapper.toDomain(validData.value) - this.roomLocalDataSourceService.insert(room) + const createResult = await this.roomLocalDataSourceService.insert(room) + + if(createResult.isErr()) { + console.error('createResultErr', createResult.error); + } + } } + + + if(validData.value.data.expirationDate) { + this.CronJobService.createCronJob(`remove expired room ${id}`, new Date(validData.value.data.expirationDate), () => { + setTimeout(() => { + this.execute(id); + }, 60000); + }) + } + + } else { } - - } else if (isHttpResponse(result.error) ) { if(result.error.status == 404) { await this.roomLocalDataSourceService.delete(id) diff --git a/src/app/module/chat/domain/use-case/room/room-get-list-on-create-use-case.service.ts b/src/app/module/chat/domain/use-case/room/room-get-list-on-create-use-case.service.ts index 9132c362e..46d8a102b 100644 --- a/src/app/module/chat/domain/use-case/room/room-get-list-on-create-use-case.service.ts +++ b/src/app/module/chat/domain/use-case/room/room-get-list-on-create-use-case.service.ts @@ -1,6 +1,7 @@ import { Injectable } from '@angular/core'; import { GetRoomListUseCaseService } from './room-get-list-use-case.service' import { RoomSocketRepositoryService } from '../../../data/repository/room/room-socket-repository.service' +import { IRoomLocalRepository } from 'src/app/core/chat/repository/room/room-local-repository'; @Injectable({ providedIn: 'root' @@ -9,7 +10,8 @@ export class RoomGetListOnCreateUseCaseService { constructor( private RoomSocketRepositoryService: RoomSocketRepositoryService, - private getRoomListUseCaseService: GetRoomListUseCaseService + private getRoomListUseCaseService: GetRoomListUseCaseService, + private roomLocalDataSourceService: IRoomLocalRepository, ) { this.init() } @@ -21,10 +23,22 @@ export class RoomGetListOnCreateUseCaseService { } - private OnReceiveCreateRoom() { - this.RoomSocketRepositoryService.listenToCreateRoom().subscribe((data)=> { - console.log('OnReceiveCreateRoom', data) - this.getRoomListUseCaseService.execute() + private async OnReceiveCreateRoom() { + this.RoomSocketRepositoryService.listenToCreateRoom().subscribe(async(data)=> { + + setTimeout(async () => { + const findLocally = await this.roomLocalDataSourceService.findOne({id:(data.data as any).id}) + + if(findLocally.isOk() && !findLocally.value) { + this.getRoomListUseCaseService.execute() + } + + }, 1000); + + + // const result = await this.roomRemoteDataSourceService.getRoom(id) + // console.log('OnReceiveCreateRoom', data) + //this.getRoomListUseCaseService.execute() }) } diff --git a/src/app/module/chat/domain/use-case/room/room-get-list-use-case.service.ts b/src/app/module/chat/domain/use-case/room/room-get-list-use-case.service.ts index d0833f778..260b76aed 100644 --- a/src/app/module/chat/domain/use-case/room/room-get-list-use-case.service.ts +++ b/src/app/module/chat/domain/use-case/room/room-get-list-use-case.service.ts @@ -60,6 +60,7 @@ export class GetRoomListUseCaseService { @captureAndReraiseAsync('RoomRepositoryService/list') async execute() { + console.log('update===============') const result = await this.roomRemoteDataSourceService.getRoomList() const localList = await this.roomLocalDataSourceService.findAll() @@ -108,22 +109,44 @@ export class GetRoomListUseCaseService { } } else { - this.roomLocalDataSourceService.insert(room) + const createResult = this.roomLocalDataSourceService.insert(room) + + createResult.then((result) => { + if(result.isErr()) { + console.log('error', result.error) + } + }) } - - if(room.expirationDate) { - this.CronJobService.createCronJob('remove expired room', new Date(room.expirationDate), this.execute) - } } } - const roomsToUpdateEntity = GetRoomListMapper.toDomain(roomsToUpdate) - this.roomLocalDataSourceService.updateMany(roomsToUpdateEntity) + if(roomsToUpdate.length >= 1) { + const roomsToUpdateEntity = GetRoomListMapper.toDomain(roomsToUpdate) + this.roomLocalDataSourceService.updateMany(roomsToUpdateEntity) + } for( const room of roomsToDelete) { if(room.local == IDBoolean.false) { - this.roomLocalDataSourceService.delete(room.id) + const findResult = this.roomLocalDataSourceService.findOne({id:room.id}) + findResult.then((result) => { + if(result.isOk() && result.value) { + this.roomLocalDataSourceService.delete(result.value.$id) + } + }) + + } + } + + for(const room of filterValidateRooms) { + if(room.chatRoom.expirationDate) { + + + this.CronJobService.createCronJob('remove expired room list', new Date(room.chatRoom.expirationDate), () => { + setTimeout(() => { + this.execute(); + }, 60000); + }) } } diff --git a/src/app/services/monitoring/opentelemetry/matrix.ts b/src/app/services/monitoring/opentelemetry/matrix.ts index 120e34d36..a8ff3e336 100644 --- a/src/app/services/monitoring/opentelemetry/matrix.ts +++ b/src/app/services/monitoring/opentelemetry/matrix.ts @@ -13,7 +13,7 @@ if (window.location.protocol !== 'https:' && environment.apiURL != 'https://gdqa // const metricReader = new PeriodicExportingMetricReader({ // exporter: new OTLPMetricExporter({ // //url: 'https://5-180-182-151.cloud-xip.com:85/collector2/v1/metrics', - // url: 'https://185-229-224-75.cloud-xip.com:85/collector2/v1/metrics', + // // url: 'https://185-229-224-75.cloud-xip.com:85/collector2/v1/metrics', // //url: 'http://5-180-182-151.cloud-xip.com:4318/v1/metrics', // //url: 'http://185-229-224-75.cloud-xip.com:4318/v1/metrics' // // headers: { diff --git a/src/app/services/monitoring/opentelemetry/opentelemetry.ts b/src/app/services/monitoring/opentelemetry/opentelemetry.ts index 4e5f876dd..aa94ed3d5 100644 --- a/src/app/services/monitoring/opentelemetry/opentelemetry.ts +++ b/src/app/services/monitoring/opentelemetry/opentelemetry.ts @@ -1,9 +1,12 @@ import { ConsoleSpanExporter, SimpleSpanProcessor } from '@opentelemetry/sdk-trace-base'; import { WebTracerProvider } from '@opentelemetry/sdk-trace-web'; +import { ZipkinExporter } from '@opentelemetry/exporter-zipkin'; import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions' import { Resource } from '@opentelemetry/resources'; +//import { OTLPTraceExporter } from '@opentelemetry/exporter-otlp-http'; 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({ diff --git a/src/app/ui/chat/chat-routing.module.ts b/src/app/ui/chat/chat-routing.module.ts index 9da4a7c8f..518ec0011 100644 --- a/src/app/ui/chat/chat-routing.module.ts +++ b/src/app/ui/chat/chat-routing.module.ts @@ -11,10 +11,6 @@ const routes: Routes = [ path: 'new-group', loadChildren: () => import('./modal/new-group/new-group.module').then( m => m.NewGroupPageModule) }, - { - path: 'group-messages', - loadChildren: () => import('./modal/group-messages/group-messages.module').then( m => m.GroupMessagesPageModule) - }, { path: 'messages', outlet:'message', @@ -28,14 +24,6 @@ const routes: Routes = [ path: 'chat-options-popover', loadChildren:() => import('./modal/chat-options-popover/chat-options-popover.module').then( m => m.ChatOptionsPopoverPageModule) }, - { - path: 'chat-debugging', - loadChildren: () => import('./modal/chat-debugging/chat-debugging.module').then( m => m.ChatDebuggingPageModule) - }, - { - path: 'chat-message-debugging', - loadChildren: () => import('./modal/chat-message-debugging/chat-message-debugging.module').then( m => m.ChatMessageDebuggingPageModule) - }, { path: 'empty-chat', loadChildren: () => import('./component/empty-chat/empty-chat.module').then( m => m.EmptyChatPageModule) diff --git a/src/app/ui/chat/chat.module.ts b/src/app/ui/chat/chat.module.ts index b5f4c7d48..6e75bd935 100644 --- a/src/app/ui/chat/chat.module.ts +++ b/src/app/ui/chat/chat.module.ts @@ -15,8 +15,7 @@ import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; import { ImageCropperModule } from 'ngx-image-cropper'; import { EmptyChatPageModule } from './component/empty-chat/empty-chat.module'; import { EditGroupPageModule } from './component/edit-group/edit-group.module'; -import { GroupContactsPageModule } from './component/group-messages/group-contacts/group-contacts.module'; -import { GroupMessagesPageModule } from './component/group-messages/group-messages.module'; +import { GroupContactsPageModule } from './component/group-contacts/group-contacts.module'; import { MessagesPageModule } from './component/messages/messages.module'; import { ContactsPageModule } from './component/contacts/contacts.module'; import { NewGroupPageModule } from './component/new-group/new-group.module'; @@ -35,7 +34,6 @@ import { BoldLocalRepository } from 'src/app/module/chat/data/repository/bold/bo RouterModule, MessagesPageModule, ContactsPageModule, - GroupMessagesPageModule, NewGroupPageModule, EditGroupPageModule, GroupContactsPageModule, diff --git a/src/app/ui/chat/chat.page.ts b/src/app/ui/chat/chat.page.ts index 06821ac2a..5f26a6879 100644 --- a/src/app/ui/chat/chat.page.ts +++ b/src/app/ui/chat/chat.page.ts @@ -4,7 +4,6 @@ import { OnInit, } from '@angular/core'; import { ModalController } from '@ionic/angular'; -import { GroupMessagesPage } from './modal/group-messages/group-messages.page'; import { ContactsPage } from './modal/./messages/contacts/contacts.page'; import { MessagesPage } from './modal/./messages/messages.page'; import { INewGroupModalOutPut, NewGroupPage } from './modal/./new-group/new-group.page'; @@ -551,22 +550,4 @@ export class ChatPage implements OnInit { } - - async openGroupMessagesModal(roomId: any) { - - const modal = await this.modalController.create({ - component: GroupMessagesPage, - cssClass: 'modal modal-desktop isGroupChatOpened', - componentProps: { - roomId: roomId, - }, - }); - - modal.onDidDismiss().then(() => { - // this.ChatSystemService.currentRoom.roomLeave() - }); - await modal.present(); - } - - } diff --git a/src/app/ui/chat/component/contacts/contacts.module.ts b/src/app/ui/chat/component/contacts/contacts.module.ts index 8d087470a..2fbc17124 100644 --- a/src/app/ui/chat/component/contacts/contacts.module.ts +++ b/src/app/ui/chat/component/contacts/contacts.module.ts @@ -8,7 +8,8 @@ import { ContactsPageRoutingModule } from './contacts-routing.module'; import { ContactsPage } from './contacts.page'; import { SharedModule } from 'src/app/shared/shared.module'; -import { BtnSeguintePageModule } from 'src/app/shared/btn-seguinte/btn-seguinte.module'; +import { FilterPipe } from 'src/app/pipes/filter.pipe'; +import { PipesModule } from 'src/app/pipes/pipes.module'; @NgModule({ imports: [ @@ -16,9 +17,9 @@ import { BtnSeguintePageModule } from 'src/app/shared/btn-seguinte/btn-seguinte. FormsModule, IonicModule, ContactsPageRoutingModule, - BtnSeguintePageModule, + PipesModule, ], - declarations: [ContactsPage], - exports: [ContactsPage] + exports: [ContactsPage], + declarations: [ContactsPage] }) export class ContactsPageModule {} diff --git a/src/app/ui/chat/component/contacts/contacts.page.scss b/src/app/ui/chat/component/contacts/contacts.page.scss index 992cb002d..52b4f3984 100644 --- a/src/app/ui/chat/component/contacts/contacts.page.scss +++ b/src/app/ui/chat/component/contacts/contacts.page.scss @@ -32,13 +32,13 @@ overflow: auto; padding: 0 !important; } - + .back-icon{ width: 37px; float: left; font-size: rem(35); overflow: auto; - + } .div-title{ width: 221px; @@ -56,7 +56,7 @@ --padding-bottom:0 !important; --padding-start:0 !important; --padding-end:0 !important; - + .search{ border: 1px solid #ebebeb; margin: 5px 20px 5px 20px; @@ -76,7 +76,7 @@ } ion-content{ --background:transparent; -} +} @@ -115,7 +115,7 @@ ion-content{ width: rem(30); margin-left: 15px; } - + .detele-item-icon ion-icon{ font-size: rem(20) !important; } @@ -127,13 +127,13 @@ ion-content{ justify-content: flex-end; } } - + .item-divider{ background: #ebebeb; font-size: rem(15); margin: 10px 0 10px 0; padding:5px 0 5px 20px; - + } .item-checkbox{ @@ -180,4 +180,4 @@ ion-content{ button { display: none !important; } -} \ No newline at end of file +} diff --git a/src/app/ui/chat/component/contacts/contacts.page.ts b/src/app/ui/chat/component/contacts/contacts.page.ts index b346d08c1..962e69333 100644 --- a/src/app/ui/chat/component/contacts/contacts.page.ts +++ b/src/app/ui/chat/component/contacts/contacts.page.ts @@ -1,6 +1,5 @@ import { Component, EventEmitter, Input, OnInit, Output } 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 { UserContacts } from 'src/app/services/Repositorys/contacts/data-source/contacts-data-source.service'; import { ContactRepositoryService } from 'src/app/services/Repositorys/contacts/repository/contacts-repository.service'; diff --git a/src/app/ui/chat/component/group-messages/group-contacts/group-contacts-routing.module.ts b/src/app/ui/chat/component/group-contacts/group-contacts-routing.module.ts similarity index 100% rename from src/app/ui/chat/component/group-messages/group-contacts/group-contacts-routing.module.ts rename to src/app/ui/chat/component/group-contacts/group-contacts-routing.module.ts diff --git a/src/app/ui/chat/component/group-messages/group-contacts/group-contacts.module.ts b/src/app/ui/chat/component/group-contacts/group-contacts.module.ts similarity index 100% rename from src/app/ui/chat/component/group-messages/group-contacts/group-contacts.module.ts rename to src/app/ui/chat/component/group-contacts/group-contacts.module.ts diff --git a/src/app/ui/chat/component/group-messages/group-contacts/group-contacts.page.html b/src/app/ui/chat/component/group-contacts/group-contacts.page.html similarity index 100% rename from src/app/ui/chat/component/group-messages/group-contacts/group-contacts.page.html rename to src/app/ui/chat/component/group-contacts/group-contacts.page.html diff --git a/src/app/ui/chat/component/group-messages/group-contacts/group-contacts.page.scss b/src/app/ui/chat/component/group-contacts/group-contacts.page.scss similarity index 100% rename from src/app/ui/chat/component/group-messages/group-contacts/group-contacts.page.scss rename to src/app/ui/chat/component/group-contacts/group-contacts.page.scss diff --git a/src/app/ui/chat/component/group-messages/group-contacts/group-contacts.page.spec.ts b/src/app/ui/chat/component/group-contacts/group-contacts.page.spec.ts similarity index 100% rename from src/app/ui/chat/component/group-messages/group-contacts/group-contacts.page.spec.ts rename to src/app/ui/chat/component/group-contacts/group-contacts.page.spec.ts diff --git a/src/app/ui/chat/component/group-messages/group-contacts/group-contacts.page.ts b/src/app/ui/chat/component/group-contacts/group-contacts.page.ts similarity index 91% rename from src/app/ui/chat/component/group-messages/group-contacts/group-contacts.page.ts rename to src/app/ui/chat/component/group-contacts/group-contacts.page.ts index 8fe3d4da8..69f473b18 100644 --- a/src/app/ui/chat/component/group-messages/group-contacts/group-contacts.page.ts +++ b/src/app/ui/chat/component/group-contacts/group-contacts.page.ts @@ -80,11 +80,10 @@ export class GroupContactsPage implements OnInit { async loadUsers() { const getallChatUsers = await this.contactsRepositoryService.getUsers() - const getRoomById = await this.chatServiceService.getRoomById(this.roomId) - console.log({getallChatUsers, getRoomById}) + // console.log({getallChatUsers, getRoomById}) - if(getallChatUsers.isOk() && getRoomById.isOk()) { + if(getallChatUsers.isOk()) { this.allChatUsers = getallChatUsers.value.data.result.sort((a,b) => { if(a.wxFullName < b.wxFullName) { @@ -128,13 +127,6 @@ export class GroupContactsPage implements OnInit { } - } - else if (getRoomById.isErr() && getRoomById.error instanceof HttpResponse) { - this.httpErrorHandle.httpStatusHandle(getRoomById.error) - } else if (getallChatUsers.isErr() && getallChatUsers.error instanceof HttpResponse) { - this.httpErrorHandle.httpStatusHandle(getallChatUsers.error) - } else if (getRoomById.isErr() ) { - console.log(getRoomById.error) } else if (getallChatUsers.isErr() ) { console.log(getallChatUsers.error) } else { diff --git a/src/app/ui/chat/component/group-messages/group-messages-routing.module.ts b/src/app/ui/chat/component/group-messages/group-messages-routing.module.ts deleted file mode 100644 index 708ec8d8f..000000000 --- a/src/app/ui/chat/component/group-messages/group-messages-routing.module.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { NgModule } from '@angular/core'; -import { Routes, RouterModule } from '@angular/router'; - -import { GroupMessagesPage } from './group-messages.page'; - -const routes: Routes = [ - { - path: '', - component: GroupMessagesPage - }, { - path: 'group-contacts', - loadChildren: () => import('./group-contacts/group-contacts.module').then( m => m.GroupContactsPageModule) - } - -]; - -@NgModule({ - imports: [RouterModule.forChild(routes)], - exports: [RouterModule], -}) -export class GroupMessagesPageRoutingModule {} diff --git a/src/app/ui/chat/component/group-messages/group-messages.module.ts b/src/app/ui/chat/component/group-messages/group-messages.module.ts deleted file mode 100644 index f611624d6..000000000 --- a/src/app/ui/chat/component/group-messages/group-messages.module.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormsModule } from '@angular/forms'; - -import { IonicModule } from '@ionic/angular'; - -import { GroupMessagesPageRoutingModule } from './group-messages-routing.module'; - -import { GroupMessagesPage } from './group-messages.page'; -import { SharedModule } from 'src/app/shared/shared.module'; - -import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; -import {MatMenuModule} from '@angular/material/menu'; -import { LettersAvatarModule } from "ngx-letters-avatar"; -import { PipesModule } from 'src/app/pipes/pipes.module'; -import { SafehtmlPipe } from 'src/app/pipes/safehtml.pipe'; -import { ChatPopoverPageModule } from '../../modal/chat-popover/chat-popover.module'; - -@NgModule({ - imports: [ - CommonModule, - FormsModule, - IonicModule, - FontAwesomeModule, - ChatPopoverPageModule, - GroupMessagesPageRoutingModule, - MatMenuModule, - LettersAvatarModule, - PipesModule, - // - ], - exports: [GroupMessagesPage], - schemas: [CUSTOM_ELEMENTS_SCHEMA], - declarations: [GroupMessagesPage] -}) -export class GroupMessagesPageModule {} diff --git a/src/app/ui/chat/component/group-messages/group-messages.page.html b/src/app/ui/chat/component/group-messages/group-messages.page.html deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/app/ui/chat/component/group-messages/group-messages.page.scss b/src/app/ui/chat/component/group-messages/group-messages.page.scss deleted file mode 100644 index a8610faa5..000000000 --- a/src/app/ui/chat/component/group-messages/group-messages.page.scss +++ /dev/null @@ -1,350 +0,0 @@ - @import '~src/function.scss'; -.header-toolbar{ - --background:transparent; - --opacity: 1; - - .main-header{ - width: 100%; - height: 100%; - overflow:auto; - padding: 30px 20px 0px 20px; - color:#000; - //transform: translate3d(0, 1px, 0); - - .header-top{ - width: 100%; - overflow: auto; - padding: 0 !important; - background: #fff; - .middle{ - padding: 0!important; - float: left; - width:calc(100% - 77px); - margin: 2.5px 0 0 5px; - } - .right{ - padding: 0!important; - float: right; - font-size: rem(25); - color: #0782c9; - margin: 5px 0 0 0; - } - } - .header-bottom{ - width: 98%; - overflow: auto; - - .header-bottom-icon{ - width: rem(30); - font-size: rem(25); - float: left; - padding: 2px; - - } - .header-bottom-contacts{ - width: calc(100% - 40px); - font-size: rem(15); - color: #797979; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - float: left; - padding: 5px; - margin: 1px; - - .contacts-list{ - white-space: nowrap; - overflow: hidden !important; - text-overflow: ellipsis !important; - } - } - } - - .title{ - font-size: rem(25); - white-space: nowrap; - overflow: hidden !important; - text-overflow: ellipsis !important; - float: left; - } - .div-icon{ - width: rem(40); - float: right; - font-size: rem(35); - overflow: auto; - padding: 1px; - } - .div-icon ion-icon{ - float: right; - padding-left: 20px; - } - } - } - .btn-delete-recording{ - margin-left: 20px !important; - } - - ion-content{ - .welcome-text{ - /* width: 322px; */ - //width: em(422px); - background: #ebebeb; - text-align: center; - font-size: rem(13); - color: #797979; - padding: 10px; - margin: 0 auto !important; - line-height: 1.2rem; - border-radius: 8px; - } - .info-text{ - /* width: 322px; */ - width: em(422px); - background: var(--chat-alert-msg-color); - text-align: center; - font-size: rem(13); - color: #262420; - padding: 10px; - margin: 10px auto; - line-height: 1.2rem; - /* margin: 15px 0px 15px 0px; */ - border-radius: 8px; - } - .info-text-leave{ - display: flex; - align-items: center; - justify-content: center; - width: fit-content; - padding: 10px; - background: #e0e9ee; - border-radius: 8px; - margin: 10px auto; - color: #797979 !important; - font-size: rem(13) !important; - /* margin: 15px 0px 15px 0px; */ - - .info-text-leave ion-label{ - font-size: rem(13) !important; - line-height: 1.2rem; - } - } - - .info-meeting{ - /* width: 322px; */ - width: em(422px); - background: var(--chat-alert-msg-color); - text-align: center; - font-size: rem(13); - color: #262420; - padding: 10px; - margin: 10px auto; - line-height: 1.2rem; - /* margin: 15px 0px 15px 0px; */ - border-radius: 8px; - - .info-meeting-small{ - font-size: rem(10); - font-style: italic; - } - .info-meeting-medium{ - font-size: rem(12); - } - .info-meeting-normal{ - font-weight: 700; - } - .info-meeting-normal:hover{ - text-decoration: underline; - color: #0782c9; - } - } - .messages{ - font-size: rem(13); - font-family: Roboto; - overflow: auto; - - //set scroll do bottom - position: absolute; - top: 0; - left: 0; - overflow-x: hidden; - overflow-y: auto; - width: 100%; - height: 100%; - word-wrap: break-word; - -webkit-overflow-scrolling: touch; - - .incoming-true, .incoming-false{ - padding: 15px 20px; - border-radius: 10px; - } - .incoming-true{ - margin: 10px 75px 10px 20px; - background: #ebebeb; - float: left; - } - .container-width-100{ - width: 100%; - overflow: auto; - } - } - .incoming-false{ - margin: 10px 20px 10px 75px; - background: var(--chat-incoming-msg-color); - float: right; - } - .title{ - display: inline; - color: var(--title-text-color); - font-weight: bold; - margin-bottom: 5px; - - .time{ - color: #797979; - text-align: right; - margin-left: 10px; - float: right; - } - } - .message{ - .message-attachments{ - .file{ - align-items: center; - - .file-details{ - width: 100%; - - .file-title{ - color: #000; - text-decoration: underline; - white-space: nowrap; - overflow: hidden !important; - text-overflow: ellipsis !important; - } - .file-title:hover{ - color: #0782c9; - } - } - } - } - } - } - - ion-footer{ - padding-top: 7.5px; - padding-bottom: 7.5px; - - .container{ - justify-content: center; - justify-content: space-evenly; - align-items: center; - margin: 0 !important; - padding: 0 !important; - } - - .chat-icon-options{ - display:block !important; - font-size: rem(35); - float: right !important; - margin-top: 5px; - } - - .chat-icon-send{ - font-size: rem(45); - margin: 0 auto; - margin-top: 4px; - } - - .type-message{ - display: flex; - border: 1px solid #ebebeb; - border-radius: 25px; - padding-left: 15px; - margin: 0 15px 0 75px; - align-items: center; - overflow: auto; - - ion-textarea{ - margin: 0 !important; - align-self: center; - } - } - - .btn-send{ - padding-right: 20px !important; - overflow: hidden; - } - - } - - -.typing { - position: relative; - top: -25px; - height: 0px; - left: 0px; - margin-left: 22px; - display: flex; - font-size: rem(12); - align-items: center; -} - - -.typing ngx-letters-avatar { - padding-right: 5px; -} - - -.float-status{ - position: relative !important; - float: right; - display: flex; - align-items: self-end; -} - -.float-status-image{ - position: relative !important; - float: right; - display: flex; - align-items: self-end; - top: -15px; -} - -.float-status-webtrix { - position: relative !important; - top: 0px !important; - float: right; - display: flex; - align-items: self-end; -} - -.float-status-all { - font-size: 10pt !important; -} - - -.try { - color: red; - background: #f3414159; - padding: 6px; - border-radius: 10px; - cursor: pointer; -} - - -.dateLabel { - background: #ebebeb !important; - float: unset !important; - margin: 0px auto !important; - width: 111px !important; - text-align: center; - margin-top: 10px !important; - padding: 15px 20px; - border-radius: 10px; -} - - - -.lido, -.enviado { - font-size: rem(11); -} diff --git a/src/app/ui/chat/component/group-messages/group-messages.page.spec.ts b/src/app/ui/chat/component/group-messages/group-messages.page.spec.ts deleted file mode 100644 index 62c380096..000000000 --- a/src/app/ui/chat/component/group-messages/group-messages.page.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { IonicModule } from '@ionic/angular'; - -import { GroupMessagesPage } from './group-messages.page'; - -describe('GroupMessagesPage', () => { - let component: GroupMessagesPage; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ GroupMessagesPage ], - imports: [IonicModule.forRoot()] - }).compileComponents(); - - fixture = TestBed.createComponent(GroupMessagesPage); - component = fixture.componentInstance; - fixture.detectChanges(); - })); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/ui/chat/component/group-messages/group-messages.page.ts b/src/app/ui/chat/component/group-messages/group-messages.page.ts deleted file mode 100644 index 882f4e8b1..000000000 --- a/src/app/ui/chat/component/group-messages/group-messages.page.ts +++ /dev/null @@ -1,1196 +0,0 @@ -import { Component, OnChanges, OnInit, Input, SimpleChanges, Output, EventEmitter, ViewChild, ElementRef, AfterViewInit, OnDestroy } from '@angular/core'; -import { AnimationController, ModalController, PopoverController, Platform } from '@ionic/angular'; -import { AlertService } from 'src/app/services/alert.service'; -import { GroupContactsPage } from './group-contacts/group-contacts.page'; -import { ChatOptionsFeaturesPage } from 'src/app/modals/chat-options-features/chat-options-features.page'; -import { TimeService } from 'src/app/services/functions/time.service'; -import { SearchPage } from 'src/app/pages/search/search.page'; -import { SearchList } from 'src/app/models/search-document'; -import { FileService } from 'src/app/services/functions/file.service'; -import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page'; -import { ThemeService } from 'src/app/services/theme.service' -import { Storage } from '@ionic/storage'; -// 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'; -import { ToastService } from 'src/app/services/toast.service'; -import { Camera, CameraResultType, CameraSource } from '@capacitor/camera'; -import { VoiceRecorder, RecordingData, GenericResponse } from 'capacitor-voice-recorder'; -import { Filesystem, Directory } from '@capacitor/filesystem'; -import { DomSanitizer } from '@angular/platform-browser'; -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'; -import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page'; -import { PermissionService } from 'src/app/services/permission.service'; -import { FileValidatorService } from "src/app/services/file/file-validator.service" -import { ChatOptionsPopoverPage } from '../../modal/chat-options-popover/chat-options-popover.page'; -import { ChatPopoverPage } from '../../modal/chat-popover/chat-popover.page'; -@Component({ - selector: 'app-group-messages', - templateUrl: './group-messages.page.html', - styleUrls: ['./group-messages.page.scss'], -}) -export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy { - showLoader: boolean; - isGroupCreated: boolean; - loggedUser: any; - message: any; - messages: any; - documents: SearchList[] = []; - - room: any = new Array(); - members: any; - - capturedImage: any; - capturedImageTitle: any; - - loggedUserChat: any; - scrollingOnce: boolean = true; - private scrollChangeCallback: () => void; - currentPosition: any; - startPosition: number; - scrollToBottomBtn = false; - isAdmin = false; - - @Input() roomId: string; - @Output() closeAllDesktopComponents: EventEmitter = new EventEmitter(); - @Output() showEmptyContainer: EventEmitter = new EventEmitter(); - @Output() openGroupContacts: EventEmitter = new EventEmitter(); - @Output() openEditGroupPage: EventEmitter = new EventEmitter(); - @Output() openNewEventPage: EventEmitter = new EventEmitter(); - @Output() getGroups: EventEmitter = new EventEmitter(); - - @ViewChild('scrollMe') private myScrollContainer: ElementRef; - - downloadFile: any; - showAvatar = false; - - recording = false; - allowTyping = true; - storedFileNames = []; - lastAudioRecorded = ''; - audioRecorded: any = ""; - audioDownloaded: any = ""; - durationDisplay = ''; - duration = 0; - - audioPermissionStatus: 'granted'| 'denied' | 'prompt' | null = null - sessionStore = SessionStore - groupNameFormart = ""; - - constructor( - // public ChatSystemService: ChatSystemService, - private modalController: ModalController, - public popoverController: PopoverController, - private animationController: AnimationController, - private alertService: AlertService, - private timeService: TimeService, - private fileService: FileService, - public ThemeService: ThemeService, - private storage: Storage, - private CameraService: CameraService, - private toastService: ToastService, - private sanitiser: DomSanitizer, - private file: File, - private platform: Platform, - private fileOpener: FileOpener, - public p: PermissionService, - private FileValidatorService: FileValidatorService - ) { - - // this.ChatSystemService.getUser() - this.loggedUserChat = SessionStore.user.ChatData['data']; - this.isGroupCreated = true; - - - } - 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.showAvatar = false - - setTimeout(() => { - this.scrollToBottomClicked() - this.showAvatar = true - }, 50) - - this.deleteRecording(); - - - // if (SessionStore.user.ChatData.data.userId == this.ChatSystemService.getGroupRoom(this.roomId).u._id) { - // this.isAdmin = true - // } else { - // this.isAdmin = false - // } - - } - - ngOnInit() { - this.loggedUser = this.loggedUserChat; - //setTimeout(() => { - this.getRoomInfo() - //}, 1000); - this.getChatMembers(); - - this.deleteRecording(); - this.loadFiles(); - } - - showDateDuration(start: any) { - return this.timeService.showDateDuration(start); - } - - setStatus(status: string) { - let body = { - message: '', - status: status, - } - } - - scrollToBottom(): void { - try { - if (this.scrollingOnce) { - this.myScrollContainer.nativeElement.scrollTop = this.myScrollContainer.nativeElement.scrollHeight; - } - } catch (err) { } - } - - scrollToBottomClicked = () => { - try { - this.myScrollContainer.nativeElement.scrollTop = this.myScrollContainer.nativeElement.scrollHeight; - } catch (err) { } - } - - - ngAfterViewInit() { - this.scrollChangeCallback = () => this.onContentScrolled(event); - window.addEventListener('scroll', this.scrollChangeCallback, true); - } - - onContentScrolled(e) { - this.startPosition = e.srcElement.scrollTop; - let scroll = e.srcElement.scrollTop; - let windowHeight = e.srcElement.scrollHeight; - let containerHeight = windowHeight - e.srcElement.clientHeight; - - if (scroll > this.currentPosition) { - } else { - this.scrollingOnce = false; - } - if ((containerHeight - 100) > scroll) { - this.scrollToBottomBtn = true; - } - else { - this.scrollToBottomBtn = false; - } - this.currentPosition = scroll; - } - - calculateDuration() { - if (!this.recording) { - this.duration = 0; - this.durationDisplay = ''; - return; - } - this.duration += 1; - const minutes = Math.floor(this.duration / 60); - const seconds = (this.duration % 60).toString().padStart(2, '0'); - this.durationDisplay = `${minutes}:${seconds}`; - - setTimeout(() => { - this.calculateDuration(); - }, 1000) - } - - async getFile(fileName?: any) { - const audioFile = await Filesystem.readFile({ - path: fileName, - directory: Directory.Data - }) - const base64sound = audioFile.data; - const base64Response = await fetch(`data:audio/ogg;base64,${base64sound}`); - this.audioRecorded = base64Response.url; - } - - async loadFiles() { - try { - this.storage.get('fileName').then((fileName) => { - this.lastAudioRecorded = fileName; - }) - - this.storage.get('recordData').then((recordData) => { - - if (recordData?.value?.recordDataBase64.includes('data:audio')) { - this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(recordData?.value?.recordDataBase64); - } - else if(recordData?.value?.mimeType && recordData?.value?.recordDataBase64) { - this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(`data:${recordData.value.mimeType};base64,${recordData?.value?.recordDataBase64}`); - } - }); - } catch (error) { } - - - } - - async startRecording() { - VoiceRecorder.requestAudioRecordingPermission(); - if(await VoiceRecorder.canDeviceVoiceRecord().then((result: GenericResponse) =>{return result.value})){ - if(await VoiceRecorder.requestAudioRecordingPermission().then((result: GenericResponse) => {return result.value})){ - //if(await this.hasAudioRecordingPermission()){ - if (this.recording) { - return; - } - this.recording = true; - VoiceRecorder.startRecording(); - this.calculateDuration(); - //} - } - else{ - this.toastService._badRequest('Para gravar uma mensagem de voz, permita o acesso do Gabinete Digital ao seu microfone.'); - } - } - else{ - this.toastService._badRequest('Este dispositivo não tem capacidade para gravação de áudio!'); - } - } - - stopRecording() { - this.deleteRecording(); - this.allowTyping = false; - - if (!this.recording) { - return; - } - this.recording = false; - VoiceRecorder.stopRecording().then(async (result: RecordingData) => { - - this.recording = false; - if (result.value && result.value.recordDataBase64) { - const recordData = result.value.recordDataBase64; - // - const fileName = new Date().getTime() + ".mp3"; - //Save file - this.storage.set('fileName', fileName); - this.storage.set('recordData', result).then(() => { - - }) - } - }) - setTimeout(async () => { - this.loadFiles(); - }, 1000); - } - - async deleteRecording() { - this.storage.remove('fileName'); - this.storage.remove('recordData'); - - this.allowTyping = true; - this.lastAudioRecorded = ''; - this.loadFiles(); - } - - ngOnDestroy() { - window.removeEventListener('scroll', this.scrollChangeCallback, true); - } - - async getChatMembers() { - - // this.chatService.getAllUsers().subscribe(res => { - // // - - // this.allUsers = res['users'] - // // - // }); - - - // if(this.ChatSystemService.users.length == 0) { - // this.ChatSystemService.getUser() - // } - - } - - openGroupContactsPage() { - this.openGroupContacts.emit(this.roomId); - } - - openBookMeetingComponent() { - let data = { - roomId: this.roomId, - members: this.members - } - this.openNewEventPage.emit(data); - } - - close() { - this.modalController.dismiss(); - } - - doRefresh(ev: any) { - this.getRoomInfo(); - ev.target.complete(); - } - - get watch() { - this.getRoomInfo(); - - return this.roomId; - } - - async getRoomInfo() { - - // if(this.ChatSystemService.getGroupRoom(this.roomId)) { - // this.ChatSystemService.getGroupRoom(this.roomId).loadHistory({}); - // } - - this.getGroupContacts(this.room); - } - - getGroupContacts(room: any) { - // this.showLoader = true; - // //If group is private call getGroupMembers - // if (room.t === 'p') { - // this.chatService.getGroupMembers(this.roomId).subscribe(res => { - // // - // this.members = res['members']; - // this.showLoader = false; - // }); - // } - // //Otherwise call getChannelMembers for públic groups - // else { - // this.chatService.getChannelMembers(this.roomId).subscribe(res => { - - // this.members = res['members']; - // this.showLoader = false; - // }); - // } - - // this.members = this.ChatSystemService.getGroupRoom(this.roomId).members - } - - sendMessage() { - // this.ChatSystemService.getGroupRoom(this.roomId).send({}) - } - - - async sendAudio(fileName) { - const roomId = this.roomId - let audioFile; - this.storage.get('recordData').then(async (recordData) => { - - audioFile = recordData; - if (recordData?.value?.recordDataBase64.includes('data:audio')) { - this.audioRecorded = recordData?.value?.recordDataBase64; - } - else if (recordData?.value?.mimeType && recordData?.value?.recordDataBase64) { - this.audioRecorded = `data:${recordData.value.mimeType};base64,${recordData?.value?.recordDataBase64}`; - } - - //Converting base64 to blob - const encodedData = btoa(this.audioRecorded); - const blob = this.fileService.base64toBlob(encodedData, recordData.value.mimeType) - - 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.deleteRecording(); - } - - deleteMessage(msgId: string) { - // const room = this.ChatSystemService.getGroupRoom(this.roomId) - // this.alertService.confirmDeleteMessage(msgId, room); - } - - async openGroupMessagesOptions() { - const enterAnimation = (baseEl: any) => { - const backdropAnimation = this.animationController.create() - .addElement(baseEl.querySelector('ion-backdrop')!) - .fromTo('opacity', '0.01', 'var(--backdrop-opacity)'); - - const wrapperAnimation = this.animationController.create() - .addElement(baseEl.querySelector('.modal-wrapper')!) - .keyframes([ - { offset: 0, opacity: '1', right: '-100%' }, - { offset: 1, opacity: '1', right: '0px' } - ]); - - return this.animationController.create() - .addElement(baseEl) - .easing('ease-out') - .duration(500) - .addAnimation([backdropAnimation, wrapperAnimation]); - } - - const leaveAnimation = (baseEl: any) => { - return enterAnimation(baseEl).direction('reverse'); - } - - const modal = await this.modalController.create({ - enterAnimation, - leaveAnimation, - component: ChatPopoverPage, - cssClass: 'model search-submodal chat-option-aside', - componentProps: { - roomId: this.roomId, - members: this.members, - isAdmin: this.isAdmin - } - }); - await modal.present(); - modal.onDidDismiss().then(res => { - - if (res.data == 'leave') { - this.getRoomInfo(); - this.closeAllDesktopComponents.emit(); - this.showEmptyContainer.emit(); - // this.ChatSystemService.hidingRoom(this.roomId).catch((error) => console.error(error)); - } - else if (res.data == 'delete') { - this.closeAllDesktopComponents.emit(); - this.showEmptyContainer.emit(); - } - else if (res.data == 'cancel') { - - } - else if (res.data == 'edit') { - - //this.closeAllDesktopComponents.emit(); - this.openEditGroupPage.emit(this.roomId); - } else if (res.data == 'addUser') { - - this.openGroupContactsPage(); - } - else { - - - }; - - }); - - } - - openSendGroupMessageOptions(ev?: any) { - if (window.innerWidth <= 701) { - - this.openChatOptions(ev); - } - else { - - this._openChatOptions(); - } - } - - - async openOptions(ev: any) { - - // console.trace(this.room) - - const popover = await this.popoverController.create({ - component: ChatPopoverPage, - cssClass: 'chat-popover modal-desktop', - event: ev, - componentProps: { - room: this.room, - }, - translucent: true - }); - await popover.present(); - popover.onDidDismiss().then(res => { - - if (res.data) { - //this.getRoomInfo(); - //this.modalController.dismiss(); - }; - - }); - } - async openChatOptions(ev: any) { - const popover = await this.popoverController.create({ - component: ChatOptionsPopoverPage, - cssClass: 'chat-options-popover', - event: ev, - componentProps: { - room: this.room, - members: this.members, - }, - translucent: true - }); - await popover.present(); - await popover.onDidDismiss().then(() => { - }); - } - async addContacts() { - - if(this.isAdmin) { - const modal = await this.modalController.create({ - component: GroupContactsPage, - componentProps: { - isCreated: this.isGroupCreated, - room: this.room, - members: this.members, - name: this.room.name, - }, - cssClass: 'contacts', - backdropDismiss: false - }); - - - - modal.onDidDismiss().then(() => { - //this.getRoomInfo(); - }); - - await modal.present(); - } - - } - - - async addDocGestaoDocumental() { - const modal = await this.modalController.create({ - component: SearchPage, - cssClass: 'group-messages modal-desktop search-modal search-modal-to-desktop', - componentProps: { - type: 'AccoesPresidenciais & ArquivoDespachoElect', - select: true, - showSearchInput: true, - } - }); - - modal.onDidDismiss().then(async res => { - if (res) { - const data = res.data; - this.documents.push(data.selected); - - this.addFileWebtrix() - } - }); - - await modal.present(); - } - - viewDocument(file: any, url?: string) { - if (file.type == "application/webtrix") { - this.openViewDocumentModal(file); - } - else { - let fullUrl = "https://www.tabularium.pt" + url; - this.fileService.viewDocumentByUrl(fullUrl); - } - } - - async openViewDocumentModal(file: any) { - let task = { - serialNumber: '', - taskStartDate: '', - isEvent: true, - workflowInstanceDataFields: { - FolderID: '', - Subject: file.Assunto, - SourceSecFsID: file.ApplicationId, - SourceType: 'DOC', - SourceID: file.DocId, - DispatchNumber: '' - } - } - - let doc = { - "Id": "", - "ParentId": "", - "Source": 1, - "ApplicationId": file.ApplicationId, - "CreateDate": "", - "Data": null, - "Description": "", - "Link": null, - "SourceId": file.DocId, - "SourceName": file.Assunto, - "Stakeholders": "", - } - - const modal = await this.modalController.create({ - component: ViewDocumentPage, - componentProps: { - trustedUrl: '', - file: { - title: file.Assunto, - url: '', - title_link: '', - }, - Document: doc, - applicationId: file.ApplicationId, - docId: file.DocId, - folderId: '', - task: task - }, - cssClass: 'modal modal-desktop' - }); - await modal.present(); - } - - async takePictureMobile() { - const roomId = this.roomId - - const file = await Camera.getPhoto({ - quality: 90, - // allowEditing: true, - resultType: CameraResultType.Base64, - source: CameraSource.Camera - }); - - //const imageData = await this.fileToBase64Service.convert(file) - // - var base64 = 'data:image/jpeg;base64,' + file.base64String - const compressedImage = await this.compressImageBase64( - base64, - 800, // maxWidth - 800, // maxHeight - 0.9 // quality - ).then((picture) => { - console.log('Selected: ', picture) - base64 = picture - }); - - const response = await fetch(base64); - const blob = await response.blob(); - - 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, - // } - // }) - - } - - async takePicture() { - // const roomId = this.roomId - - // const image = await this.CameraService.takePicture(); - // await this.fileService.saveImage(image) - // const lastphoto: any = await this.fileService.loadFiles(); - // const { capturedImage, capturedImageTitle } = await this.fileService.loadFileData(lastphoto); - - // const base64 = await fetch(capturedImage); - // const blob = await base64.blob(); - // const formData = new FormData(); - // formData.append("blobFile", blob); - - const roomId = this.roomId - - const file = await Camera.getPhoto({ - quality: 90, - // allowEditing: true, - resultType: CameraResultType.Base64, - source: CameraSource.Camera - }); - - const imageBase64 = 'data:image/jpeg;base64,' + file.base64String - const blob = this.dataURItoBlob(imageBase64) - - console.log(imageBase64) - - 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, - // } - // }) - - } - - async addImage() { - this.addFileToChatMobile(['image/apng', 'image/jpeg', 'image/png']) - } - - async addFile() { - this.addFileToChat(['.doc', '.docx', '.pdf']) - } - - async addFileWebtrix() { - const roomId = this.roomId - - const modal = await this.modalController.create({ - component: SearchPage, - cssClass: 'group-messages modal-desktop search-modal search-modal-to-desktop', - componentProps: { - type: 'AccoesPresidenciais & ArquivoDespachoElect', - select: true, - showSearchInput: true, - } - }); - - modal.onDidDismiss().then(async res => { - const data = res.data; - - 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 - // }) - - - } - }); - - await modal.present(); - } - async addFileToChatMobile(types: typeof FileType[]) { - const roomId = this.roomId - - const file = await Camera.getPhoto({ - quality: 90, - // allowEditing: true, - resultType: CameraResultType.Base64, - source: CameraSource.Photos - }); - - const imageBase64 = 'data:image/jpeg;base64,' + file.base64String - const blob = this.dataURItoBlob(imageBase64) - - console.log(imageBase64) - - 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, - // } - // }) - - } - - - async addFileToChat(types: typeof FileType[]) { - - const roomId = this.roomId - - const file: any = await this.fileService.getFileFromDevice(types); - - const fileName = file.name - - const validation = this.FileValidatorService.fileNameValidation(fileName) - - if(validation.isOk) { - - const encodedData = btoa(JSON.stringify(await this.getBase64(file).catch ((error) => { - console.error(error); - }))); - let blob; - let formData - let fileBase64 - if (this.platform.is("tablet")) { - - blob = this.fileService.base64toBlob(encodedData, file.type) - console.log('BLOB BLOB', blob) - - formData = new FormData(); - formData.append('blobFile', blob); - /* console.log('add file', fileBase64) */ - - } else { - blob = this.fileService.base64toBlob(encodedData, file.type) - - fileBase64 = await this._getBase64(file) - - formData = new FormData(); - 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, - // } - // }) - } else { - this.toastService._badRequest("Ficheiro inválido") - } - - - } - - getFileReader(): FileReader { - const fileReader = new FileReader(); - const zoneOriginalInstance = (fileReader as any)["__zone_symbol__originalInstance"]; - return zoneOriginalInstance || fileReader; - } - - getBase64(file) { - var reader = this.getFileReader(); - reader.readAsDataURL(file); - return new Promise(resolve => { - reader.onload = function () { - resolve(reader.result) - }; - reader.onerror = function (error) { - - }; - }); - - } - - bookMeeting() { - let data = { - roomId: this.roomId, - members: this.members - } - this.openNewEventPage.emit(data); - } - - async _openChatOptions() { - - const enterAnimation = (baseEl: any) => { - const backdropAnimation = this.animationController.create() - .addElement(baseEl.querySelector('ion-backdrop')!) - .fromTo('opacity', '0.01', 'var(--backdrop-opacity)'); - - const wrapperAnimation = this.animationController.create() - .addElement(baseEl.querySelector('.modal-wrapper')!) - .keyframes([ - { offset: 0, opacity: '1', right: '-100%' }, - { offset: 1, opacity: '1', right: '0px' } - ]); - - return this.animationController.create() - .addElement(baseEl) - .easing('ease-out') - .duration(500) - .addAnimation([backdropAnimation, wrapperAnimation]); - } - - const leaveAnimation = (baseEl: any) => { - return enterAnimation(baseEl).direction('reverse'); - } - - const modal = await this.modalController.create({ - enterAnimation, - leaveAnimation, - component: ChatOptionsFeaturesPage, - cssClass: 'model profile-modal search-submodal', - componentProps: { - roomId: this.roomId, - members: this.members, - } - }); - await modal.present(); - modal.onDidDismiss().then(async (res) => { - - const roomId = this.roomId; - - if (res['data'] == 'meeting') { - //this.closeAllDesktopComponents.emit(); - let data = { - roomId: this.roomId, - members: this.members - } - this.openNewEventPage.emit(data); - } - else if (res['data'] == 'take-picture') { - - this.takePicture() - - } - else if (res['data'] == 'add-picture') { - - this.addImage() - - } - else if (res['data'] == 'add-document') { - - this.addFile() - - } - else if (res['data'] == 'documentoGestaoDocumental') { - - this.addFileWebtrix() - - this.showLoader = false; - } - - }); - } - - - downloadFileMsg(msg: any) { - msg.downloadFileMsg() - } - - downloadFileFromBrowser(fileName: string, data: any): void { - const link = document.createElement("a") - link.href = `data:${data.type}';base64,${data.image_url}`; - link.download = fileName - link.click() - - link.remove() - } - - b64toBlob(b64Data, contentType) { - contentType = contentType || ''; - var sliceSize = 512; - b64Data = b64Data.replace(/^[^,]+,/, ''); - b64Data = b64Data.replace(/\s/g, ''); - var byteCharacters = window.atob(b64Data); - var byteArrays = []; - - for (var offset = 0; offset < byteCharacters.length; offset += sliceSize) { - var slice = byteCharacters.slice(offset, offset + sliceSize); - - var byteNumbers = new Array(slice.length); - for (var i = 0; i < slice.length; i++) { - byteNumbers[i] = slice.charCodeAt(i); - } - - var byteArray = new Uint8Array(byteNumbers); - - byteArrays.push(byteArray); - } - - var blob = new Blob(byteArrays, { type: contentType }); - return blob; - } - - openFile(pdfString, filename, type) { - const blob = this.b64toBlob(pdfString, type) - let pathFile = '' - const fileName = filename - const contentFile = blob - if (this.platform.is('ios')) { - pathFile = this.file.documentsDirectory - } else { - pathFile = this.file.externalRootDirectory - } - - - - this.file - .writeFile(pathFile, fileName, contentFile, { replace: true }) - .then(success => { - this.fileOpener - .open(pathFile + fileName, type) - .then(() => {}) - .catch(e => console.error(e)) - }) - .catch(e => console.error(e)) - } - - async openPreview(msg) { - - - if (msg.file.type === "application/webtrix") { - this.viewDocument(msg.file, msg.attachments.image_url) - } else { - - if (!msg.attachments[0].image_url || msg.attachments[0].image_url === null || msg.attachments[0].image_url === '') { - this.downloadFileMsg(msg) - //this.testDownlod(msg) - - } else { - var str = msg.attachments[0].image_url; - str = str.substring(1, ((str.length) - 1)); - - if (this.platform.is('desktop') || this.platform.is('mobileweb')) { - - if (msg.file.type == "application/img") { - const modal = await this.modalController.create({ - component: ViewMediaPage, - cssClass: 'modal modal-desktop', - componentProps: { - image: msg.attachments[0].image_url, - type: msg.file.type, - username: msg.u.name, - _updatedAt: msg._updatedAt - } - }); - modal.present(); - } else { - this.downloadFileFromBrowser(msg.attachments[0].title, msg.attachments[0]) - } - } else { - this.openFile(msg.attachments.image_url, msg.attachments[0].title, msg.file.type); - } - - } - } - - } - - async audioPreview(msg) { - - if (!msg.attachments[0].title_link || msg.attachments[0].title_link === null || msg.attachments[0].title_link === '') { - this.downloadFileMsg(msg) - } else { } - } - - - async compressImageBase64(base64String: string, maxWidth: number, maxHeight: number, quality: number): Promise { - return new Promise((resolve, reject) => { - const image = new (window as any).Image(); - image.src = base64String; - - image.onload = async () => { - const canvas = document.createElement('canvas'); - let newWidth = image.width; - let newHeight = image.height; - - if (newWidth > maxWidth) { - newHeight *= maxWidth / newWidth; - newWidth = maxWidth; - } - - if (newHeight > maxHeight) { - newWidth *= maxHeight / newHeight; - newHeight = maxHeight; - } - - canvas.width = newWidth; - canvas.height = newHeight; - - const context = canvas.getContext('2d'); - context?.drawImage(image, 0, 0, newWidth, newHeight); - - const compressedBase64 = canvas.toDataURL('image/jpeg', quality); - resolve(compressedBase64); - }; - - image.onerror = (error) => { - reject(error); - }; - }); - } - - dataURItoBlob(dataURI) { - // convert base64 to raw binary data held in a string - // doesn't handle URLEncoded DataURIs - see SO answer #6850276 for code that does this - var byteString = atob(dataURI.split(',')[1]); - - // separate out the mime component - var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0] - - // write the bytes of the string to an ArrayBuffer - var ab = new ArrayBuffer(byteString.length); - - // create a view into the buffer - var ia = new Uint8Array(ab); - - // set the bytes of the buffer to the correct values - for (var i = 0; i < byteString.length; i++) { - ia[i] = byteString.charCodeAt(i); - } - - // write the ArrayBuffer to a blob, and you're done - var blob = new Blob([ab], {type: mimeString}); - return blob; - - } - - - - _getBase64(file) { - return new Promise((resolve, reject)=>{ - var reader = new FileReader(); - reader.readAsDataURL(file); - reader.onload = function () { - resolve(reader.result) - }; - reader.onerror = function (error) { - console.log('Error: ', error); - }; - }) - } - -} - diff --git a/src/app/ui/chat/component/messages/contacts/contacts-routing.module.ts b/src/app/ui/chat/component/messages/contacts/contacts-routing.module.ts deleted file mode 100644 index fb8c7a5ea..000000000 --- a/src/app/ui/chat/component/messages/contacts/contacts-routing.module.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { NgModule } from '@angular/core'; -import { Routes, RouterModule } from '@angular/router'; - -import { ContactsPage } from './contacts.page'; - -const routes: Routes = [ - { - path: '', - component: ContactsPage - } -]; - -@NgModule({ - imports: [RouterModule.forChild(routes)], - exports: [RouterModule], -}) -export class ContactsPageRoutingModule {} diff --git a/src/app/ui/chat/component/messages/contacts/contacts.module.ts b/src/app/ui/chat/component/messages/contacts/contacts.module.ts deleted file mode 100644 index 2fbc17124..000000000 --- a/src/app/ui/chat/component/messages/contacts/contacts.module.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormsModule } from '@angular/forms'; - -import { IonicModule } from '@ionic/angular'; - -import { ContactsPageRoutingModule } from './contacts-routing.module'; - -import { ContactsPage } from './contacts.page'; -import { SharedModule } from 'src/app/shared/shared.module'; -import { FilterPipe } from 'src/app/pipes/filter.pipe'; -import { PipesModule } from 'src/app/pipes/pipes.module'; - -@NgModule({ - imports: [ - CommonModule, - FormsModule, - IonicModule, - ContactsPageRoutingModule, - PipesModule, - ], - exports: [ContactsPage], - declarations: [ContactsPage] -}) -export class ContactsPageModule {} diff --git a/src/app/ui/chat/component/messages/contacts/contacts.page.html b/src/app/ui/chat/component/messages/contacts/contacts.page.html deleted file mode 100644 index 5c15d7303..000000000 --- a/src/app/ui/chat/component/messages/contacts/contacts.page.html +++ /dev/null @@ -1,49 +0,0 @@ - - -
-
-
- - - -
-
- - Nova Conversa -
-
-
-
- - - -
- - - - - - - - -
- - - -
- {{ header }} -
- -
-

{{ user.wxFullName }}

- - - -
- -
-
- -
diff --git a/src/app/ui/chat/component/messages/contacts/contacts.page.scss b/src/app/ui/chat/component/messages/contacts/contacts.page.scss deleted file mode 100644 index 84a35bed2..000000000 --- a/src/app/ui/chat/component/messages/contacts/contacts.page.scss +++ /dev/null @@ -1,136 +0,0 @@ -@import '~src/function.scss'; - -.header-toolbar{ - --background:transparent; - --opacity: 1; - - .main-header{ - width: 100%; - height: 100%; - font-family: Roboto; - border-top-left-radius: 25px; - border-top-right-radius: 25px; - background-color: #fff; - overflow:hidden; - padding: 30px 20px 0px 20px; - color:#000; - transform: translate3d(0, 1px, 0); - - .div-icon{ - width: rem(40); - float: right; - font-size: rem(35); - overflow: auto; - padding: 1px; - } - .div-icon ion-icon{ - float: right; - padding-left: 20px; - } - .title-content{ - margin: 0px auto; - overflow: auto; - padding: 0 !important; - } - - .back-icon{ - width: 37px; - float: left; - font-size: rem(35); - overflow: auto; - - } - .div-title{ - width: 221px; - padding: 0!important; - float: left; - margin: 2.5px 0 0 5px; - } - .title{ - font-size: rem(25); - } - } - } - .toolbar-search{ - --padding-top:0 !important; - --padding-bottom:0 !important; - --padding-start:0 !important; - --padding-end:0 !important; - - .search{ - border: 1px solid #ebebeb; - margin: 5px 20px 5px 20px; - border-radius: 5px; - height: auto; - padding: 0 !important; - } - .search ion-searchbar{ - /* border: 1px solid green; */ - width: 100%; - margin: 0 !important; - padding: 0 !important; - --border-radius: 5px; - --box-shadow: none; - overflow: hidden; - --icon-color:var( --font-awesome); - } - - } - ion-content{ - --background:transparent; - } - .main-content{ - width: 100%; - height: 100%; - font-family: Roboto; - margin: 0 auto; - background-color: #fff; - padding: 0 0 0 0; - overflow:auto; - - .item-divider{ - background: #ebebeb; - font-size: rem(15); - margin: 10px 0 10px 0; - padding:5px 0 5px 20px; - - } - - .item-user{ - display: flex; - margin: 10px 20px 10px 20px !important; - overflow: auto; - align-items: center; - } - - .item-user p{ - display: block; - margin: 0 !important; - width: 90%; - font-size: rem(15); - color: var(--title-text-color); - float: left; - } - .item-user .icon{ - width: 10%; - font-size: rem(10); - display: block; - text-align: right; - overflow: auto; - } - .online{ - color:#99e47b; - } - .offline{ - color:#cbced1; - } - .away{ - color:#ffd21f; - } - .invisible{ - color:#cbced1; - } - .busy{ - color:#f5455c; - } - } \ No newline at end of file diff --git a/src/app/ui/chat/component/messages/contacts/contacts.page.spec.ts b/src/app/ui/chat/component/messages/contacts/contacts.page.spec.ts deleted file mode 100644 index 8f263232b..000000000 --- a/src/app/ui/chat/component/messages/contacts/contacts.page.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { IonicModule } from '@ionic/angular'; - -import { ContactsPage } from './contacts.page'; - -describe('ContactsPage', () => { - let component: ContactsPage; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ ContactsPage ], - imports: [IonicModule.forRoot()] - }).compileComponents(); - - fixture = TestBed.createComponent(ContactsPage); - component = fixture.componentInstance; - fixture.detectChanges(); - })); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/ui/chat/component/messages/contacts/contacts.page.ts b/src/app/ui/chat/component/messages/contacts/contacts.page.ts deleted file mode 100644 index 609e5abdc..000000000 --- a/src/app/ui/chat/component/messages/contacts/contacts.page.ts +++ /dev/null @@ -1,203 +0,0 @@ -import { HttpHeaders } from '@angular/common/http'; -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 { 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'; - -import { HttpErrorResponse } from '@angular/common/http'; -import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'; -import { ToastService } from 'src/app/services/toast.service'; -import { ChatServiceService } from 'src/app/module/chat/domain/chat-service.service' - - -class UserToSelect { - -} - -@Component({ - selector: 'app-contacts', - templateUrl: './contacts.page.html', - styleUrls: ['./contacts.page.scss'], -}) -export class ContactsPage implements OnInit { - loggedUser: any; - - headers: HttpHeaders; - options: any; - textSearch: string; - room: any; - dm: any; - sessionStore = SessionStore - loading = false - @Input() roomId: string; - - @Output() openMessage: EventEmitter = new EventEmitter(); - @Output() emptyTextDescriptionOpen: EventEmitter = new EventEmitter(); - @Output() backToChat: EventEmitter = new EventEmitter(); - @Output() closeAllDesktopComponents: EventEmitter = new EventEmitter(); - - userList: UserContacts[]; - originalUserList: any[] = []; - - CoolList = [] - - constructor( - private modalController: ModalController, - public ThemeService: ThemeService, - // public ChatSystemService: ChatSystemService, - private contactsRepositoryService: ContactRepositoryService, - private httpErrorHandle: HttpErrorHandle, - private toastService: ToastService, - private ChatServiceService: ChatServiceService - ) { - this.loggedUser = SessionStore.user.ChatData['data']; - this.textSearch = ""; - this.dm = null; - this.room = null; - } - - async ngOnInit() { - - this.loadUsers(); - } - - onChange(event) { - this.textSearch = event.detail.value.toLowerCase(); - this.userList = this.originalUserList.filter((e) => { - const username = e.wxFullName.toLowerCase(); - return username.includes(this.textSearch); - }); - - this.userList.sort((a, b) => a.wxFullName.toLowerCase().localeCompare(b.wxFullName.toLowerCase())); - } - - openMessagesPage(username: string, wxUserId: number) { - this.createRoom(username, wxUserId); - /* if (window.innerWidth < 701) { - this.createRoom(username); - } - else { - let body = { - username: username, - } - - this.loading = true - this.chatService.createRoom(body).subscribe(res => { - this.room = res['room']; - - this.ChatSystemService.getAllRooms(() => { - this.openMessage.emit(this.room._id); - - this.loading = false - }, this.room._id); - - }, () => { - this.loading = false - }); - }*/ - } - - async loadUsers() { - try { - let users = await this.contactsRepositoryService.getUsers(); - if (users.isOk()) { - const userData = users.value.data.result; - console.log(userData) - this.originalUserList = userData; - this.userList = [...this.originalUserList]; - this.userList.sort((a, b) => a.wxFullName.toLowerCase().localeCompare(b.wxFullName.toLowerCase())); - console.log('User data loaded successfully:', this.originalUserList); - } else { - console.error('Failed to fetch users:', users.error); - } - this.loading = false; - } catch (error) { - console.error('Error loading users', error); - this.loading = false; - } - } - - separateLetter(record, recordIndex, records) { - const normalize = (str) => str.normalize('NFD').replace(/[\u0300-\u036f]/g, ''); - - if (recordIndex == 0) { - return normalize(record.wxFullName[0]).toUpperCase(); - } - - let firstPrev = normalize(records[recordIndex - 1].wxFullName[0]).toUpperCase(); - let firstCurrent = normalize(record.wxFullName[0]).toUpperCase(); - - if (firstPrev !== firstCurrent) { - return firstCurrent; - } - return null; - } - - doRefresh(event) { - } - - close() { - if (this.roomId) { - this.backToChat.emit({ roomId: this.roomId }); - } else { - this.closeAllDesktopComponents.emit(); - } - - } - - clicked() { - - } - - async createRoom(username: string, wxUserId: number) { - const result = await this.ChatServiceService.createRoom({ - roomName: username, - createdBy: SessionStore.user.UserId, - roomType: 0, - expirationDate: null, - members: [wxUserId] - }) - - - console.log(result) - - if(result.isOk()) { - await this.ChatServiceService.getRoomById(result.value.id); - this.openMessage.emit(result.value.id); - - } else if(result.error instanceof HttpErrorResponse) { - this.httpErrorHandle.httpStatusHandle(result.error) - } else { - this.toastService._badRequest("Pedimos desculpa mas não foi possível executar a acção. Por favor, contacte o apoio técnico.") - console.log(result.error) - } - /* this.chatService.createRoom(body).subscribe(res => { - - this.room = res['room']; - this.openMessagesModal(this.room._id); - this.ChatSystemService.getAllRooms() - }); */ - } - - async openMessagesModal(roomId: any) { - - - - const modal = await this.modalController.create({ - component: MessagesPage, - cssClass: 'modal modal-desktop isMessagesChatOpened', - componentProps: { - roomId: roomId, - }, - }); - - modal.onDidDismiss(); - await modal.present(); - } - - -} diff --git a/src/app/ui/chat/component/messages/messages-routing.module.ts b/src/app/ui/chat/component/messages/messages-routing.module.ts index c00bd5ccb..a8b70e2ef 100644 --- a/src/app/ui/chat/component/messages/messages-routing.module.ts +++ b/src/app/ui/chat/component/messages/messages-routing.module.ts @@ -1,21 +1,22 @@ -import { NgModule } from '@angular/core'; -import { Routes, RouterModule } from '@angular/router'; - -import { MessagesPage } from './messages.page'; - -const routes: Routes = [ - { - path: '', - component: MessagesPage - }, { +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; + +import { MessagesPage } from './messages.page'; + +const routes: Routes = [ + { + path: '', + component: MessagesPage + }, + { path: 'contacts', - loadChildren: () => import('./contacts/contacts.module').then( m => m.ContactsPageModule) + loadChildren: () => import('../contacts/contacts.module').then( m => m.ContactsPageModule) } -]; - -@NgModule({ - imports: [RouterModule.forChild(routes)], - exports: [RouterModule], -}) -export class MessagesPageRoutingModule {} +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule], +}) +export class MessagesPageRoutingModule {} diff --git a/src/app/ui/chat/component/messages/messages.page.html b/src/app/ui/chat/component/messages/messages.page.html index 68caebb27..d0fc4bd4f 100644 --- a/src/app/ui/chat/component/messages/messages.page.html +++ b/src/app/ui/chat/component/messages/messages.page.html @@ -7,7 +7,7 @@ -
+
- - diff --git a/src/app/ui/chat/modal/chat-message-debugging/chat-message-debugging.page.scss b/src/app/ui/chat/modal/chat-message-debugging/chat-message-debugging.page.scss deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/app/ui/chat/modal/chat-message-debugging/chat-message-debugging.page.spec.ts b/src/app/ui/chat/modal/chat-message-debugging/chat-message-debugging.page.spec.ts deleted file mode 100644 index 6080b7ada..000000000 --- a/src/app/ui/chat/modal/chat-message-debugging/chat-message-debugging.page.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; -import { IonicModule } from '@ionic/angular'; - -import { ChatMessageDebuggingPage } from './chat-message-debugging.page'; - -describe('ChatMessageDebuggingPage', () => { - let component: ChatMessageDebuggingPage; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ ChatMessageDebuggingPage ], - imports: [IonicModule.forRoot()] - }).compileComponents(); - - fixture = TestBed.createComponent(ChatMessageDebuggingPage); - component = fixture.componentInstance; - fixture.detectChanges(); - })); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/ui/chat/modal/chat-message-debugging/chat-message-debugging.page.ts b/src/app/ui/chat/modal/chat-message-debugging/chat-message-debugging.page.ts deleted file mode 100644 index 1fac0421f..000000000 --- a/src/app/ui/chat/modal/chat-message-debugging/chat-message-debugging.page.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { Component, OnInit } from '@angular/core'; -import { NavParams } from '@ionic/angular'; -// import { ChatSystemService } from 'src/app/services/chat/chat-system.service'; - -@Component({ - selector: 'app-chat-message-debugging', - templateUrl: './chat-message-debugging.page.html', - styleUrls: ['./chat-message-debugging.page.scss'], -}) -export class ChatMessageDebuggingPage implements OnInit { - - roomId: string - - constructor( - // public ChatSystemService: ChatSystemService, - private navParams: NavParams - ) { } - - ngOnInit() { - this.roomId = this.navParams.get('roomId') - - - } - - loadHistory() { - // this.ChatSystemService.getDmRoom(this.roomId).loadHistory({}); - } - -} diff --git a/src/app/ui/chat/modal/group-messages/group-contacts/group-contacts-routing.module.ts b/src/app/ui/chat/modal/group-contacts/group-contacts-routing.module.ts similarity index 100% rename from src/app/ui/chat/modal/group-messages/group-contacts/group-contacts-routing.module.ts rename to src/app/ui/chat/modal/group-contacts/group-contacts-routing.module.ts diff --git a/src/app/ui/chat/modal/group-messages/group-contacts/group-contacts.module.ts b/src/app/ui/chat/modal/group-contacts/group-contacts.module.ts similarity index 100% rename from src/app/ui/chat/modal/group-messages/group-contacts/group-contacts.module.ts rename to src/app/ui/chat/modal/group-contacts/group-contacts.module.ts diff --git a/src/app/ui/chat/modal/group-messages/group-contacts/group-contacts.page.html b/src/app/ui/chat/modal/group-contacts/group-contacts.page.html similarity index 100% rename from src/app/ui/chat/modal/group-messages/group-contacts/group-contacts.page.html rename to src/app/ui/chat/modal/group-contacts/group-contacts.page.html diff --git a/src/app/ui/chat/modal/group-messages/group-contacts/group-contacts.page.scss b/src/app/ui/chat/modal/group-contacts/group-contacts.page.scss similarity index 100% rename from src/app/ui/chat/modal/group-messages/group-contacts/group-contacts.page.scss rename to src/app/ui/chat/modal/group-contacts/group-contacts.page.scss diff --git a/src/app/ui/chat/modal/group-messages/group-contacts/group-contacts.page.spec.ts b/src/app/ui/chat/modal/group-contacts/group-contacts.page.spec.ts similarity index 100% rename from src/app/ui/chat/modal/group-messages/group-contacts/group-contacts.page.spec.ts rename to src/app/ui/chat/modal/group-contacts/group-contacts.page.spec.ts diff --git a/src/app/ui/chat/modal/group-messages/group-contacts/group-contacts.page.ts b/src/app/ui/chat/modal/group-contacts/group-contacts.page.ts similarity index 94% rename from src/app/ui/chat/modal/group-messages/group-contacts/group-contacts.page.ts rename to src/app/ui/chat/modal/group-contacts/group-contacts.page.ts index cde29c314..569aa59ea 100644 --- a/src/app/ui/chat/modal/group-messages/group-contacts/group-contacts.page.ts +++ b/src/app/ui/chat/modal/group-contacts/group-contacts.page.ts @@ -85,11 +85,8 @@ export class GroupContactsPage implements OnInit { async loadUsers() { const getallChatUsers = await this.contactsRepositoryService.getUsers() - const getRoomById = await this.chatServiceService.getRoomById(this.roomId) - console.log({getallChatUsers, getRoomById}) - - if(getallChatUsers.isOk() && getRoomById.isOk()) { + if(getallChatUsers.isOk()) { this.allChatUsers = getallChatUsers.value.data.result.sort((a,b) => { if(a.wxFullName < b.wxFullName) { @@ -133,15 +130,8 @@ export class GroupContactsPage implements OnInit { } - } - else if (getRoomById.isErr() && getRoomById.error instanceof HttpResponse) { - this.httpErrorHandle.httpStatusHandle(getRoomById.error) } else if (getallChatUsers.isErr() && getallChatUsers.error instanceof HttpResponse) { this.httpErrorHandle.httpStatusHandle(getallChatUsers.error) - } else if (getRoomById.isErr() ) { - console.log(getRoomById.error) - } else if (getallChatUsers.isErr() ) { - console.log(getallChatUsers.error) } else { this.toastService._badRequest("Pedimos desculpa mas não foi possível executar a acção. Por favor, contacte o apoio técnico.") } diff --git a/src/app/ui/chat/modal/group-messages/group-messages-routing.module.ts b/src/app/ui/chat/modal/group-messages/group-messages-routing.module.ts deleted file mode 100644 index 708ec8d8f..000000000 --- a/src/app/ui/chat/modal/group-messages/group-messages-routing.module.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { NgModule } from '@angular/core'; -import { Routes, RouterModule } from '@angular/router'; - -import { GroupMessagesPage } from './group-messages.page'; - -const routes: Routes = [ - { - path: '', - component: GroupMessagesPage - }, { - path: 'group-contacts', - loadChildren: () => import('./group-contacts/group-contacts.module').then( m => m.GroupContactsPageModule) - } - -]; - -@NgModule({ - imports: [RouterModule.forChild(routes)], - exports: [RouterModule], -}) -export class GroupMessagesPageRoutingModule {} diff --git a/src/app/ui/chat/modal/group-messages/group-messages.module.ts b/src/app/ui/chat/modal/group-messages/group-messages.module.ts deleted file mode 100644 index 727bdf276..000000000 --- a/src/app/ui/chat/modal/group-messages/group-messages.module.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormsModule } from '@angular/forms'; -import { BrowserModule } from '@angular/platform-browser'; - -import { IonicModule } from '@ionic/angular'; - -import { GroupMessagesPageRoutingModule } from './group-messages-routing.module'; - -import { GroupMessagesPage } from './group-messages.page'; - -import { BtnModalDismissPageModule } from 'src/app/shared/btn-modal-dismiss/btn-modal-dismiss.module'; - -import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; -import { LettersAvatarModule } from "ngx-letters-avatar"; -import { PipesModule } from 'src/app/pipes/pipes.module'; -import { ChatPopoverPageModule } from '../chat-popover/chat-popover.module'; - -@NgModule({ - imports: [ - CommonModule, - FormsModule, - FontAwesomeModule, - IonicModule, - GroupMessagesPageRoutingModule, - ChatPopoverPageModule, - BtnModalDismissPageModule, - LettersAvatarModule, - PipesModule, - /* ImageCropperModule, - AngularCropperjsModule */ - - ], - declarations: [GroupMessagesPage] -}) -export class GroupMessagesPageModule {} diff --git a/src/app/ui/chat/modal/group-messages/group-messages.page.html b/src/app/ui/chat/modal/group-messages/group-messages.page.html deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/app/ui/chat/modal/group-messages/group-messages.page.scss b/src/app/ui/chat/modal/group-messages/group-messages.page.scss deleted file mode 100644 index 4c73702bb..000000000 --- a/src/app/ui/chat/modal/group-messages/group-messages.page.scss +++ /dev/null @@ -1,441 +0,0 @@ -@import '~src/function.scss'; - -.header-toolbar { - --background: transparent; - --opacity: 1; - - .main-header { - width: 100%; - /* 400px */ - height: 100%; - font-family: Roboto; - border-top-left-radius: 25px; - border-top-right-radius: 25px; - background-color: #fff; - overflow: hidden; - padding: 30px 20px 0px 20px; - color: #000; - transform: translate3d(0, 1px, 0); - - .header-top { - overflow: auto; - padding: 0 !important; - background: #fff; - - .left { - width: fit-content; - float: left; - //font-size: rem(35); - overflow: hidden; - } - - .middle-container { - display: flex; - overflow: auto; - height: auto; - width: calc(100% - 47px); - float: left; - - /* white-space: nowrap; - overflow: hidden !important; - text-overflow: ellipsis !important; */ - - .middle { - width: 100%; - padding: 0 !important; - margin: 0 0 0 10px; - font-size: rem(25); - } - } - - .middle-container-options { - padding: 0 !important; - float: left; - width: calc(100% - 67px); - text-align: right; - - .middle-container-options-icons { - color: #0782c9; - font-size: rem(23); - } - } - - .right { - padding: 0 !important; - float: right; - font-size: rem(25); - color: #0782c9; - } - - .header-top-btn { - background: transparent; - font-size: rem(25) !important; - font-weight: 100 !important; - /* color: #0782c9; */ - color: #42b9fe; - padding: 0 5px 0 5px; - } - } - - .header-bottom { - padding-left: 10px; - overflow: auto; - margin: 0 auto; - - .header-bottom-icon { - width: rem(30); - font-size: rem(25); - float: left; - padding: 2px; - - } - - .header-bottom-contacts { - width: calc(100% - 40px); - font-size: rem(15); - color: #797979; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - float: left; - padding: 5px; - margin: 1px; - - .contacts-list { - white-space: nowrap; - overflow: hidden !important; - text-overflow: ellipsis !important; - } - } - } - - .div-icon { - width: rem(40); - float: right; - font-size: rem(35); - overflow: auto; - padding: 1px; - } - - .div-icon ion-icon { - float: right; - padding-left: 20px; - } - } -} - -ion-content { - .welcome-text { - /* width: 322px; */ - width: em(422px); - background: #ebebeb; - text-align: center; - font-size: rem(13); - color: #797979; - padding: 10px; - margin: 0 auto !important; - line-height: 1.2rem; - // margin: 20px 39px 25px; - border-radius: 8px; - } - - .info-text { - display: flex; - width: fit-content; - height: auto; - background: var(--chat-alert-msg-color); - text-align: center; - font-size: rem(13); - color: #262420; - padding: 10px; - margin: 10px auto; - line-height: 1.2rem; - border-radius: 8px; - } - - .info-text-leave { - display: flex; - align-items: center; - justify-content: center; - width: fit-content; - padding: 10px; - background: #e0e9ee; - border-radius: 8px; - margin: 10px auto; - color: #797979 !important; - font-size: rem(13) !important; - /* margin: 15px 0px 15px 0px; */ - - .info-text-leave ion-label { - font-size: rem(13) !important; - line-height: 1.2rem; - } - } - - .messages { - font-size: rem(13); - font-family: Roboto; - overflow: auto; - - //set scroll do bottom - position: absolute; - top: 0; - left: 0; - overflow-x: hidden; - overflow-y: auto; - width: 100%; - height: 100%; - word-wrap: break-word; - -webkit-overflow-scrolling: touch; - - .messages-list-item-wrapper { - overflow: hidden; - } - - .messages-list-item-wrapper-active { - background: #e6f6ff75 !important; - } - - .message-container { - //border: 1px solid red; - } - - - .incoming-true, - .incoming-false { - width: 305px; - padding: 15px 20px; - border-radius: 10px; - } - - .incoming-true { - margin: 10px 35px 10px 20px; - background: #ebebeb; - float: left; - } - } - - .incoming-false { - margin: 10px 20px 10px 35px; - background: var(--chat-incoming-msg-color); - float: right; - } - - .title { - color: var(--title-text-color); - - font-weight: bold; - margin-bottom: 5px; - - .time { - color: #797979; - text-align: right; - float: right; - } - } - - .online { - color: #99e47b !important; - } - - .offline { - color: #cbced1 !important; - } - - .away { - color: #ffd21f !important; - } - - .invisible { - color: #cbced1 !important; - } - - .busy { - color: #f5455c !important; - } -} - -.info-meeting { - /* width: 322px; */ - width: em(422); - background: var(--chat-alert-msg-color); - text-align: center; - font-size: rem(13); - color: #262420; - padding: 10px; - margin: 10px auto; - line-height: 1.2rem; - /* margin: 15px 0px 15px 0px; */ - border-radius: 8px; - - .info-meeting-small { - font-size: rem(10); - font-style: italic; - } - - .info-meeting-medium { - font-size: rem(12); - } - - .info-meeting-normal { - color: #0782c9; - font-weight: 700; - text-decoration: underline; - } - - .info-meeting-normal:hover { - text-decoration: underline; - color: #0782c9; - } -} - -ion-footer { - padding-top: 7.5px; - padding-bottom: 20px; - - .container { - justify-content: center; - justify-content: space-evenly; - align-items: center; - - .message-box { - margin: 0 5px 0 5px; - } - - } - - .chat-icon-options { - display: block !important; - font-size: rem(35); - float: right !important; - margin-top: 5px; - } - - .chat-icon-send { - font-size: rem(40); - margin: 0 auto; - margin-top: 4px; - } - - .type-message { - display: flex; - border: 1px solid #ebebeb; - border-radius: 25px; - padding-left: 15px; - align-items: center; - - overflow: auto; - - ion-textarea { - margin: 0 !important; - align-self: center; - } - } - -} - -.preview-slides { - margin-top: 20%; - background: #e6e6e6; - - img { - padding-top: 20px; - padding-bottom: 20px; - } -} - -.transparent-modal { - .modal-wrapper { - --background: rgba(44, 39, 45, 0.2); - } -} - - -.image-slide, -.image-card { - overflow: visible; -} - -.image-card { - z-index: 9; -} - -.backdrop { - height: 200%; - width: 100%; - background: black; - position: absolute; - z-index: 10; -} - - -.typing { - position: relative; - top: -25px; - height: 0px; - left: 0px; - margin-left: 22px; - display: flex; - font-size: rem(12); - align-items: center; -} - - -.typing ngx-letters-avatar { - padding-right: 5px; -} - - -.float-status { - position: relative !important; - float: right; - display: flex; - align-items: self-end; -} - -.float-status-image { - position: relative !important; - float: right; - display: flex; - align-items: self-end; - top: -15px; -} - -.float-status-webtrix { - position: relative !important; - top: 0px !important; - float: right; - display: flex; - align-items: self-end; -} - -.float-status-all { - font-size: rem(13) !important; -} - -.try { - color: red; - background: #f3414159; - padding: 6px; - border-radius: 10px; - cursor: pointer; -} - - - -.font-40-rem { - font-size: 2.5rem !important; -} - - -.dateLabel { - background: #ebebeb !important; - float: unset !important; - margin: 0px auto !important; - width: 111px; - text-align: center; - margin-top: 10px !important; - padding: 15px 20px; - border-radius: 10px; -} - diff --git a/src/app/ui/chat/modal/group-messages/group-messages.page.spec.ts b/src/app/ui/chat/modal/group-messages/group-messages.page.spec.ts deleted file mode 100644 index 62c380096..000000000 --- a/src/app/ui/chat/modal/group-messages/group-messages.page.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { IonicModule } from '@ionic/angular'; - -import { GroupMessagesPage } from './group-messages.page'; - -describe('GroupMessagesPage', () => { - let component: GroupMessagesPage; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ GroupMessagesPage ], - imports: [IonicModule.forRoot()] - }).compileComponents(); - - fixture = TestBed.createComponent(GroupMessagesPage); - component = fixture.componentInstance; - fixture.detectChanges(); - })); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/ui/chat/modal/group-messages/group-messages.page.ts b/src/app/ui/chat/modal/group-messages/group-messages.page.ts deleted file mode 100644 index 9501c8c7d..000000000 --- a/src/app/ui/chat/modal/group-messages/group-messages.page.ts +++ /dev/null @@ -1,1269 +0,0 @@ -import { Component, ElementRef, OnInit, ViewChild, AfterViewInit, OnDestroy, ChangeDetectorRef, } from '@angular/core'; -import { ModalController, NavParams, PopoverController, Platform } from '@ionic/angular'; -import { AlertService } from 'src/app/services/alert.service'; -import { GroupContactsPage } from './group-contacts/group-contacts.page'; -import { Router } from '@angular/router' -import { EditGroupPage } from '../edit-group/edit-group.page'; -import { TimeService } from 'src/app/services/functions/time.service'; -import { FileService } from 'src/app/services/functions/file.service'; -import { ToastService } from 'src/app/services/toast.service'; -import { environment } from 'src/environments/environment'; -import { EventPerson } from 'src/app/models/eventperson.model'; -import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page'; -import { ThemeService } from 'src/app/services/theme.service' -// import { ViewEventPage } from 'src/app/modals/view-event/view-event.page'; -import { ViewEventPage } from 'src/app/modals/view-event/view-event.page'; -import { FileType } from 'src/app/models/fileType'; -import { Storage } from '@ionic/storage'; - -import { CameraService } from 'src/app/services/camera.service'; -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 { File } from '@awesome-cordova-plugins/file/ngx'; -import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx'; -import { SessionStore } from 'src/app/store/session.service'; -import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page'; -import { Camera, CameraResultType, CameraSource } from '@capacitor/camera'; -import { RouteService } from 'src/app/services/route.service'; -import { FileValidatorService } from "src/app/services/file/file-validator.service" -import { sanitize } from "sanitize-filename-ts"; -import { FilePicker } from '@capawesome/capacitor-file-picker'; -import { NewEventPage } from 'src/app/pages/agenda/new-event/new-event.page'; -import { ChatPopoverPage } from '../chat-popover/chat-popover.page'; -import { ChatOptionsPopoverPage } from '../chat-options-popover/chat-options-popover.page'; - -@Component({ - selector: 'app-group-messages', - templateUrl: './group-messages.page.html', - styleUrls: ['./group-messages.page.scss'], -}) -export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy { - - showLoader: boolean; - isGroupCreated: boolean; - loggedUser: any; - - room: any; - roomName: any; - members: any = [] - contacts: string[] = [" Ana M.", "Andre F.", "Bruno G.", "Catarina T", "Tiago"]; - - roomId: string; - loggedUserChat: any; - eventSelectedDate: Date = new Date(); - - scrollingOnce: boolean = true; - private scrollChangeCallback: () => void; - currentPosition: any; - startPosition: number; - - capturedImage: any; - capturedImageTitle: any; - attendees: EventPerson[] = []; - scrollToBottomBtn = false; - - longPressActive = false; - showMessageOptions = false; - selectedMsgId: string; - roomCountDownDate: any; - downloadFile: any; - groupNameFormart = ""; - - @ViewChild('scrollMe') private myScrollContainer: ElementRef; - - recording = false; - allowTyping = true; - storedFileNames = []; - lastAudioRecorded = ''; - audioRecorded: any = ""; - audioDownloaded: any = ""; - durationDisplay = ''; - duration = 0; - showAvatar = true; - audioPermissionStatus: 'granted' | 'denied' | 'prompt' | null = null - sessionStore = SessionStore - isAdmin = false; - constructor( - private modalController: ModalController, - public popoverController: PopoverController, - private timeService: TimeService, - private fileService: FileService, - private toastService: ToastService, - public ThemeService: ThemeService, - private changeDetectorRef: ChangeDetectorRef, - private platform: Platform, - //public ChatSystemService: ChatSystemService, - private storage: Storage, - private sanitiser: DomSanitizer, - private file: File, - private fileOpener: FileOpener, - public RouteService: RouteService, - private FileValidatorService: FileValidatorService, - ) { - // this.ChatSystemService.getUser() - - // this.loggedUserChat = SessionStore.user.ChatData['data']; - // this.isGroupCreated = true; - // this.roomId = this.navParams.get('roomId'); - // window.onresize = (event) => { - // if (window.innerWidth > 701) { - // this.modalController.dismiss(); - // } - // }; - - // this.open(); - - // setTimeout(() => { - // this.scrollToBottomClicked() - // }, 50) - - - // this.showAvatar = false - - // setTimeout(() => { - // this.scrollToBottomClicked() - // this.showAvatar = true - // }, 150) - - } - - - - open() { - // try { - // this.ChatSystemService.getGroupRoom(this.roomId).loadHistory({}); - // this.ChatSystemService.getGroupRoom(this.roomId).scrollDown = this.scrollToBottomClicked; - // this.ChatSystemService.openRoom(this.roomId) - // this.groupNameFormart = this.ChatSystemService.getGroupRoom(this.roomId).name.split('-').join(' ') - // } catch (error) { - // setTimeout(() => { - // this.open() - // }, 3000) - // } - } - - - ngOnInit() { - - // this.loggedUser = this.loggedUserChat; - // this.getRoomInfo(); - // this.scrollToBottom(); - // this.serverLongPull(); - // this.setStatus('online'); - // this.getChatMembers(); - - // // this.getRoomMessageDB(this.roomId); - // this.getGroupContacts({}); - - } - - setStatus(status: string) { - let body = { - message: '', - status: status, - } - // this.chatService.setUserStatus(body).subscribe(res => { - // - // }) - } - - deleteMessage(msgId: string) { - // const room = this.ChatSystemService.getGroupRoom(this.roomId) - // this.alertService.confirmDeleteMessage(msgId, room); - } - - ngAfterViewInit() { - this.scrollChangeCallback = () => this.onContentScrolled(event); - window.addEventListener('scroll', this.scrollChangeCallback, true); - - if (this.room?.customFields?.countDownDate) { - this.roomCountDownDate = this.timeService.countDownDate(this.room.customFields.countDownDate, this.room._id); - } - } - - handlePress(id?: string) { - this.selectedMsgId = id; - this.showMessageOptions = true; - } - - handleClick() { - this.showMessageOptions = false; - this.selectedMsgId = ""; - } - - onContentScrolled(e) { - this.startPosition = e.srcElement.scrollTop; - let scroll = e.srcElement.scrollTop; - let windowHeight = e.srcElement.scrollHeight; - let containerHeight = windowHeight - e.srcElement.clientHeight; - - if (scroll > this.currentPosition) { - } else { - this.scrollingOnce = false; - } - if ((containerHeight - 100) > scroll) { - this.scrollToBottomBtn = true; - } - else { - this.scrollToBottomBtn = false; - } - this.currentPosition = scroll; - } - - calculateDuration() { - if (!this.recording) { - this.duration = 0; - this.durationDisplay = ''; - return; - } - this.duration += 1; - const minutes = Math.floor(this.duration / 60); - const seconds = (this.duration % 60).toString().padStart(2, '0'); - this.durationDisplay = `${minutes}:${seconds}`; - - setTimeout(() => { - this.calculateDuration(); - }, 1000) - } - - async getFile(fileName?: any) { - const audioFile = await Filesystem.readFile({ - path: fileName, - directory: Directory.Data - }) - // - const base64sound = audioFile.data; - - //Converting base64 to blob - const base64 = await fetch(base64sound); - // - - const base64Response = await fetch(`data:audio/ogg;base64,${base64sound}`); - // - - this.audioRecorded = base64Response.url; - - - - } - - async loadFiles() { - - this.storage.get('fileName').then((fileName) => { - this.lastAudioRecorded = fileName; - }) - - try { - this.storage.get('recordData').then((recordData) => { - - if (recordData?.value?.recordDataBase64.includes('data:audio')) { - this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(recordData?.value?.recordDataBase64); - } - else if (recordData?.value?.mimeType && recordData?.value?.recordDataBase64) { - this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(`data:${recordData.value.mimeType};base64,${recordData?.value?.recordDataBase64}`); - } - }); - } catch (error) { } - - - } - - stopRecording() { - this.deleteRecording(); - this.allowTyping = false; - - if (!this.recording) { - return; - } - this.recording = false; - VoiceRecorder.stopRecording().then(async (result: RecordingData) => { - - - this.recording = false; - if (result.value && result.value.recordDataBase64) { - const recordData = result.value.recordDataBase64; - // - const fileName = new Date().getTime() + ".mp3"; - //Save file - await this.storage.set('fileName', fileName) - this.storage.set('recordData', result).then(() => { - - - setTimeout(async () => { - this.loadFiles(); - }, 1000); - }) - } - }) - - } - - async startRecording() { - VoiceRecorder.requestAudioRecordingPermission(); - if (await VoiceRecorder.canDeviceVoiceRecord().then((result: GenericResponse) => { return result.value })) { - if (await VoiceRecorder.requestAudioRecordingPermission().then((result: GenericResponse) => { return result.value })) { - //if(await this.hasAudioRecordingPermission()){ - if (this.recording) { - return; - } - this.recording = true; - VoiceRecorder.startRecording(); - this.calculateDuration(); - //} - } - else { - this.toastService._badRequest('Para gravar uma mensagem de voz, permita o acesso do Gabinete Digital ao seu microfone.'); - } - } - else { - this.toastService._badRequest('Este dispositivo não tem capacidade para gravação de áudio!'); - } - } - - - - async deleteRecording() { - this.storage.remove('fileName'); - this.storage.remove('recordData'); - - this.allowTyping = true; - this.lastAudioRecorded = ''; - this.loadFiles(); - } - - ngOnDestroy() { - window.removeEventListener('scroll', this.scrollChangeCallback, true); - } - - scrollToBottom(): void { - try { - if (this.scrollingOnce) { - this.myScrollContainer.nativeElement.scrollTop = this.myScrollContainer.nativeElement.scrollHeight; - //this.scrollingOnce = false; - } - } catch (err) { } - } - - scrollToBottomClicked = () => { - try { - this.myScrollContainer.nativeElement.scrollTop = this.myScrollContainer.nativeElement.scrollHeight; - } catch (err) { } - } - - async getRoomInfo() { - this.showLoader = true; - // this.chatService.getRoomInfo(this.roomId).subscribe(room => { - // this.room = room['room']; - // this.roomName = this.room.name.split('-').join(' '); - // if (this.room.customFields.countDownDate) { - // this.roomCountDownDate = this.timeService.countDownDateTimer(this.room.customFields.countDownDate, this.room._id); - // } - // this.getGroupContacts(this.room); - // this.showLoader = false; - // }); - // this.ChatSystemService.getGroupRoom(this.roomId).loadHistory({}); - // let room = await this.chatService.getRoomInfo(this.roomId).toPromise(); - // // console.log('ROOM',room) - // this.room = room['room']; - // if (this.room.name) { - // try { - // this.roomName = this.room.name.split('-').join(' '); - // } catch (error) { - // this.roomName = this.room.name; - // } - - // } - - - // if (SessionStore.user.ChatData.data.userId == this.room.u._id) { - // this.isAdmin = true - // } else { - // this.isAdmin = false - // } - - // if (this.room.customFields.countDownDate) { - // this.roomCountDownDate = this.room.customFields.countDownDate; - // } - } - - async getChatMembers() { - // if(this.ChatSystemService.users.length == 0) { - // this.ChatSystemService.getUser() - // } - } - - /* load(){ - this.getGroupContacts(); - this.loadGroupMessages(); - } */ - - close() { - this.modalController.dismiss(); - this.deleteRecording(); - } - - doRefresh(ev: any) { - this.getRoomInfo(); - ev.target.complete(); - } - - getGroupContacts(room: any) { - // this.showLoader = true; - // //If group is private call getGroupMembers - // if (this.room.t === 'p') { - // this.chatService.getGroupMembers(this.roomId).subscribe(res => { - - // this.members = res['members']; - // this.showLoader = false; - // }); - // } - // //Otherwise call getChannelMembers for públic groups - // else { - // this.chatService.getChannelMembers(this.roomId).subscribe(res => { - - // this.members = res['members']; - // this.showLoader = false; - // }); - // } - - // this.members = this.ChatSystemService.getGroupRoom(this.roomId).members - } - - - showDateDuration(start: any) { - return this.timeService.showDateDuration(start); - } - countDownDate(date: any, roomId: string) { - this.roomCountDownDate = this.timeService.countDownDate(date, roomId); - return this.timeService.countDownDateTimer(date, roomId); - } - - addZero(i) { - if (i < 10) { - i = "0" + i; - } - return i; - } - - sendMessage() { - // this.ChatSystemService.getGroupRoom(this.roomId).send({}) - } - - - async sendAudio(fileName) { - - const roomId = this.roomId - let audioFile; - this.storage.get('recordData').then(async (recordData) => { - - audioFile = recordData; - if (recordData?.value?.recordDataBase64.includes('data:audio')) { - this.audioRecorded = recordData?.value?.recordDataBase64; - } - else if (recordData?.value?.mimeType && recordData?.value?.recordDataBase64) { - this.audioRecorded = `data:${recordData.value.mimeType};base64,${recordData?.value?.recordDataBase64}`; - } - - //Converting base64 to blob - const encodedData = btoa(this.audioRecorded); - const blob = this.fileService.base64toBlob(encodedData, recordData.value.mimeType) - - 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": sanitize(fileName), - // "title_link_download": true, - // "type": "audio" - // }], - // temporaryData: formData, - // attachmentsModelData: { - // fileBase64: encodedData, - // } - // }) - - }); - this.deleteRecording(); - } - - - async openOptions() { - const modal = await this.popoverController.create({ - component: ChatPopoverPage, - cssClass: 'popover-bottom', - componentProps: { - roomId: this.roomId, - members: this.members, - isAdmin: this.isAdmin, - isCreated: this.isGroupCreated, - room: this.room, - name: this.room.name, - }, - }); - await modal.present(); - modal.onDidDismiss().then(res => { - if (res.data == 'leave') { - this.close() - // this.ChatSystemService.deleteRoom(this.roomId) - //this.ChatSystemService.subscribeToRoomUpdate(this.roomId, this.room); - } - else if (res.data == 'cancel') { - - } - else if (res.data == 'edit') { - this.editGroup(this.roomId); - } else if (res.data == 'addUser') { - - this.addContacts(); - } else if (res.data == 'delete') { - this.close() - // this.ChatSystemService.deleteRoom(this.roomId) - } - }); - } - - - viewDocument(file: any, url?: string) { - - if (file.type == "application/webtrix") { - this.openViewDocumentModal(file); - } - else { - let fullUrl = "https://www.tabularium.pt" + url; - this.fileService.viewDocumentByUrl(fullUrl); - } - } - - async openViewDocumentModal(file: any) { - - let task = { - serialNumber: '', - taskStartDate: '', - isEvent: true, - workflowInstanceDataFields: { - FolderID: '', - Subject: file.Assunto, - SourceSecFsID: file.ApplicationId, - SourceType: 'DOC', - SourceID: file.DocId, - DispatchNumber: '' - } - } - - let doc = { - "Id": "", - "ParentId": "", - "Source": 1, - "ApplicationId": file.ApplicationId, - "CreateDate": "", - "Data": null, - "Description": "", - "Link": null, - "SourceId": file.DocId, - "SourceName": file.Assunto, - "Stakeholders": "", - } - - const modal = await this.modalController.create({ - component: ViewDocumentPage, - componentProps: { - trustedUrl: '', - file: { - title: file.Assunto, - url: '', - title_link: '', - }, - Document: doc, - applicationId: file.ApplicationId, - docId: file.DocId, - folderId: '', - task: task - }, - cssClass: 'modal modal-desktop' - }); - await modal.present(); - - } - - async bookMeeting() { - - this.getGroupContacts({}); - this.attendees = this.members.map((val) => { - return { - Name: val.name, - EmailAddress: val.username + "@" + environment.domain, - IsRequired: "true", - } - }); - - // this.popoverController.dismiss(); - const modal = await this.modalController.create({ - component: NewEventPage, - componentProps: { - attendees: this.attendees, - }, - cssClass: 'modal modal-desktop', - backdropDismiss: false - }); - - modal.onDidDismiss().then((data) => { - if (data) { - - } - }); - - await modal.present(); - } - - - - async takePicture() { - const roomId = this.roomId - - const file = await Camera.getPhoto({ - quality: 90, - // allowEditing: true, - resultType: CameraResultType.Base64, - source: CameraSource.Camera - }); - - var imageBase64 = 'data:image/jpeg;base64,' + file.base64String - - const compressedImage = await this.compressImageBase64( - imageBase64, - 800, // maxWidth - 800, // maxHeight - 0.9 // quality - ).then((picture) => { - // console.log('Selected: ', picture) - imageBase64 = picture - }); - - const blob = this.dataURItoBlob(imageBase64) - - // console.log(imageBase64) - - 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, - // } - // }) - - } - - async addImage() { - this.addFileToChat(['image/apng', 'image/jpeg', 'image/png']) - } - - async addFile() { - this.addFileToChat(['.doc', '.docx', '.pdf']) - } - - async addImageMobile() { - this.addFileToChatMobile(['image/apng', 'image/jpeg', 'image/png']) - } - - - async addFileToChatMobile(types: typeof FileType[]) { - const roomId = this.roomId - - const file = await Camera.getPhoto({ - quality: 90, - // allowEditing: true, - resultType: CameraResultType.Base64, - source: CameraSource.Photos - }); - - //const imageData = await this.fileToBase64Service.convert(file) - // - - var imageBase64 = 'data:image/jpeg;base64,' + file.base64String - - const compressedImage = await this.compressImageBase64( - imageBase64, - 800, // maxWidth - 800, // maxHeight - 0.9 // quality - ).then((picture) => { - // console.log('Selected: ', picture) - imageBase64 = picture - }); - - - const response = await fetch(imageBase64); - const blob = await response.blob(); - - console.log(imageBase64) - - const formData = new FormData(); - formData.append("blobFile", blob); - - // this.ChatSystemService.getGroupRoom(roomId).send({ - // file: { - // "type": "application/img", - // "guid": '' - // }, - // temporaryData: formData, - // attachments: [{ - // "title": file.path, - // "text": "description", - // "title_link_download": false, - // }], - // attachmentsModelData: { - // fileBase64: imageBase64, - // } - // }) - - } - - async addFileWebtrix() { - const modal = await this.modalController.create({ - component: SearchPage, - cssClass: 'group-messages modal-desktop search-modal search-modal-to-desktop', - componentProps: { - type: 'AccoesPresidenciais & ArquivoDespachoElect', - select: true, - showSearchInput: true, - } - }); - await modal.present(); - modal.onDidDismiss().then(async res => { - const data = res.data; - - if (data.selected) { - - // this.ChatSystemService.getGroupRoom(this.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": "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", - // }] - // }) - - } - }); - } - - - _getBase64(file) { - return new Promise((resolve, reject) => { - var reader = new FileReader(); - reader.readAsDataURL(file); - reader.onload = function () { - resolve(reader.result) - }; - reader.onerror = function (error) { - console.log('Error: ', error); - }; - }) - } - - async addFileToChat(types: typeof FileType[]) { - - - - const roomId = this.roomId - - if(this.platform.is('ios')) { - console.log('ios add file ') - - const resultt = await FilePicker.pickFiles({ - types: ['application/pdf'], - multiple: false, - readData: true, - }); - - console.log('RESULT', resultt.files[0]) - - const blobb = this.fileService.base64toBlob(resultt.files[0].data, resultt.files[0].mimeType) - - const formDataa = new FormData(); - formDataa.append('blobFile', blobb); - /* console.log('add file', fileBase64) */ - - // this.ChatSystemService.getGroupRoom(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 - - } - - const file: any = await this.fileService.getFileFromDevice(types); - - - const fileName = file.name - - const validation = this.FileValidatorService.fileNameValidation(fileName) - - if(validation.isOk) { - - if (file.type != "application/img" && file.type != "image/png" && file.type != "image/jpeg" && file.type != "image/gif") { - - const encodedData = btoa(JSON.stringify(await this.getBase64(file).catch((error) => { - console.error(error); - }))); - const blob = this.fileService.base64toBlob(encodedData, file.type) - - const formData = new FormData(); - formData.append('blobFile', blob); - - - // this.ChatSystemService.getGroupRoom(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 { - - } - } else { - this.toastService._badRequest("Ficheiro inválido") - } - - } - - getFileReader(): FileReader { - const fileReader = new FileReader(); - const zoneOriginalInstance = (fileReader as any)["__zone_symbol__originalInstance"]; - return zoneOriginalInstance || fileReader; - } - - getBase64(file) { - var reader = this.getFileReader(); - reader.readAsDataURL(file); - return new Promise(resolve => { - reader.onload = function () { - resolve(reader.result) - }; - reader.onerror = function (error) { - - }; - }); - - } - - async openChatOptions(ev?: any) { - - const roomId = this.roomId; - - const popover = await this.popoverController.create({ - component: ChatOptionsPopoverPage, - cssClass: 'chat-options-popover', - event: ev, - componentProps: { - room: this.room, - members: this.members, - eventSelectedDate: new Date(), - }, - translucent: true - }); - await popover.present(); - await popover.onDidDismiss().then(async (res) => { - - if (res['data'] == 'meeting') { - this.bookMeeting(); - } - else if (res['data'] == 'take-picture') { - this.takePicture() - } - else if (res['data'] == 'add-picture') { - this.addImageMobile() - - } - else if (res['data'] == 'add-document') { - this.addFile() - } - else if (res['data'] == 'documentoGestaoDocumental') { - - this.addFileWebtrix() - } - }); - } - - async addContacts() { - if (this.isAdmin) { - - const modal = await this.modalController.create({ - component: GroupContactsPage, - componentProps: { - isCreated: this.isGroupCreated, - room: this.room, - //members: this.ChatSystemService.getGroupRoom(this.roomId).members, - members: [], - name: this.room.name, - }, - cssClass: 'contacts', - backdropDismiss: false - }); - - - - modal.onDidDismiss().then(() => { - this.getRoomInfo(); - }); - await modal.present(); - } - - } - - async editGroup(roomId) { - const modal = await this.modalController.create({ - component: EditGroupPage, - cssClass: 'modal modal-desktop', - componentProps: { - roomId: roomId, - }, - }); - await modal.present(); - modal.onDidDismiss().then((res) => { - - this.getRoomInfo(); - //this.modalController.dismiss(res.data); - }); - } - - isJson(str) { - try { - JSON.parse(str); - } catch (e) { - return ""; - } - return JSON.parse(str); - } - - transformDataMSG(res) { - if (this.platform.is('desktop') || this.platform.is('mobileweb')) { - } else { - res.forEach(element => { - - let chatmsg = { - _id: element._id, - attachments: element.attachments, - channels: element.channels, - file: element.file, - mentions: element.mentions, - msg: element.msg, - rid: element.rid, - ts: element.ts, - u: element.u, - _updatedAt: element._updatedAt, - /* image_url: { - name: name, - path: `${IMAGE_DIR}/${name}`, - data: `data:image/jpeg;base64,${readFile.data}`, - }, */ - } - - // this.sqlservice.addChatMSG(chatmsg) - - }); - } - - } - - async serverLongPull() { - - } - - sliderOpts = { - zoom: false, - slidesPerView: 1.5, - spaceBetween: 20, - centeredSlides: true - }; - zoomActive = false; - zoomScale = 1; - - sliderZoomOpts = { - allowSlidePrev: false, - allowSlideNext: false, - zoom: { - maxRatio: 5 - }, - on: { - zoomChange: (scale, imageEl, slideEl) => { - this.zoomActive = true; - this.zoomScale = scale / 5; - this.changeDetectorRef.detectChanges(); - } - } - } - - touchStart(card) { - // Make card appear above backdrop - card.el.style['z-index'] = 11; - } - - b64toBlob(b64Data, contentType) { - contentType = contentType || ''; - var sliceSize = 512; - b64Data = b64Data.replace(/^[^,]+,/, ''); - b64Data = b64Data.replace(/\s/g, ''); - var byteCharacters = window.atob(b64Data); - var byteArrays = []; - - for (var offset = 0; offset < byteCharacters.length; offset += sliceSize) { - var slice = byteCharacters.slice(offset, offset + sliceSize); - - var byteNumbers = new Array(slice.length); - for (var i = 0; i < slice.length; i++) { - byteNumbers[i] = slice.charCodeAt(i); - } - - var byteArray = new Uint8Array(byteNumbers); - - byteArrays.push(byteArray); - } - - var blob = new Blob(byteArrays, { type: contentType }); - return blob; - } - - async openFile(pdfString, filename, type) { - /* const modal = await this.modalController.create({ - component: ViewDocumentSecondOptionsPage, - componentProps: { - fileUrl: pdfString, - filename: filename - }, - cssClass: 'modal modal-desktop' - }); - await modal.present(); */ - const blob = this.b64toBlob(pdfString, type) - let pathFile = '' - const fileName = filename - const contentFile = blob - if (this.platform.is('ios')) { - pathFile = this.file.documentsDirectory - } else { - pathFile = this.file.externalRootDirectory - } - - console.log('file data', pdfString) - console.log(pathFile) - - let removePre = this.removeTextBeforeSlash(pdfString,',') - console.log('file data remove ', removePre) - - await Filesystem.writeFile({ - path: fileName, - data: removePre, - directory: Directory.Cache, - }).then((dir) => { - console.log('DIR ', dir) - this.fileOpener - .open(dir.uri, type) - .then(() => console.log()) - .catch(e => console.error(e)) - }); - } - - downloadFileMsg(msg: any) { - msg.downloadFileMsg() - } - - downloadFileFromBrowser(fileName: string, data: any): void { - const linkSource = data; - const downloadLink = document.createElement("a"); - downloadLink.href = linkSource; - downloadLink.download = fileName; - downloadLink.click(); - } - - async openPreview(msg: any) { - - if (msg?.file?.type === "application/webtrix") { - this.viewDocument(msg.file, msg.attachments.image_url) - } else { - if (!msg.attachments[0].image_url || msg.attachments[0].image_url === null || msg.attachments[0].image_url === '') { - this.downloadFileMsg(msg) - - } else { - - var str = msg.attachments[0].image_url; - str = str.substring(1, ((str.length) - 1)); - - if (this.platform.is('desktop') || this.platform.is('mobileweb')) { - - if (msg?.file?.type == "application/img") { - - const modal = await this.modalController.create({ - component: ViewMediaPage, - cssClass: 'modal modal-desktop', - componentProps: { - image: msg.attachments[0].image_url, - type: msg.file.type, - username: msg.u.name, - _updatedAt: msg._updatedAt - } - }); - modal.present(); - } else { - this.downloadFileFromBrowser("file", str) - this.downloadFileFromBrowser(msg.attachments[0].title, str) - } - - } else { - if (msg.file.type == "application/img") { - const modal = await this.modalController.create({ - component: ViewMediaPage, - cssClass: 'modal modal-desktop', - componentProps: { - image: msg.attachments[0].image_url, - type: msg.file.type, - username: msg.u.name, - _updatedAt: msg._updatedAt - } - }); - modal.present(); - } else { - this.openFile(msg.attachments[0].image_url, msg.attachments[0].title, msg.file.type); - } - } - } - } - - } - - async audioPreview(msg) { - - if (!msg.attachments[0].title_link || msg.attachments[0].title_link === null || msg.attachments[0].title_link === '') { - this.downloadFileMsg(msg) - } else { } - } - - - dataURItoBlob(dataURI) { - // convert base64 to raw binary data held in a string - // doesn't handle URLEncoded DataURIs - see SO answer #6850276 for code that does this - var byteString = atob(dataURI.split(',')[1]); - - // separate out the mime component - var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0] - - // write the bytes of the string to an ArrayBuffer - var ab = new ArrayBuffer(byteString.length); - - // create a view into the buffer - var ia = new Uint8Array(ab); - - // set the bytes of the buffer to the correct values - for (var i = 0; i < byteString.length; i++) { - ia[i] = byteString.charCodeAt(i); - } - - // write the ArrayBuffer to a blob, and you're done - var blob = new Blob([ab], { type: mimeString }); - return blob; - - } - - async compressImageBase64(base64String: string, maxWidth: number, maxHeight: number, quality: number): Promise { - return new Promise((resolve, reject) => { - const image = new (window as any).Image(); - image.src = base64String; - - image.onload = async () => { - const canvas = document.createElement('canvas'); - let newWidth = image.width; - let newHeight = image.height; - - if (newWidth > maxWidth) { - newHeight *= maxWidth / newWidth; - newWidth = maxWidth; - } - - if (newHeight > maxHeight) { - newWidth *= maxHeight / newHeight; - newHeight = maxHeight; - } - - canvas.width = newWidth; - canvas.height = newHeight; - - const context = canvas.getContext('2d'); - context?.drawImage(image, 0, 0, newWidth, newHeight); - - const compressedBase64 = canvas.toDataURL('image/jpeg', quality); - resolve(compressedBase64); - }; - - image.onerror = (error) => { - reject(error); - }; - }); - - } - - removeTextBeforeSlash(inputString, controlString) { - if (inputString.includes(controlString)) { - const parts = inputString.split(controlString); - return parts.length > 1 ? parts[1] : inputString; - } else { - return inputString; - } - } -} - diff --git a/src/app/ui/chat/modal/messages/contacts/contacts.page.ts b/src/app/ui/chat/modal/messages/contacts/contacts.page.ts index 6bc8c11c5..44f727f3a 100644 --- a/src/app/ui/chat/modal/messages/contacts/contacts.page.ts +++ b/src/app/ui/chat/modal/messages/contacts/contacts.page.ts @@ -161,7 +161,7 @@ export class ContactsPage implements OnInit { close() { - this.modalController.dismiss({}); + this.modalController.dismiss(null); } async select(user: UserContacts) { diff --git a/src/app/ui/chat/modal/messages/messages.page.ts b/src/app/ui/chat/modal/messages/messages.page.ts index 224acbaf5..ee1e8b521 100644 --- a/src/app/ui/chat/modal/messages/messages.page.ts +++ b/src/app/ui/chat/modal/messages/messages.page.ts @@ -44,9 +44,9 @@ import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx'; import { FileSystemMobileService } from 'src/app/infra/file-system/mobile/file-system-mobile.service'; import { RoomViewModel } from '../../store/model/room'; import { RoomStore } from '../../store/roomStore' -import { GroupContactsPage, IGroupContactsPageOutPutSchema } from '../group-messages/group-contacts/group-contacts.page'; import { EditGroupPage } from '../edit-group/edit-group.page'; import { imageMimeTypes } from 'src/app/utils/allowedImageExtension'; +import { GroupContactsPage, IGroupContactsPageOutPutSchema } from '../group-contacts/group-contacts.page'; const IMAGE_DIR = 'stored-images'; diff --git a/src/app/ui/chat/modal/new-group/contacts/contacts-routing.module.ts b/src/app/ui/chat/modal/new-group/contacts/contacts-routing.module.ts deleted file mode 100644 index fb8c7a5ea..000000000 --- a/src/app/ui/chat/modal/new-group/contacts/contacts-routing.module.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { NgModule } from '@angular/core'; -import { Routes, RouterModule } from '@angular/router'; - -import { ContactsPage } from './contacts.page'; - -const routes: Routes = [ - { - path: '', - component: ContactsPage - } -]; - -@NgModule({ - imports: [RouterModule.forChild(routes)], - exports: [RouterModule], -}) -export class ContactsPageRoutingModule {} diff --git a/src/app/ui/chat/modal/new-group/contacts/contacts.module.ts b/src/app/ui/chat/modal/new-group/contacts/contacts.module.ts deleted file mode 100644 index 4c4ec76ec..000000000 --- a/src/app/ui/chat/modal/new-group/contacts/contacts.module.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormsModule } from '@angular/forms'; - -import { IonicModule } from '@ionic/angular'; - -import { ContactsPageRoutingModule } from './contacts-routing.module'; - -import { ContactsPage } from './contacts.page'; -import { SharedModule } from 'src/app/shared/shared.module'; - -import { BtnSeguintePageModule } from 'src/app/shared/btn-seguinte/btn-seguinte.module'; - -@NgModule({ - imports: [ - CommonModule, - FormsModule, - IonicModule, - - ContactsPageRoutingModule, - BtnSeguintePageModule, - ], - declarations: [ContactsPage] -}) -export class ContactsPageModule {} diff --git a/src/app/ui/chat/modal/new-group/contacts/contacts.page.html b/src/app/ui/chat/modal/new-group/contacts/contacts.page.html deleted file mode 100644 index 1052cb20b..000000000 --- a/src/app/ui/chat/modal/new-group/contacts/contacts.page.html +++ /dev/null @@ -1,57 +0,0 @@ - - -
-
-
- -
-
- Contactos -
- -
-
-
- - - -
- - - - - - - -
- - - - - -
- {{header}} -
- -
- -

{{user.first}} {{user.last}}

- -
- -
- -
-
- - diff --git a/src/app/ui/chat/modal/new-group/contacts/contacts.page.scss b/src/app/ui/chat/modal/new-group/contacts/contacts.page.scss deleted file mode 100644 index a3d20fdd1..000000000 --- a/src/app/ui/chat/modal/new-group/contacts/contacts.page.scss +++ /dev/null @@ -1,128 +0,0 @@ - -@import '~src/function.scss'; - -.header-toolbar{ - --background:transparent; - --opacity: 1; - - .main-header{ - width: 100%; /* 400px */ - height: 100%; - font-family: Roboto; - border-top-left-radius: 25px; - border-top-right-radius: 25px; - background-color: #fff; - overflow:hidden; - padding: 30px 20px 0px 20px; - color:#000; - transform: translate3d(0, 1px, 0); - - .div-icon{ - width: rem(40); - float: right; - font-size: rem(35); - overflow: auto; - padding: 1px; - } - .div-icon ion-icon{ - float: right; - padding-left: 20px; - } - .title-content{ - margin: 0px auto; - overflow: auto; - padding: 0 !important; - } - - .back-icon{ - width: 37px; - float: left; - font-size: rem(35); - overflow: auto; - - } - .div-title{ - width: 221px; - padding: 0!important; - float: left; - margin: 2.5px 0 0 5px; - } - .title{ - font-size: rem(25); - } - } -} -.toolbar-search{ - --padding-top:0 !important; - --padding-bottom:0 !important; - --padding-start:0 !important; - --padding-end:0 !important; - - .search{ - border: 1px solid #ebebeb; - margin: 5px 20px 5px 20px; - border-radius: 5px; - } - .search ion-searchbar{ - /* border: 1px solid green; */ - width: 100%; - margin: 0 !important; - padding: 0 !important; - --border-radius: 5px; - --box-shadow: none; - overflow: auto; - --icon-color:var(--title-text-color); - } - -} -ion-content{ - --background:transparent; -} -.main-content{ - width: 100%; - height: 100%; - font-family: Roboto; - margin: 0 auto; - background-color: #fff; - overflow:auto; - padding: 0 0 0 0; - - .item-divider{ - background: #ebebeb; - font-size: rem(15); - margin: 10px 0 10px 0; - padding:5px 0 5px 20px; - - } - - .item-checkbox{ - display: flex; - margin: 10px 20px 10px 20px !important; - overflow: auto; - align-items: center; - - } - - .item-checkbox ion-checkbox{ - --border-color: var(--title-text-color); - --background-checked:var(--title-text-color); - float: left; - } - - .item-checkbox p{ - display: block; - margin: 0 !important; - width: 330px; - padding-left: 10px; - font-size: rem(15); - color: var(--title-text-color); - float: left; - } - .item-checkbox ion-icon{ - font-size: rem(10); - float: left; - color:#99e47b; - margin-left: 10px; - } - } - diff --git a/src/app/ui/chat/modal/new-group/contacts/contacts.page.spec.ts b/src/app/ui/chat/modal/new-group/contacts/contacts.page.spec.ts deleted file mode 100644 index 8f263232b..000000000 --- a/src/app/ui/chat/modal/new-group/contacts/contacts.page.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { IonicModule } from '@ionic/angular'; - -import { ContactsPage } from './contacts.page'; - -describe('ContactsPage', () => { - let component: ContactsPage; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ ContactsPage ], - imports: [IonicModule.forRoot()] - }).compileComponents(); - - fixture = TestBed.createComponent(ContactsPage); - component = fixture.componentInstance; - fixture.detectChanges(); - })); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/ui/chat/modal/new-group/contacts/contacts.page.ts b/src/app/ui/chat/modal/new-group/contacts/contacts.page.ts deleted file mode 100644 index 9fafe97b7..000000000 --- a/src/app/ui/chat/modal/new-group/contacts/contacts.page.ts +++ /dev/null @@ -1,120 +0,0 @@ -import { HttpHeaders } from '@angular/common/http'; -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' - -@Component({ - selector: 'app-contacts', - templateUrl: './contacts.page.html', - styleUrls: ['./contacts.page.scss'], -}) -export class ContactsPage implements OnInit { - showLoader: boolean; - users = []; - - contact: string[] = [" Ana M.", "Andre F.", "Bruno G.", "Catarina T", "Tiago"]; - - headers: HttpHeaders; - options:any; - - contacts = [ - { - first: 'Ana', - last: 'Manuel', - url: 'https://randomuser.me/api/portraits/med/women/54.jpg', - }, - { - first: 'Abdullah', - last: 'Hill', - url: 'https://randomuser.me/api/portraits/med/women/54.jpg', - }, - { - first: 'Batur', - last: 'Oymen', - url: 'https://randomuser.me/api/portraits/med/women/54.jpg', - }, - { - first: 'Bianca', - last: 'Costa', - url: 'https://randomuser.me/api/portraits/med/women/54.jpg', - }, - { - first: 'Zaya', - last: 'Mary', - url: 'https://randomuser.me/api/portraits/med/women/54.jpg', - }, - { - first: 'Tiago', - last: 'Kayaya', - url: 'https://randomuser.me/api/portraits/med/women/54.jpg', - } -]; - - constructor( - private modalController: ModalController, - public ThemeService: ThemeService - ) - { } - - ngOnInit() { - this.loadUsers(); - - } - - loadUsers(){ - - this.users = this.contacts.sort((a,b) => { - if(a.first < b.first){ - return -1; - } - if(a.first > b.first){ - return 1; - } - return 0; - }); - } - - separateLetter(record, recordIndex, records){ - - if(recordIndex == 0){ - return record.first[0]; - } - - let first_prev = records[recordIndex - 1].first[0]; - let first_current = record.first[0]; - - if(first_prev != first_current){ - return first_current; - } - return null; - } - - doRefresh(event){ - - } - close(){ - this.modalController.dismiss(); - } - onChange(event){ - - } - clicked(){ - - - } - async groupMessages(){ - const modal = await this.modalController.create({ - component: GroupMessagesPage, - componentProps: {}, - cssClass: 'contacts', - backdropDismiss: false - }); - - - - modal.onDidDismiss(); - await modal.present(); - } - -} diff --git a/src/app/ui/chat/modal/new-group/new-group-routing.module.ts b/src/app/ui/chat/modal/new-group/new-group-routing.module.ts index 7800e505c..0fcb08f07 100644 --- a/src/app/ui/chat/modal/new-group/new-group-routing.module.ts +++ b/src/app/ui/chat/modal/new-group/new-group-routing.module.ts @@ -7,10 +7,6 @@ const routes: Routes = [ { path: '', component: NewGroupPage - }, - { - path: 'contacts', - loadChildren: () => import('./contacts/contacts.module').then( m => m.ContactsPageModule) } ]; diff --git a/src/app/ui/chat/modal/new-group/new-group.page.ts b/src/app/ui/chat/modal/new-group/new-group.page.ts index 7d7b279e9..70b01f1cb 100644 --- a/src/app/ui/chat/modal/new-group/new-group.page.ts +++ b/src/app/ui/chat/modal/new-group/new-group.page.ts @@ -1,7 +1,6 @@ import { Component, OnInit } from '@angular/core'; import { ModalController, NavParams, PickerController, PopoverController } from '@ionic/angular'; import { GroupDurationPage } from 'src/app/shared/popover/group-duration/group-duration.page'; -import { GroupContactsPage, IGroupContactsPageOutPutSchema } from '../group-messages/group-contacts/group-contacts.page'; import { ThemeService } from 'src/app/services/theme.service'; import { SessionStore } from 'src/app/store/session.service'; import { ToastService } from 'src/app/services/toast.service'; @@ -10,6 +9,7 @@ import { ChatServiceService } from 'src/app/module/chat/domain/chat-service.serv import { UDate } from 'src/app/utils/date'; import { HttpErrorResponse } from '@angular/common/http'; import { z } from 'zod'; +import { GroupContactsPage, IGroupContactsPageOutPutSchema } from '../group-contacts/group-contacts.page'; const NewGroupModalOutPutSchema = z.object({ @@ -25,7 +25,8 @@ export type INewGroupModalOutPut = z.infer export class NewGroupPage implements OnInit { isGroupCreated: boolean; showLoader: boolean; - displayDuration: any; + expirationDate: Date = null; + displayDuration = '' showDuration: boolean; selectedDuration = ['', '', '']; thedate: any; @@ -70,7 +71,7 @@ export class NewGroupPage implements OnInit { roomName: this.groupName, createdBy: SessionStore.user.UserId, roomType: 0, - expirationDate: this.displayDuration?.toISOString() ? UDate.GetDateWithTimeZone(this.displayDuration) : null, + expirationDate: this.expirationDate?.toISOString() ? UDate.GetDateWithTimeZone(this.expirationDate) : null, members: [] }) @@ -130,10 +131,10 @@ export class NewGroupPage implements OnInit { { text: 'Ok', cssClass: 'btn-cancel', - handler: (value: any) => { + handler:(value:any)=>{ let now = new Date(); - this.thedate = new Date(now.getFullYear(), now.getMonth(), now.getDate() + value.days.value, now.getHours() + value.hours.value, now.getMinutes() + value.minutes.value, now.getSeconds(), now.getMilliseconds()); + this.expirationDate = new Date(now.getFullYear(), now.getMonth(), now.getDate() + value.days.value, now.getHours() + value.hours.value, now.getMinutes() + value.minutes.value, now.getSeconds(), now.getMilliseconds()) this.selectedDuration = [ value.days.value, @@ -141,41 +142,41 @@ export class NewGroupPage implements OnInit { value.minutes.value, ] - if (value.days.value != null && value.hours.value != null && value.minutes.value != null) { - if (value.days.value > 0) { - if (value.days.value == 1) { - if (value.hours.value == 1) { - this.displayDuration = value.days.value + " day " + - value.hours.value + " hora " + - value.minutes.value + " minutos"; + if(value.days.value != null && value.hours.value != null && value.minutes.value != null){ + if(value.days.value > 0){ + if(value.days.value == 1){ + if(value.hours.value == 1){ + this.displayDuration = value.days.value + " day " + + value.hours.value + " hora " + + value.minutes.value + " minutos"; } - else { - this.displayDuration = value.days.value + " days " + - value.hours.value + " horas " + - value.minutes.value + " minutos"; + else{ + this.displayDuration = value.days.value + " days " + + value.hours.value + " horas " + + value.minutes.value + " minutos"; } } - else { - if (value.hours.value == 1) { - this.displayDuration = value.days.value + " days " + - value.hours.value + " hora " + - value.minutes.value + " minutos"; + else{ + if(value.hours.value == 1){ + this.displayDuration = value.days.value + " days " + + value.hours.value + " hora " + + value.minutes.value + " minutos"; } - else { - this.displayDuration = value.days.value + " days " + - value.hours.value + " horas " + - value.minutes.value + " minutos"; + else{ + this.displayDuration = value.days.value + " days " + + value.hours.value + " horas " + + value.minutes.value + " minutos"; } } } - else { - if (value.hours.value == 1) { + else{ + if(value.hours.value == 1){ this.displayDuration = value.hours.value + " hora " + - value.minutes.value + " minutos"; + value.minutes.value + " minutos"; } - else { + else{ this.displayDuration = value.hours.value + " horas " + - value.minutes.value + " minutos"; + value.minutes.value + " minutos"; } } } diff --git a/src/app/ui/chat/modal/room-info/room-info.page.html b/src/app/ui/chat/modal/room-info/room-info.page.html index ec8fad4dc..d081a2b56 100644 --- a/src/app/ui/chat/modal/room-info/room-info.page.html +++ b/src/app/ui/chat/modal/room-info/room-info.page.html @@ -3,12 +3,12 @@ {{ roomData.roomName }} -
- + - -
diff --git a/src/app/ui/chat/store/roomStore.ts b/src/app/ui/chat/store/roomStore.ts index 2277c91e9..65c14e20e 100644 --- a/src/app/ui/chat/store/roomStore.ts +++ b/src/app/ui/chat/store/roomStore.ts @@ -178,7 +178,7 @@ export class RoomStore { listenToUpdateMessage() { this.messageUpdateSubject?.unsubscribe(); - console.log('liste to update') + // console.log('liste to update') this.messageUpdateSubject = this.chatServiceService.listenToUpdateMessage(this.room.id).subscribe((updateMessage) => { const index = this.messages1[this.room.$id].findIndex(e => e?.id === updateMessage.id); // Use triple equals for comparison @@ -225,7 +225,12 @@ export class RoomStore { } } - this.sendReadMessage() + this.chatServiceService.sendReadAt({ + memberId: SessionStore.user.UserId, + messageId: message.id, + requestId: '', + roomId: this.room.id + }) setTimeout(() => { this.scrollToBottomClicked() @@ -241,7 +246,7 @@ export class RoomStore { removeBold() { if(!this.room?.local) { - this.chatServiceService.removeBoldFromRoom({roomId: this.room.$id}) + this.chatServiceService.removeBoldFromRoom({roomId: this.room.id}) } } @@ -279,7 +284,7 @@ export class RoomStore { this.date = {} const allMessage = []; - console.time("mappingTime"); + //console.time("mappingTime"); const sortMessages = messages.value.sort((a, b) => new Date(a.sentAt).getTime() - new Date(b.sentAt).getTime()) for(const message of sortMessages) { @@ -292,7 +297,7 @@ export class RoomStore { allMessage.push(new MessageViewModal(message)) } - console.timeEnd("mappingTime"); + //console.timeEnd("mappingTime"); this.messages1[this.room.$id] this.messages1[this.room.$id] = allMessage @@ -351,7 +356,7 @@ export class RoomStore { roomId: this.room.id }) } else { - console.log('no need', message ) + // console.log('no need', message ) } } } @@ -417,14 +422,14 @@ export class RoomStore { if(message.isOk() && this.room.local == IDBoolean.true) { this.room.local = IDBoolean.false; - // console.log('enter') - // await this.chatServiceService.roomSetLocalToFalseById({ - // $roomId: this.room.$id, - // roomId: message.value.roomId - // }) + console.log('enter') + await this.chatServiceService.roomSetLocalToFalseById({ + $roomId: this.room.$id, + roomId: message.value.roomId + }) this.room.id = message.value.roomId - // this.subscribeToChanges() + this.subscribeToChanges() } } diff --git a/version/git-version.ts b/version/git-version.ts index 101b68615..b3eb67ea2 100644 --- a/version/git-version.ts +++ b/version/git-version.ts @@ -1,11 +1,11 @@ export let versionData = { - "shortSHA": "9da65a1e7", - "SHA": "9da65a1e7be721fb69c0b820b02a19e171b484d2", + "shortSHA": "d8eb3ddbd", + "SHA": "d8eb3ddbd68b11cb363b3dc2836b71444d602ccb", "branch": "feature/chat-new-api-peter", "lastCommitAuthor": "'Peter Maquiran'", - "lastCommitTime": "'Thu Sep 19 23:36:59 2024 +0100'", - "lastCommitMessage": "fix open pdf and member list", - "lastCommitNumber": "6085", - "changeStatus": "On branch feature/chat-new-api-peter\nYour branch is up to date with 'origin/feature/chat-new-api-peter'.\n\nChanges to be committed:\n (use \"git restore --staged ...\" to unstage)\n\tmodified: angular.json\n\tmodified: package-lock.json\n\tmodified: package.json\n\tmodified: src/app/core/chat/repository/distribution/distribution-local-repository.ts\n\tmodified: src/app/infra/file-system/mobile/file-system-mobile.service.ts\n\tmodified: src/app/module/chat/data/repository/destribution/destribution-local-repository.ts\n\tmodified: src/app/module/chat/domain/use-case/room/room-bold-sync-use-case.service.ts\n\tmodified: src/app/services/events.service.ts\n\tmodified: src/app/ui/chat/chat.page.ts\n\tmodified: src/app/ui/chat/component/messages/messages.page.ts\n\tmodified: src/app/ui/chat/modal/messages/messages.page.ts\n\tmodified: src/app/ui/chat/modal/room-info/room-info.page.ts\n\tnew file: src/app/utils/allowedImageExtension.ts\n\tmodified: src/firebase-messaging-sw.js\n\tmodified: src/main.ts\n\tmodified: version/git-version.ts", + "lastCommitTime": "'Fri Sep 20 11:45:11 2024 +0100'", + "lastCommitMessage": "fix upload picture", + "lastCommitNumber": "6086", + "changeStatus": "On branch feature/chat-new-api-peter\nYour branch is ahead of 'origin/feature/chat-new-api-peter' by 1 commit.\n (use \"git push\" to publish your local commits)\n\nChanges to be committed:\n (use \"git restore --staged ...\" to unstage)\n\tmodified: gabinete-digital-fo.code-workspace\n\tmodified: src/app/app.module.ts\n\tnew file: src/app/core/actions/repository/actionsRepository.ts\n\tnew file: src/app/core/actions/use-case/presidential-actions-create-use-case.service.ts\n\tnew file: src/app/core/actions/use-case/presidential-actions-get.service.ts\n\tmodified: src/app/core/chat/repository/attachment/attachment-remote-repository.ts\n\tmodified: src/app/core/chat/repository/distribution/distribution-local-repository.ts\n\trenamed: src/app/infra/database/dexie/service.ts -> src/app/infra/database/dexie/instance/chat/service.ts\n\tnew file: src/app/infra/database/dexie/instance/logs/schema/SentryErrors.ts\n\tnew file: src/app/infra/database/dexie/instance/logs/service.ts\n\tmodified: src/app/infra/http/adapter.ts\n\tmodified: src/app/infra/http/http.service.ts\n\tmodified: src/app/infra/repository/adapter.ts\n\tmodified: src/app/infra/repository/dexie/dexie-repository.service.ts\n\tmodified: src/app/infra/socket/signalR/signalR.ts\n\tnew file: src/app/module/actions/data/repository/actions-repository.service.ts\n\tmodified: src/app/module/chat/chat.module.ts\n\tmodified: src/app/module/chat/data/repository/attachment/attachment-local-repository.service.ts\n\tmodified: src/app/module/chat/data/repository/attachment/attachment-remote-repository.service.ts\n\tmodified: src/app/module/chat/data/repository/bold/bold-local-repository.ts\n\tmodified: src/app/module/chat/data/repository/destribution/destribution-local-repository.ts\n\tmodified: src/app/module/chat/data/repository/member/member-list-local-repository.service.ts\n\tmodified: src/app/module/chat/data/repository/message/message-local-data-source.service.ts\n\tmodified: src/app/module/chat/data/repository/room/room-local-repository.service.ts\n\tmodified: src/app/module/chat/data/repository/typing/user-typing-local-data-source.service.ts\n\tmodified: src/app/module/chat/data/repository/user-foto/user-photo-local-repository.service.ts\n\tmodified: src/app/module/chat/domain/chat-service.service.ts\n\tmodified: src/app/module/chat/domain/use-case/message/message-attachment-by-message-id.service.ts\n\tmodified: src/app/module/chat/domain/use-case/message/message-download-attachment-user-case.service.ts\n\tmodified: src/app/module/chat/domain/use-case/message/message-local-get-by-id.service.ts\n\tmodified: src/app/module/chat/domain/use-case/message/message-mark-as-read-use-case.service.ts\n\tmodified: src/app/module/chat/domain/use-case/room/room-bold-sync-use-case.service.ts\n\tmodified: src/app/module/chat/domain/use-case/room/room-get-by-id-use-case.service.ts\n\tmodified: src/app/module/chat/domain/use-case/room/room-get-list-on-create-use-case.service.ts\n\tmodified: src/app/module/chat/domain/use-case/room/room-get-list-use-case.service.ts\n\tmodified: src/app/services/monitoring/opentelemetry/matrix.ts\n\tmodified: src/app/services/monitoring/opentelemetry/opentelemetry.ts\n\tmodified: src/app/ui/chat/chat-routing.module.ts\n\tmodified: src/app/ui/chat/chat.module.ts\n\tmodified: src/app/ui/chat/chat.page.ts\n\tmodified: src/app/ui/chat/component/contacts/contacts.module.ts\n\tmodified: src/app/ui/chat/component/contacts/contacts.page.scss\n\tmodified: src/app/ui/chat/component/contacts/contacts.page.ts\n\trenamed: src/app/ui/chat/component/group-messages/group-contacts/group-contacts-routing.module.ts -> src/app/ui/chat/component/group-contacts/group-contacts-routing.module.ts\n\trenamed: src/app/ui/chat/component/group-messages/group-contacts/group-contacts.module.ts -> src/app/ui/chat/component/group-contacts/group-contacts.module.ts\n\trenamed: src/app/ui/chat/component/group-messages/group-contacts/group-contacts.page.html -> src/app/ui/chat/component/group-contacts/group-contacts.page.html\n\trenamed: src/app/ui/chat/component/group-messages/group-contacts/group-contacts.page.scss -> src/app/ui/chat/component/group-contacts/group-contacts.page.scss\n\trenamed: src/app/ui/chat/component/group-messages/group-contacts/group-contacts.page.spec.ts -> src/app/ui/chat/component/group-contacts/group-contacts.page.spec.ts\n\trenamed: src/app/ui/chat/component/group-messages/group-contacts/group-contacts.page.ts -> src/app/ui/chat/component/group-contacts/group-contacts.page.ts\n\tdeleted: src/app/ui/chat/component/group-messages/group-messages-routing.module.ts\n\tdeleted: src/app/ui/chat/component/group-messages/group-messages.module.ts\n\tdeleted: src/app/ui/chat/component/group-messages/group-messages.page.html\n\tdeleted: src/app/ui/chat/component/group-messages/group-messages.page.scss\n\tdeleted: src/app/ui/chat/component/group-messages/group-messages.page.spec.ts\n\tdeleted: src/app/ui/chat/component/group-messages/group-messages.page.ts\n\tdeleted: src/app/ui/chat/component/messages/contacts/contacts-routing.module.ts\n\tdeleted: src/app/ui/chat/component/messages/contacts/contacts.module.ts\n\tdeleted: src/app/ui/chat/component/messages/contacts/contacts.page.html\n\tdeleted: src/app/ui/chat/component/messages/contacts/contacts.page.scss\n\tdeleted: src/app/ui/chat/component/messages/contacts/contacts.page.spec.ts\n\tdeleted: src/app/ui/chat/component/messages/contacts/contacts.page.ts\n\tmodified: src/app/ui/chat/component/messages/messages-routing.module.ts\n\tmodified: src/app/ui/chat/component/messages/messages.page.html\n\tmodified: src/app/ui/chat/component/messages/messages.page.ts\n\tdeleted: src/app/ui/chat/modal/chat-debugging/chat-debugging-routing.module.ts\n\tdeleted: src/app/ui/chat/modal/chat-debugging/chat-debugging.module.ts\n\tdeleted: src/app/ui/chat/modal/chat-debugging/chat-debugging.page.html\n\tdeleted: src/app/ui/chat/modal/chat-debugging/chat-debugging.page.scss\n\tdeleted: src/app/ui/chat/modal/chat-debugging/chat-debugging.page.spec.ts\n\tdeleted: src/app/ui/chat/modal/chat-debugging/chat-debugging.page.ts\n\tdeleted: src/app/ui/chat/modal/chat-message-debugging/chat-message-debugging-routing.module.ts\n\tdeleted: src/app/ui/chat/modal/chat-message-debugging/chat-message-debugging.module.ts\n\tdeleted: src/app/ui/chat/modal/chat-message-debugging/chat-message-debugging.page.html\n\tdeleted: src/app/ui/chat/modal/chat-message-debugging/chat-message-debugging.page.scss\n\tdeleted: src/app/ui/chat/modal/chat-message-debugging/chat-message-debugging.page.spec.ts\n\tdeleted: src/app/ui/chat/modal/chat-message-debugging/chat-message-debugging.page.ts\n\trenamed: src/app/ui/chat/modal/group-messages/group-contacts/group-contacts-routing.module.ts -> src/app/ui/chat/modal/group-contacts/group-contacts-routing.module.ts\n\trenamed: src/app/ui/chat/modal/group-messages/group-contacts/group-contacts.module.ts -> src/app/ui/chat/modal/group-contacts/group-contacts.module.ts\n\trenamed: src/app/ui/chat/modal/group-messages/group-contacts/group-contacts.page.html -> src/app/ui/chat/modal/group-contacts/group-contacts.page.html\n\trenamed: src/app/ui/chat/modal/group-messages/group-contacts/group-contacts.page.scss -> src/app/ui/chat/modal/group-contacts/group-contacts.page.scss\n\trenamed: src/app/ui/chat/modal/group-messages/group-contacts/group-contacts.page.spec.ts -> src/app/ui/chat/modal/group-contacts/group-contacts.page.spec.ts\n\trenamed: src/app/ui/chat/modal/group-messages/group-contacts/group-contacts.page.ts -> src/app/ui/chat/modal/group-contacts/group-contacts.page.ts\n\tdeleted: src/app/ui/chat/modal/group-messages/group-messages-routing.module.ts\n\tdeleted: src/app/ui/chat/modal/group-messages/group-messages.module.ts\n\tdeleted: src/app/ui/chat/modal/group-messages/group-messages.page.html\n\tdeleted: src/app/ui/chat/modal/group-messages/group-messages.page.scss\n\tdeleted: src/app/ui/chat/modal/group-messages/group-messages.page.spec.ts\n\tdeleted: src/app/ui/chat/modal/group-messages/group-messages.page.ts\n\tmodified: src/app/ui/chat/modal/messages/contacts/contacts.page.ts\n\tmodified: src/app/ui/chat/modal/messages/messages.page.ts\n\tdeleted: src/app/ui/chat/modal/new-group/contacts/contacts-routing.module.ts\n\tdeleted: src/app/ui/chat/modal/new-group/contacts/contacts.module.ts\n\tdeleted: src/app/ui/chat/modal/new-group/contacts/contacts.page.html\n\tdeleted: src/app/ui/chat/modal/new-group/contacts/contacts.page.scss\n\tdeleted: src/app/ui/chat/modal/new-group/contacts/contacts.page.spec.ts\n\tdeleted: src/app/ui/chat/modal/new-group/contacts/contacts.page.ts\n\tmodified: src/app/ui/chat/modal/new-group/new-group-routing.module.ts\n\tmodified: src/app/ui/chat/modal/new-group/new-group.page.ts\n\tmodified: src/app/ui/chat/modal/room-info/room-info.page.html\n\tmodified: src/app/ui/chat/store/roomStore.ts", "changeAuthor": "peter.maquiran" } \ No newline at end of file