mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 12:37:53 +00:00
create direct message
This commit is contained in:
@@ -12,17 +12,10 @@
|
|||||||
"name": "logs",
|
"name": "logs",
|
||||||
"path": "../logs"
|
"path": "../logs"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "opentelemetry-js-main",
|
|
||||||
"path": "../../../Downloads/opentelemetry-js-main/opentelemetry-js-main"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "grayLog",
|
"name": "grayLog",
|
||||||
"path": "../grayLog"
|
"path": "../grayLog"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"path": "../../../Downloads/nestjs-microservice-boilerplate-api-master"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"path": "../sqlCliente"
|
"path": "../sqlCliente"
|
||||||
},
|
},
|
||||||
|
|||||||
+21
-11
@@ -96,6 +96,7 @@ import { DiplomaOptionsPage } from './shared/popover/deploma-options/deploma-opt
|
|||||||
import { ImageCropperModule } from 'ngx-image-cropper';
|
import { ImageCropperModule } from 'ngx-image-cropper';
|
||||||
import { createAction, createReducer, on, StoreModule } from '@ngrx/store';
|
import { createAction, createReducer, on, StoreModule } from '@ngrx/store';
|
||||||
import { ChatModule } from './module/chat/chat.module';
|
import { ChatModule } from './module/chat/chat.module';
|
||||||
|
import { openTelemetryLogging, OpenTelemetryLogging } from './services/monitoring/opentelemetry/logging';
|
||||||
// import { ServiceWorkerModule } from '@angular/service-worker';
|
// import { ServiceWorkerModule } from '@angular/service-worker';
|
||||||
// import { AngularFireModule } from '@angular/fire';
|
// import { AngularFireModule } from '@angular/fire';
|
||||||
// import { AngularFireMessagingModule } from '@angular/fire/messaging';
|
// import { AngularFireMessagingModule } from '@angular/fire/messaging';
|
||||||
@@ -106,15 +107,6 @@ import { FirebaseX } from '@ionic-native/firebase-x/ngx'; */
|
|||||||
//import { FCM } from 'cordova-plugin-fcm-with-dependecy-updated/ionic/ngx';
|
//import { FCM } from 'cordova-plugin-fcm-with-dependecy-updated/ionic/ngx';
|
||||||
|
|
||||||
|
|
||||||
// import { WebTracerProvider } from '@opentelemetry/web';
|
|
||||||
// import { SimpleSpanProcessor } from '@opentelemetry/tracing';
|
|
||||||
// import { ConsoleSpanExporter } from '@opentelemetry/tracing';
|
|
||||||
|
|
||||||
|
|
||||||
// const provider = new WebTracerProvider();
|
|
||||||
// provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));
|
|
||||||
// provider.register();
|
|
||||||
|
|
||||||
Sentry.init(
|
Sentry.init(
|
||||||
{
|
{
|
||||||
dsn: 'https://5b345a3ae70b4e4da463da65881b4aaa@o4504340905525248.ingest.sentry.io/4504345615794176',
|
dsn: 'https://5b345a3ae70b4e4da463da65881b4aaa@o4504340905525248.ingest.sentry.io/4504345615794176',
|
||||||
@@ -128,10 +120,28 @@ import { FirebaseX } from '@ionic-native/firebase-x/ngx'; */
|
|||||||
new BrowserTracing({
|
new BrowserTracing({
|
||||||
tracingOrigins: ['localhost', 'https://gd-api.oapr.gov.ao/api/'],
|
tracingOrigins: ['localhost', 'https://gd-api.oapr.gov.ao/api/'],
|
||||||
}) as Integration,
|
}) as Integration,
|
||||||
]
|
],
|
||||||
|
beforeSend(event) {
|
||||||
|
if (event.level === 'error') {
|
||||||
|
console.log(event.exception.values[0].value)
|
||||||
|
openTelemetryLogging.send({
|
||||||
|
type: 'graylog',
|
||||||
|
payload: {
|
||||||
|
message: event.exception.values[0].value,
|
||||||
|
object: {
|
||||||
|
sentry: true,
|
||||||
|
error: event
|
||||||
|
}
|
||||||
|
},
|
||||||
|
spanContext: null
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// Return event to send it to Sentry
|
||||||
|
return event;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
// Forward the init method to the sibling Framework.
|
// Forward the init method to the sibling Framework.
|
||||||
SentrySibling.init
|
SentrySibling.init,
|
||||||
);
|
);
|
||||||
|
|
||||||
export const increment = createAction('[Counter Component] Increment');
|
export const increment = createAction('[Counter Component] Increment');
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ import { MessageAttachmentFileType, MessageAttachmentSource } from "./messageOut
|
|||||||
import { base64Schema } from "src/app/utils/zod";
|
import { base64Schema } from "src/app/utils/zod";
|
||||||
|
|
||||||
export const MessageInputDTOSchema = z.object({
|
export const MessageInputDTOSchema = z.object({
|
||||||
roomId: z.string().uuid(),
|
roomId: z.string().uuid().optional(),
|
||||||
|
receiverId: z.number().optional(),
|
||||||
senderId: z.number(),
|
senderId: z.number(),
|
||||||
message: z.string().nullable().optional(),
|
message: z.string().nullable().optional(),
|
||||||
messageType: z.number(),
|
messageType: z.number(),
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export const MessageOutPutDataDTOSchema = z.object({
|
|||||||
canEdit: z.boolean(),
|
canEdit: z.boolean(),
|
||||||
oneShot: z.boolean(),
|
oneShot: z.boolean(),
|
||||||
requireUnlock: z.boolean(),
|
requireUnlock: z.boolean(),
|
||||||
requestId: z.string().optional(),
|
requestId: z.string().optional().nullable(),
|
||||||
reactions: z.object({
|
reactions: z.object({
|
||||||
id: z.string(),
|
id: z.string(),
|
||||||
reactedAt: z.string(),
|
reactedAt: z.string(),
|
||||||
|
|||||||
@@ -1,51 +0,0 @@
|
|||||||
import { Injectable } from '@angular/core';
|
|
||||||
import { err, ok } from 'neverthrow';
|
|
||||||
import { SignalRService } from '../../infra/socket/signal-r.service';
|
|
||||||
|
|
||||||
interface msgObj {
|
|
||||||
roomId: string;
|
|
||||||
senderId: string;
|
|
||||||
message:string;
|
|
||||||
messageType:1;
|
|
||||||
canEdit:Boolean;
|
|
||||||
oneShot:Boolean;
|
|
||||||
requestId: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Injectable({
|
|
||||||
providedIn: 'root'
|
|
||||||
})
|
|
||||||
export class MessageLiveDataSourceService {
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
private messageLiveSignalRDataSourceService: SignalRService
|
|
||||||
) {}
|
|
||||||
|
|
||||||
async sendMessage(data: msgObj) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
const result = await this.messageLiveSignalRDataSourceService.sendMessage(data)
|
|
||||||
|
|
||||||
return ok(result)
|
|
||||||
} catch (e) {
|
|
||||||
return err(e)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
listenToMessages() {
|
|
||||||
return this.messageLiveSignalRDataSourceService.getMessage()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
listenToDeleteMessages() {
|
|
||||||
return this.messageLiveSignalRDataSourceService.getMessageDelete()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
listenToUpdateMessages() {
|
|
||||||
return this.messageLiveSignalRDataSourceService.getMessageUpdate()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
+99
@@ -0,0 +1,99 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { err, ok } from 'neverthrow';
|
||||||
|
import { SignalRService } from '../../../infra/socket/signal-r.service';
|
||||||
|
import { SessionStore } from 'src/app/store/session.service';
|
||||||
|
import { MessageDeleteInputDTO } from '../../dto/message/messageDeleteInputDTO';
|
||||||
|
import { v4 as uuidv4 } from 'uuid'
|
||||||
|
import { InstanceId } from '../../../domain/chat-service.service';
|
||||||
|
import { MessageUpdateInput } from '../../../domain/use-case/message-update-by-id-use-case.service';
|
||||||
|
import { MessageOutPutDataDTO } from '../../dto/message/messageOutputDTO';
|
||||||
|
import { MessageInputDTO } from '../../dto/message/messageInputDtO';
|
||||||
|
|
||||||
|
interface msgObj {
|
||||||
|
roomId: string;
|
||||||
|
senderId: string;
|
||||||
|
message:string;
|
||||||
|
messageType:1;
|
||||||
|
canEdit:Boolean;
|
||||||
|
oneShot:Boolean;
|
||||||
|
requestId: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class MessageSocketRepositoryService {
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private socket: SignalRService
|
||||||
|
) {}
|
||||||
|
|
||||||
|
async sendMessage(data: msgObj) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
const result = await this.socket.sendMessage(data)
|
||||||
|
return ok(result)
|
||||||
|
} catch (e) {
|
||||||
|
return err(e)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
async sendDirectMessage(data: MessageInputDTO) {
|
||||||
|
const result = await this.socket.sendData<MessageOutPutDataDTO>({
|
||||||
|
method: 'SendDirectMessage',
|
||||||
|
data: data as any,
|
||||||
|
})
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
listenToMessages() {
|
||||||
|
return this.socket.getMessage()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
listenToDeleteMessages() {
|
||||||
|
return this.socket.getMessageDelete()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
listenToUpdateMessages() {
|
||||||
|
return this.socket.getMessageUpdate()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
reactToMessageSocket(data) {
|
||||||
|
this.socket.sendData({
|
||||||
|
method: 'ReactMessage',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
updateMessage(input: MessageUpdateInput) {
|
||||||
|
this.socket.sendData({
|
||||||
|
method: 'EditMessage',
|
||||||
|
data: input,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
sendTyping(roomId) {
|
||||||
|
return this.socket.sendTyping({
|
||||||
|
roomId,
|
||||||
|
UserName:SessionStore.user.FullName,
|
||||||
|
userId: SessionStore.user.UserId
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sendMessageDelete(data: MessageDeleteInputDTO) {
|
||||||
|
|
||||||
|
data['requestId'] = InstanceId +'@'+ uuidv4();
|
||||||
|
|
||||||
|
return this.socket.sendMessageDelete(data)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
+2
-2
@@ -3,10 +3,10 @@ import { liveQuery } from 'Dexie';
|
|||||||
import { err, ok, Result } from 'neverthrow';
|
import { err, ok, Result } from 'neverthrow';
|
||||||
import { Observable, Subject } from 'rxjs';
|
import { Observable, Subject } from 'rxjs';
|
||||||
import { filter } from 'rxjs/operators';
|
import { filter } from 'rxjs/operators';
|
||||||
import { MessageEntity } from '../../domain/entity/message';
|
import { MessageEntity } from '../../../domain/entity/message';
|
||||||
import { DexieRepository } from 'src/app/infra/repository/dexie/dexie-repository.service';
|
import { DexieRepository } from 'src/app/infra/repository/dexie/dexie-repository.service';
|
||||||
import { MessageTable, MessageTableSchema } from 'src/app/module/chat/infra/database/dexie/schema/message';
|
import { MessageTable, MessageTableSchema } from 'src/app/module/chat/infra/database/dexie/schema/message';
|
||||||
import { chatDatabase } from '../../infra/database/dexie/service';
|
import { chatDatabase } from '../../../infra/database/dexie/service';
|
||||||
import { Observable as DexieObservable, PromiseExtended } from 'Dexie';
|
import { Observable as DexieObservable, PromiseExtended } from 'Dexie';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
+6
-36
@@ -1,15 +1,15 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { HttpService } from 'src/app/services/http.service';
|
import { HttpService } from 'src/app/services/http.service';
|
||||||
import { MessageInputDTO, MessageInputDTOSchema } from '../dto/message/messageInputDtO';
|
import { MessageInputDTO, MessageInputDTOSchema } from '../../dto/message/messageInputDtO';
|
||||||
import { ValidateSchema } from 'src/app/services/decorators/validate-schema.decorator';
|
import { ValidateSchema } from 'src/app/services/decorators/validate-schema.decorator';
|
||||||
import { APIReturn } from 'src/app/services/decorators/api-validate-schema.decorator';
|
import { APIReturn } from 'src/app/services/decorators/api-validate-schema.decorator';
|
||||||
import { MessageOutPutDataDTOSchema, MessageOutPutDTO, MessageOutPutDTOSchema } from '../dto/message/messageOutputDTO';
|
import { MessageOutPutDataDTOSchema, MessageOutPutDTO, MessageOutPutDTOSchema } from '../../dto/message/messageOutputDTO';
|
||||||
import { DataSourceReturn } from 'src/app/services/Repositorys/type';
|
import { DataSourceReturn } from 'src/app/services/Repositorys/type';
|
||||||
import { SignalRService } from '../../infra/socket/signal-r.service';
|
import { SignalRService } from '../../../infra/socket/signal-r.service';
|
||||||
import { MessageUpdateInput } from '../../domain/use-case/message-update-by-id-use-case.service';
|
import { MessageUpdateInput } from '../../../domain/use-case/message-update-by-id-use-case.service';
|
||||||
import { SessionStore } from 'src/app/store/session.service';
|
import { SessionStore } from 'src/app/store/session.service';
|
||||||
import { MessageDeleteInputDTO } from '../dto/message/messageDeleteInputDTO';
|
import { MessageDeleteInputDTO } from '../../dto/message/messageDeleteInputDTO';
|
||||||
import { InstanceId } from '../../domain/chat-service.service';
|
import { InstanceId } from '../../../domain/chat-service.service';
|
||||||
import { v4 as uuidv4 } from 'uuid'
|
import { v4 as uuidv4 } from 'uuid'
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
@@ -46,35 +46,5 @@ export class MessageRemoteDataSourceService {
|
|||||||
return await this.httpService.get(`${this.baseUrl}/attachment/${id}`);
|
return await this.httpService.get(`${this.baseUrl}/attachment/${id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
reactToMessageSocket(data) {
|
|
||||||
this.socket.sendData({
|
|
||||||
method: 'ReactMessage',
|
|
||||||
data
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
updateMessage(input: MessageUpdateInput) {
|
|
||||||
this.socket.sendData({
|
|
||||||
method: 'EditMessage',
|
|
||||||
data: input,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
sendTyping(roomId) {
|
|
||||||
return this.socket.sendTyping({
|
|
||||||
roomId,
|
|
||||||
UserName:SessionStore.user.FullName,
|
|
||||||
userId: SessionStore.user.UserId
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
sendMessageDelete(data: MessageDeleteInputDTO) {
|
|
||||||
|
|
||||||
data['requestId'] = InstanceId +'@'+ uuidv4();
|
|
||||||
|
|
||||||
return this.socket.sendMessageDelete(data)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -4,7 +4,7 @@ import { SessionStore } from 'src/app/store/session.service';
|
|||||||
import { MessageReactionInput, MessageReactionUseCaseService } from 'src/app/module/chat/domain/use-case/message-reaction-by-id-use-case.service';
|
import { MessageReactionInput, MessageReactionUseCaseService } from 'src/app/module/chat/domain/use-case/message-reaction-by-id-use-case.service';
|
||||||
import { MessageUpdateInput, MessageUpdateUseCaseService } from 'src/app/module/chat/domain/use-case/message-update-by-id-use-case.service';
|
import { MessageUpdateInput, MessageUpdateUseCaseService } from 'src/app/module/chat/domain/use-case/message-update-by-id-use-case.service';
|
||||||
import { MemberAdminUseCaseService, MemberSetAdminDTO } from 'src/app/module/chat/domain/use-case/member-admin-use-case.service';
|
import { MemberAdminUseCaseService, MemberSetAdminDTO } from 'src/app/module/chat/domain/use-case/member-admin-use-case.service';
|
||||||
import { MessageCreateUseCaseService } from 'src/app/module/chat/domain/use-case/message-create-use-case.service';
|
import { MessageCreateUseCaseService, MessageEnum } from 'src/app/module/chat/domain/use-case/message-create-use-case.service';
|
||||||
import { SignalRService } from '../infra/socket/signal-r.service';
|
import { SignalRService } from '../infra/socket/signal-r.service';
|
||||||
import { SocketMessageDeleteUseCaseService } from 'src/app/module/chat/domain/use-case/socket/socket-message-delete-use-case.service';
|
import { SocketMessageDeleteUseCaseService } from 'src/app/module/chat/domain/use-case/socket/socket-message-delete-use-case.service';
|
||||||
import { SocketMessageUpdateUseCaseService } from 'src/app/module/chat/domain/use-case/socket/socket-message-update-use-case.service';
|
import { SocketMessageUpdateUseCaseService } from 'src/app/module/chat/domain/use-case/socket/socket-message-update-use-case.service';
|
||||||
@@ -151,8 +151,8 @@ export class ChatServiceService {
|
|||||||
return this.MemberAdminUseCaseService.execute(input)
|
return this.MemberAdminUseCaseService.execute(input)
|
||||||
}
|
}
|
||||||
|
|
||||||
sendMessage(input: MessageEntity) {
|
sendMessage(input: MessageEntity, messageEnum: MessageEnum) {
|
||||||
return this.MessageCreateUseCaseService.execute(input);
|
return this.MessageCreateUseCaseService.execute(input, messageEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
asyncAllRoomMessage() {
|
asyncAllRoomMessage() {
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
export enum RoomType {
|
||||||
|
Group = 1,
|
||||||
|
Direct = 2
|
||||||
|
}
|
||||||
@@ -6,7 +6,8 @@ import { base64Schema } from "src/app/utils/zod";
|
|||||||
export const MessageEntitySchema = z.object({
|
export const MessageEntitySchema = z.object({
|
||||||
$id: z.any().optional(),
|
$id: z.any().optional(),
|
||||||
id: z.string().optional(),
|
id: z.string().optional(),
|
||||||
roomId: z.string(),
|
roomId: z.string().uuid().optional(),
|
||||||
|
receiverId: z.number().optional(),
|
||||||
message: z.string().optional(),
|
message: z.string().optional(),
|
||||||
messageType: z.number(),
|
messageType: z.number(),
|
||||||
canEdit: z.boolean(),
|
canEdit: z.boolean(),
|
||||||
@@ -38,7 +39,8 @@ export class MessageEntity implements Message {
|
|||||||
|
|
||||||
$id: number
|
$id: number
|
||||||
id: string
|
id: string
|
||||||
roomId: string
|
roomId?: string
|
||||||
|
receiverId?: number
|
||||||
message: string
|
message: string
|
||||||
messageType: number = 0
|
messageType: number = 0
|
||||||
canEdit: boolean = false
|
canEdit: boolean = false
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { MessageInputDTO } from "../../data/dto/message/messageInputDtO";
|
import { MessageInputDTO } from "../../data/dto/message/messageInputDtO";
|
||||||
import { MessageOutPutDataDTO } from "../../data/dto/message/messageOutputDTO";
|
import { MessageOutPutDataDTO } from "../../data/dto/message/messageOutputDTO";
|
||||||
import { MessageEntity } from "../entity/message";
|
import { MessageEntity } from "../entity/message";
|
||||||
import { attachments } from '../../../../../../../../../Downloads/equilibriumito-gabinete-digital-fo-23cf0fc4cbaa/equilibriumito-gabinete-digital-fo-23cf0fc4cbaa/src/app/models/beast-orm';
|
|
||||||
|
|
||||||
export class MessageMapper {
|
export class MessageMapper {
|
||||||
static toDomain(DTO: MessageOutPutDataDTO) : MessageEntity {
|
static toDomain(DTO: MessageOutPutDataDTO) : MessageEntity {
|
||||||
@@ -10,6 +9,7 @@ export class MessageMapper {
|
|||||||
|
|
||||||
static fromDomain(entity:MessageEntity, requestId): MessageInputDTO {
|
static fromDomain(entity:MessageEntity, requestId): MessageInputDTO {
|
||||||
return {
|
return {
|
||||||
|
receiverId: entity.receiverId,
|
||||||
canEdit: entity.canEdit,
|
canEdit: entity.canEdit,
|
||||||
message: entity.message,
|
message: entity.message,
|
||||||
messageType: entity.messageType,
|
messageType: entity.messageType,
|
||||||
@@ -26,7 +26,7 @@ export class MessageMapper {
|
|||||||
applicationId: e.applicationId || 0,
|
applicationId: e.applicationId || 0,
|
||||||
docId: Number(e.docId) || 0,
|
docId: Number(e.docId) || 0,
|
||||||
mimeType: e.mimeType
|
mimeType: e.mimeType
|
||||||
}))[0]
|
}))[0] || {}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { filter, map } from 'rxjs/operators';
|
import { filter, map } from 'rxjs/operators';
|
||||||
import { InstanceId } from '../chat-service.service';
|
import { InstanceId } from '../chat-service.service';
|
||||||
import { MessageLiveDataSourceService } from 'src/app/module/chat/data/repository/message-live-signalr-data-source.service'
|
import { MessageSocketRepositoryService } from 'src/app/module/chat/data/repository/message/message-live-signalr-data-source.service'
|
||||||
import { MessageEntity } from '../entity/message';
|
import { MessageEntity } from '../entity/message';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
@@ -10,12 +10,12 @@ import { MessageEntity } from '../entity/message';
|
|||||||
export class ListenMessageByRoomIdNewUseCase {
|
export class ListenMessageByRoomIdNewUseCase {
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private MessageLiveDataSourceService: MessageLiveDataSourceService
|
private MessageSocketRepositoryService: MessageSocketRepositoryService
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
execute({roomId}: {roomId: string}) {
|
execute({roomId}: {roomId: string}) {
|
||||||
|
|
||||||
return this.MessageLiveDataSourceService.listenToMessages().pipe(
|
return this.MessageSocketRepositoryService.listenToMessages().pipe(
|
||||||
filter((message) => !message?.requestId?.startsWith(InstanceId) && message?.roomId == roomId),
|
filter((message) => !message?.requestId?.startsWith(InstanceId) && message?.roomId == roomId),
|
||||||
map(message => Object.assign(new MessageEntity(), message))
|
map(message => Object.assign(new MessageEntity(), message))
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { filter } from 'rxjs/operators';
|
import { filter } from 'rxjs/operators';
|
||||||
import { MessageLiveDataSourceService } from '../../data/repository/message-live-signalr-data-source.service';
|
import { MessageSocketRepositoryService } from '../../data/repository/message/message-live-signalr-data-source.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
@@ -8,7 +8,7 @@ import { MessageLiveDataSourceService } from '../../data/repository/message-live
|
|||||||
export class ListenMessageUpdateByRoomIdUseCase {
|
export class ListenMessageUpdateByRoomIdUseCase {
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private messageLiveSignalRDataSourceService: MessageLiveDataSourceService,
|
private messageLiveSignalRDataSourceService: MessageSocketRepositoryService,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
execute({roomId}) {
|
execute({roomId}) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { MessageLiveDataSourceService } from 'src/app/module/chat/data/repository/message-live-signalr-data-source.service'
|
import { MessageSocketRepositoryService } from 'src/app/module/chat/data/repository/message/message-live-signalr-data-source.service'
|
||||||
import { InstanceId } from '../chat-service.service';
|
import { InstanceId } from '../chat-service.service';
|
||||||
import { filter, map } from 'rxjs/operators';
|
import { filter, map } from 'rxjs/operators';
|
||||||
|
|
||||||
@@ -9,12 +9,12 @@ import { filter, map } from 'rxjs/operators';
|
|||||||
export class ListenSendMessageUseCase {
|
export class ListenSendMessageUseCase {
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private MessageLiveDataSourceService: MessageLiveDataSourceService
|
private MessageSocketRepositoryService: MessageSocketRepositoryService
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
execute({roomId}: {roomId: string}) {
|
execute({roomId}: {roomId: string}) {
|
||||||
|
|
||||||
return this.MessageLiveDataSourceService.listenToMessages().pipe(
|
return this.MessageSocketRepositoryService.listenToMessages().pipe(
|
||||||
filter((message) => message?.requestId?.startsWith(InstanceId) && message?.roomId == roomId),
|
filter((message) => message?.requestId?.startsWith(InstanceId) && message?.roomId == roomId),
|
||||||
map(message => message)
|
map(message => message)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -8,8 +8,9 @@ import { createDataURL } from 'src/app/utils/ToBase64';
|
|||||||
import { zodSafeValidation } from 'src/app/utils/zodValidation';
|
import { zodSafeValidation } from 'src/app/utils/zodValidation';
|
||||||
import { Logger } from 'src/app/services/logger/main/service';
|
import { Logger } from 'src/app/services/logger/main/service';
|
||||||
import { MessageAttachmentSource, MessageOutPutDataDTO } from '../../data/dto/message/messageOutputDTO';
|
import { MessageAttachmentSource, MessageOutPutDataDTO } from '../../data/dto/message/messageOutputDTO';
|
||||||
import { MessageLocalDataSourceService } from '../../data/repository/message-local-data-source.service';
|
import { MessageLocalDataSourceService } from '../../data/repository/message/message-local-data-source.service';
|
||||||
import { err } from 'neverthrow';
|
import { MessageSocketRepositoryService } from '../../data/repository/message/message-live-signalr-data-source.service';
|
||||||
|
import { err, Result } from 'neverthrow';
|
||||||
import { MessageTable } from '../../infra/database/dexie/schema/message';
|
import { MessageTable } from '../../infra/database/dexie/schema/message';
|
||||||
import { MessageMapper } from '../mapper/messageMapper';
|
import { MessageMapper } from '../mapper/messageMapper';
|
||||||
import { SignalRService } from '../../infra/socket/signal-r.service';
|
import { SignalRService } from '../../infra/socket/signal-r.service';
|
||||||
@@ -20,6 +21,11 @@ const MessageInputUseCaseSchema = z.object({
|
|||||||
message: z.string()
|
message: z.string()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
export enum MessageEnum {
|
||||||
|
Direct = 1,
|
||||||
|
group = 2
|
||||||
|
}
|
||||||
|
|
||||||
export type MessageInputUseCase = z.infer< typeof MessageInputUseCaseSchema>
|
export type MessageInputUseCase = z.infer< typeof MessageInputUseCaseSchema>
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
@@ -31,10 +37,11 @@ export class MessageCreateUseCaseService {
|
|||||||
private AttachmentLocalRepositoryService: AttachmentLocalDataSource,
|
private AttachmentLocalRepositoryService: AttachmentLocalDataSource,
|
||||||
private messageLocalDataSourceService: MessageLocalDataSourceService,
|
private messageLocalDataSourceService: MessageLocalDataSourceService,
|
||||||
private messageLiveSignalRDataSourceService: SignalRService,
|
private messageLiveSignalRDataSourceService: SignalRService,
|
||||||
|
private messageSocketRepositoryService: MessageSocketRepositoryService
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
|
|
||||||
async execute(message: MessageEntity) {
|
async execute(message: MessageEntity, messageEnum: MessageEnum) {
|
||||||
|
|
||||||
const validation = zodSafeValidation<MessageEntity>(MessageEntitySchema, message)
|
const validation = zodSafeValidation<MessageEntity>(MessageEntitySchema, message)
|
||||||
|
|
||||||
@@ -85,7 +92,14 @@ export class MessageCreateUseCaseService {
|
|||||||
message.sending = true
|
message.sending = true
|
||||||
|
|
||||||
const DTO = MessageMapper.fromDomain(message, message.requestId)
|
const DTO = MessageMapper.fromDomain(message, message.requestId)
|
||||||
const sendMessageResult = await this.messageLiveSignalRDataSourceService.sendMessage<MessageOutPutDataDTO>(DTO)
|
|
||||||
|
let sendMessageResult: Result<MessageOutPutDataDTO, any>
|
||||||
|
if(messageEnum == MessageEnum.group) {
|
||||||
|
sendMessageResult = await this.messageLiveSignalRDataSourceService.sendMessage<MessageOutPutDataDTO>(DTO)
|
||||||
|
} else {
|
||||||
|
sendMessageResult = await this.messageSocketRepositoryService.sendDirectMessage(DTO)
|
||||||
|
}
|
||||||
|
|
||||||
// return this sendMessageResult
|
// return this sendMessageResult
|
||||||
|
|
||||||
if(sendMessageResult.isOk()) {
|
if(sendMessageResult.isOk()) {
|
||||||
@@ -101,7 +115,9 @@ export class MessageCreateUseCaseService {
|
|||||||
$id : message.$id
|
$id : message.$id
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.messageLocalDataSourceService.update(message.$id, {...clone, sending: false, roomId: message.roomId})
|
this.messageLocalDataSourceService.update(message.$id, {...clone, sending: false, roomId: message.roomId})
|
||||||
|
|
||||||
|
return sendMessageResult
|
||||||
} else {
|
} else {
|
||||||
Logger.error('failed to send message to the server', {
|
Logger.error('failed to send message to the server', {
|
||||||
error: sendMessageResult.error
|
error: sendMessageResult.error
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { SafeValidateSchema, ValidateSchema } from 'src/app/services/decorators/validate-schema.decorator';
|
import { SafeValidateSchema, ValidateSchema } from 'src/app/services/decorators/validate-schema.decorator';
|
||||||
import { MessageRemoteDataSourceService } from '../../data/repository/message-remote-data-source.service';
|
import { MessageRemoteDataSourceService } from '../../data/repository/message/message-remote-data-source.service';
|
||||||
|
import { MessageSocketRepositoryService } from '../../data/repository/message/message-live-signalr-data-source.service';
|
||||||
|
|
||||||
|
|
||||||
export const MessageDeleteInputDTOSchema = z.object({
|
export const MessageDeleteInputDTOSchema = z.object({
|
||||||
requestId: z.string().optional(),
|
requestId: z.string().optional(),
|
||||||
@@ -17,7 +19,7 @@ export type MessageDeleteInputDTO = z.infer<typeof MessageDeleteInputDTOSchema>
|
|||||||
})
|
})
|
||||||
export class MessageDeleteLiveUseCaseService {
|
export class MessageDeleteLiveUseCaseService {
|
||||||
constructor(
|
constructor(
|
||||||
public repository: MessageRemoteDataSourceService
|
public repository: MessageSocketRepositoryService
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
@SafeValidateSchema(MessageDeleteInputDTOSchema, 'MessageDeleteUseCaseService')
|
@SafeValidateSchema(MessageDeleteInputDTOSchema, 'MessageDeleteUseCaseService')
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { object, z } from 'zod';
|
import { object, z } from 'zod';
|
||||||
import { ValidateSchema } from 'src/app/services/decorators/validate-schema.decorator';
|
import { ValidateSchema } from 'src/app/services/decorators/validate-schema.decorator';
|
||||||
import { MessageRemoteDataSourceService } from '../../data/repository/message-remote-data-source.service';
|
import { MessageRemoteDataSourceService } from '../../data/repository/message/message-remote-data-source.service';
|
||||||
|
import { MessageSocketRepositoryService } from '../../data/repository/message/message-live-signalr-data-source.service';
|
||||||
|
|
||||||
|
|
||||||
const MessageReactionInputDTOSchema = z.object({
|
const MessageReactionInputDTOSchema = z.object({
|
||||||
@@ -20,7 +21,7 @@ export type MessageReactionInput = z.infer< typeof MessageReactionInputDTOSchema
|
|||||||
export class MessageReactionUseCaseService {
|
export class MessageReactionUseCaseService {
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public repository: MessageRemoteDataSourceService
|
public repository: MessageSocketRepositoryService
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
@ValidateSchema(MessageReactionInputDTOSchema)
|
@ValidateSchema(MessageReactionInputDTOSchema)
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { err, ok } from 'neverthrow';
|
import { err, ok } from 'neverthrow';
|
||||||
import { SessionStore } from 'src/app/store/session.service';
|
import { SessionStore } from 'src/app/store/session.service';
|
||||||
import { MessageLocalDataSourceService } from '../../data/repository/message-local-data-source.service';
|
import { MessageLocalDataSourceService } from '../../data/repository/message/message-local-data-source.service';
|
||||||
import { MessageRemoteDataSourceService } from '../../data/repository/message-remote-data-source.service';
|
import { MessageRemoteDataSourceService } from '../../data/repository/message/message-remote-data-source.service';
|
||||||
import { SignalRService } from '../../infra/socket/signal-r.service';
|
import { SignalRService } from '../../infra/socket/signal-r.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { ValidateSchema } from 'src/app/services/decorators/validate-schema.decorator';
|
import { ValidateSchema } from 'src/app/services/decorators/validate-schema.decorator';
|
||||||
import { MessageRemoteDataSourceService } from '../../data/repository/message-remote-data-source.service';
|
import { MessageRemoteDataSourceService } from '../../data/repository/message/message-remote-data-source.service';
|
||||||
|
import { MessageSocketRepositoryService } from '../../data/repository/message/message-live-signalr-data-source.service';
|
||||||
|
|
||||||
|
|
||||||
const MessageUpdateInputDTOSchema = z.object({
|
const MessageUpdateInputDTOSchema = z.object({
|
||||||
memberId: z.number(),
|
memberId: z.number(),
|
||||||
@@ -20,7 +22,7 @@ export type MessageUpdateInput = z.infer< typeof MessageUpdateInputDTOSchema>
|
|||||||
export class MessageUpdateUseCaseService {
|
export class MessageUpdateUseCaseService {
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public repository: MessageRemoteDataSourceService
|
public repository: MessageSocketRepositoryService
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
@ValidateSchema(MessageUpdateInputDTOSchema)
|
@ValidateSchema(MessageUpdateInputDTOSchema)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { MessageLocalDataSourceService } from '../../data/repository/message-local-data-source.service';
|
import { MessageLocalDataSourceService } from '../../data/repository/message/message-local-data-source.service';
|
||||||
import { MessageOutPutDataDTO } from '../../data/dto/message/messageOutputDTO';
|
import { MessageOutPutDataDTO } from '../../data/dto/message/messageOutputDTO';
|
||||||
import { MessageTable } from '../../infra/database/dexie/schema/message';
|
import { MessageTable } from '../../infra/database/dexie/schema/message';
|
||||||
import { SignalRService } from '../../infra/socket/signal-r.service';
|
import { SignalRService } from '../../infra/socket/signal-r.service';
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
import { Injectable, Input } from '@angular/core';
|
import { Injectable, Input } from '@angular/core';
|
||||||
import { MessageLocalDataSourceService } from '../../../data/repository/message-local-data-source.service';
|
import { MessageLocalDataSourceService } from '../../../data/repository/message/message-local-data-source.service';
|
||||||
import { TracingType, XTracerAsync } from 'src/app/services/monitoring/opentelemetry/tracer';
|
import { TracingType, XTracerAsync } from 'src/app/services/monitoring/opentelemetry/tracer';
|
||||||
import { ParamsValidation } from 'src/app/services/decorators/validate-schema.decorator';
|
import { ParamsValidation } from 'src/app/services/decorators/validate-schema.decorator';
|
||||||
import { MessageOutPutDataDTOSchema } from '../../../data/dto/message/messageOutputDTO';
|
import { MessageOutPutDataDTOSchema } from '../../../data/dto/message/messageOutputDTO';
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { MessageLocalDataSourceService } from '../../../data/repository/message-local-data-source.service';
|
import { MessageLocalDataSourceService } from '../../../data/repository/message/message-local-data-source.service';
|
||||||
import { MessageOutPutDataDTO } from '../../../data/dto/message/messageOutputDTO';
|
import { MessageOutPutDataDTO } from '../../../data/dto/message/messageOutputDTO';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { MessageLocalDataSourceService } from '../../../data/repository/message-local-data-source.service';
|
import { MessageLocalDataSourceService } from '../../../data/repository/message/message-local-data-source.service';
|
||||||
import { MessageOutPutDataDTO, MessageOutPutDataDTOSchema } from '../../../data/dto/message/messageOutputDTO';
|
import { MessageOutPutDataDTO, MessageOutPutDataDTOSchema } from '../../../data/dto/message/messageOutputDTO';
|
||||||
import { ParamsValidation, SafeValidateSchema, ValidateSchema } from 'src/app/services/decorators/validate-schema.decorator';
|
import { ParamsValidation, SafeValidateSchema, ValidateSchema } from 'src/app/services/decorators/validate-schema.decorator';
|
||||||
import { MessageInputDTOSchema } from '../../../data/dto/message/messageInputDtO';
|
import { MessageInputDTOSchema } from '../../../data/dto/message/messageInputDtO';
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { MessageLocalDataSourceService } from '../../data/repository/message-local-data-source.service';
|
import { MessageLocalDataSourceService } from '../../data/repository/message/message-local-data-source.service';
|
||||||
import { messageListDetermineChanges } from '../../data/async/list/rooms/messageListChangedetector';
|
import { messageListDetermineChanges } from '../../data/async/list/rooms/messageListChangedetector';
|
||||||
import { MessageTable } from '../../infra/database/dexie/schema/message';
|
import { MessageTable } from '../../infra/database/dexie/schema/message';
|
||||||
import { MessageRemoteDataSourceService } from '../../data/repository/message-remote-data-source.service';
|
import { MessageRemoteDataSourceService } from '../../data/repository/message/message-remote-data-source.service';
|
||||||
import { ok } from 'neverthrow';
|
import { ok } from 'neverthrow';
|
||||||
import { RoomLocalRepository } from '../../data/repository/room-local-repository.service';
|
import { RoomLocalRepository } from '../../data/repository/room-local-repository.service';
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { z } from 'zod';
|
|||||||
export const MessageTableSchema = z.object({
|
export const MessageTableSchema = z.object({
|
||||||
$id: z.number().optional(),
|
$id: z.number().optional(),
|
||||||
id: z.string().optional(),
|
id: z.string().optional(),
|
||||||
roomId: z.string().uuid(),
|
roomId: z.string().uuid().optional(),
|
||||||
message: z.string().nullable().optional(),
|
message: z.string().nullable().optional(),
|
||||||
messageType: z.number(),
|
messageType: z.number(),
|
||||||
canEdit: z.boolean(),
|
canEdit: z.boolean(),
|
||||||
@@ -18,6 +18,7 @@ export const MessageTableSchema = z.object({
|
|||||||
wxeMail: z.string(),
|
wxeMail: z.string(),
|
||||||
userPhoto: z.string(),
|
userPhoto: z.string(),
|
||||||
}),
|
}),
|
||||||
|
receiverId: z.number().optional(),
|
||||||
sending: z.boolean().optional(),
|
sending: z.boolean().optional(),
|
||||||
reactions: z.object({
|
reactions: z.object({
|
||||||
id: z.string(),
|
id: z.string(),
|
||||||
|
|||||||
@@ -134,8 +134,8 @@ export class SignalRService {
|
|||||||
return this.messageUpdateSubject.asObservable()
|
return this.messageUpdateSubject.asObservable()
|
||||||
}
|
}
|
||||||
|
|
||||||
sendData(input: ISignalRInput) {
|
sendData<T>(input: ISignalRInput) {
|
||||||
return this.connection.sendData(input)
|
return this.connection.sendData<T>(input)
|
||||||
}
|
}
|
||||||
|
|
||||||
getData() {
|
getData() {
|
||||||
|
|||||||
@@ -241,7 +241,7 @@ export class SignalRConnection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sendData(input: ISignalRInput): Promise<Result<any, any>> {
|
sendData<T>(input: ISignalRInput): Promise<Result<T, any>> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|
||||||
if(this.connectionStateSubject.value == true) {
|
if(this.connectionStateSubject.value == true) {
|
||||||
@@ -249,10 +249,10 @@ export class SignalRConnection {
|
|||||||
this.hubConnection.invoke(input.method, input.data)
|
this.hubConnection.invoke(input.method, input.data)
|
||||||
|
|
||||||
this.sendDataSubject.pipe(
|
this.sendDataSubject.pipe(
|
||||||
filter((message: any) => input.data.requestId == message?.requestId),
|
filter((message) => input.data.requestId == message?.data.requestId),
|
||||||
first()
|
first()
|
||||||
).subscribe(value => {
|
).subscribe(value => {
|
||||||
resolve(ok(value))
|
resolve(ok(value.data as unknown as T))
|
||||||
console.log('Received valid value:', value);
|
console.log('Received valid value:', value);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -43,14 +43,12 @@ export class WebSocketGraylogService {
|
|||||||
payload: data.payload,
|
payload: data.payload,
|
||||||
requestId: data.requestId,
|
requestId: data.requestId,
|
||||||
parentSpan: {
|
parentSpan: {
|
||||||
traceId: data.spanContext.spanContext().traceId,
|
traceId: data?.spanContext?.spanContext().traceId,
|
||||||
spanId: data.spanContext.spanContext().spanId,
|
spanId: data?.spanContext?.spanContext().spanId,
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// data.spanContext.end()
|
// data.spanContext.end()
|
||||||
} else {
|
|
||||||
console.warn('WebSocket is not open. Message not sent.');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,10 @@ const routes: Routes = [
|
|||||||
path: 'set-room-owner',
|
path: 'set-room-owner',
|
||||||
loadChildren: () => import('./modal/set-room-owner/set-room-owner.module').then( m => m.SetRoomOwnerPageModule)
|
loadChildren: () => import('./modal/set-room-owner/set-room-owner.module').then( m => m.SetRoomOwnerPageModule)
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'contacts',
|
||||||
|
loadChildren: () => import('./component/contacts/contacts.module').then( m => m.ContactsPageModule)
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import { EditGroupPageModule } from './component/edit-group/edit-group.module';
|
|||||||
import { GroupContactsPageModule } from './component/group-messages/group-contacts/group-contacts.module';
|
import { GroupContactsPageModule } from './component/group-messages/group-contacts/group-contacts.module';
|
||||||
import { GroupMessagesPageModule } from './component/group-messages/group-messages.module';
|
import { GroupMessagesPageModule } from './component/group-messages/group-messages.module';
|
||||||
import { MessagesPageModule } from './component/messages/messages.module';
|
import { MessagesPageModule } from './component/messages/messages.module';
|
||||||
import { ContactsPageModule } from './component/new-group/contacts/contacts.module';
|
import { ContactsPageModule } from './component/contacts/contacts.module';
|
||||||
import { NewGroupPageModule } from './component/new-group/new-group.module';
|
import { NewGroupPageModule } from './component/new-group/new-group.module';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
|||||||
+2
-1
@@ -18,6 +18,7 @@ import { BtnSeguintePageModule } from 'src/app/shared/btn-seguinte/btn-seguinte.
|
|||||||
ContactsPageRoutingModule,
|
ContactsPageRoutingModule,
|
||||||
BtnSeguintePageModule,
|
BtnSeguintePageModule,
|
||||||
],
|
],
|
||||||
declarations: [ContactsPage]
|
declarations: [ContactsPage],
|
||||||
|
exports: [ContactsPage]
|
||||||
})
|
})
|
||||||
export class ContactsPageModule {}
|
export class ContactsPageModule {}
|
||||||
+12
-19
@@ -9,9 +9,9 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="div-title">
|
<div class="div-title">
|
||||||
|
<!-- Create direct message -->
|
||||||
<ion-label class="title">Contactos</ion-label>
|
<ion-label class="title">Contactos</ion-label>
|
||||||
</div>
|
</div>
|
||||||
<app-btn-seguinte (click)="groupMessages()" class="cursor-pointer"></app-btn-seguinte>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
@@ -23,34 +23,27 @@
|
|||||||
</ion-header>
|
</ion-header>
|
||||||
|
|
||||||
<ion-content>
|
<ion-content>
|
||||||
|
|
||||||
<ion-refresher name="refresher" slot="fixed" (ionRefresh)="doRefresh($event)">
|
<ion-refresher name="refresher" slot="fixed" (ionRefresh)="doRefresh($event)">
|
||||||
<!-- <ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar> -->
|
<ion-progress-bar type="indeterminate" *ngIf="loading"></ion-progress-bar>
|
||||||
<ion-refresher-content>
|
<ion-refresher-content>
|
||||||
</ion-refresher-content>
|
</ion-refresher-content>
|
||||||
</ion-refresher>
|
</ion-refresher>
|
||||||
<div class="main-content">
|
<div class="main-content">
|
||||||
|
<ion-progress-bar class="position-absolute" type="indeterminate" *ngIf="loading"></ion-progress-bar>
|
||||||
|
<div *ngFor="let userContainer of userContainer | keyvalue;" >
|
||||||
|
|
||||||
<!-- <ion-list>
|
<div class="item-divider">
|
||||||
<ion-item *ngFor="let user of searchedItem">
|
<ion-label>{{ userContainer.key }}</ion-label>
|
||||||
{{user.name}}
|
|
||||||
</ion-item>
|
|
||||||
</ion-list> -->
|
|
||||||
|
|
||||||
<!-- <ion-virtual-scroll [items]="ChatSystemService.users" approxItemHeight="70px" [headerFn]="separateLetter">
|
|
||||||
|
|
||||||
<div class="item-divider" *virtualHeader="let header">
|
|
||||||
<ion-label>{{header}}</ion-label>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div *virtualItem="let user" class="item-checkbox">
|
<div *ngFor="let user of userContainer.value; let i = index" class="d-flex px-20 align-center" (click)="select(user)">
|
||||||
<ion-checkbox color="primary"></ion-checkbox>
|
<ion-checkbox [(ngModel)]="user.isChecked" color="primary"></ion-checkbox>
|
||||||
<p>{{user.first}} {{user.last}}</p>
|
<ion-label class="flex-grow-1 px-10">{{user.wxFullName}}</ion-label>
|
||||||
<ion-icon name="ellipse"></ion-icon>
|
<div class="icon"><ion-icon name="ellipse"></ion-icon></div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</ion-virtual-scroll> -->
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</ion-content>
|
</ion-content>
|
||||||
|
|
||||||
|
|
||||||
+79
-23
@@ -76,52 +76,108 @@
|
|||||||
}
|
}
|
||||||
ion-content{
|
ion-content{
|
||||||
--background:transparent;
|
--background:transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.main-content{
|
.main-content{
|
||||||
width: 100%;
|
//width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
font-family: Roboto;
|
font-family: Roboto;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
overflow:auto;
|
|
||||||
padding: 0 0 0 0;
|
padding: 0 0 0 0;
|
||||||
|
overflow:auto;
|
||||||
|
|
||||||
.item-divider{
|
.members{
|
||||||
background: #ebebeb;
|
padding: 15px 20px 0 20px !important;
|
||||||
font-size: rem(15);
|
|
||||||
margin: 10px 0 10px 0;
|
.members-list{
|
||||||
padding:5px 0 5px 20px;
|
margin: 0 !important;
|
||||||
|
padding: 0 !important;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.members-label{
|
||||||
|
//margin: 10px 20px 10px 20px !important;
|
||||||
|
/* font-size: rem(15); */
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.members-checkbox{
|
||||||
|
display: flex;
|
||||||
|
//margin: 0px 20px 0px 20px !important;
|
||||||
|
overflow: auto;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.detele-item-icon{
|
||||||
|
display: none;
|
||||||
|
width: rem(30);
|
||||||
|
margin-left: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detele-item-icon ion-icon{
|
||||||
|
font-size: rem(20) !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.members-checkbox:hover{
|
||||||
|
.detele-item-icon{
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-divider{
|
||||||
|
background: #ebebeb;
|
||||||
|
font-size: rem(15);
|
||||||
|
margin: 10px 0 10px 0;
|
||||||
|
padding:5px 0 5px 20px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
.item-checkbox{
|
.item-checkbox{
|
||||||
display: flex;
|
display: flex;
|
||||||
margin: 10px 20px 10px 20px !important;
|
margin: 10px 20px 10px 20px !important;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-checkbox ion-checkbox{
|
.item-checkbox ion-checkbox, .members-checkbox ion-checkbox{
|
||||||
--border-color: #0d89d1;
|
--border-color: var(--title-text-color);
|
||||||
--background-checked:#0d89d1;
|
--background-checked:var(--title-text-color);
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-checkbox p{
|
.item-checkbox ion-label, .members-checkbox p{
|
||||||
display: block;
|
|
||||||
margin: 0 !important;
|
|
||||||
width: 330px;
|
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
font-size: rem(15);
|
font-size: rem(15);
|
||||||
color: #0d89d1;
|
color: var(--title-text-color);
|
||||||
float: left;
|
float: left;
|
||||||
|
flex-grow: 1;
|
||||||
}
|
}
|
||||||
.item-checkbox ion-icon{
|
.icon, .members-checkbox ion-icon{
|
||||||
font-size: rem(10);
|
font-size: rem(10);
|
||||||
float: left;
|
|
||||||
color:#99e47b;
|
|
||||||
margin-left: 10px;
|
|
||||||
}
|
}
|
||||||
|
.online{
|
||||||
|
color:#99e47b !important;
|
||||||
|
}
|
||||||
|
.offline{
|
||||||
|
color:#cbced1 !important;
|
||||||
|
}
|
||||||
|
.away{
|
||||||
|
color:#ffd21f !important;
|
||||||
|
}
|
||||||
|
.invisible{
|
||||||
|
color:#cbced1 !important;
|
||||||
|
}
|
||||||
|
.busy{
|
||||||
|
color:#f5455c !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.inactive {
|
||||||
|
opacity: 0.7;
|
||||||
|
button {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,153 @@
|
|||||||
|
import { Component, EventEmitter, 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';
|
||||||
|
import { ChatServiceService } from 'src/app/module/chat/domain/chat-service.service';
|
||||||
|
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
||||||
|
import { ToastService } from 'src/app/services/toast.service';
|
||||||
|
import { SessionStore } from 'src/app/store/session.service';
|
||||||
|
import { MessageEnum } from 'src/app/module/chat/domain/use-case/message-create-use-case.service';
|
||||||
|
import { MessageEntity } from 'src/app/module/chat/domain/entity/message';
|
||||||
|
// import { ChatSystemService } from 'src/app/services/chat/chat-system.service'
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-contacts',
|
||||||
|
templateUrl: './contacts.page.html',
|
||||||
|
styleUrls: ['./contacts.page.scss'],
|
||||||
|
})
|
||||||
|
export class ContactsPage implements OnInit {
|
||||||
|
options:any;
|
||||||
|
|
||||||
|
loading = false
|
||||||
|
userList: UserContacts[] = []
|
||||||
|
currentMembers:UserContacts[];
|
||||||
|
allChatUsers: UserContacts[] = [];
|
||||||
|
userContainer: {[key: string]: ( UserContacts & {isChecked: boolean})[] } = {}
|
||||||
|
|
||||||
|
@Output() openMessage: EventEmitter<any> = new EventEmitter<any>();
|
||||||
|
@Output() emptyTextDescriptionOpen: EventEmitter<any> = new EventEmitter<any>();
|
||||||
|
@Output() backToChat: EventEmitter<any> = new EventEmitter<any>();
|
||||||
|
@Output() closeAllDesktopComponents: EventEmitter<any> = new EventEmitter<any>();
|
||||||
|
|
||||||
|
roomId= ''
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private modalController: ModalController,
|
||||||
|
public ThemeService: ThemeService,
|
||||||
|
private contactsRepositoryService: ContactRepositoryService,
|
||||||
|
private httpErrorHandle: HttpErrorHandle,
|
||||||
|
private toastService: ToastService,
|
||||||
|
private chatServiceService: ChatServiceService
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.loadUsers();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
async loadUsers() {
|
||||||
|
|
||||||
|
this.loading = true
|
||||||
|
const getallChatUsers = await this.contactsRepositoryService.getUsers()
|
||||||
|
|
||||||
|
if(getallChatUsers.isOk()) {
|
||||||
|
|
||||||
|
this.allChatUsers = getallChatUsers.value.data.result.sort((a,b) => {
|
||||||
|
if(a.wxFullName < b.wxFullName) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if(a.wxFullName > b.wxFullName) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
for(const user of this.allChatUsers) {
|
||||||
|
const firstLetter = user.wxFullName.charAt(0)
|
||||||
|
|
||||||
|
if(!this.userContainer[firstLetter]) {
|
||||||
|
user['isChecked'] = false
|
||||||
|
this.userContainer[firstLetter] = [user as any]
|
||||||
|
} else {
|
||||||
|
const userIds = this.userContainer[firstLetter].map( e => e.wxUserId)
|
||||||
|
if(!userIds.includes(user.wxUserId)) {
|
||||||
|
user['isChecked'] = false
|
||||||
|
this.userContainer[firstLetter].push(user as any)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
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.")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
this.loading = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
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(roomId) {
|
||||||
|
if (roomId) {
|
||||||
|
this.backToChat.emit({ roomId: roomId });
|
||||||
|
} else {
|
||||||
|
this.closeAllDesktopComponents.emit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onChange(event) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
clicked() {}
|
||||||
|
|
||||||
|
|
||||||
|
selectOnce = true
|
||||||
|
async select(user: UserContacts) {
|
||||||
|
|
||||||
|
const message = new MessageEntity();
|
||||||
|
|
||||||
|
message.sender = {
|
||||||
|
userPhoto: '',
|
||||||
|
wxeMail: SessionStore.user.Email,
|
||||||
|
wxFullName: SessionStore.user.FullName,
|
||||||
|
wxUserId: SessionStore.user.UserId
|
||||||
|
}
|
||||||
|
|
||||||
|
message.receiverId = user.wxUserId
|
||||||
|
message.message = 'hello'
|
||||||
|
|
||||||
|
const result = await this.chatServiceService.sendMessage(message, MessageEnum.Direct)
|
||||||
|
|
||||||
|
if(result.isOk()) {
|
||||||
|
this.close(result.value.roomId)
|
||||||
|
} else {
|
||||||
|
console.log(result.error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</ion-list>
|
</ion-list>
|
||||||
</div>
|
</div>
|
||||||
|
pppp
|
||||||
<div *ngFor="let userContainer of userContainer | keyvalue;" >
|
<div *ngFor="let userContainer of userContainer | keyvalue;" >
|
||||||
|
|
||||||
<div class="item-divider">
|
<div class="item-divider">
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { AfterViewInit, Component, ElementRef, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core';
|
import { AfterViewInit, Component, ElementRef, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core';
|
||||||
import { AnimationController, GestureController, IonRange, ModalController, PopoverController } from '@ionic/angular';
|
import { AnimationController, GestureController, IonRange, ModalController, PopoverController } from '@ionic/angular';
|
||||||
import { ToastService } from 'src/app/services/toast.service';
|
import { ToastService } from 'src/app/services/toast.service';
|
||||||
import { ContactsPage } from '../new-group/contacts/contacts.page';
|
import { ContactsPage } from '../contacts/contacts.page';
|
||||||
import { ChatOptionsFeaturesPage } from 'src/app/modals/chat-options-features/chat-options-features.page';
|
import { ChatOptionsFeaturesPage } from 'src/app/modals/chat-options-features/chat-options-features.page';
|
||||||
import { TimeService } from 'src/app/services/functions/time.service';
|
import { TimeService } from 'src/app/services/functions/time.service';
|
||||||
import { FileService } from 'src/app/services/functions/file.service';
|
import { FileService } from 'src/app/services/functions/file.service';
|
||||||
@@ -43,8 +43,9 @@ import { ChatPopoverPage } from '../../modal/chat-popover/chat-popover.page';
|
|||||||
import { LastMessage } from '../../utils/lastMessage';
|
import { LastMessage } from '../../utils/lastMessage';
|
||||||
import { UserTypingLocalRepository } from 'src/app/module/chat/data/repository/user-typing-local-data-source.service';
|
import { UserTypingLocalRepository } from 'src/app/module/chat/data/repository/user-typing-local-data-source.service';
|
||||||
import { UserTypingRemoteRepositoryService } from 'src/app/module/chat/data/repository/user-typing-live-data-source.service';
|
import { UserTypingRemoteRepositoryService } from 'src/app/module/chat/data/repository/user-typing-live-data-source.service';
|
||||||
import { MessageLocalDataSourceService } from 'src/app/module/chat/data/repository/message-local-data-source.service';
|
import { MessageLocalDataSourceService } from 'src/app/module/chat/data/repository/message/message-local-data-source.service';
|
||||||
import { MessageRemoteDataSourceService } from 'src/app/module/chat/data/repository/message-remote-data-source.service';
|
import { MessageRemoteDataSourceService } from 'src/app/module/chat/data/repository/message/message-remote-data-source.service';
|
||||||
|
import { MessageEnum } from 'src/app/module/chat/domain/use-case/message-create-use-case.service';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -567,7 +568,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
|||||||
safeFile: this.sanitiser.bypassSecurityTrustResourceUrl(this.audioRecordedDataUrl)
|
safeFile: this.sanitiser.bypassSecurityTrustResourceUrl(this.audioRecordedDataUrl)
|
||||||
}]
|
}]
|
||||||
|
|
||||||
this.chatServiceService.sendMessage(message)
|
this.chatServiceService.sendMessage(message, MessageEnum.group)
|
||||||
this.messages1[this.roomId].push(message)
|
this.messages1[this.roomId].push(message)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.scrollToBottomClicked()
|
this.scrollToBottomClicked()
|
||||||
@@ -628,7 +629,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.scrollToBottomClicked()
|
this.scrollToBottomClicked()
|
||||||
}, 100)
|
}, 100)
|
||||||
const data = await this.chatServiceService.sendMessage(message)
|
const data = await this.chatServiceService.sendMessage(message, MessageEnum.group)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -810,7 +811,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.scrollToBottomClicked()
|
this.scrollToBottomClicked()
|
||||||
}, 100)
|
}, 100)
|
||||||
this.chatServiceService.sendMessage(message)
|
this.chatServiceService.sendMessage(message, MessageEnum.group)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -866,7 +867,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.scrollToBottomClicked()
|
this.scrollToBottomClicked()
|
||||||
}, 100)
|
}, 100)
|
||||||
this.chatServiceService.sendMessage(message)
|
this.chatServiceService.sendMessage(message, MessageEnum.group)
|
||||||
this.textField = ''
|
this.textField = ''
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -920,7 +921,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.scrollToBottomClicked()
|
this.scrollToBottomClicked()
|
||||||
}, 100)
|
}, 100)
|
||||||
this.chatServiceService.sendMessage(message)
|
this.chatServiceService.sendMessage(message, MessageEnum.group)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -976,7 +977,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.scrollToBottomClicked()
|
this.scrollToBottomClicked()
|
||||||
}, 100)
|
}, 100)
|
||||||
this.chatServiceService.sendMessage(message)
|
this.chatServiceService.sendMessage(message, MessageEnum.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,73 +0,0 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
|
||||||
import { ModalController } from '@ionic/angular';
|
|
||||||
import { GroupMessagesPage } from '../../group-messages/group-messages.page';
|
|
||||||
import { ThemeService } from 'src/app/services/theme.service'
|
|
||||||
// import { ChatSystemService } from 'src/app/services/chat/chat-system.service'
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-contacts',
|
|
||||||
templateUrl: './contacts.page.html',
|
|
||||||
styleUrls: ['./contacts.page.scss'],
|
|
||||||
})
|
|
||||||
export class ContactsPage implements OnInit {
|
|
||||||
options:any;
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
private modalController: ModalController,
|
|
||||||
public ThemeService: ThemeService,
|
|
||||||
// public ChatSystemService: ChatSystemService
|
|
||||||
)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
|
||||||
this.loadUsers();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
loadUsers(){
|
|
||||||
// sthis.ChatSystemService.getUser()
|
|
||||||
}
|
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -7,10 +7,6 @@ const routes: Routes = [
|
|||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
component: NewGroupPage
|
component: NewGroupPage
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'contacts',
|
|
||||||
loadChildren: () => import('./contacts/contacts.module').then( m => m.ContactsPageModule)
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="div-title">
|
<div class="div-title">
|
||||||
<!-- MOBILE -->
|
<!-- MOBILE -->
|
||||||
<ion-label class="title">Nova Conversa</ion-label>
|
<ion-label class="title">Nova Conversa ..</ion-label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -38,8 +38,8 @@
|
|||||||
<ion-label>{{ userContainer.key }}</ion-label>
|
<ion-label>{{ userContainer.key }}</ion-label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div *ngFor="let user of userContainer.value; let i = index" class="d-flex px-20 align-center">
|
<div *ngFor="let user of userContainer.value; let i = index" class="d-flex px-20 align-center" (click)="select(user)">
|
||||||
<ion-label class="flex-grow-1 px-10">{{user.wxFullName}}</ion-label>
|
<ion-label class="flex-grow-1 px-10 cursor-pointer">{{user.wxFullName}}</ion-label>
|
||||||
<div class="icon"><ion-icon name="ellipse"></ion-icon></div>
|
<div class="icon"><ion-icon name="ellipse"></ion-icon></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ import { ContactRepositoryService } from 'src/app/services/Repositorys/contacts/
|
|||||||
import { UserContacts } from 'src/app/services/Repositorys/contacts/data-source/contacts-data-source.service';
|
import { UserContacts } from 'src/app/services/Repositorys/contacts/data-source/contacts-data-source.service';
|
||||||
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
||||||
import { ToastService } from 'src/app/services/toast.service';
|
import { ToastService } from 'src/app/services/toast.service';
|
||||||
|
import { ChatServiceService } from 'src/app/module/chat/domain/chat-service.service'
|
||||||
|
import { MessageEntity } from 'src/app/module/chat/domain/entity/message';
|
||||||
|
import { MessageEnum } from 'src/app/module/chat/domain/use-case/message-create-use-case.service';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -38,6 +41,7 @@ export class ContactsPage implements OnInit {
|
|||||||
private contactsRepositoryService: ContactRepositoryService,
|
private contactsRepositoryService: ContactRepositoryService,
|
||||||
private httpErrorHandle: HttpErrorHandle,
|
private httpErrorHandle: HttpErrorHandle,
|
||||||
private toastService: ToastService,
|
private toastService: ToastService,
|
||||||
|
private chatServiceService: ChatServiceService
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
this.loggedUser = SessionStore.user.ChatData['data'];
|
this.loggedUser = SessionStore.user.ChatData['data'];
|
||||||
@@ -159,4 +163,23 @@ export class ContactsPage implements OnInit {
|
|||||||
close() {
|
close() {
|
||||||
this.modalController.dismiss({});
|
this.modalController.dismiss({});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
select(user: UserContacts) {
|
||||||
|
|
||||||
|
const message = new MessageEntity();
|
||||||
|
|
||||||
|
message.sender = {
|
||||||
|
userPhoto: '',
|
||||||
|
wxeMail: SessionStore.user.Email,
|
||||||
|
wxFullName: SessionStore.user.FullName,
|
||||||
|
wxUserId: SessionStore.user.UserId
|
||||||
|
}
|
||||||
|
|
||||||
|
message.receiverId = user.wxUserId
|
||||||
|
|
||||||
|
message.message = 'hello'
|
||||||
|
|
||||||
|
this.chatServiceService.sendMessage(message, MessageEnum.Direct)
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,8 @@ import { RoomLocalRepository } from 'src/app/module/chat/data/repository/room-lo
|
|||||||
import { MemberListLocalRepository } from 'src/app/module/chat/data/repository/member-list-local-repository.service'
|
import { MemberListLocalRepository } from 'src/app/module/chat/data/repository/member-list-local-repository.service'
|
||||||
import { UserTypingLocalRepository } from 'src/app/module/chat/data/repository/user-typing-local-data-source.service';
|
import { UserTypingLocalRepository } from 'src/app/module/chat/data/repository/user-typing-local-data-source.service';
|
||||||
import { UserTypingRemoteRepositoryService } from 'src/app/module/chat/data/repository/user-typing-live-data-source.service';
|
import { UserTypingRemoteRepositoryService } from 'src/app/module/chat/data/repository/user-typing-live-data-source.service';
|
||||||
import { MessageLocalDataSourceService } from 'src/app/module/chat/data/repository/message-local-data-source.service';
|
import { MessageLocalDataSourceService } from 'src/app/module/chat/data/repository/message/message-local-data-source.service';
|
||||||
|
import { MessageEnum } from 'src/app/module/chat/domain/use-case/message-create-use-case.service';
|
||||||
|
|
||||||
|
|
||||||
const IMAGE_DIR = 'stored-images';
|
const IMAGE_DIR = 'stored-images';
|
||||||
@@ -525,7 +526,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
wxUserId: SessionStore.user.UserId
|
wxUserId: SessionStore.user.UserId
|
||||||
}
|
}
|
||||||
|
|
||||||
this.chatServiceService.sendMessage(message)
|
this.chatServiceService.sendMessage(message, MessageEnum.group)
|
||||||
this.messages1[this.roomId].push(message)
|
this.messages1[this.roomId].push(message)
|
||||||
|
|
||||||
this.textField = ''
|
this.textField = ''
|
||||||
@@ -568,7 +569,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
}]
|
}]
|
||||||
|
|
||||||
this.messages1[this.roomId].push(message)
|
this.messages1[this.roomId].push(message)
|
||||||
this.chatServiceService.sendMessage(message)
|
this.chatServiceService.sendMessage(message, MessageEnum.group)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.scrollToBottomClicked()
|
this.scrollToBottomClicked()
|
||||||
}, 100)
|
}, 100)
|
||||||
@@ -749,7 +750,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
}]
|
}]
|
||||||
|
|
||||||
this.messages1[this.roomId].push(message)
|
this.messages1[this.roomId].push(message)
|
||||||
this.chatServiceService.sendMessage(message)
|
this.chatServiceService.sendMessage(message, MessageEnum.group)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -799,7 +800,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
}]
|
}]
|
||||||
|
|
||||||
this.messages1[this.roomId].push(message)
|
this.messages1[this.roomId].push(message)
|
||||||
this.chatServiceService.sendMessage(message)
|
this.chatServiceService.sendMessage(message, MessageEnum.group)
|
||||||
this.textField = ''
|
this.textField = ''
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -845,7 +846,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
}]
|
}]
|
||||||
|
|
||||||
this.messages1[this.roomId].push(message)
|
this.messages1[this.roomId].push(message)
|
||||||
this.chatServiceService.sendMessage(message)
|
this.chatServiceService.sendMessage(message, MessageEnum.group)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -896,7 +897,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
}]
|
}]
|
||||||
|
|
||||||
this.messages1[this.roomId].push(message)
|
this.messages1[this.roomId].push(message)
|
||||||
this.chatServiceService.sendMessage(message)
|
this.chatServiceService.sendMessage(message, MessageEnum.group)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -940,7 +941,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
}]
|
}]
|
||||||
|
|
||||||
this.messages1[this.roomId].push(message)
|
this.messages1[this.roomId].push(message)
|
||||||
this.chatServiceService.sendMessage(message)
|
this.chatServiceService.sendMessage(message, MessageEnum.group)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
import { Event } from '@sentry/types/types/event';
|
||||||
+1
-1
@@ -48,4 +48,4 @@ platformBrowserDynamic().bootstrapModule(AppModule)
|
|||||||
|
|
||||||
// Call the element loader after the platform has been bootstrapped
|
// Call the element loader after the platform has been bootstrapped
|
||||||
|
|
||||||
defineCustomElements(window);
|
defineCustomElements(window);
|
||||||
Reference in New Issue
Block a user