Visibility setting for notification badge

I’m working on a social networking app and I want to display the number of notifications that logged-in user get as a badge in the menu icon.
image

I’ve created a collection called Notifications to handle different types of notifications and the number of new notifications is calculated using Custom Formula.

Notification Collection:

Notification Count using Custom Formula:

I want to control the visibility of the badge so that the badge is hidden when the count is zero, but I can’t do this because I can’t use Custom Formula in Visibility Control.

I’d be happy if someone tell me how do I realize or work around this…

Hi @Leo,

As an idea - you might want to create an additional property in Users collection, as number. Call it “Unread_notifications” and implement increase/decrease logic, when user reads notification. Then you can use “sometimes visible” based on this property.

Another idea is based on the ability to use “sometimes visible” settings based on math operation with numeric properties. One can use “sum”, “count”, “max”, “min”, etc. So you add a numeric property for notifications collection; set it to 1 for the unread notification, and 0 - to read. Then the sum of property’s values will be the number of unread notifications. And you can use this property in visibility settings.
I didn’t try this logic personally :slight_smile:

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.