mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 12:37:53 +00:00
fix change
This commit is contained in:
@@ -50,7 +50,6 @@ export class RoomEntity extends BaseEntity<RoomEntity>(RoomEntitySchema) implem
|
||||
roomType: typeof RoomEntitySchema._input.roomType
|
||||
members: typeof RoomEntitySchema._input.members
|
||||
messages: typeof RoomEntitySchema._input.messages
|
||||
displayDate = ''
|
||||
|
||||
constructor(data: IRoom) {
|
||||
super();
|
||||
|
||||
@@ -19,7 +19,7 @@ export const MessageOutPutDataDTOSchema = z.object({
|
||||
wxUserId: z.number(),
|
||||
wxFullName: z.string(),
|
||||
wxeMail: z.string(),
|
||||
userPhoto: z.string().optional()
|
||||
userPhoto: z.string().nullable().optional()
|
||||
}),
|
||||
message: z.string().nullable().optional(),
|
||||
messageType: z.number(),
|
||||
|
||||
@@ -3,7 +3,7 @@ import { BehaviorSubject, Observable, Subject, timer } from 'rxjs';
|
||||
import { Platform } from '@ionic/angular';
|
||||
import { SignalRConnection, SocketMessage } from './signalR';
|
||||
import { Plugins } from '@capacitor/core';
|
||||
import { filter, map, skip, switchMap } from 'rxjs/operators';
|
||||
import { switchMap } from 'rxjs/operators';
|
||||
import { Result } from 'neverthrow';
|
||||
import { HubConnection } from '@microsoft/signalr';
|
||||
import { ISignalRInput } from '../type';
|
||||
@@ -28,6 +28,7 @@ export class SignalRService {
|
||||
this.deadConnectionBackGround.pipe(
|
||||
switchMap(() => timer(150000)), // 2 minutes 30 seconds
|
||||
).subscribe(() => {
|
||||
console.log('trigger new connections')
|
||||
this.newConnection()
|
||||
})
|
||||
|
||||
@@ -58,7 +59,7 @@ export class SignalRService {
|
||||
const attempConnection = await connection.establishConnection()
|
||||
|
||||
if(attempConnection.isOk()) {
|
||||
|
||||
console.log('connect')
|
||||
this.connection?.closeConnection()
|
||||
this.connection = connection
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ export enum EnumSocketError {
|
||||
export class SignalRConnection {
|
||||
|
||||
private hubConnection: signalR.HubConnection;
|
||||
private messageSubject: BehaviorSubject<MessageOutPutDataDTO> = new BehaviorSubject<MessageOutPutDataDTO>(null);
|
||||
private connectionStateSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||
private disconnectSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||
private reconnectSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||
@@ -127,7 +126,12 @@ export class SignalRConnection {
|
||||
this.hubConnection.invoke(input.method, input.data)
|
||||
|
||||
this.sendDataSubject.pipe(
|
||||
filter((message) => input.data.requestId == message?.data.requestId),
|
||||
filter((message) => {
|
||||
console.log(message)
|
||||
return input.data.requestId == message?.data.requestId ||
|
||||
input.data.roomName == message?.data.roomName
|
||||
|
||||
}),
|
||||
first()
|
||||
).subscribe(value => {
|
||||
resolve(ok(value.data as unknown as T))
|
||||
@@ -157,7 +161,6 @@ export class SignalRConnection {
|
||||
|
||||
for(const method of methods) {
|
||||
this.hubConnection.on(method, (message: any) => {
|
||||
this.messageSubject.next(message);
|
||||
this.sendDataSubject.next({
|
||||
method: method,
|
||||
data: message
|
||||
|
||||
-3
@@ -13,7 +13,6 @@ import { MessageMarkAsReadInput } from '../../../domain/use-case/message/message
|
||||
import { MessageOutPutDataDTO } from 'src/app/core/chat/repository/dto/messageOutputDTO';
|
||||
import { MessageDeleteInputDTO } from '../../../domain/use-case/message/message-delete-by-id-live-use-case.service';
|
||||
|
||||
|
||||
interface sendDeliverAt {
|
||||
memberId: number,
|
||||
messageId:string,
|
||||
@@ -21,8 +20,6 @@ interface sendDeliverAt {
|
||||
requestId: string
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
|
||||
@@ -22,7 +22,7 @@ export class RoomService {
|
||||
}
|
||||
|
||||
OnDeleteCreateRoom() {
|
||||
this.RoomSocketRepositoryService.listenToCreateRoom().subscribe((data)=> {
|
||||
this.RoomSocketRepositoryService.listenToDeleteRoom().subscribe((data)=> {
|
||||
console.log('OnDeleteCreateRoom7', data)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -45,11 +45,13 @@ export class CreateRoomUseCaseService {
|
||||
async execute(data: CreateRoomInputDTO, tracing?: TracingType) {
|
||||
|
||||
const result = await this.RoomSocketRepositoryService.CreateGroup(data)
|
||||
|
||||
console.log('history', result)
|
||||
// const result = await this.roomRemoteDataSourceService.createRoom(data)
|
||||
|
||||
if(result.isOk()) {
|
||||
|
||||
console.log(result.value)
|
||||
console.log('create rooms',result.value)
|
||||
if(!result?.value?.createdBy) {
|
||||
|
||||
let dataObject;
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
</div>
|
||||
|
||||
<ion-toolbar [class.block-button]="showNewEvent || showNewGroup || showContacts">
|
||||
<ion-segment [(ngModel)]="segment" (ionChange)="onSegmentChange()">
|
||||
<ion-segment [(ngModel)]="segment">
|
||||
<ion-segment-button value="{{RoomType.Direct}}" class="font-14-em">
|
||||
Conversas
|
||||
</ion-segment-button>
|
||||
|
||||
@@ -160,9 +160,7 @@ export class ChatPage implements OnInit {
|
||||
// this.setStatus('offline');
|
||||
this.routerSubscription?.unsubscribe();
|
||||
// Unsubscribe from the interval to prevent memory leaks
|
||||
if (this.intervalSubscription) {
|
||||
this.intervalSubscription.unsubscribe();
|
||||
}
|
||||
this.intervalSubscription?.unsubscribe();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -131,6 +131,8 @@ export class NewGroupPage implements OnInit{
|
||||
members: []
|
||||
})
|
||||
|
||||
console.log(result)
|
||||
|
||||
if(result.isOk()) {
|
||||
this.addGroupMessage.emit(result.value.id);
|
||||
} else if(result.error instanceof HttpErrorResponse) {
|
||||
|
||||
Reference in New Issue
Block a user