@@ -133,10 +133,10 @@
-
diff --git a/src/app/modals/profile/profile.page.scss b/src/app/modals/profile/profile.page.scss
index 7f4d64961..d92e2f2e5 100644
--- a/src/app/modals/profile/profile.page.scss
+++ b/src/app/modals/profile/profile.page.scss
@@ -149,6 +149,7 @@ ion-list {
overflow: hidden;
}
+
.notification-item {
width: fit-content;
float: left;
diff --git a/src/app/modals/profile/profile.page.ts b/src/app/modals/profile/profile.page.ts
index 64e4775ba..cee117a73 100644
--- a/src/app/modals/profile/profile.page.ts
+++ b/src/app/modals/profile/profile.page.ts
@@ -19,7 +19,7 @@ import { NotificationRepositoryService } from 'src/app/module/notification/data/
import { Observable } from 'rxjs';
import { NotificationTable } from 'src/app/module/notification/data/infra/db/notification.db';
import { isHttpError } from 'src/app/services/http.service';
-
+import { map, filter } from 'rxjs/operators';
@Component({
selector: 'app-profile',
templateUrl: './profile.page.html',
@@ -52,6 +52,8 @@ export class ProfilePage implements OnInit {
notificationList$: Observable
+ objectRead = {}
+
constructor(
private modalController: ModalController,
private animationController: AnimationController,
@@ -72,7 +74,9 @@ export class ProfilePage implements OnInit {
private notificationRepositoryService: NotificationRepositoryService
) {
- this.notificationList$ = this.notificationRepositoryService.getNotificationLive()
+ this.notificationList$ = this.notificationRepositoryService.getNotificationLive().pipe(
+ filter(data => data.some(item => item.status === false))
+ )
window['e'] = () => {
console.log(
@@ -227,7 +231,6 @@ export class ProfilePage implements OnInit {
console.log({item})
- this.notificationRepositoryService.notificationStatus(item)
try {
if (item.service === "agenda") {
@@ -241,18 +244,19 @@ export class ProfilePage implements OnInit {
if(res.isOk()) {
this.zone.run(() => this.router.navigate(['/home/agenda', item.idObject, 'agenda']));
- this.deleteNotification(index);
+ this.deleteNotification(item);
tracing.setAttribute('outcome', 'success')
} else {
tracing.setAttribute('outcome', 'success')
tracing.setAttribute('data.exist', 'false')
- this.NotificationHolderService.notificationList[index].read = true;
+
if (isHttpError(res.error)) {
-
if(res.error.status == 404) {
- this.toastService._badRequest('Este evento já não existe')
- this.notificationRepositoryService.localNotificationStatus(item)
+ // this.toastService._badRequest('Este evento já não existe')
+
+ this.objectRead[item.notificationId] = true
+
}
}
@@ -274,13 +278,13 @@ export class ProfilePage implements OnInit {
console.log('evento exist')
tracing.setAttribute('outcome', 'success')
this.zone.run(() => this.router.navigate(['/home/agenda/event-list/approve-event', item.idObject, 'agenda']));
- this.deleteNotification(index);
+ this.deleteNotification(item);
this.isloading = false
} else {
tracing.setAttribute('outcome', 'success')
console.log('evento não existe')
tracing.setAttribute('data.exist', 'false')
- // this.NotificationHolderService.notificationList[index].read = true;
+ this.objectRead[item.notificationId] = true
this.isloading = false
}
} else {
@@ -330,11 +334,11 @@ export class ProfilePage implements OnInit {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expedientes-pr', item.idObject, 'gabinete-digital']));
}
- this.deleteNotification(index);
+ this.deleteNotification(item);
this.isloading = false
}, (error) => {
- // this.NotificationHolderService.notificationList[i].read = true;
+ this.objectRead[item.notificationId] = true
this.isloading = false
})
@@ -342,11 +346,11 @@ export class ProfilePage implements OnInit {
} else if (item.service === "accoes") {
if (item.service === "accoes" && item.idObject === "accao") {
this.zone.run(() => this.router.navigate(['/home/publications', item.idObject]));
- this.deleteNotification(index);
+ this.deleteNotification(item);
}
else if (item.service === "accoes" && item.idObject === "publicacao") {
this.zone.run(() => this.router.navigate(['/home/publications/view-publications', item.folderId, item.idObject]));
- this.deleteNotification(index);
+ this.deleteNotification(item);
}
} else if (item.service === "chat") {
@@ -360,7 +364,7 @@ export class ProfilePage implements OnInit {
}, 200);
- this.deleteNotification(index);
+ this.deleteNotification(item);
} else {
console.log({service:item.service, Object, IdObject:item.idObject, FolderId:item.folderId})
@@ -379,13 +383,11 @@ export class ProfilePage implements OnInit {
}
-
-
}
- deleteNotification(index) {
- const notificationdata = this.NotificationHolderService.notificationList.find(item => item.index == index);
- this.NotificationHolderService.removeNotification(notificationdata)
+ deleteNotification(item: NotificationTable) {
+ this.objectRead[item.notificationId] = false
+ this.notificationRepositoryService.RemoveNotificationStatus(item)
}
logout() {
@@ -464,12 +466,15 @@ export class ProfilePage implements OnInit {
}
- keppNotification(index) {
- this.NotificationHolderService.notificationList[index].read = false;
+ keppNotification(item: NotificationTable) {
+ // this.NotificationHolderService.notificationList[index].read = false;
+ this.objectRead[item.notificationId] = false
+ this.notificationRepositoryService.localNotificationStatus(item)
}
- doNotKeppNotification(index) {
- this.deleteNotification(index);
+ doNotKeppNotification(item: NotificationTable) {
+ this.objectRead[item.notificationId] = false
+ this.deleteNotification(item);
}
}
diff --git a/src/app/module/notification/data/notification-repository.service.ts b/src/app/module/notification/data/notification-repository.service.ts
index 2aedc7b1c..e7db1334b 100644
--- a/src/app/module/notification/data/notification-repository.service.ts
+++ b/src/app/module/notification/data/notification-repository.service.ts
@@ -40,6 +40,9 @@ export class NotificationRepositoryService {
if(result.isOk()) {
console.log('notification-list', result.value.data.result)
+ const serverListFiltered = result.value.data.result.filter( e => e.body != 'Foi editado um evento na vossa agenda' && e.body != 'Foi apagado um evento na vossa agenda')
+ result.value.data.result = serverListFiltered
+
if(result.value.data.result.length >= 1) {
const localList = await this.LocalNotificationService.getNotification()
const serverList = NotificationListMapper(result.value)
@@ -74,6 +77,15 @@ export class NotificationRepositoryService {
return
}
+
+ async RemoveNotificationStatus(item: NotificationTable) {
+ await this.RemoteNotificationService.notificationStatus(item.notificationId)
+ item.status = true
+ this.LocalNotificationService.updateNotification(item)
+ this.init()
+ return
+ }
+
async localNotificationStatus(item: NotificationTable) {
item.status = true
this.LocalNotificationService.updateNotification(item)
diff --git a/version/git-version.ts b/version/git-version.ts
index ad37c544b..b36d767bf 100644
--- a/version/git-version.ts
+++ b/version/git-version.ts
@@ -1,11 +1,11 @@
export let versionData = {
- "shortSHA": "78c13d1bf",
- "SHA": "78c13d1bfb0b5e24a79a101990ba73e50e831107",
+ "shortSHA": "11587cc94",
+ "SHA": "11587cc944ab205b6f03aa1e1af4d43fcd92c509",
"branch": "feature/agenda-api-peter",
"lastCommitAuthor": "'Peter Maquiran'",
- "lastCommitTime": "'Wed Jun 26 13:45:25 2024 +0100'",
- "lastCommitMessage": "ITOTEAM-609 search event>",
- "lastCommitNumber": "5844",
- "changeStatus": "On branch feature/agenda-api-peter\nYour branch is ahead of 'origin/feature/agenda-api-peter' by 7 commits.\n (use \"git push\" to publish your local commits)\n\nChanges to be committed:\n (use \"git restore --staged ...\" to unstage)\n\tmodified: src/app/modals/profile/profile.page.html\n\tmodified: src/app/modals/profile/profile.page.scss\n\tmodified: src/app/modals/profile/profile.page.ts\n\tnew file: src/app/module/notification/data/async/changes/notificationListChange.ts\n\tnew file: src/app/module/notification/data/datasource/firebase-push-notification.service.spec.ts\n\tnew file: src/app/module/notification/data/datasource/firebase-push-notification.service.ts\n\tnew file: src/app/module/notification/data/datasource/local-notification.service.spec.ts\n\tnew file: src/app/module/notification/data/datasource/local-notification.service.ts\n\tnew file: src/app/module/notification/data/datasource/remote-notification.service.spec.ts\n\tnew file: src/app/module/notification/data/datasource/remote-notification.service.ts\n\tnew file: src/app/module/notification/data/dto/NotificationInputDTO.ts\n\tnew file: src/app/module/notification/data/dto/NotificationOutputDTO.ts\n\tnew file: src/app/module/notification/data/infra/db/notification.db.ts\n\tnew file: src/app/module/notification/data/notification-repository.service.spec.ts\n\tnew file: src/app/module/notification/data/notification-repository.service.ts\n\tnew file: src/app/module/notification/domain/mapper/notificationListMapper.ts\n\tmodified: src/app/pages/agenda/agenda.page.html\n\tmodified: src/app/pages/agenda/agenda.page.ts\n\tmodified: src/app/services/agenda/list-box.service.ts\n\tmodified: src/app/services/http.service.ts\n\tmodified: src/app/services/notification/notifications.service.ts\n\tmodified: src/app/services/notifications.service.ts",
+ "lastCommitTime": "'Thu Jun 27 16:53:45 2024 +0100'",
+ "lastCommitMessage": "ITOTEAM-523 notification status",
+ "lastCommitNumber": "5845",
+ "changeStatus": "On branch feature/agenda-api-peter\nYour branch is up to date with 'origin/feature/agenda-api-peter'.\n\nChanges to be committed:\n (use \"git restore --staged ...\" to unstage)\n\tmodified: src/app/modals/profile/profile.page.html\n\tmodified: src/app/modals/profile/profile.page.scss\n\tmodified: src/app/modals/profile/profile.page.ts\n\tmodified: src/app/module/notification/data/notification-repository.service.ts\n\tmodified: version/git-version.ts",
"changeAuthor": "peter.maquiran"
}
\ No newline at end of file