fix message

This commit is contained in:
peter.maquiran
2025-09-29 11:34:11 +01:00
parent 4870a0cd69
commit f79df96d48
11 changed files with 122 additions and 44 deletions
@@ -5,7 +5,6 @@ import { IMemberRemoteRepository } from 'src/app/core/chat/repository/member/mem
// Define the schema for the entire response // Define the schema for the entire response
const MemberSetAdminDTOSchema = z.object({ const MemberSetAdminDTOSchema = z.object({
senderId: z.number(),
roomId: z.string(), roomId: z.string(),
memberId: z.string() memberId: z.string()
}); });
@@ -32,7 +32,7 @@
<ion-icon slot="start" src="assets/images/icons-description.svg"></ion-icon> <ion-icon slot="start" src="assets/images/icons-description.svg"></ion-icon>
</div> </div>
<div class="ion-input-class flex-grow-1" [class.input-error]="Form?.get('Location')?.invalid && validateFrom || validateField "> <div class="ion-input-class flex-grow-1" [class.input-error]="Form?.get('Location')?.invalid && validateFrom || validateField ">
<ion-textarea autoGrow="true" autocomplete="on" autocorrect="on" spellcheck="true" class="add-border heigh-200" placeholder="Descrição*" [(ngModel)]="postData.DispatchFolder.Message"></ion-textarea> <ion-textarea autoGrow="true" autocomplete="on" autocorrect="on" spellcheck="true" class="add-border heigh-200" [placeholder]="getDescricaoPlaceholder()" [(ngModel)]="postData.DispatchFolder.Message"></ion-textarea>
</div> </div>
</div> </div>
</div> </div>
@@ -190,6 +190,19 @@
</ion-label> </ion-label>
</div> </div>
<!-- <div class="ion-item-container-no-border cursor-pointer" (click)="getDoc1()">
<ion-label class="d-flex align-center">
<div class="attach-icon d-flex align-center">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-attach-doc.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " src="assets/images/theme/gov/icons-attach-doc.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " src="assets/images/theme/{{ThemeService.currentTheme}}/icons-attach-doc.svg"></ion-icon>
</div>
<div class="attach-document pl-10">
<ion-label>Anexar Documentos</ion-label>
</div>
</ion-label>
</div> -->
<div class="list " *ngFor="let document of documents; let i = index" > <div class="list " *ngFor="let document of documents; let i = index" >
<ion-list> <ion-list>
<ion-item> <ion-item>
@@ -28,6 +28,9 @@ import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
import { RouteService } from 'src/app/services/route.service'; import { RouteService } from 'src/app/services/route.service';
import { TaskService } from 'src/app/services/task.service' import { TaskService } from 'src/app/services/task.service'
import { z } from 'zod'; import { z } from 'zod';
import { FilePickerWebService } from 'src/app/infra/file-picker/web/file-picker-web.service'
import { allowedDocExtension } from 'src/app/utils/allowedDocExtension';
import { JSFileToDataUrl } from 'src/app/utils/ToBase64';
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = { const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
parse: { parse: {
@@ -124,7 +127,8 @@ export class ExpedientTaskModalPage implements OnInit {
public p: PermissionService, public p: PermissionService,
private httpErroHandle: HttpErrorHandle, private httpErroHandle: HttpErrorHandle,
private RouteService: RouteService, private RouteService: RouteService,
public TaskService: TaskService public TaskService: TaskService,
private FilePickerWebService: FilePickerWebService,
) { ) {
this.loggeduser = SessionStore.user; this.loggeduser = SessionStore.user;
@@ -221,6 +225,12 @@ export class ExpedientTaskModalPage implements OnInit {
this.getSubjectType(); this.getSubjectType();
} }
getDescricaoPlaceholder() {
let title = this.modalTitle[this.taskType];
title = title.replace(/Efectuar|Solicitar/g, '');
return SessionStore.user.Profile == 'PR'? `Escreva aqui o conteúdo do ${title}` : 'Descrição*';
}
onSelectedTypesChanged(ev:any) { onSelectedTypesChanged(ev:any) {
if(ev.length > 1){ if(ev.length > 1){
@@ -664,7 +674,23 @@ export class ExpedientTaskModalPage implements OnInit {
} }
async getDoc(){ async getDoc1() {
const file = await this.FilePickerWebService.getAnyFileFromDevice();
if(file.isOk()) {
//const fileExtension = await allowedDocExtension(file.value.type)
console.log('FILE rigth?', file)
let fileBase64 = await JSFileToDataUrl(file.value);
if(fileBase64.isOk()) {
}
}
}
async getDoc() {
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: SearchPage, component: SearchPage,
cssClass: 'modal-width-100-width-background modal', cssClass: 'modal-width-100-width-background modal',
+4 -3
View File
@@ -90,7 +90,8 @@
<!-- --> <!-- -->
<!-- <div *ngIf="room?.messages?.[0]?.message" class="item-description d-flex align-items-center" [class.item-description-active]="room.$id ==selectedRoomId"> --> <!-- <div *ngIf="room?.messages?.[0]?.message" class="item-description d-flex align-items-center" [class.item-description-active]="room.$id ==selectedRoomId"> -->
<!-- <div class="item-message" *ngIf="group.otherUserType == false">{{room?.messages?.[0]?.message.u.name}}: {{room?.messages?.[0]?.message.msg}} </div> --> <!-- <div class="item-message" *ngIf="group.otherUserType == false">{{room?.messages?.[0]?.message.u.name}}: {{room?.messages?.[0]?.message.msg}} </div> -->
<div class="item-message font-13-em add-ellipsis white-space-nowrap"> {{room.messages[0].message}} </div> <div class="item-message font-13-em add-ellipsis white-space-nowrap" *ngIf="room.messages[0].oneShot == false"> {{room.messages[0].message}} </div>
<div class="item-message font-13-em add-ellipsis white-space-nowrap" *ngIf="room.messages[0].oneShot == true"> Visualização única </div>
<!-- <div *ngIf="group.otherUserType == true">{{group.userThatIsTyping}} está escrever ...</div> --> <!-- <div *ngIf="group.otherUserType == true">{{group.userThatIsTyping}} está escrever ...</div> -->
<div class="item-files add-ellipsis" *ngIf="room.messages[0]?.attachments?.length >= 1"> <div class="item-files add-ellipsis" *ngIf="room.messages[0]?.attachments?.length >= 1">
@@ -106,8 +107,8 @@
<div *ngIf="room?.messages?.length >= 1 && room.messages[0]._isDeleted==true && room.messages[0].oneShot == false"> <div *ngIf="room?.messages?.length >= 1 && room.messages[0]._isDeleted==true && room.messages[0].oneShot == false">
<div class="item-message font-13-em add-ellipsis white-space-nowrap"> Mensagem foi eliminada </div> <div class="item-message font-13-em add-ellipsis white-space-nowrap"> Mensagem foi eliminada </div>
</div> </div>
<div *ngIf="room?.messages?.length >= 1 && room.messages[0]._isDeleted==true && room.messages[0].oneShot == true"> <div *ngIf="room?.messages?.length >= 1 && room.messages[0].oneShotIsViewed">
<div class="item-message font-13-em add-ellipsis white-space-nowrap"> Mensagem visualizada </div> <div class="item-message font-13-em add-ellipsis white-space-nowrap"> Mensagem de visualização única </div>
</div> </div>
</div> </div>
@@ -58,7 +58,7 @@
</span> </span>
</div> </div>
<div class="message-container rotate-div" *ngIf="message.showMessage"> <div class="message-container rotate-div" *ngIf="message.showMessage && !message.meSendOneShot">
<div *ngIf="message.sender.wxUserId != SessionStore.user.UserId && roomType == RoomTypeEnum.Group"> <div *ngIf="message.sender.wxUserId != SessionStore.user.UserId && roomType == RoomTypeEnum.Group">
<b> <b>
{{ message.sender.wxFullName }} {{ message.sender.wxFullName }}
@@ -66,7 +66,7 @@
</div> </div>
<div class="d-flex justify-content-between"> <div class="d-flex justify-content-between">
<div> <div>
<div style="white-space: pre-line;"> <div style="white-space: pre-line;" >
{{ message.message }} {{ message.message }}
</div> </div>
@@ -89,10 +89,6 @@
(error)="onImageError()" (error)="onImageError()"
> >
<div *ngIf="SessionStore.user.UserId == message.sender.wxUserId && message.oneShot == true">
Mandou uma mensagen com visualização única
</div>
<div *ngIf="SessionStore.user.UserId != message.sender.wxUserId && message.oneShot == true"> <div *ngIf="SessionStore.user.UserId != message.sender.wxUserId && message.oneShot == true">
<!-- <div *ngIf="message.oneShot == true" class="cursor-pointer"> --> <!-- <div *ngIf="message.oneShot == true" class="cursor-pointer"> -->
<div (click)="viewOnce($event, message, i)"> <div (click)="viewOnce($event, message, i)">
@@ -152,6 +148,11 @@
</div> </div>
</div> </div>
<div class="message-container rotate-div" *ngIf="message.meSendOneShot">
Mandou uma mensagen com visualização única
</div>
<div class="message-container rotate-div" *ngIf="message._isDeleted == true && message.id != '' && message.oneShot == false"> <div class="message-container rotate-div" *ngIf="message._isDeleted == true && message.id != '' && message.oneShot == false">
Mensagem foi eliminada Mensagem foi eliminada
</div> </div>
@@ -237,7 +238,7 @@
<div class="width-100"> <div class="width-100">
<div *ngIf="!recording && !lastAudioRecorded" class="type-message"> <div *ngIf="!recording && !lastAudioRecorded" class="type-message">
<ion-textarea *ngIf="allowTyping" (keyup.enter)="sendMessage()" clearOnEdit="true" placeholder="Escrever uma mensagem" class="message-input" rows="1" [(ngModel)]="textField" (ionChange)="sendTyping()"></ion-textarea> <ion-textarea autoGrow="true" *ngIf="allowTyping" (keyup.enter)="sendMessage()" clearOnEdit="true" placeholder="Escrever uma mensagem" class="message-input" rows="1" [(ngModel)]="textField" (ionChange)="sendTyping()"></ion-textarea>
</div> </div>
<div *ngIf="recording" class="d-flex align-items-center justify-content-center"> <div *ngIf="recording" class="d-flex align-items-center justify-content-center">
<button (click)="stopRecording()" class="btn-no-color d-flex align-items-center justify-content-center"> <button (click)="stopRecording()" class="btn-no-color d-flex align-items-center justify-content-center">
@@ -257,7 +257,7 @@ ion-footer {
.container { .container {
justify-content: center; justify-content: center;
justify-content: space-evenly; justify-content: space-evenly;
align-items: center; align-items: bottom;
} }
.chat-icon-options { .chat-icon-options {
@@ -551,3 +551,9 @@ ion-footer {
max-height: 400px; max-height: 400px;
max-width: 700px; max-width: 700px;
} }
.message-input {
max-height: 150px; /* limit expansion */
overflow-y: auto; /* allow scroll once max height is hit */
}
@@ -150,6 +150,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
date: {[key: string]: Object} = {} date: {[key: string]: Object} = {}
handleClickActive = true handleClickActive = true
onShot = false;
constructor( constructor(
@@ -455,14 +456,14 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
if(!me) { if(!me) {
if(message.oneShot == false) { //if(message.oneShot == false) {
this.chatServiceService.sendReadAt({ this.chatServiceService.sendReadAt({
memberId: SessionStore.user.UserId, memberId: SessionStore.user.UserId,
messageId: message.id, messageId: message.id,
requestId: uuidv4(), requestId: uuidv4(),
roomId: this.room.id roomId: this.room.id
}) })
} //}
} }
} }
@@ -501,14 +502,14 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
} }
} }
if(message.oneShot == false) { //if(message.oneShot == false) {
this.chatServiceService.sendReadAt({ this.chatServiceService.sendReadAt({
memberId: SessionStore.user.UserId, memberId: SessionStore.user.UserId,
messageId: message.id, messageId: message.id,
requestId: '', requestId: '',
roomId: this.room.id roomId: this.room.id
}) })
} //}
setTimeout(() => { setTimeout(() => {
this.scrollToBottomClicked() this.scrollToBottomClicked()
@@ -830,6 +831,8 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
message.receiverId = this.room.receiverId message.receiverId = this.room.receiverId
} }
message.oneShot = this.onShot;
return message return message
} }
@@ -877,7 +880,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
this.messages1[this.room.$id].push(message) this.messages1[this.room.$id].push(message)
let sendMessage = this.chatServiceService.sendMessage(message, this.roomType) let sendMessage = this.chatServiceService.sendMessage(message, this.roomType)
//this.messageResult(sendMessage) this.onShot = false;
setTimeout(() => { setTimeout(() => {
this.scrollToBottomClicked() this.scrollToBottomClicked()
@@ -902,6 +905,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
const message = this.createMessage(); const message = this.createMessage();
message.message = this.textField message.message = this.textField
this.onShot = false;
this.textField = '' this.textField = ''
const date = whatsappDate(message.sentAt, false) const date = whatsappDate(message.sentAt, false)
@@ -916,7 +920,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
this.scrollToBottomClicked() this.scrollToBottomClicked()
}, 100) }, 100)
let sendMessage = this.chatServiceService.sendMessage(message, this.roomType) let sendMessage = this.chatServiceService.sendMessage(message, this.roomType)
//this.messageResult(sendMessage) this.onShot = false;
} }
@@ -1078,7 +1082,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
const message = this.createMessage(); const message = this.createMessage();
message.oneShot = oneShot
message.attachments = [{ message.attachments = [{
file: compressedImage.value.split(',')[1], file: compressedImage.value.split(',')[1],
@@ -1088,7 +1092,6 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
mimeType: 'image/'+picture.value.format mimeType: 'image/'+picture.value.format
}] }]
const date = whatsappDate(message.sentAt, false) const date = whatsappDate(message.sentAt, false)
if(!this.date[date]) { if(!this.date[date]) {
this.date[date] = true this.date[date] = true
@@ -1100,8 +1103,9 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
setTimeout(() => { setTimeout(() => {
this.scrollToBottomClicked() this.scrollToBottomClicked()
}, 100) }, 100)
let sendMessage = this.chatServiceService.sendMessage(message, this.roomType) let sendMessage = this.chatServiceService.sendMessage(message, this.roomType)
//this.messageResult(sendMessage) this.onShot = false;
} }
@@ -1159,7 +1163,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
this.scrollToBottomClicked() this.scrollToBottomClicked()
}, 100) }, 100)
let sendMessage = this.chatServiceService.sendMessage(message, this.roomType) let sendMessage = this.chatServiceService.sendMessage(message, this.roomType)
//this.messageResult(sendMessage) this.onShot = false;
this.textField = '' this.textField = ''
} }
@@ -1204,7 +1208,6 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
async pickPicture() { async pickPicture() {
const oneShot = await this.askIfOneShot() const oneShot = await this.askIfOneShot()
const file = await this.FilePickerService.getPicture({ const file = await this.FilePickerService.getPicture({
cameraResultType: CameraResultType.Base64 cameraResultType: CameraResultType.Base64
}) })
@@ -1247,7 +1250,8 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
this.scrollToBottomClicked() this.scrollToBottomClicked()
}, 100) }, 100)
let sendMessage = this.chatServiceService.sendMessage(message, this.roomType) let sendMessage = this.chatServiceService.sendMessage(message, this.roomType)
//this.messageResult(sendMessage) //this.onShot = false;
} }
} }
@@ -1301,13 +1305,10 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
setTimeout(() => { setTimeout(() => {
this.scrollToBottomClicked() this.scrollToBottomClicked()
}, 100) }, 100)
let sendMessage = this.chatServiceService.sendMessage(message, this.roomType)
//this.messageResult(sendMessage)
}
//} else { let sendMessage = this.chatServiceService.sendMessage(message, this.roomType)
//this.toastService._badRequest("Ficheiro inválido") this.onShot = false;
//} }
} }
} }
@@ -1480,6 +1481,16 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
closeModal(a: any) { closeModal(a: any) {
} }
forceShowOneShot(message: MessageViewModal) {
message.forceShowOneShot()
this.chatServiceService.messageDelete({
messageId: message.id,
roomId: this.room.id,
})
}
} }
+21
View File
@@ -57,6 +57,7 @@ export class MessageViewModal {
showReaction = false showReaction = false
showMessage = false showMessage = false
ballon = false ballon = false
showOneShot = false
hour = '' hour = ''
constructor(model?: IMessage) { constructor(model?: IMessage) {
@@ -119,7 +120,27 @@ export class MessageViewModal {
return this.sender.wxUserId == SessionStore.user.UserId return this.sender.wxUserId == SessionStore.user.UserId
} }
get meSendOneShot() {
return this.meSender() && this.oneShot == true
}
get _isDeleted() { get _isDeleted() {
return this.isDeleted || this.info.filter(e =>e.memberId == SessionStore.user.UserId && e.isDeleted).length == 1 return this.isDeleted || this.info.filter(e =>e.memberId == SessionStore.user.UserId && e.isDeleted).length == 1
} }
get oneShotAlreadyViewsByMe() {
return this._isDeleted == true && this.oneShot == true
}
get openByOther() {
return this.isDeleted || this.info.filter(e =>e.memberId != SessionStore.user.UserId && e.isDeleted).length >= 1
}
get oneShotIsViewed() {
return this.oneShot == true && this.info.filter(e =>e.memberId == SessionStore.user.UserId && e.isDeleted == true).length == 1
}
forceShowOneShot() {
this.showOneShot = true;
}
} }
+4 -4
View File
@@ -224,14 +224,14 @@ export class RoomStore {
} }
} }
if(message.oneShot == false) { //if(message.oneShot == false) {
this.chatServiceService.sendReadAt({ this.chatServiceService.sendReadAt({
memberId: SessionStore.user.UserId, memberId: SessionStore.user.UserId,
messageId: message.id, messageId: message.id,
requestId: uuidv4(), requestId: uuidv4(),
roomId: this.room.id roomId: this.room.id
}) })
} //}
setTimeout(() => { setTimeout(() => {
@@ -351,14 +351,14 @@ export class RoomStore {
if(!me) { if(!me) {
// Logger.info('send read at, sender '+ message.sender.wxFullName+ ' '+ message.message +'message id'+ message.id) // Logger.info('send read at, sender '+ message.sender.wxFullName+ ' '+ message.message +'message id'+ message.id)
if(message.oneShot == false) { //if(message.oneShot == false) {
this.chatServiceService.sendReadAt({ this.chatServiceService.sendReadAt({
memberId: SessionStore.user.UserId, memberId: SessionStore.user.UserId,
messageId: message.id, messageId: message.id,
requestId: uuidv4(), requestId: uuidv4(),
roomId: this.room.id roomId: this.room.id
}) })
} //}
} else { } else {
// console.log('no need', message ) // console.log('no need', message )
+1 -1
View File
@@ -2,4 +2,4 @@ import { Environment } from './../app/models/envarioment'
import { environment as oaprDev } from './suport/oapr' import { environment as oaprDev } from './suport/oapr'
import { DevDev } from './suport/dev' import { DevDev } from './suport/dev'
export const environment: Environment = oaprDev export const environment: Environment = DevDev
+6 -6
View File
@@ -1,11 +1,11 @@
export let versionData = { export let versionData = {
"shortSHA": "3eecedb23", "shortSHA": "4870a0cd6",
"SHA": "3eecedb23fae5e23cf158df3f253a1fdbb16ed05", "SHA": "4870a0cd695183670f21f5e4d3e614ac2e170284",
"branch": "developer", "branch": "developer",
"lastCommitAuthor": "'peter.maquiran'", "lastCommitAuthor": "'peter.maquiran'",
"lastCommitTime": "'Wed Sep 17 18:37:35 2025 +0100'", "lastCommitTime": "'Wed Sep 24 16:21:52 2025 +0100'",
"lastCommitMessage": "fix publication", "lastCommitMessage": "fix messsage",
"lastCommitNumber": "6149", "lastCommitNumber": "6150",
"changeStatus": "On branch developer\nYour branch is ahead of 'origin/developer' by 6 commits.\n (use \"git push\" to publish your local commits)\n\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: package-lock.json\n\tmodified: package.json\n\tmodified: src/app/app.module.ts\n\tmodified: src/app/core/chat/usecase/message/message-create-use-case.service.ts\n\tmodified: src/app/core/chat/usecase/message/messages-send-offline-use-case.service.ts\n\tmodified: src/app/core/chat/usecase/room/room-update-name-sync.service.ts\n\tmodified: src/app/infra/socket/signalR/signalR.ts\n\tmodified: src/app/pages/events/events.page.html\n\tmodified: src/app/pages/gabinete-digital/diplomas-assinar/diploma-assinar/diploma-assinar.page.ts\n\tmodified: src/app/pages/gabinete-digital/diplomas/diploma/diploma.page.ts\n\tmodified: src/app/services/processes.service.ts\n\tmodified: src/app/shared/popover/event-details-documents-options/event-details-documents-options.page.ts\n\tmodified: src/app/shared/publication/view-publications/view-publications.page.ts\n\tmodified: src/app/ui/agenda/agenda.page.ts\n\tmodified: src/app/ui/chat/chat.page.html\n\tmodified: src/app/ui/chat/chat.page.ts\n\tmodified: src/app/ui/chat/component/messages/messages.page.html\n\tmodified: src/environments/environment.ts", "changeStatus": "On branch developer\nYour branch is ahead of 'origin/developer' by 7 commits.\n (use \"git push\" to publish your local commits)\n\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: src/app/core/chat/usecase/member/member-admin-use-case.service.ts\n\tmodified: src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page.html\n\tmodified: src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page.ts\n\tmodified: src/app/ui/chat/chat.page.html\n\tmodified: src/app/ui/chat/component/messages/messages.page.html\n\tmodified: src/app/ui/chat/component/messages/messages.page.scss\n\tmodified: src/app/ui/chat/component/messages/messages.page.ts\n\tmodified: src/app/ui/chat/store/model/message.ts\n\tmodified: src/app/ui/chat/store/roomStore.ts\n\tmodified: src/environments/environment.ts\n\tmodified: version/git-version.ts",
"changeAuthor": "peter.maquiran" "changeAuthor": "peter.maquiran"
} }