Skip to content

Conversation

@GhanshyamJha05
Copy link

@GhanshyamJha05 GhanshyamJha05 commented Jan 22, 2026

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

  • Verified logic priorities: description -> metadata.comment -> (none).
  • Verified cross-platform parity (Android & iOS).
  • 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.

@rolznz rolznz requested a review from im-adithya January 23, 2026 02:58
@rolznz
Copy link
Contributor

rolznz commented Jan 23, 2026

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Jan 23, 2026

✅ 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
Copy link

coderabbitai bot commented Jan 23, 2026

📝 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 docstrings

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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@assets/android/MessagingService.kt`:
- Around line 163-166: The description extraction sets descriptionText from
notification.optString("description", "") but doesn't handle JSONObject.NULL or
whitespace; change the logic around descriptionText (and the fallback from
notification.optJSONObject("metadata")?.optString("comment", "")) to treat
values that are null, the literal string "null", or blank (use isBlank()) as
empty and therefore trigger the fallback; ensure you check both the initial
optString result and the metadata comment result before assigning/using
descriptionText.

@GhanshyamJha05
Copy link
Author

Sir review the changes please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants