Skip to content

Conversation

@grunch
Copy link
Member

@grunch grunch commented Jul 10, 2025

  • Add app_links dependency for cross-platform deep link handling
  • Configure Android intent filters and iOS URL schemes for nostr: protocol
  • Implement NIP-19 nevent decoding with TLV parsing in NostrUtils
  • Add DeepLinkService for processing nostr: URLs and order resolution
  • Create DeepLinkHandler for app integration and navigation
  • Extend NostrService with event fetching by ID from specified relays
  • Add automatic relay management for nevent-specified relays
  • Implement proper order type detection and route navigation
  • Support navigation to /take_sell/:orderId and /take_buy/:orderId based on order type
  • Add comprehensive error handling and user feedback
  • Include tests for nevent decoding functionality

This enables decentralized order discovery through nostr: links that contain NIP-19 nevent references to order events, allowing users to share and access orders across different clients and platforms.

Summary by CodeRabbit

  • New Features

    • Added support for deep linking using the "nostr:" URI scheme on Android and iOS.
    • Incoming "nostr:" links are processed to fetch order details and navigate to the appropriate screens.
    • Introduced a deep link handler with user feedback for loading and error states.
  • Bug Fixes

    • Improved decoding of bech32 strings for accurate data extraction.
  • Tests

    • Added unit tests for Nostr event decoding and URL validation utilities.
  • Chores

    • Added the app_links dependency to enable deep link handling.

- Add app_links dependency for cross-platform deep link handling
- Configure Android intent filters and iOS URL schemes for nostr: protocol
- Implement NIP-19 nevent decoding with TLV parsing in NostrUtils
- Add DeepLinkService for processing nostr: URLs and order resolution
- Create DeepLinkHandler for app integration and navigation
- Extend NostrService with event fetching by ID from specified relays
- Add automatic relay management for nevent-specified relays
- Implement proper order type detection and route navigation
- Support navigation to /take_sell/:orderId and /take_buy/:orderId based on order type
- Add comprehensive error handling and user feedback
- Include tests for nevent decoding functionality

This enables decentralized order discovery through nostr: links that contain
NIP-19 nevent references to order events, allowing users to share and access
orders across different clients and platforms.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 10, 2025

Walkthrough

This change implements deep linking support for the "nostr:" URI scheme across Android and iOS. It introduces platform-specific manifest updates, a new deep link handler, a deep link service for parsing and processing NIP-19/NIP-69 events, utility methods for nevent decoding, and unit tests. The app now navigates to order screens based on incoming nostr links.

Changes

Files / Areas Change Summary
android/app/src/main/AndroidManifest.xml, ios/Runner/Info.plist Added intent filter (Android) and URL scheme (iOS) for "nostr" deep linking
pubspec.yaml Added app_links dependency for deep link handling
lib/core/app.dart Integrated GoRouter instance caching, deep link handler lifecycle, and router-based navigation
lib/core/deep_link_handler.dart Added new DeepLinkHandler class for initializing, processing, and disposing deep link flows
lib/services/deep_link_service.dart Introduced DeepLinkService, OrderInfo, DeepLinkResult, and provider for deep link parsing/navigation
lib/services/nostr_service.dart Added methods for fetching/parsing NIP-69 order events and extracting order info from events
lib/shared/utils/nostr_utils.dart Added nevent decoding, nostr URL validation/parsing, and fixed bech32 decode index
test/utils/nostr_utils_test.dart Added unit tests for nevent decoding and nostr URL parsing
lib/features/key_manager/key_management_screen.dart Minor formatting improvements without functional changes

Sequence Diagram(s)

sequenceDiagram
    participant OS as Mobile OS
    participant App as Mostro App
    participant DeepLinkHandler
    participant DeepLinkService
    participant NostrService
    participant Router as GoRouter

    OS->>App: Launch app via nostr: URI
    App->>DeepLinkHandler: initialize()
    DeepLinkHandler->>DeepLinkService: listen for deep links
    DeepLinkService-->>DeepLinkHandler: emits nostr: link
    DeepLinkHandler->>DeepLinkService: processNostrLink(url, NostrService)
    DeepLinkService->>NostrService: fetchOrderInfoByEventId(eventId, relays)
    NostrService-->>DeepLinkService: OrderInfo (id, type)
    DeepLinkService-->>DeepLinkHandler: DeepLinkResult.success(OrderInfo)
    DeepLinkHandler->>Router: navigateToOrder(OrderInfo)
    Router-->>App: Navigates to order screen
Loading

Possibly related issues

Suggested reviewers

  • chebizarro

Poem

🥕
A nostr link comes hopping in,
Through relays, tags, and bech32 spin.
The app now wakes with ears alert—
Decodes the link, does not avert!
Orders fetched, screens appear,
Deep linking magic, crystal clear.
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5273143 and 40815de.

📒 Files selected for processing (1)
  • test/mocks.mocks.dart (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • test/mocks.mocks.dart
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@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: 9

🧹 Nitpick comments (1)
lib/services/nostr_service.dart (1)

360-367: Simplify temporary settings creation.

You can use the copyWith pattern or spread operator to make this more maintainable.

Consider adding a copyWith method to the Settings class:

final tempSettings = settings.copyWith(relays: allRelays);

Or if Settings is a data class, you could use:

final tempSettings = Settings(
  ...settings,
  relays: allRelays,
);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0cd718a and 290170e.

⛔ Files ignored due to path filters (1)
  • pubspec.lock is excluded by !**/*.lock
📒 Files selected for processing (9)
  • android/app/src/main/AndroidManifest.xml (1 hunks)
  • ios/Runner/Info.plist (1 hunks)
  • lib/core/app.dart (5 hunks)
  • lib/core/deep_link_handler.dart (1 hunks)
  • lib/services/deep_link_service.dart (1 hunks)
  • lib/services/nostr_service.dart (2 hunks)
  • lib/shared/utils/nostr_utils.dart (1 hunks)
  • pubspec.yaml (1 hunks)
  • test/utils/nostr_utils_test.dart (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
`**/*.dart`: Remove unused imports and dependencies Use `const` constructors where possible

**/*.dart: Remove unused imports and dependencies
Use const constructors where possible

📄 Source: CodeRabbit Inference Engine (CLAUDE.md)

List of files the instruction was applied to:

  • test/utils/nostr_utils_test.dart
  • lib/core/deep_link_handler.dart
  • lib/core/app.dart
  • lib/services/deep_link_service.dart
  • lib/shared/utils/nostr_utils.dart
  • lib/services/nostr_service.dart
`lib/**/*.dart`: Use `S.of(context).yourKey` for all user-facing strings

lib/**/*.dart: Use S.of(context).yourKey for all user-facing strings

📄 Source: CodeRabbit Inference Engine (CLAUDE.md)

List of files the instruction was applied to:

  • lib/core/deep_link_handler.dart
  • lib/core/app.dart
  • lib/services/deep_link_service.dart
  • lib/shared/utils/nostr_utils.dart
  • lib/services/nostr_service.dart
🧠 Learnings (7)
pubspec.yaml (1)
Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-08T17:55:04.549Z
Learning: Applies to **/*.dart : Remove unused imports and dependencies
test/utils/nostr_utils_test.dart (4)
Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-08T17:55:04.549Z
Learning: Applies to lib/data/models/nostr_event.dart : Custom `timeAgoWithLocale()` method is implemented in NostrEvent extension
Learnt from: chebizarro
PR: MostroP2P/mobile#74
File: lib/services/nostr_service.dart:3-4
Timestamp: 2025-05-06T15:46:08.942Z
Learning: The file in dart_nostr library is named "ease.dart" (not "eose.dart" as might be expected), as confirmed by the project maintainer.
Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-08T17:55:04.549Z
Learning: Applies to test/mocks.dart : Mocks are generated using Mockito in `test/mocks.dart`
Learnt from: chebizarro
PR: MostroP2P/mobile#74
File: lib/services/mostro_service.dart:70-76
Timestamp: 2025-05-06T15:49:26.443Z
Learning: In the Mostro Mobile codebase, `eventStorageProvider` is exported from `package:mostro_mobile/shared/providers/mostro_service_provider.dart` and not from a separate `event_storage_provider.dart` file.
lib/core/deep_link_handler.dart (1)
Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-08T17:55:04.549Z
Learning: Use Riverpod for all state management
lib/core/app.dart (10)
Learnt from: chebizarro
PR: MostroP2P/mobile#74
File: lib/services/mostro_service.dart:70-76
Timestamp: 2025-05-06T15:49:26.443Z
Learning: In the Mostro Mobile codebase, Riverpod code generation is used with `@Riverpod` annotations. Providers like `eventStorageProvider` are generated in `.g.dart` files from annotated functions in the main provider files. These providers are accessible by importing the main provider file (e.g., `mostro_service_provider.dart`), not by importing a separate provider file.
Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-08T17:55:04.549Z
Learning: Use Riverpod for all state management
Learnt from: chebizarro
PR: MostroP2P/mobile#74
File: lib/services/mostro_service.dart:70-76
Timestamp: 2025-05-06T15:49:26.443Z
Learning: In the Mostro Mobile codebase, `eventStorageProvider` is exported from `package:mostro_mobile/shared/providers/mostro_service_provider.dart` and not from a separate `event_storage_provider.dart` file.
Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-08T17:55:04.549Z
Learning: Applies to lib/**/*.dart : Use `S.of(context).yourKey` for all user-facing strings
Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-08T17:55:04.549Z
Learning: Applies to lib/main.dart : Locales for the timeago package are configured in `main.dart` with `timeago.setLocaleMessages()`
Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-08T17:55:04.549Z
Learning: Applies to **/*.dart : Remove unused imports and dependencies
Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-08T17:55:04.549Z
Learning: Regenerate localization files after ARB modifications by running `dart run build_runner build -d`
Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-08T17:55:04.549Z
Learning: Target zero `flutter analyze` issues
Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-08T17:55:04.549Z
Learning: Applies to test/mocks.dart : Mocks are generated using Mockito in `test/mocks.dart`
Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-08T17:55:04.549Z
Learning: Pass BuildContext to methods that need localization
lib/services/deep_link_service.dart (3)
Learnt from: chebizarro
PR: MostroP2P/mobile#74
File: lib/services/mostro_service.dart:70-76
Timestamp: 2025-05-06T15:49:26.443Z
Learning: In the Mostro Mobile codebase, Riverpod code generation is used with `@Riverpod` annotations. Providers like `eventStorageProvider` are generated in `.g.dart` files from annotated functions in the main provider files. These providers are accessible by importing the main provider file (e.g., `mostro_service_provider.dart`), not by importing a separate provider file.
Learnt from: chebizarro
PR: MostroP2P/mobile#74
File: lib/services/mostro_service.dart:70-76
Timestamp: 2025-05-06T15:49:26.443Z
Learning: In the Mostro Mobile codebase, `eventStorageProvider` is exported from `package:mostro_mobile/shared/providers/mostro_service_provider.dart` and not from a separate `event_storage_provider.dart` file.
Learnt from: chebizarro
PR: MostroP2P/mobile#110
File: test/notifiers/take_order_notifier_test.dart:72-74
Timestamp: 2025-06-04T19:35:20.209Z
Learning: MostroService methods like takeBuyOrder() and takeSellOrder() return Future<void> and trigger side effects through other mechanisms rather than direct return values. When testing these methods, focus on verifying method calls and testing state changes through the provider system rather than mocking return values.
lib/shared/utils/nostr_utils.dart (2)
Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-08T17:55:04.549Z
Learning: Applies to lib/data/models/nostr_event.dart : Custom `timeAgoWithLocale()` method is implemented in NostrEvent extension
Learnt from: chebizarro
PR: MostroP2P/mobile#74
File: lib/notifications/notification_service.dart:54-59
Timestamp: 2025-05-08T16:31:29.582Z
Learning: In the Nostr protocol, event.id will never be null in events returned by relay subscriptions, so null safety checks for this property are unnecessary.
lib/services/nostr_service.dart (6)
Learnt from: chebizarro
PR: MostroP2P/mobile#74
File: lib/notifications/notification_service.dart:54-59
Timestamp: 2025-05-08T16:31:29.582Z
Learning: In the Nostr protocol, event.id will never be null in events returned by relay subscriptions, so null safety checks for this property are unnecessary.
Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-08T17:55:04.549Z
Learning: Applies to lib/data/models/nostr_event.dart : Custom `timeAgoWithLocale()` method is implemented in NostrEvent extension
Learnt from: chebizarro
PR: MostroP2P/mobile#110
File: test/notifiers/take_order_notifier_test.dart:72-74
Timestamp: 2025-06-04T19:35:20.209Z
Learning: MostroService methods like takeBuyOrder() and takeSellOrder() return Future<void> and trigger side effects through other mechanisms rather than direct return values. When testing these methods, focus on verifying method calls and testing state changes through the provider system rather than mocking return values.
Learnt from: chebizarro
PR: MostroP2P/mobile#127
File: lib/features/order/notfiers/abstract_mostro_notifier.dart:45-54
Timestamp: 2025-06-26T15:03:23.529Z
Learning: In AbstractMostroNotifier, state updates occur for all messages regardless of timestamp to hydrate the OrderNotifier from MostroStorage during sync, while handleEvent is only called for recent messages (within 60 seconds) to prevent re-triggering side effects like notifications and navigation for previously handled messages. This design prevents displaying stale notifications when the app is reopened or brought to the foreground.
Learnt from: chebizarro
PR: MostroP2P/mobile#74
File: lib/services/mostro_service.dart:70-76
Timestamp: 2025-05-06T15:49:26.443Z
Learning: In the Mostro Mobile codebase, `eventStorageProvider` is exported from `package:mostro_mobile/shared/providers/mostro_service_provider.dart` and not from a separate `event_storage_provider.dart` file.
Learnt from: chebizarro
PR: MostroP2P/mobile#127
File: lib/data/models/cant_do.dart:10-27
Timestamp: 2025-07-08T05:40:47.527Z
Learning: In the CantDo model parsing in lib/data/models/cant_do.dart, the inconsistent key naming between 'cant_do' (top-level) and 'cant-do' (nested) is required by the protocol specification and should not be changed as it would break message parsing compatibility.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (9)
ios/Runner/Info.plist (1)

56-69: LGTM! Proper iOS deep linking configuration.

The URL scheme configuration is correctly implemented following iOS standards. The use of "Editor" role is appropriate for handling nostr URLs.

android/app/src/main/AndroidManifest.xml (1)

27-34: LGTM! Proper Android deep linking configuration.

The intent filter is correctly configured for handling nostr URLs. The autoVerify="true" attribute enables automatic verification of app links.

test/utils/nostr_utils_test.dart (1)

1-35: LGTM! Comprehensive test coverage for NostrUtils.

The test file provides good coverage of the NostrUtils functionality with appropriate test cases for:

  • Nevent decoding with validation of structure and content
  • URL validation
  • URL parsing with result verification

The hardcoded test data is appropriate for unit testing and the assertions verify both structure and expected values.

lib/core/app.dart (1)

84-84: LGTM! Router caching improves performance.

Caching the router instance prevents unnecessary recreation on each build, which is a good performance optimization.

lib/shared/utils/nostr_utils.dart (2)

104-104: Good fix for the bech32 decoding index.

The correction to use result[0] aligns with the comment indicating it returns the data part.


111-170: Well-implemented NIP-19 nevent decoding with proper TLV parsing.

The implementation correctly handles:

  • Format validation
  • TLV structure parsing
  • Event ID extraction (32 bytes)
  • Multiple relay URLs
  • Comprehensive error handling
lib/services/deep_link_service.dart (1)

69-108: Good error handling and separation of concerns.

The processNostrLink method properly validates input, handles errors gracefully, and returns structured results.

lib/services/nostr_service.dart (2)

200-256: Well-structured event fetching with proper validation.

The method correctly:

  • Validates the Nostr service initialization
  • Filters for NIP-69 order events (kind 38383)
  • Validates event source against configured Mostro public key
  • Handles both specific and default relay scenarios

383-390: Excellent error handling with settings restoration.

The implementation ensures original relay settings are restored even if an error occurs during fetching. This prevents leaving the service in an inconsistent state.

grunch added 5 commits July 10, 2025 13:48
- Fix curly braces requirement for if statement in key management screen
- Update app_links dependency to version 6.4.0 for improved compatibility
- Format all Dart files according to standard style guidelines
- Update localization files with proper formatting
- Ensure consistent code style across the project
flag changed to false, the default value (true) can break third-party plugins like app_links
- Convert static class to instance-based service with dependency injection
- Add constructor that accepts Ref parameter for accessing providers
- Remove static keywords from all fields and methods
- Create deepLinkHandlerProvider with automatic disposal handling
- Update app.dart to use provider instead of static calls
- Improve testability and align with Riverpod patterns
- Maintain clean lifecycle management through ref.onDispose
- Refactor DeepLinkService from static to instance-based implementation
- Add proper error handling to deep link initialization in app.dart
- Implement localized error messages for deep link operations
- Fix BuildContext async usage warnings in DeepLinkHandler
- Add retry mechanism for failed deep link initialization
- Align service architecture with Riverpod dependency injection patterns

Features:
- New localization keys: unsupportedLinkFormat, failedToOpenLink, failedToLoadOrder, failedToOpenOrder
- Instance-based DeepLinkService with proper disposal through provider
- Enhanced error handling and logging for deep link operations
- Improved code maintainability and testability
Copy link
Contributor

@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: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9e50323 and 5273143.

📒 Files selected for processing (8)
  • lib/core/app.dart (5 hunks)
  • lib/core/deep_link_handler.dart (1 hunks)
  • lib/l10n/intl_en.arb (1 hunks)
  • lib/l10n/intl_es.arb (1 hunks)
  • lib/l10n/intl_it.arb (1 hunks)
  • lib/services/deep_link_service.dart (1 hunks)
  • test/mocks.mocks.dart (1 hunks)
  • test/services/mostro_service_test.mocks.dart (4 hunks)
✅ Files skipped from review due to trivial changes (1)
  • test/mocks.mocks.dart
🚧 Files skipped from review as they are similar to previous changes (4)
  • lib/l10n/intl_en.arb
  • lib/core/app.dart
  • lib/core/deep_link_handler.dart
  • lib/services/deep_link_service.dart
🧰 Additional context used
📓 Path-based instructions (3)
`**/*.dart`: Remove unused imports and dependencies Use `const` constructors where possible

**/*.dart: Remove unused imports and dependencies
Use const constructors where possible

📄 Source: CodeRabbit Inference Engine (CLAUDE.md)

List of files the instruction was applied to:

  • test/services/mostro_service_test.mocks.dart
`lib/l10n/intl_{en,es,it}.arb`: Add new localization keys to all three ARB files (en, es, it)

lib/l10n/intl_{en,es,it}.arb: Add new localization keys to all three ARB files (en, es, it)

📄 Source: CodeRabbit Inference Engine (CLAUDE.md)

List of files the instruction was applied to:

  • lib/l10n/intl_es.arb
  • lib/l10n/intl_it.arb
`lib/l10n/*.arb`: Use proper ARB metadata for strings with parameters

lib/l10n/*.arb: Use proper ARB metadata for strings with parameters

📄 Source: CodeRabbit Inference Engine (CLAUDE.md)

List of files the instruction was applied to:

  • lib/l10n/intl_es.arb
  • lib/l10n/intl_it.arb
🧠 Learnings (3)
test/services/mostro_service_test.mocks.dart (9)
Learnt from: chebizarro
PR: MostroP2P/mobile#110
File: test/notifiers/take_order_notifier_test.dart:72-74
Timestamp: 2025-06-04T19:35:20.209Z
Learning: MostroService methods like takeBuyOrder() and takeSellOrder() return Future<void> and trigger side effects through other mechanisms rather than direct return values. When testing these methods, focus on verifying method calls and testing state changes through the provider system rather than mocking return values.
Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-08T17:55:04.549Z
Learning: Applies to test/mocks.dart : Mocks are generated using Mockito in `test/mocks.dart`
Learnt from: chebizarro
PR: MostroP2P/mobile#74
File: lib/services/mostro_service.dart:70-76
Timestamp: 2025-05-06T15:49:26.443Z
Learning: In the Mostro Mobile codebase, `eventStorageProvider` is exported from `package:mostro_mobile/shared/providers/mostro_service_provider.dart` and not from a separate `event_storage_provider.dart` file.
Learnt from: chebizarro
PR: MostroP2P/mobile#127
File: lib/features/order/notfiers/abstract_mostro_notifier.dart:45-54
Timestamp: 2025-06-26T15:03:23.529Z
Learning: In AbstractMostroNotifier, state updates occur for all messages regardless of timestamp to hydrate the OrderNotifier from MostroStorage during sync, while handleEvent is only called for recent messages (within 60 seconds) to prevent re-triggering side effects like notifications and navigation for previously handled messages. This design prevents displaying stale notifications when the app is reopened or brought to the foreground.
Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-08T17:55:04.549Z
Learning: Applies to lib/data/models/nostr_event.dart : Custom `timeAgoWithLocale()` method is implemented in NostrEvent extension
Learnt from: chebizarro
PR: MostroP2P/mobile#74
File: lib/notifications/notification_service.dart:54-59
Timestamp: 2025-05-08T16:31:29.582Z
Learning: In the Nostr protocol, event.id will never be null in events returned by relay subscriptions, so null safety checks for this property are unnecessary.
Learnt from: chebizarro
PR: MostroP2P/mobile#74
File: lib/services/mostro_service.dart:70-76
Timestamp: 2025-05-06T15:49:26.443Z
Learning: In the Mostro Mobile codebase, Riverpod code generation is used with `@Riverpod` annotations. Providers like `eventStorageProvider` are generated in `.g.dart` files from annotated functions in the main provider files. These providers are accessible by importing the main provider file (e.g., `mostro_service_provider.dart`), not by importing a separate provider file.
Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-08T17:55:04.549Z
Learning: Use Riverpod for all state management
Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-08T17:55:04.549Z
Learning: Applies to **/*.dart : Remove unused imports and dependencies
lib/l10n/intl_es.arb (4)
Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-08T17:55:04.549Z
Learning: Applies to lib/l10n/intl_{en,es,it}.arb : Add new localization keys to all three ARB files (en, es, it)
Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-08T17:55:04.549Z
Learning: Applies to lib/l10n/*.arb : Use proper ARB metadata for strings with parameters
Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-08T17:55:04.549Z
Learning: Test localization changes in all supported languages
Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-08T17:55:04.549Z
Learning: Regenerate localization files after ARB modifications by running `dart run build_runner build -d`
lib/l10n/intl_it.arb (2)
Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-08T17:55:04.549Z
Learning: Applies to lib/l10n/intl_{en,es,it}.arb : Add new localization keys to all three ARB files (en, es, it)
Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-08T17:55:04.549Z
Learning: Applies to lib/l10n/*.arb : Use proper ARB metadata for strings with parameters
🪛 RuboCop (1.75.5)
lib/l10n/intl_es.arb

[warning] 415-415: Duplicated key in hash literal.

(Lint/DuplicateHashKey)

lib/l10n/intl_it.arb

[warning] 415-415: Duplicated key in hash literal.

(Lint/DuplicateHashKey)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (7)
test/services/mostro_service_test.mocks.dart (4)

13-20: Import updates look good for deep link functionality.

The new imports properly support the deep link functionality with consistent alias usage throughout the file.


409-423: New mock method for event fetching is well-implemented.

The fetchEventById method mock correctly returns Future<Order?> and accepts optional relay specification, which aligns with the deep link processing requirements.


445-445: Import alias updates are correctly applied.

The MockSessionNotifier class and its methods have been properly updated to use the new import aliases (_i12, _i13, _i14) consistently throughout the file.

Also applies to: 527-527, 657-657


425-439: OrderInfo definition verified

The OrderInfo class is properly declared in lib/services/deep_link_service.dart with the expected fields and constructor. No further changes are needed.

lib/l10n/intl_it.arb (2)

414-414: LGTM - Deep link localization strings are well-crafted.

The Italian translations for the deep link functionality are clear and appropriate:

  • Loading state message is properly translated
  • Error messages are user-friendly and descriptive
  • No ARB metadata needed as these strings don't contain parameters

Also applies to: 416-419


414-419: All new deep link localization keys are present in all language files.

I’ve verified that the following keys are defined in lib/l10n/intl_en.arb, intl_es.arb, and intl_it.arb:

  • loadingOrder
  • unsupportedLinkFormat
  • failedToOpenLink
  • failedToLoadOrder
  • failedToOpenOrder

No further additions are needed.

lib/l10n/intl_es.arb (1)

414-414: Localization keys present in all ARB files

All new deep-link localization keys (loadingOrder, unsupportedLinkFormat, failedToOpenLink, failedToLoadOrder, failedToOpenOrder) are already added to:

  • lib/l10n/intl_en.arb
  • lib/l10n/intl_es.arb
  • lib/l10n/intl_it.arb

Please regenerate the localization outputs by running:

dart run build_runner build -d

This will update the generated files under lib/generated/. Do not edit those generated files manually—commit them once the build completes.

"chooseLanguageDescription": "Scegli la tua lingua preferita o usa il predefinito di sistema",
"done": "FATTO"
"loadingOrder": "Caricamento ordine...",
"done": "FATTO",
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix duplicate key definition.

The key "done" is already defined at line 131 with the value "Fatto", but it's being redefined here with "FATTO". This will cause the first definition to be overwritten.

Choose one of these solutions:

  1. Remove the duplicate entry if line 131's definition is sufficient
  2. Rename this key to something more specific like "deepLinkDone" if a different value is needed for deep link contexts
-  "done": "FATTO",
+  "deepLinkDone": "FATTO",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"done": "FATTO",
- "done": "FATTO",
+ "deepLinkDone": "FATTO",
🧰 Tools
🪛 RuboCop (1.75.5)

[warning] 415-415: Duplicated key in hash literal.

(Lint/DuplicateHashKey)

🤖 Prompt for AI Agents
In lib/l10n/intl_it.arb at line 415, there is a duplicate key "done" which is
already defined at line 131. To fix this, either remove the duplicate entry at
line 415 if the original value is sufficient, or rename the key at line 415 to a
more specific name like "deepLinkDone" if a different value is required for a
distinct context.

"chooseLanguageDescription": "Elige tu idioma preferido o usa el predeterminado del sistema",
"done": "HECHO"
"loadingOrder": "Cargando orden...",
"done": "HECHO",
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix duplicate key error.

The key "done" already exists at line 131 with value "Hecho". This duplicate key will cause issues and needs to be resolved.

Either remove this duplicate entry or rename it to a more specific key like "deepLinkDone" if it serves a different purpose in the deep link context.

-  "done": "HECHO",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"done": "HECHO",
"loadingOrder": "Cargando orden...",
- "done": "HECHO",
"unsupportedLinkFormat": "Formato de enlace no compatible",
"failedToOpenLink": "Error al abrir el enlace",
"failedToLoadOrder": "Error al cargar la orden",
"failedToOpenOrder": "Error al abrir la orden"
🧰 Tools
🪛 RuboCop (1.75.5)

[warning] 415-415: Duplicated key in hash literal.

(Lint/DuplicateHashKey)

🤖 Prompt for AI Agents
In lib/l10n/intl_es.arb at line 415, there is a duplicate key "done" which
already exists at line 131. To fix this, either remove the duplicate entry at
line 415 or rename it to a unique key such as "deepLinkDone" if it represents a
different context. Ensure no duplicate keys remain in the file to prevent
conflicts.

- Remove redundant 'must_be_immutable' ignore directive
- File-level ignore already covers this case
@grunch grunch merged commit 3bd8e00 into main Jul 10, 2025
2 checks passed
@grunch grunch deleted the feat/nostr-deep-link-support branch July 10, 2025 19:31
@coderabbitai coderabbitai bot mentioned this pull request Nov 10, 2025
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