fix messsage

This commit is contained in:
peter.maquiran
2025-09-24 16:21:52 +01:00
parent 3eecedb23f
commit 4870a0cd69
19 changed files with 183 additions and 338 deletions
+6 -5
View File
@@ -91,11 +91,12 @@ import { UserModule } from './module/user/user.module';
import { Logger } from './services/logger/main/service';
registerLocaleData(localePt, 'pt');
import * as Sentry from '@sentry/capacitor';
import { Integration } from '@sentry/types';
import { BrowserTracing } from '@sentry/tracing';
import { LogsDatabase } from './infra/database/dexie/instance/logs/service';
import { AppErrorHandler } from './infra/crash-analytics/app-error-handler';
// import * as Sentry from '@sentry/capacitor';
// import { Integration } from '@sentry/types';
// import { BrowserTracing } from '@sentry/tracing';
// import { LogsDatabase } from './infra/database/dexie/instance/logs/service';
// import { AppErrorHandler } from './infra/crash-analytics/app-error-handler';
// Sentry.init(
@@ -134,6 +134,8 @@ export class MessageCreateUseCaseService {
var i = 0;
for (const att of attachments.value) {
console.log(att);
const isWebtrix = att.source === MessageAttachmentSource.Webtrix;
var a = await this.MessageRemoteRepository.messageAttachmentUpload({
fileType: att.fileType,
@@ -143,7 +145,7 @@ export class MessageCreateUseCaseService {
applicationId: att.applicationId || 0,
docId: att.docId || 0,
mimeType: att.mimeType,
description: att.description || "something",
description: att.description || att.fileName,
senderId: SessionStore.user.UserId,
});
@@ -79,6 +79,8 @@ export class SendLocalMessagesUseCaseService {
var i = 0;
for (const att of attachments.value) {
console.log(att);
const isWebtrix = att.source === MessageAttachmentSource.Webtrix;
var a = await this.MessageRemoteRepository.messageAttachmentUpload({
fileType: att.fileType,
@@ -88,7 +90,7 @@ export class SendLocalMessagesUseCaseService {
applicationId: att.applicationId || 0,
docId: att.docId || 0,
mimeType: att.mimeType,
description: att.description || "something",
description: att.description || att.fileName,
senderId: SessionStore.user.UserId,
});
@@ -1,6 +1,7 @@
import { Injectable } from '@angular/core';
import { IRoomSocketRepository } from 'src/app/core/chat/repository/room/room-socket-repository';
import { GetRoomByIdUseCaseService } from './room-get-by-id-use-case.service'
import { GetRoomListUseCaseService } from 'src/app/core/chat/usecase/room/room-get-list-use-case.service'
@Injectable({
providedIn: 'root'
})
@@ -8,16 +9,18 @@ export class RoomUpdateNameSyncService {
constructor(
private GetRoomByIdUseCaseService: GetRoomByIdUseCaseService,
private roomSocketRepository: IRoomSocketRepository
private roomSocketRepository: IRoomSocketRepository,
private getRoomListUseCaseService: GetRoomListUseCaseService
) {
// this.watch()
this.watch()
}
private watch() {
this.roomSocketRepository.listenToRoomUpdate().subscribe((event) => {
console.log('listenToRoomUpdate')
this.GetRoomByIdUseCaseService.execute(event.data.id)
//this.GetRoomByIdUseCaseService.execute(event.data.id)
this.getRoomListUseCaseService.execute();
})
}
}
+1 -1
View File
@@ -161,7 +161,7 @@ export class SignalRConnection {
const methods = ['ReceiveMessage', 'TypingMessage', 'AvailableUsers',
'ReadAt', 'DeleteMessage', 'UpdateMessage', 'GroupAddedMembers',
'GroupDeletedMembers', 'UserAddGroup']
'GroupDeletedMembers', 'UserAddGroup', 'GroupUpdate']
for(const method of methods) {
this.hubConnection.on(method, (message: any) => {
+1 -1
View File
@@ -139,7 +139,7 @@
</div>
<div class="flex-1">
<div *ngIf="p.userPermission([p.permissionList.Gabinete.access])" class="schedule schedule-1 height-100">
<ion-progress-bar type="indeterminate" *ngIf="loadingAllTask || TaskService.showLoaderNum != 0"></ion-progress-bar>
<ion-progress-bar type="indeterminate" *ngIf="loadingAllTask"></ion-progress-bar>
<div class="schedule-header">
<div class="title">
<ion-icon class="icon" slot="end" src="assets/images/icons-correspondencias.svg"></ion-icon>
@@ -271,7 +271,7 @@ export class DiplomaAssinarPage implements OnInit {
async AssinarDraft() {
if (this.asDraft) {
//if (this.asDraft) {
const modal = await this.modalController.create({
component: PopupQuestionPage,
componentProps: {
@@ -299,7 +299,7 @@ export class DiplomaAssinarPage implements OnInit {
try {
await this.processes.createSignatureV2(body);
//await this.Assinar();
await this.Assinar();
this.TaskService.loadDiplomas();
this.goBack();
} catch (error) {
@@ -315,9 +315,9 @@ export class DiplomaAssinarPage implements OnInit {
});
await modal.present();
} else {
//} else {
this.httpErroHandle.validationMessagge("diplomaAsDraft");
}
//}
}
@@ -566,7 +566,7 @@ export class DiplomaAssinarPage implements OnInit {
this.mergedArray.push(file);
}
this.task.DraftIds = draftList.value.data.map(e => e.id).join(',')
this.task.DraftIds = draftList.value.data.map(e => e.id).join(';')
this.DraftIds = this.task.DraftIds
if (draftList.value.data.length == 0) {
@@ -486,9 +486,9 @@ export class DiplomaPage implements OnInit {
this.TaskService.loadDiplomas()
if(taskAction != '0') {
//if(taskAction != '0') {
this.goBack();
}
//}
}, (error) => {
console.log(error)
+10 -19
View File
@@ -11,18 +11,13 @@ import { fullTaskList } from '../models/dailyworktask.model';
import { ChangeProfileService } from './change-profile.service';
import { SessionStore } from '../store/session.service';
import { HttpService } from '../infra/http/http.service';
import { Result } from 'neverthrow';
import { HttpResult } from '../infra/http/type';
interface SignatureInputDTO {
InstanceId: any;
FolderId: any;
DraftIds: any;
OriginalFileName: string;
}
@Injectable({
providedIn: 'root'
})
@@ -265,26 +260,22 @@ export class ProcessesService {
private baseUrl = `${environment.apiURLStage.slice(0, -1)}`;
async createSignatureV2(input: SignatureInputDTO) {
// Split DraftIds into an array
const draftIds: String[] = input.DraftIds?.split(";").filter(Boolean) || [];
const draftIds: number[] = input.DraftIds?.split(";").filter(Boolean).map(id => Number(id)) || [];
if (draftIds.length === 0) {
throw new Error("No valid DraftIds provided");
}
// Run all requests in parallel
const responses: Result<HttpResult<any>, HttpErrorResponse>[] = await Promise.all(
draftIds.map(draftId =>
this.httpService.put<any>(
`${this.baseUrl}/Contents/${draftId}/signature/${SessionStore.user.UserId}`,
input
) as Promise<Result<HttpResult<any>, HttpErrorResponse>>
)
);
const failures = responses.filter(r => r.isErr() );
const responses = await this.httpService.put<any>(`${this.baseUrl}/Contents/signature`,
{
folderId: input.FolderId,
instanceId: input.InstanceId,
drafts: draftIds
}
)
if (failures.length > 0) {
// You can either throw or return both successes and failures
if (responses.isErr()) {
throw new Error(
`Some requests failed draft}`
);
@@ -162,8 +162,7 @@ export class EventDetailsDocumentsOptionsPage implements OnInit {
try {
await this.processes.createSignatureV2(body);
//await this.Assinar();
await this.Assinar();
this.TaskService.loadDiplomas();
this.goBackRoute();
} catch (error) {
@@ -250,7 +250,7 @@ export class ViewPublicationsPage implements OnInit {
cssClass: 'discart-expedient-modal',
backdropDismiss: true,
componentProps: {
title: 'Deseja arquivar este acção?',
title: 'Deseja eliminar este acção?',
/* description: 'Nota: Ao Efetuar esta operação, o tratamento deste acção não poderá ser realizado a partir da lista de acções' */
},
});
+7
View File
@@ -204,8 +204,15 @@ export class AgendaPage implements OnInit {
public AgendaDataRepositoryService: AgendaDataRepositoryService,
private toastService: ToastService,
private notificationRepository: NotificationRepositoryService,
private processesService: ProcessesService
) {
// this.processesService.createSignatureV2({
// DraftIds: "123;456",
// FolderId: 1,
// InstanceId: "instance-001",
// });
this.NotificationUpdate.pipe(
throttleTime(1000) // Prevents the function from being called more than once per second
).subscribe(() => {
+2 -2
View File
@@ -53,7 +53,7 @@
<div class="width-100">
<div class="item item-hover width-100 d-flex ion-no-padding ion-no-margin"
*ngFor="let room of filterRoomList"
[class.item-active]="room.$id == selectedRoomId" [class.hide-room]="room.roomType != segment">
[class.item-active]="room.$id == selectedRoomId" [class.hide-room]="room.roomType != segment || (room.expirationDate && expirationDate[room.$id] === 0)">
<div class="item-icon">
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && room.$id != selectedRoomId && room.roomType == RoomType.Group " class="icon" slot="start" src="assets/images/theme/gov/icons-chat-chat-40.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && room.$id == selectedRoomId && room.roomType == RoomType.Group" class="icon" slot="start" src="assets/images/theme/gov/icons-chat-chat-40-hover.svg"></ion-icon>
@@ -107,7 +107,7 @@
<div class="item-message font-13-em add-ellipsis white-space-nowrap"> Mensagem foi eliminada </div>
</div>
<div *ngIf="room?.messages?.length >= 1 && room.messages[0]._isDeleted==true && room.messages[0].oneShot == true">
<div class="item-message font-13-em add-ellipsis white-space-nowrap"> Mensagem de visualizada </div>
<div class="item-message font-13-em add-ellipsis white-space-nowrap"> Mensagem visualizada </div>
</div>
</div>
+9 -5
View File
@@ -171,12 +171,16 @@ export class ChatPage implements OnInit {
// Create the interval observable
const interval$ = interval(1000).pipe(
tap(() => {
for (const room of this.rooms) {
if(room.expirationDate) {
this.expirationDate[room.$id] = this.getSecondsLeft(room.expirationDate);
}
this.rooms = this.rooms.filter(room => {
if (room.expirationDate) {
const secondsLeft = this.getSecondsLeft(room.expirationDate);
this.expirationDate[room.$id] = secondsLeft;
}
// keep only if still valid
return secondsLeft != null && secondsLeft > 0;
}
return true; // keep rooms without expiration date
});
})
);
@@ -157,7 +157,7 @@
</div>
<div class="message-container rotate-div" *ngIf="message._isDeleted == true && message.id != '' && message.oneShot == true">
Mensagem de visualizada
Mensagem visualizada
</div>
<div *ngIf="message.messageType == IMessageType.information && !message.ballon" class="text-center">
+1 -1
View File
@@ -2,4 +2,4 @@ import { Environment } from './../app/models/envarioment'
import { environment as oaprDev } from './suport/oapr'
import { DevDev } from './suport/dev'
export const environment: Environment = DevDev
export const environment: Environment = oaprDev