mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
add reaction to chat
This commit is contained in:
@@ -3,15 +3,23 @@ import { BehaviorSubject } from 'rxjs';
|
||||
import { Platform } from '@ionic/angular';
|
||||
import { SignalRConnection } from './signalR';
|
||||
import { Plugins } from '@capacitor/core';
|
||||
import { z } from 'zod';
|
||||
import { UserTypingDTO } from '../../data/dto/typing/typingInputDTO';
|
||||
import { MessageOutPutDataDTO } from '../../data/dto/message/messageOutputDTO';
|
||||
import { MessageDeleteInputDTO } from '../../data/dto/message/messageDeleteInputDTO';
|
||||
import { object, z } from 'zod';
|
||||
|
||||
const { App } = Plugins;
|
||||
|
||||
const SignalRInputSchema = z.object({
|
||||
method: z.string(),
|
||||
data: z.object({
|
||||
requestId: z.string()
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
export type ISignalRInput = z.infer<typeof SignalRInputSchema>
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
@@ -22,6 +30,8 @@ export class SignalRService {
|
||||
private connectingSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(null);
|
||||
private messageDelete: BehaviorSubject<MessageOutPutDataDTO> = new BehaviorSubject<MessageOutPutDataDTO>(null);
|
||||
private messageUpdateSubject: BehaviorSubject<MessageOutPutDataDTO> = new BehaviorSubject<MessageOutPutDataDTO>(null);
|
||||
private sendDataSubject: BehaviorSubject<Object> = new BehaviorSubject<Object>(false);
|
||||
|
||||
|
||||
constructor(
|
||||
private platform: Platform) {
|
||||
@@ -78,6 +88,14 @@ export class SignalRService {
|
||||
this.connection.getMessageUpdateSubject().subscribe((data) => {
|
||||
this.messageUpdateSubject.next(data)
|
||||
})
|
||||
|
||||
this.connection.getMessageUpdateSubject().subscribe((data) => {
|
||||
this.messageUpdateSubject.next(data)
|
||||
})
|
||||
|
||||
this.connection.getData().subscribe((data) => {
|
||||
this.messageUpdateSubject.next(data)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
@@ -100,6 +118,14 @@ export class SignalRService {
|
||||
return this.messageUpdateSubject.asObservable()
|
||||
}
|
||||
|
||||
sendData(input: ISignalRInput) {
|
||||
return this.connection.sendData(input)
|
||||
}
|
||||
|
||||
getData() {
|
||||
return this.getData()
|
||||
}
|
||||
|
||||
async sendMessage(data: Object) {
|
||||
return await this.connection.sendMessage(data as any)
|
||||
}
|
||||
@@ -120,5 +146,10 @@ export class SignalRService {
|
||||
async sendMessageDelete(data: MessageDeleteInputDTO) {
|
||||
return await this.connection.deleteMessage(data)
|
||||
}
|
||||
|
||||
|
||||
|
||||
async sendReactToMessage(data) {
|
||||
return await this.connection.sendReactMessage(data)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user