add reaction to chat

This commit is contained in:
Peter Maquiran
2024-08-02 11:34:57 +01:00
parent 8774cef0b2
commit efc7f72042
10 changed files with 245 additions and 21 deletions
+30 -2
View File
@@ -127,6 +127,10 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
userTyping$: UserTypingList[] | undefined
newMessagesStream!: Subscription
selectedMessage: any = null;
emojis: string[] = ['😊', '😂', '❤️', '👍', '😢']; // Add more emojis as needed
constructor(
public popoverController: PopoverController,
private modalController: ModalController,
@@ -193,12 +197,36 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
// })
}
toggleEmojiPicker(message: any) {
if (this.selectedMessage === message) {
this.selectedMessage = null; // Close the picker if it's already open
} else {
this.selectedMessage = message; // Open the picker for the selected message
}
}
addReaction(message: any, emoji: string) {
// Logic to add reaction to the message
console.log(`Reacting to message ${message.id} with emoji ${emoji.codePointAt(0).toString(16)}`);
this.selectedMessage = null; // Close the picker after adding reaction
this.chatServiceService.reactToMessage({
memberId: SessionStore.user.UserId,
messageId: message.messageId,
roomId: this.roomId,
reaction: emoji,
requestId: ''
})
}
sendReadAt() {
this.messageRepositoryService.sendReadAt({roomId: this.roomId}).then((e) => {
console.log(e)
})
}
sendTyping() {
this.userTypingServiceRepository.addUserTyping(this.roomId)
}
@@ -922,7 +950,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
messageDelete({messageId}) {
// this.messageRepositoryService.sendMessageDelete()
this.chatServiceService.messageDelete({
messageId: messageId,
roomId: this.roomId,