go icon indicating copy to clipboard operation
go copied to clipboard

feat: use metadata.comment as fallback for push notification description

Open GhanshyamJha05 opened this issue 10 months ago β€’ 4 comments

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 comment from the metadata object if the primary description field is empty.
  • Uses safe JSON parsing (optJSONObject) to ensure stability.

🍎 iOS

  • Updated assets/ios/NotificationService.m to check notificationDict[@"metadata"][@"comment"] if descriptionText is 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 metadata is 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.

GhanshyamJha05 avatar Jan 22 '26 14:01 GhanshyamJha05

@coderabbitai review

rolznz avatar Jan 23 '26 03:01 rolznz

βœ… Actions performed

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.

coderabbitai[bot] avatar Jan 23 '26 03:01 coderabbitai[bot]

[!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 review command 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.

❀️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Jan 23 '26 03:01 coderabbitai[bot]

Sir review the changes please

GhanshyamJha05 avatar Feb 01 '26 12:02 GhanshyamJha05