feat(ActivityCenter): Switch on backend filtering for the AC notifications
This commit is contained in:
parent
0529ea4be5
commit
c5a32ff8cb
|
@ -44,7 +44,7 @@ proc delete*(self: Controller) =
|
||||||
proc init*(self: Controller) =
|
proc init*(self: Controller) =
|
||||||
self.events.on(activity_center_service.SIGNAL_ACTIVITY_CENTER_NOTIFICATIONS_LOADED) do(e: Args):
|
self.events.on(activity_center_service.SIGNAL_ACTIVITY_CENTER_NOTIFICATIONS_LOADED) do(e: Args):
|
||||||
let args = ActivityCenterNotificationsArgs(e)
|
let args = ActivityCenterNotificationsArgs(e)
|
||||||
self.delegate.addActivityCenterNotification(args.activityCenterNotifications)
|
self.delegate.addActivityCenterNotifications(args.activityCenterNotifications)
|
||||||
|
|
||||||
self.events.on(activity_center_service.SIGNAL_MARK_NOTIFICATIONS_AS_ACCEPTED) do(e: Args):
|
self.events.on(activity_center_service.SIGNAL_MARK_NOTIFICATIONS_AS_ACCEPTED) do(e: Args):
|
||||||
var evArgs = MarkAsAcceptedNotificationProperties(e)
|
var evArgs = MarkAsAcceptedNotificationProperties(e)
|
||||||
|
@ -143,6 +143,18 @@ proc getMessageById*(self: Controller, chatId, messageId: string): MessageDto =
|
||||||
|
|
||||||
proc setActiveNotificationGroup*(self: Controller, group: int) =
|
proc setActiveNotificationGroup*(self: Controller, group: int) =
|
||||||
self.activityCenterService.setActiveNotificationGroup(ActivityCenterGroup(group))
|
self.activityCenterService.setActiveNotificationGroup(ActivityCenterGroup(group))
|
||||||
|
self.activityCenterService.resetCursor()
|
||||||
|
let activityCenterNotifications = self.activityCenterService.getActivityCenterNotifications()
|
||||||
|
self.delegate.resetActivityCenterNotifications(activityCenterNotifications)
|
||||||
|
|
||||||
proc getActiveNotificationGroup*(self: Controller): int =
|
proc getActiveNotificationGroup*(self: Controller): int =
|
||||||
return self.activityCenterService.getActiveNotificationGroup().int
|
return self.activityCenterService.getActiveNotificationGroup().int
|
||||||
|
|
||||||
|
proc setActivityCenterReadType*(self: Controller, readType: int) =
|
||||||
|
self.activityCenterService.setActivityCenterReadType(ActivityCenterReadType(readType))
|
||||||
|
self.activityCenterService.resetCursor()
|
||||||
|
let activityCenterNotifications = self.activityCenterService.getActivityCenterNotifications()
|
||||||
|
self.delegate.resetActivityCenterNotifications(activityCenterNotifications)
|
||||||
|
|
||||||
|
proc getActivityCenterReadType*(self: Controller): int =
|
||||||
|
return self.activityCenterService.getActivityCenterReadType().int
|
||||||
|
|
|
@ -66,10 +66,10 @@ method markActivityCenterNotificationUnread*(self: AccessInterface, notification
|
||||||
method markAsSeenActivityCenterNotifications*(self: AccessInterface) {.base.} =
|
method markAsSeenActivityCenterNotifications*(self: AccessInterface) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method pushActivityCenterNotifications*(self: AccessInterface, activityCenterNotifications: seq[ActivityCenterNotificationDto]) {.base.} =
|
method addActivityCenterNotifications*(self: AccessInterface, activityCenterNotifications: seq[ActivityCenterNotificationDto]) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method addActivityCenterNotification*(self: AccessInterface, activityCenterNotifications: seq[ActivityCenterNotificationDto]) {.base.} =
|
method resetActivityCenterNotifications*(self: AccessInterface, activityCenterNotifications: seq[ActivityCenterNotificationDto]) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method acceptActivityCenterNotifications*(self: AccessInterface, notificationIds: seq[string]): string {.base.} =
|
method acceptActivityCenterNotifications*(self: AccessInterface, notificationIds: seq[string]): string {.base.} =
|
||||||
|
@ -92,3 +92,9 @@ method setActiveNotificationGroup*(self: AccessInterface, group: int) {.base.} =
|
||||||
|
|
||||||
method getActiveNotificationGroup*(self: AccessInterface): int {.base.} =
|
method getActiveNotificationGroup*(self: AccessInterface): int {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
method setActivityCenterReadType*(self: AccessInterface, readType: int) {.base.} =
|
||||||
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
method getActivityCenterReadType*(self: AccessInterface): int {.base.} =
|
||||||
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
|
@ -181,7 +181,7 @@ method convertToItems*(
|
||||||
|
|
||||||
method fetchActivityCenterNotifications*(self: Module) =
|
method fetchActivityCenterNotifications*(self: Module) =
|
||||||
let activityCenterNotifications = self.controller.getActivityCenterNotifications()
|
let activityCenterNotifications = self.controller.getActivityCenterNotifications()
|
||||||
self.view.pushActivityCenterNotifications(self.convertToItems(activityCenterNotifications))
|
self.view.addActivityCenterNotifications(self.convertToItems(activityCenterNotifications))
|
||||||
|
|
||||||
method markAllActivityCenterNotificationsRead*(self: Module): string =
|
method markAllActivityCenterNotificationsRead*(self: Module): string =
|
||||||
self.controller.markAllActivityCenterNotificationsRead()
|
self.controller.markAllActivityCenterNotificationsRead()
|
||||||
|
@ -212,17 +212,11 @@ method markActivityCenterNotificationReadDone*(self: Module, notificationIds: se
|
||||||
method markAsSeenActivityCenterNotifications*(self: Module) =
|
method markAsSeenActivityCenterNotifications*(self: Module) =
|
||||||
self.controller.markAsSeenActivityCenterNotifications()
|
self.controller.markAsSeenActivityCenterNotifications()
|
||||||
|
|
||||||
method pushActivityCenterNotifications*(
|
method addActivityCenterNotifications*(self: Module, activityCenterNotifications: seq[ActivityCenterNotificationDto]) =
|
||||||
self: Module,
|
self.view.addActivityCenterNotifications(self.convertToItems(activityCenterNotifications))
|
||||||
activityCenterNotifications: seq[ActivityCenterNotificationDto]
|
|
||||||
) =
|
|
||||||
self.view.pushActivityCenterNotifications(self.convertToItems(activityCenterNotifications))
|
|
||||||
|
|
||||||
method addActivityCenterNotification*(
|
method resetActivityCenterNotifications*(self: Module, activityCenterNotifications: seq[ActivityCenterNotificationDto]) =
|
||||||
self: Module,
|
self.view.resetActivityCenterNotifications(self.convertToItems(activityCenterNotifications))
|
||||||
activityCenterNotifications: seq[ActivityCenterNotificationDto]
|
|
||||||
) =
|
|
||||||
self.view.addActivityCenterNotification(self.convertToItems(activityCenterNotifications))
|
|
||||||
|
|
||||||
method markActivityCenterNotificationUnread*(
|
method markActivityCenterNotificationUnread*(
|
||||||
self: Module,
|
self: Module,
|
||||||
|
@ -302,3 +296,9 @@ method setActiveNotificationGroup*(self: Module, group: int) =
|
||||||
|
|
||||||
method getActiveNotificationGroup*(self: Module): int =
|
method getActiveNotificationGroup*(self: Module): int =
|
||||||
return self.controller.getActiveNotificationGroup()
|
return self.controller.getActiveNotificationGroup()
|
||||||
|
|
||||||
|
method setActivityCenterReadType*(self: Module, readType: int) =
|
||||||
|
self.controller.setActivityCenterReadType(readType)
|
||||||
|
|
||||||
|
method getActivityCenterReadType*(self: Module): int =
|
||||||
|
return self.controller.getActivityCenterReadType()
|
||||||
|
|
|
@ -60,10 +60,6 @@ QtObject:
|
||||||
read = hasUnseenActivityCenterNotifications
|
read = hasUnseenActivityCenterNotifications
|
||||||
notify = hasUnseenActivityCenterNotificationsChanged
|
notify = hasUnseenActivityCenterNotificationsChanged
|
||||||
|
|
||||||
proc pushActivityCenterNotifications*(self:View, activityCenterNotifications: seq[Item]) =
|
|
||||||
self.model.addActivityNotificationItemsToList(activityCenterNotifications)
|
|
||||||
self.hasMoreToShowChanged()
|
|
||||||
|
|
||||||
proc loadMoreNotifications(self: View) {.slot.} =
|
proc loadMoreNotifications(self: View) {.slot.} =
|
||||||
self.delegate.fetchActivityCenterNotifications()
|
self.delegate.fetchActivityCenterNotifications()
|
||||||
|
|
||||||
|
@ -134,9 +130,12 @@ QtObject:
|
||||||
proc dismissActivityCenterNotificationsDone*(self: View, notificationIds: seq[string]) =
|
proc dismissActivityCenterNotificationsDone*(self: View, notificationIds: seq[string]) =
|
||||||
self.model.removeNotifications(notificationIds)
|
self.model.removeNotifications(notificationIds)
|
||||||
|
|
||||||
proc addActivityCenterNotification*(self: View, activityCenterNotifications: seq[Item]) =
|
proc addActivityCenterNotifications*(self: View, activityCenterNotifications: seq[Item]) =
|
||||||
self.model.addActivityNotificationItemsToList(activityCenterNotifications)
|
self.model.addActivityNotificationItemsToList(activityCenterNotifications)
|
||||||
|
|
||||||
|
proc resetActivityCenterNotifications*(self: View, activityCenterNotifications: seq[Item]) =
|
||||||
|
self.model.setNewData(activityCenterNotifications)
|
||||||
|
|
||||||
proc switchTo*(self: View, sectionId: string, chatId: string, messageId: string) {.slot.} =
|
proc switchTo*(self: View, sectionId: string, chatId: string, messageId: string) {.slot.} =
|
||||||
self.delegate.switchTo(sectionId, chatId, messageId)
|
self.delegate.switchTo(sectionId, chatId, messageId)
|
||||||
|
|
||||||
|
@ -159,3 +158,17 @@ QtObject:
|
||||||
read = getActiveNotificationGroup
|
read = getActiveNotificationGroup
|
||||||
write = setActiveNotificationGroup
|
write = setActiveNotificationGroup
|
||||||
notify = activeNotificationGroupChanged
|
notify = activeNotificationGroupChanged
|
||||||
|
|
||||||
|
proc activityCenterReadTypeChanged*(self: View) {.signal.}
|
||||||
|
|
||||||
|
proc setActivityCenterReadType*(self: View, readType: int) {.slot.} =
|
||||||
|
self.delegate.setActivityCenterReadType(readType)
|
||||||
|
self.activityCenterReadTypeChanged()
|
||||||
|
|
||||||
|
proc getActivityCenterReadType*(self: View): int {.slot.} =
|
||||||
|
return self.delegate.getActivityCenterReadType()
|
||||||
|
|
||||||
|
QtProperty[int] activityCenterReadType:
|
||||||
|
read = getActivityCenterReadType
|
||||||
|
write = setActivityCenterReadType
|
||||||
|
notify = activityCenterReadTypeChanged
|
||||||
|
|
|
@ -5,10 +5,12 @@ type
|
||||||
AsyncActivityNotificationLoadTaskArg = ref object of QObjectTaskArg
|
AsyncActivityNotificationLoadTaskArg = ref object of QObjectTaskArg
|
||||||
cursor: string
|
cursor: string
|
||||||
limit: int
|
limit: int
|
||||||
|
group: ActivityCenterGroup
|
||||||
|
readType: ActivityCenterReadType
|
||||||
|
|
||||||
const asyncActivityNotificationLoadTask: Task = proc(argEncoded: string) {.gcsafe, nimcall.} =
|
const asyncActivityNotificationLoadTask: Task = proc(argEncoded: string) {.gcsafe, nimcall.} =
|
||||||
let arg = decode[AsyncActivityNotificationLoadTaskArg](argEncoded)
|
let arg = decode[AsyncActivityNotificationLoadTaskArg](argEncoded)
|
||||||
let activityNotificationsCallResult = backend.activityCenterNotifications(newJString(arg.cursor), arg.limit)
|
let activityNotificationsCallResult = backend.activityCenterNotificationsByGroup(newJString(arg.cursor), arg.limit, arg.group.int, arg.readType.int)
|
||||||
|
|
||||||
let responseJson = %*{
|
let responseJson = %*{
|
||||||
"activityNotifications": activityNotificationsCallResult.result
|
"activityNotifications": activityNotificationsCallResult.result
|
||||||
|
|
|
@ -31,6 +31,11 @@ type ActivityCenterGroup* {.pure.}= enum
|
||||||
Transactions = 7,
|
Transactions = 7,
|
||||||
System = 8
|
System = 8
|
||||||
|
|
||||||
|
type ActivityCenterReadType* {.pure.}= enum
|
||||||
|
Read = 1,
|
||||||
|
Unread = 2
|
||||||
|
All = 3
|
||||||
|
|
||||||
type ActivityCenterMembershipStatus* {.pure.}= enum
|
type ActivityCenterMembershipStatus* {.pure.}= enum
|
||||||
Idle = 0,
|
Idle = 0,
|
||||||
Pending = 1,
|
Pending = 1,
|
||||||
|
@ -79,14 +84,14 @@ proc toActivityCenterNotificationDto*(jsonObj: JsonNode): ActivityCenterNotifica
|
||||||
result.membershipStatus = ActivityCenterMembershipStatus.Idle
|
result.membershipStatus = ActivityCenterMembershipStatus.Idle
|
||||||
var membershipStatusInt: int
|
var membershipStatusInt: int
|
||||||
if (jsonObj.getProp("membershipStatus", membershipStatusInt) and
|
if (jsonObj.getProp("membershipStatus", membershipStatusInt) and
|
||||||
(membershipStatusInt >= ord(low(ActivityCenterMembershipStatus)) or
|
(membershipStatusInt >= ord(low(ActivityCenterMembershipStatus)) and
|
||||||
membershipStatusInt <= ord(high(ActivityCenterMembershipStatus)))):
|
membershipStatusInt <= ord(high(ActivityCenterMembershipStatus)))):
|
||||||
result.membershipStatus = ActivityCenterMembershipStatus(membershipStatusInt)
|
result.membershipStatus = ActivityCenterMembershipStatus(membershipStatusInt)
|
||||||
|
|
||||||
result.verificationStatus = VerificationStatus.Unverified
|
result.verificationStatus = VerificationStatus.Unverified
|
||||||
var verificationStatusInt: int
|
var verificationStatusInt: int
|
||||||
if (jsonObj.getProp("contactVerificationStatus", verificationStatusInt) and
|
if (jsonObj.getProp("contactVerificationStatus", verificationStatusInt) and
|
||||||
(verificationStatusInt >= ord(low(VerificationStatus)) or
|
(verificationStatusInt >= ord(low(VerificationStatus)) and
|
||||||
verificationStatusInt <= ord(high(VerificationStatus)))):
|
verificationStatusInt <= ord(high(VerificationStatus)))):
|
||||||
result.verificationStatus = VerificationStatus(verificationStatusInt)
|
result.verificationStatus = VerificationStatus(verificationStatusInt)
|
||||||
|
|
||||||
|
@ -95,7 +100,7 @@ proc toActivityCenterNotificationDto*(jsonObj: JsonNode): ActivityCenterNotifica
|
||||||
result.notificationType = ActivityCenterNotificationType.NoType
|
result.notificationType = ActivityCenterNotificationType.NoType
|
||||||
var notificationTypeInt: int
|
var notificationTypeInt: int
|
||||||
if (jsonObj.getProp("type", notificationTypeInt) and
|
if (jsonObj.getProp("type", notificationTypeInt) and
|
||||||
(notificationTypeInt >= ord(low(ActivityCenterNotificationType)) or
|
(notificationTypeInt >= ord(low(ActivityCenterNotificationType)) and
|
||||||
notificationTypeInt <= ord(high(ActivityCenterNotificationType)))):
|
notificationTypeInt <= ord(high(ActivityCenterNotificationType)))):
|
||||||
result.notificationType = ActivityCenterNotificationType(notificationTypeInt)
|
result.notificationType = ActivityCenterNotificationType(notificationTypeInt)
|
||||||
|
|
||||||
|
@ -113,10 +118,18 @@ proc toActivityCenterNotificationDto*(jsonObj: JsonNode): ActivityCenterNotifica
|
||||||
if jsonObj.contains("replyMessage") and jsonObj{"replyMessage"}.kind != JNull:
|
if jsonObj.contains("replyMessage") and jsonObj{"replyMessage"}.kind != JNull:
|
||||||
result.replyMessage = jsonObj{"replyMessage"}.toMessageDto()
|
result.replyMessage = jsonObj{"replyMessage"}.toMessageDto()
|
||||||
|
|
||||||
|
|
||||||
proc parseActivityCenterNotifications*(rpcResult: JsonNode): (string, seq[ActivityCenterNotificationDto]) =
|
proc parseActivityCenterNotifications*(rpcResult: JsonNode): (string, seq[ActivityCenterNotificationDto]) =
|
||||||
var notifs: seq[ActivityCenterNotificationDto] = @[]
|
var notifs: seq[ActivityCenterNotificationDto] = @[]
|
||||||
if rpcResult{"notifications"}.kind != JNull:
|
if rpcResult{"notifications"}.kind != JNull:
|
||||||
for jsonMsg in rpcResult["notifications"]:
|
for jsonMsg in rpcResult["notifications"]:
|
||||||
notifs.add(jsonMsg.toActivityCenterNotificationDto())
|
notifs.add(jsonMsg.toActivityCenterNotificationDto())
|
||||||
return (rpcResult{"cursor"}.getStr, notifs)
|
return (rpcResult{"cursor"}.getStr, notifs)
|
||||||
|
|
||||||
|
proc toActivityCenterNotificationTypeList*(rpcResult: JsonNode): seq[ActivityCenterNotificationType] =
|
||||||
|
var types: seq[ActivityCenterNotificationType] = @[]
|
||||||
|
for jsonObj in rpcResult:
|
||||||
|
var notificationTypeInt = jsonObj.getInt()
|
||||||
|
if notificationTypeInt >= ord(low(ActivityCenterNotificationType)) and
|
||||||
|
notificationTypeInt <= ord(high(ActivityCenterNotificationType)):
|
||||||
|
types.add(ActivityCenterNotificationType(notificationTypeInt))
|
||||||
|
return types
|
|
@ -58,6 +58,7 @@ QtObject:
|
||||||
events: EventEmitter
|
events: EventEmitter
|
||||||
cursor*: string
|
cursor*: string
|
||||||
activeGroup: ActivityCenterGroup
|
activeGroup: ActivityCenterGroup
|
||||||
|
readType: ActivityCenterReadType
|
||||||
|
|
||||||
# Forward declaration
|
# Forward declaration
|
||||||
proc asyncActivityNotificationLoad*(self: Service)
|
proc asyncActivityNotificationLoad*(self: Service)
|
||||||
|
@ -75,19 +76,22 @@ QtObject:
|
||||||
result.threadpool = threadpool
|
result.threadpool = threadpool
|
||||||
result.cursor = ""
|
result.cursor = ""
|
||||||
result.activeGroup = ActivityCenterGroup.All
|
result.activeGroup = ActivityCenterGroup.All
|
||||||
|
result.readType = ActivityCenterReadType.All
|
||||||
|
|
||||||
proc handleNewNotificationsLoaded(self: Service, activityCenterNotifications: seq[ActivityCenterNotificationDto]) =
|
proc handleNewNotificationsLoaded(self: Service, activityCenterNotifications: seq[ActivityCenterNotificationDto]) =
|
||||||
if (activityCenterNotifications.len < 1):
|
# For now status-go notify about every notification update regardless active group so we need filter manulay on the desktop side
|
||||||
return
|
let response = backend.activityCenterTypesByGroup(self.activeGroup.int) # NOTE: no error for trivial call
|
||||||
|
var groupTypes = toActivityCenterNotificationTypeList(response.result)
|
||||||
# if (self.activeGroup == ActivityCenterGroup.All ||
|
var filteredNotifications = filter(activityCenterNotifications, proc(notification: ActivityCenterNotificationDto): bool =
|
||||||
# backend. )
|
return (self.readType == ActivityCenterReadType.All or not notification.read) and groupTypes.contains(notification.notificationType)
|
||||||
|
|
||||||
self.events.emit(
|
|
||||||
SIGNAL_ACTIVITY_CENTER_NOTIFICATIONS_LOADED,
|
|
||||||
ActivityCenterNotificationsArgs(activityCenterNotifications: activityCenterNotifications)
|
|
||||||
)
|
)
|
||||||
self.events.emit(SIGNAL_ACTIVITY_CENTER_NOTIFICATIONS_COUNT_MAY_HAVE_CHANGED, Args())
|
|
||||||
|
if (filteredNotifications.len > 0):
|
||||||
|
self.events.emit(
|
||||||
|
SIGNAL_ACTIVITY_CENTER_NOTIFICATIONS_LOADED,
|
||||||
|
ActivityCenterNotificationsArgs(activityCenterNotifications: filteredNotifications)
|
||||||
|
)
|
||||||
|
self.events.emit(SIGNAL_ACTIVITY_CENTER_NOTIFICATIONS_COUNT_MAY_HAVE_CHANGED, Args())
|
||||||
|
|
||||||
proc init*(self: Service) =
|
proc init*(self: Service) =
|
||||||
self.asyncActivityNotificationLoad()
|
self.asyncActivityNotificationLoad()
|
||||||
|
@ -103,12 +107,20 @@ QtObject:
|
||||||
self.handleNewNotificationsLoaded(activityCenterNotifications)
|
self.handleNewNotificationsLoaded(activityCenterNotifications)
|
||||||
|
|
||||||
proc setActiveNotificationGroup*(self: Service, group: ActivityCenterGroup) =
|
proc setActiveNotificationGroup*(self: Service, group: ActivityCenterGroup) =
|
||||||
echo "---------------------------------- setActiveNotificationGroup >", group
|
|
||||||
self.activeGroup = group
|
self.activeGroup = group
|
||||||
|
|
||||||
proc getActiveNotificationGroup*(self: Service): ActivityCenterGroup =
|
proc getActiveNotificationGroup*(self: Service): ActivityCenterGroup =
|
||||||
return self.activeGroup
|
return self.activeGroup
|
||||||
|
|
||||||
|
proc setActivityCenterReadType*(self: Service, readType: ActivityCenterReadType) =
|
||||||
|
self.readType = readType
|
||||||
|
|
||||||
|
proc getActivityCenterReadType*(self: Service): ActivityCenterReadType =
|
||||||
|
return self.readType
|
||||||
|
|
||||||
|
proc resetCursor*(self: Service) =
|
||||||
|
self.cursor = ""
|
||||||
|
|
||||||
proc hasMoreToShow*(self: Service): bool =
|
proc hasMoreToShow*(self: Service): bool =
|
||||||
return self.cursor != ""
|
return self.cursor != ""
|
||||||
|
|
||||||
|
@ -117,8 +129,10 @@ QtObject:
|
||||||
tptr: cast[ByteAddress](asyncActivityNotificationLoadTask),
|
tptr: cast[ByteAddress](asyncActivityNotificationLoadTask),
|
||||||
vptr: cast[ByteAddress](self.vptr),
|
vptr: cast[ByteAddress](self.vptr),
|
||||||
slot: "asyncActivityNotificationLoaded",
|
slot: "asyncActivityNotificationLoaded",
|
||||||
cursor: "",
|
cursor: self.cursor,
|
||||||
limit: DEFAULT_LIMIT
|
limit: DEFAULT_LIMIT,
|
||||||
|
group: self.activeGroup,
|
||||||
|
readType: self.readType
|
||||||
)
|
)
|
||||||
self.threadpool.start(arg)
|
self.threadpool.start(arg)
|
||||||
|
|
||||||
|
@ -130,7 +144,7 @@ QtObject:
|
||||||
else:
|
else:
|
||||||
cursorVal = newJString(self.cursor)
|
cursorVal = newJString(self.cursor)
|
||||||
|
|
||||||
let callResult = backend.activityCenterNotifications(cursorVal, DEFAULT_LIMIT)
|
let callResult = backend.activityCenterNotificationsByGroup(cursorVal, DEFAULT_LIMIT, self.activeGroup.int, self.readType.int)
|
||||||
let activityCenterNotificationsTuple = parseActivityCenterNotifications(callResult.result)
|
let activityCenterNotificationsTuple = parseActivityCenterNotifications(callResult.result)
|
||||||
|
|
||||||
self.cursor = activityCenterNotificationsTuple[0];
|
self.cursor = activityCenterNotificationsTuple[0];
|
||||||
|
|
|
@ -165,6 +165,15 @@ rpc(activityCenterNotifications, "wakuext"):
|
||||||
cursorVal: JsonNode
|
cursorVal: JsonNode
|
||||||
limit: int
|
limit: int
|
||||||
|
|
||||||
|
rpc(activityCenterNotificationsByGroup, "wakuext"):
|
||||||
|
cursorVal: JsonNode
|
||||||
|
limit: int
|
||||||
|
group: int
|
||||||
|
readType: int
|
||||||
|
|
||||||
|
rpc(activityCenterTypesByGroup, "wakuext"):
|
||||||
|
group: int
|
||||||
|
|
||||||
rpc(markAllActivityCenterNotificationsRead, "wakuext"):
|
rpc(markAllActivityCenterNotificationsRead, "wakuext"):
|
||||||
discard
|
discard
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,6 @@ Popup {
|
||||||
property ActivityCenterStore activityCenterStore
|
property ActivityCenterStore activityCenterStore
|
||||||
property var store
|
property var store
|
||||||
|
|
||||||
readonly property int unreadNotificationsCount: root.activityCenterStore.unreadNotificationsCount
|
|
||||||
|
|
||||||
onOpened: {
|
onOpened: {
|
||||||
Global.popupOpened = true
|
Global.popupOpened = true
|
||||||
}
|
}
|
||||||
|
@ -65,18 +63,20 @@ Popup {
|
||||||
ActivityCenterPopupTopBarPanel {
|
ActivityCenterPopupTopBarPanel {
|
||||||
id: activityCenterTopBar
|
id: activityCenterTopBar
|
||||||
width: parent.width
|
width: parent.width
|
||||||
unreadNotificationsCount: root.unreadNotificationsCount
|
unreadNotificationsCount: activityCenterStore.unreadNotificationsCount
|
||||||
hasAdmin: root.adminCount > 0
|
hasAdmin: root.adminCount > 0
|
||||||
hasReplies: root.repliesCount > 0
|
hasReplies: root.repliesCount > 0
|
||||||
hasMentions: root.mentionsCount > 0
|
hasMentions: root.mentionsCount > 0
|
||||||
hasContactRequests: root.contactRequestsCount > 0
|
hasContactRequests: root.contactRequestsCount > 0
|
||||||
hasIdentityRequests: root.identityRequestsCount > 0
|
hasIdentityRequests: root.identityRequestsCount > 0
|
||||||
hasMembership: root.membershipCount > 0
|
hasMembership: root.membershipCount > 0
|
||||||
hideReadNotifications: activityCenterStore.hideReadNotifications
|
hideReadNotifications: activityCenterStore.activityCenterReadType === Constants.ActivityCenterReadType.Unread
|
||||||
activeGroup: activityCenterStore.activeNotificationGroup
|
activeGroup: activityCenterStore.activeNotificationGroup
|
||||||
onGroupTriggered: activityCenterStore.setActiveNotificationGroup(group)
|
onGroupTriggered: activityCenterStore.setActiveNotificationGroup(group)
|
||||||
onMarkAllReadClicked: root.activityCenterStore.markAllActivityCenterNotificationsRead()
|
onMarkAllReadClicked: root.activityCenterStore.markAllActivityCenterNotificationsRead()
|
||||||
onShowHideReadNotifications: activityCenterStore.hideReadNotifications = hideReadNotifications
|
onShowHideReadNotifications: activityCenterStore.setActivityCenterReadType(hideReadNotifications ?
|
||||||
|
Constants.ActivityCenterReadType.Unread :
|
||||||
|
Constants.ActivityCenterReadType.All)
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusListView {
|
StatusListView {
|
||||||
|
|
|
@ -5,13 +5,12 @@ import shared 1.0
|
||||||
QtObject {
|
QtObject {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property bool hideReadNotifications: false
|
|
||||||
|
|
||||||
readonly property var activityCenterModuleInst: activityCenterModule
|
readonly property var activityCenterModuleInst: activityCenterModule
|
||||||
readonly property var activityCenterNotifications: activityCenterModuleInst.activityNotificationsModel
|
readonly property var activityCenterNotifications: activityCenterModuleInst.activityNotificationsModel
|
||||||
readonly property int unreadNotificationsCount: activityCenterModuleInst.unreadActivityCenterNotificationsCount
|
readonly property int unreadNotificationsCount: activityCenterModuleInst.unreadActivityCenterNotificationsCount
|
||||||
readonly property bool hasUnseenNotifications: activityCenterModuleInst.hasUnseenActivityCenterNotifications
|
readonly property bool hasUnseenNotifications: activityCenterModuleInst.hasUnseenActivityCenterNotifications
|
||||||
readonly property int activeNotificationGroup: activityCenterModuleInst.activeNotificationGroup
|
readonly property int activeNotificationGroup: activityCenterModuleInst.activeNotificationGroup
|
||||||
|
readonly property int activityCenterReadType: activityCenterModuleInst.activityCenterReadType
|
||||||
|
|
||||||
function markAllActivityCenterNotificationsRead() {
|
function markAllActivityCenterNotificationsRead() {
|
||||||
root.activityCenterModuleInst.markAllActivityCenterNotificationsRead()
|
root.activityCenterModuleInst.markAllActivityCenterNotificationsRead()
|
||||||
|
@ -40,4 +39,8 @@ QtObject {
|
||||||
function setActiveNotificationGroup(group) {
|
function setActiveNotificationGroup(group) {
|
||||||
root.activityCenterModuleInst.setActiveNotificationGroup(group)
|
root.activityCenterModuleInst.setActiveNotificationGroup(group)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setActivityCenterReadType(readType) {
|
||||||
|
root.activityCenterModuleInst.setActivityCenterReadType(readType)
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -639,6 +639,12 @@ QtObject {
|
||||||
ContactVerification = 10
|
ContactVerification = 10
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum ActivityCenterReadType {
|
||||||
|
Read = 1,
|
||||||
|
Unread = 2,
|
||||||
|
All = 3
|
||||||
|
}
|
||||||
|
|
||||||
readonly property int activityCenterMembershipStatusPending: 1
|
readonly property int activityCenterMembershipStatusPending: 1
|
||||||
readonly property int activityCenterMembershipStatusAccepted: 2
|
readonly property int activityCenterMembershipStatusAccepted: 2
|
||||||
readonly property int activityCenterMembershipStatusDeclined: 3
|
readonly property int activityCenterMembershipStatusDeclined: 3
|
||||||
|
|
Loading…
Reference in New Issue