feat: use metadata.comment as fallback for push notification description
Description
This PR closes issue #424 by adding a fallback to metadata.comment when the invoice description (memo) is empty in push notifications.
Changes
π€ Android
- Updated assets/android/MessagingService.kt to extract and use
commentfrom themetadataobject if the primarydescriptionfield is empty. - Uses safe JSON parsing (
optJSONObject) to ensure stability.
π iOS
- Updated assets/ios/NotificationService.m to check
notificationDict[@"metadata"][@"comment"]ifdescriptionTextis missing. - Includes type checks (
isKindOfClass:[NSDictionary class]) to prevent crashes with unexpected payloads.
Rationale
Currently, push notifications for payments (sent/received/held) only display the amount if the invoice memo is empty, even if a payment comment exists. This change ensures that relevant context provided in the comment is visible to the user immediately. This behavior now matches the existing logic in the app's internal transaction history list (TransactionItem.tsx).
Verification
- [x] Verified logic priorities:
description->metadata.comment-> (none). - [x] Verified cross-platform parity (Android & iOS).
- [x] Verified null-safety for cases where
metadatais missing.
Summary by CodeRabbit
- Bug Fixes
- Notifications now use a fallback description sourced from metadata when the primary description is missing, empty, or invalid. This ensures notification text consistently displays relevant content on both Android and iOS.
βοΈ Tip: You can customize this high-level summary in your review settings.
@coderabbitai review
Review triggered. Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.β
Actions performed
[!WARNING]
Review limit reached
@im-adithya, we couldn't start this review because you've reached your PR review rate limit.More reviews will be available in 10 minutes and 39 seconds. Learn how PR review limits work.
Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running β you're only billed for reviews past your plan's rate limits ($0.25/file).
β How to resolve this issue?
After more reviews become available, a review can be triggered using the
@coderabbitai reviewcommand as a PR comment. Alternatively, push new commits to this PR.To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.
π¦ How do rate limits work?
CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.
For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.
Please see our Fair Usage Limits Policy for further information.
βΉοΈ Review info
βοΈ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID:
edd92fad-260a-4f7f-9a57-be8f8eb64ac6π₯ Commits
Reviewing files that changed from the base of the PR and between aa24cc13de25239e56ad3becf3c9255e7a4595ff and c6f84face7c03ae456cd05359ab89ecd069217b8.
π Files selected for processing (1)
assets/android/MessagingService.kt
π Walkthrough
Walkthrough
Both Android and iOS notification services now use a fallback: if the primary description is empty or not a valid string, the code pulls description text from the notification's metadata comment field without changing public signatures or downstream formatting logic.
Changes
| Cohort / File(s) | Summary |
|---|---|
Notification Description Fallback assets/android/MessagingService.kt, assets/ios/NotificationService.m |
Added fallback logic to set descriptionText from notification.metadata.comment (or notificationDict[@"metadata"][@"comment"]) when the primary description is blank or invalid; preserved existing hasDescription and notification assembly flow. |
Estimated code review effort
π― 2 (Simple) | β±οΈ ~10 minutes
Poem
π° I nibble through lines where descriptions hide,
If empty, I peek where metadata resides,
From Kotlin to ObjβC I scurry and bind,
A hiccup fixed, one comment to find! π₯
π₯ Pre-merge checks | β 2 | β 1
β Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | β οΈ Warning | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. | Write docstrings for the functions missing them to satisfy the coverage threshold. |
β Passed checks (2 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | β Passed | Check skipped - CodeRabbitβs high-level summary is enabled. |
| Title check | β Passed | The title accurately describes the main change: adding metadata.comment as a fallback for push notification descriptions across Android and iOS platforms. |
βοΈ Tip: You can configure your own custom pre-merge checks in the settings.
β¨ Finishing Touches
π§ͺ Generate unit tests (beta)
- [ ] Create PR with unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
Sir review the changes please