diff --git a/src/views/NewActivityView.vue b/src/views/NewActivityView.vue
index 7f5bcb4bd..8d7f5e516 100644
--- a/src/views/NewActivityView.vue
+++ b/src/views/NewActivityView.vue
@@ -16,26 +16,26 @@
-
- New Offers To You
-
-
+
{{ newOffersToUser.length }}
+ New Offer{{ newOffersToUser.length === 1 ? "" : "s" }} To You
+
@@ -58,7 +66,7 @@ import GiftedDialog from "@/components/GiftedDialog.vue";
import QuickNav from "@/components/QuickNav.vue";
import EntityIcon from "@/components/EntityIcon.vue";
import { NotificationIface } from "@/constants/app";
-import { accountsDB, db, retrieveSettingsForActiveAccount } from "@/db/index";
+import { accountsDB, db, retrieveSettingsForActiveAccount, updateAccountSettings } from "@/db/index";
import { Contact } from "@/db/tables/contacts";
import {
didInfo,
@@ -120,5 +128,49 @@ export default class NewActivityView extends Vue {
);
}
}
+
+ async expandOffersToUserAndMarkRead() {
+ this.showOffersDetails = !this.showOffersDetails;
+ if (this.newOffersToUser.length > 0) {
+ await updateAccountSettings(this.activeDid, {
+ lastAckedOfferToUserJwtId: this.newOffersToUser[0].jwtId,
+ });
+ // note that we don't update this.lastAckedOfferToUserJwtId in case they
+ // later choose the last one to keep the offers as new
+ }
+ this.$notify(
+ {
+ group: "alert",
+ type: "info",
+ title: "Marked as Read",
+ text: "The offers are marked as viewed. Click in the list to keep them as new.",
+ },
+ 5000,
+ );
+ }
+
+ async markOffersAsReadStartingWith(jwtId: string) {
+ const index = this.newOffersToUser.findIndex(offer => offer.jwtId === jwtId);
+ if (index !== -1 && index < this.newOffersToUser.length - 1) {
+ // Set to the next offer's jwtId
+ await updateAccountSettings(this.activeDid, {
+ lastAckedOfferToUserJwtId: this.newOffersToUser[index + 1].jwtId,
+ });
+ } else {
+ // it's the last entry (or not found), so just keep it the same
+ await updateAccountSettings(this.activeDid, {
+ lastAckedOfferToUserJwtId: this.lastAckedOfferToUserJwtId,
+ });
+ }
+ this.$notify(
+ {
+ group: "alert",
+ type: "info",
+ title: "Marked as Unread",
+ text: "All offers above that one are marked as unread.",
+ },
+ 3000,
+ );
+ }
}