diff --git a/push_notifications.py b/home/zulip/deployments/current/zerver/lib/push_notifications.py index 7023639..9c08d8f 100644 --- a/push_notifications.py +++ b/home/zulip/deployments/current/zerver/lib/push_notifications.py @@ -1042,10 +1042,14 @@ def get_apns_alert_subtitle( def get_apns_badge_count( user_profile: UserProfile, read_messages_ids: Optional[Sequence[int]] = [] ) -> int: - # NOTE: We have temporarily set get_apns_badge_count to always - # return 0 until we can debug a likely mobile app side issue with - # handling notifications while the app is open. - return 0 + # The iOS mobile app does not keep a correct badge count after the app is opened, + # but will show the correct value when the push notfication is received. Issue + # number https://github.com/zulip/zulip-mobile/issues/438 + return ( + UserMessage.objects.filter(user_profile=user_profile) + .extra(where=[UserMessage.where_unread()]) + .count() + ) def get_apns_badge_count_future(