Skip to content

Conversation

@chebizarro
Copy link
Contributor

@chebizarro chebizarro commented Jul 22, 2025

This PR fully implements the requested "Status" filter UI/UX for the "My Active Trades" screen as per #122, matching the provided design and improving usability for users managing multiple orders. The widget is now visually compact, aligned right, and easy to maintain or reuse elsewhere.

Summary by CodeRabbit

  • New Features

    • Added a status filter dropdown to the trades screen, allowing users to filter trades by their current status.
    • Introduced a new filter control in the header for easier access to trade status filtering.
    • Enhanced trade filtering logic to reflect real-time order states for more accurate status display.
    • Updated order list items to show user role (buying or selling) within sessions and adjusted navigation accordingly.
    • Added a new currency selection dialog for streamlined fiat currency choice in settings and order screens.
    • Replaced the previous currency selector with an improved dialog-based UI in settings.
  • Localization

    • Added new translations for status filter labels and trade statuses in English, Spanish, and Italian.
    • Improved formatting and readability of some existing localized strings.
  • Bug Fixes & Improvements

    • Refined error and loading states in trades screen for better user experience.
    • Updated currency selection to sync with user settings dynamically.

chebizarro and others added 30 commits July 2, 2025 13:44
  1. Added share_plus dependency to pubspec.yaml and ran flutter pub get
  2. Updated pay_lightning_invoice_widget.dart (around lines 57-61):
    - Removed the Text widget displaying the raw lightning invoice
    - Replaced it with a Row containing two buttons:
        - Copy button: Copies the invoice to clipboard and shows a snackbar notification
      - Share button: Uses the native share functionality to share the invoice with other apps
    - Removed the duplicate copy button that was previously below
    - Styled both buttons consistently with the existing design (green background, rounded
  corners, icons)
  3. Added required import for share_plus/share_plus.dart
…l button UI (fixes Show Cancel and Dispute buttons when counterparty opens a cooperative cancellation #126)
- Add complete Spanish translations (intl_es.arb) with 120+ keys
- Update English and Italian ARB files with new UI strings
- Replace hardcoded English strings with localized versions in:
  - Authentication screens (login, register, welcome)
  - Home screen (filters, empty states, navigation)
  - Trading screens (status labels, actions, details)
  - UI components and widgets
- Add automatic Spanish locale detection and fallback logic
- Include comprehensive language addition documentation
- Remove deprecated action_localizations.dart references

All user-facing text now properly supports English, Spanish, and Italian
with automatic device language detection and graceful fallbacks.
- Added 40+ new translation keys to support all remaining hardcoded strings
- Localized BUY/SELL buttons, order creation screens, and form validation
- Translated drawer menu items (Account, Settings, About, Walkthrough)
- Updated settings screen with complete Spanish localization
- Localized about screen with all instance details and app information
- Enhanced walkthrough screens with Spanish translations
- Fixed order list items to display localized timestamps and ratings
- Removed debug locale logging as requested
- Updated all ARB files (English, Spanish, Italian) with new translation keys
- Resolved compilation errors and optimized localization method calls
- Successfully tested build compilation
…ardcoded strings

This commit removes all remaining hardcoded English strings throughout the Flutter app and replaces them with proper localization keys, providing comprehensive Spanish translation support.

## Major Changes:

### Order Creation Forms (55+ strings localized)
- Amount entry forms with validation messages and hints
- Payment method selection dialogs and custom input fields
- Premium slider with tooltips and explanations
- Error handling and user feedback messages

### Account Management Screen (15+ strings localized)
- Secret word management and restoration instructions
- Privacy settings and controls
- Trade index counters and explanations
- Key import/export functionality with success/error messages

### Chat System (8+ strings localized)
- Chat room headers and empty state messages
- Message input placeholders and conversation info
- User handle display and shared key information
- Navigation elements ("BACK", "CHAT" labels)

### Trade Detail Actions (12+ strings localized)
- All action buttons: PAY INVOICE, ADD INVOICE, FIAT SENT, DISPUTE, RELEASE, TAKE SELL/BUY
- Order ID copy confirmation and trade cancellation dialogs
- Status messages and user instructions

### Technical Improvements:
- Fixed duplicate ARB keys by renaming button-specific keys (payInvoiceButton vs payInvoice)
- Added proper BuildContext parameters to methods requiring localization
- Resolved compilation errors with const widgets containing dynamic localization calls
- Updated documentation with comprehensive localization coverage details
- Added README reference to ADDING_NEW_LANGUAGE.md guide

### Files Modified:
- lib/l10n/intl_en.arb - Added 45+ new English localization keys
- lib/l10n/intl_es.arb - Added 45+ new Spanish translations
- lib/l10n/intl_it.arb - Added 45+ new Italian translations
- 9 Flutter widget/screen files updated with S.of(context) calls
- README.md and ADDING_NEW_LANGUAGE.md documentation enhanced

### Testing:
- Build compilation verified successfully
- All hardcoded strings replaced with localized equivalents
- No remaining English text in Spanish locale areas

The app now provides complete Spanish localization covering all user-facing strings, from basic navigation to complex order creation flows and account management features.
Fixed multiple duplicate localization keys in intl_es.arb that were causing
potential conflicts in the Spanish translation system:

Removed duplicates for:
- addRelay, cancel, cancelTrade, chat, confirm
- creatingNewOrder, discoverSecurePlatform, dispute
- done, easyOnboarding, enterSatsAmountBuy, enterSatsAmountSell
- fiatSent, guidedWalkthroughSimple, orderIdCopied
- seamlessPeerToPeer, settings, skip, tradeWithConfidence
- welcomeToMostroMobile

This ensures clean localization file structure and prevents any
translation key conflicts. Build verification completed successfully.
Fixed multiple duplicate localization keys in intl_it.arb that were repeating
entries already defined earlier in the file. Preserved original entries from
lines 59-158 and removed duplicates from lines 159-197.

Removed duplicates for:
- addRelay, cancel, cancelTrade, chat, confirm, creatingNewOrder
- discoverSecurePlatform, dispute, done, easyOnboarding
- enterSatsAmountBuy, enterSatsAmountSell, fiatSent
- guidedWalkthroughSimple, orderIdCopied, seamlessPeerToPeer
- settings, skip, tradeWithConfidence, welcomeToMostroMobile

This ensures clean Italian localization file structure with each key appearing
only once. JSON validation and build compilation verified successfully.
Fixed duplicate localization keys in intl_en.arb that were conflicting with
earlier definitions, specifically addressing:

Lines 159-161: Removed duplicate entries for:
- creatingNewOrder (conflicted with line 81)
- enterSatsAmountBuy (conflicted with line 82)
- enterSatsAmountSell (conflicted with line 83)

Line 169: Removed duplicate entry for:
- settings (conflicted with line 93)

Lines 189-197: Removed duplicate entries for:
- welcomeToMostroMobile (conflicted with line 111)
- discoverSecurePlatform, easyOnboarding, guidedWalkthroughSimple
- tradeWithConfidence, seamlessPeerToPeer (conflicted with lines 112-116)
- skip, done (conflicted with lines 117-118)
- addRelay (conflicted with line 99)

Also removed additional duplicate keys throughout the file:
- cancel, confirm, chat, fiatSent, dispute, cancelTrade, orderIdCopied

This ensures Flutter's localization generation works correctly by preventing
key overwrites and maintaining clean ARB structure. All original key
definitions from lines 81-118 are preserved.
…ings

- Add 73 new localization keys to English, Spanish, and Italian ARB files
- Replace all hardcoded strings in 8 critical widget files:
  * Currency selection and order creation screens
  * Payment and invoice handling widgets
  * Trade detail and rating screens
  * Navigation and button labels
- Add proper ARB metadata for parameterized strings
- Fix type conversion issue in home_screen.dart (offersCount)
- Ensure all localization method calls have proper BuildContext
- Validate JSON syntax and build compilation

Now Spanish users see native translations like:
- "Selecciona la moneda fiat..." → "Select the fiat currency..."
- "CERRAR/TOMAR" → "CLOSE/TAKE"
- "Pagar Factura Lightning" → "Pay Lightning Invoice"

Italian users see native translations like:
- "Seleziona la valuta fiat..." → "Select the fiat currency..."
- "CHIUDI/PRENDI" → "CLOSE/TAKE"
- "Paga Fattura Lightning" → "Pay Lightning Invoice"
Fix timeLeft showing function closure instead of proper text by changing from string interpolation to proper method call with parameter.

Changed: '${S.of(context)\!.timeLeft}: ${time}'
To: S.of(context)\!.timeLeft(time)
- Add timeAgoWithLocale method to NostrEvent extension that accepts locale parameter
- Update order list item to use app's current locale instead of device locale
- Ensure Spanish "hace X horas" displays correctly instead of English "hours ago"
- Modify _timeAgo method to support locale parameter with Spanish fallback

Resolves issue where timeago package was using device locale instead of app locale.
- Remove unused imports and fields (dart:ui, flutter/material, _settings, _formatPaymentMethods)
- Replace deprecated withOpacity() with withValues(alpha:) across all files
- Replace deprecated WillPopScope with PopScope in custom_drawer_overlay.dart
- Add proper mounted checks for BuildContext usage after async operations
- Fix constructor immutability in WalkthroughScreen
- Remove duplicate ignore directive in test mocks
- Add ignore comments for unused test variables

Reduces Flutter analyze issues from 54 to 2 (remaining are false positives with proper mounted checks)
Add ignore comments for properly guarded BuildContext usage in pay_lightning_invoice_widget.dart.
These warnings were false positives as the code already has proper mounted checks.

Now achieves zero Flutter analyze issues.
Add detailed project documentation including:
- Architecture overview and development commands
- Internationalization system and best practices
- Code quality standards and git workflow
- Recent work context and key file locations
- User preferences and working style guidelines

This file provides complete context for future development sessions.
@chebizarro chebizarro requested a review from Catrya July 22, 2025 06:41
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 22, 2025

Walkthrough

A status filter feature for trades was implemented, including a new provider for the selected status, UI components for status selection, and localization updates in English, Spanish, and Italian. The trades list now supports dynamic filtering by status, and a dropdown filter control appears in the trades screen header. Additionally, session-aware labeling and navigation were added to order list items, and the currency selection UI was refactored to use a centralized dialog synced with app settings. Order state status mappings were extended, and session provider logic was simplified.

Changes

File(s) Change Summary
lib/features/trades/providers/trades_provider.dart Added statusFilterProvider; introduced filteredTradesWithOrderStateProvider using reactive OrderState status filtering; deprecated original filtered provider with simplified logic.
lib/features/trades/screens/trades_screen.dart Updated to use new filtered trades provider; replaced header text with a row containing title and StatusFilterWidget; restyled container and error/loading UI.
lib/features/trades/widgets/status_filter_widget.dart Added new StatusFilterWidget for selecting and displaying the trade status filter with localized labels and popup menu.
lib/l10n/intl_en.arb, lib/l10n/intl_es.arb, lib/l10n/intl_it.arb Added localization keys for status filter and statuses; removed "myActiveTrades" key; minor formatting and whitespace changes.
ADDING_NEW_LANGUAGE.md Updated example translation key from "myActiveTrades" to "myTrades" in French example snippet.
lib/features/home/providers/home_order_providers.dart Removed session filtering from orders; simplified filtering to only pending orders by type, sorted by expiration.
lib/features/home/widgets/order_list_item.dart Added session-aware order label ("YOU ARE BUYING"/"YOU ARE SELLING") and conditional navigation to trade detail based on session role.
lib/features/order/models/order_state.dart Extended _getStatusFromAction to map additional actions to order statuses; improved readability in updateWith method.
lib/features/order/widgets/currency_section.dart Replaced inline currency selection dialog with call to new centralized CurrencySelectionDialog; synchronized selection with settings.
lib/features/settings/settings_screen.dart Replaced CurrencyComboBox with new _buildCurrencySelector method using CurrencySelectionDialog; handles loading/error/data states.
lib/shared/providers/exchange_service_provider.dart Made selectedFiatCodeProvider reactive to user settings instead of fixed default 'USD'.
lib/shared/providers/session_notifier_provider.dart Changed sessionProvider to find session by filtering state list instead of calling notifier method.
lib/shared/widgets/currency_combo_box.dart Removed entire CurrencyComboBox widget class.
lib/shared/widgets/currency_selection_dialog.dart Added new CurrencySelectionDialog widget with search, selection, and async loading of currencies.
.github/workflows/flutter.yml Updated Flutter version from 3.32.4 to 3.32.5 in CI workflow.
lib/services/lifecycle_manager.dart Updated provider invalidation on app foreground to use new filtered trades provider.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant TradesScreen
    participant StatusFilterWidget
    participant TradesProvider

    User->>TradesScreen: Opens Trades Screen
    TradesScreen->>StatusFilterWidget: Display header with filter
    User->>StatusFilterWidget: Selects status from dropdown
    StatusFilterWidget->>TradesProvider: Updates statusFilterProvider
    TradesProvider->>TradesProvider: Filters trades by selected status using OrderState
    TradesProvider-->>TradesScreen: Returns filtered trades
    TradesScreen-->>User: Displays filtered trades list
Loading
sequenceDiagram
    participant User
    participant OrderListItem
    participant SessionProvider
    participant Navigator

    User->>OrderListItem: Taps order item
    OrderListItem->>SessionProvider: Checks for session by order ID
    alt Session exists with role
        OrderListItem->>Navigator: Navigate to trade detail with session
    else No session or role
        OrderListItem->>Navigator: Navigate to take_buy or take_sell screen
    end
Loading
sequenceDiagram
    participant User
    participant SettingsScreen
    participant CurrencySelectionDialog
    participant SettingsProvider

    User->>SettingsScreen: Opens currency selector
    SettingsScreen->>CurrencySelectionDialog: Shows dialog
    User->>CurrencySelectionDialog: Selects currency
    CurrencySelectionDialog-->>SettingsScreen: Returns selected currency
    SettingsScreen->>SettingsProvider: Updates default fiat currency
Loading

Estimated code review effort

3 (~40 minutes)

Possibly related PRs

Suggested reviewers

  • grunch

Poem

🐇 Hopping through trades with a filter so bright,
Dropdowns and statuses now shine in the light.
Sessions and orders, all labeled just right,
Currency chosen with dialogs in sight.
Code bunnies rejoice, in this meadow so wide,
With filters and flows, we take it in stride! 🌿✨


📜 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 48eafee and 012a077.

📒 Files selected for processing (1)
  • lib/features/trades/screens/trades_screen.dart (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • lib/features/trades/screens/trades_screen.dart

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

🔭 Outside diff range comments (2)
lib/l10n/intl_es.arb (2)

544-549: Duplicate keys – JSON/ARB will parse but silently override
cancelPendingButton, acceptCancelButton, disputeButton, fiatSentButton, and completePurchaseButton were already defined at lines 461-468. Keeping both copies will shadow the first definition and may break the extractor tooling.

-  "cancelPendingButton": "CANCELACIÓN PENDIENTE",
-  "acceptCancelButton": "ACEPTAR CANCELACIÓN",
-  "disputeButton": "DISPUTA",
-  "fiatSentButton": "FIAT ENVIADO",
-  "completePurchaseButton": "COMPLETAR COMPRA",

612-614: Duplicate key proofOfWork
A second proofOfWork appears here (first at line 279). Remove or merge to avoid silent override.

-  "proofOfWork": "Prueba de Trabajo",
🧹 Nitpick comments (2)
lib/features/trades/widgets/status_filter_widget.dart (2)

17-42: Consider refactoring the display text logic for better maintainability.

The switch statement works but involves repetitive string concatenation. Consider creating a helper method or using a map for cleaner code.

+// Helper method to get localized status text
+String _getStatusText(BuildContext context, Status status) {
+  switch (status) {
+    case Status.pending:
+      return S.of(context)!.statusPending;
+    case Status.waitingPayment:
+      return S.of(context)!.statusWaitingPayment;
+    // ... other cases
+    default:
+      return '';
+  }
+}

String getDisplayText() {
  if (selectedStatusFilter == null) {
    return '${S.of(context)!.statusFilter} | ${S.of(context)!.allStatuses}';
  }
-  
-  switch (selectedStatusFilter) {
-    case Status.pending:
-      return '${S.of(context)!.statusFilter} | ${S.of(context)!.statusPending}';
-    // ... other repetitive cases
-    default:
-      return S.of(context)!.statusFilter;
-  }
+  
+  return '${S.of(context)!.statusFilter} | ${_getStatusText(context, selectedStatusFilter!)}';
}

165-197: Consider using a map for status value mapping to reduce duplication.

The switch statement for converting strings to Status values could be simplified using a map for better maintainability.

+static const Map<String, Status?> _statusMap = {
+  'ALL': null,
+  'pending': Status.pending,
+  'waitingPayment': Status.waitingPayment,
+  'waitingBuyerInvoice': Status.waitingBuyerInvoice,
+  'active': Status.active,
+  'fiatSent': Status.fiatSent,
+  'success': Status.success,
+  'canceled': Status.canceled,
+  'settledHoldInvoice': Status.settledHoldInvoice,
+};

onSelected: (String value) {
-  Status? statusValue;
-  switch (value) {
-    case 'ALL':
-      statusValue = null;
-      break;
-    // ... repetitive cases
-  }
-  ref.read(statusFilterProvider.notifier).state = statusValue;
+  ref.read(statusFilterProvider.notifier).state = _statusMap[value];
},
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0256e85 and c7df896.

📒 Files selected for processing (6)
  • lib/features/trades/providers/trades_provider.dart (2 hunks)
  • lib/features/trades/screens/trades_screen.dart (3 hunks)
  • lib/features/trades/widgets/status_filter_widget.dart (1 hunks)
  • lib/l10n/intl_en.arb (2 hunks)
  • lib/l10n/intl_es.arb (4 hunks)
  • lib/l10n/intl_it.arb (4 hunks)
📓 Path-based instructions (6)
lib/**/*.dart

📄 CodeRabbit Inference Engine (CLAUDE.md)

lib/**/*.dart: Use S.of(context).yourKey for all user-facing strings
Always check mounted before using context after async operations

Files:

  • lib/features/trades/screens/trades_screen.dart
  • lib/features/trades/providers/trades_provider.dart
  • lib/features/trades/widgets/status_filter_widget.dart
**/*.dart

📄 CodeRabbit Inference Engine (CLAUDE.md)

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

Files:

  • lib/features/trades/screens/trades_screen.dart
  • lib/features/trades/providers/trades_provider.dart
  • lib/features/trades/widgets/status_filter_widget.dart
lib/l10n/intl_{en,es,it}.arb

📄 CodeRabbit Inference Engine (CLAUDE.md)

Add new localization keys to all three ARB files (intl_en.arb, intl_es.arb, intl_it.arb)

Files:

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

📄 CodeRabbit Inference Engine (CLAUDE.md)

Use proper ARB metadata for parameterized strings

Files:

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

📄 CodeRabbit Inference Engine (CLAUDE.md)

Internationalization files are located in lib/l10n/

Files:

  • lib/l10n/intl_it.arb
  • lib/l10n/intl_en.arb
  • lib/l10n/intl_es.arb
lib/features/*/providers/**/*.dart

📄 CodeRabbit Inference Engine (CLAUDE.md)

Providers are organized by feature in features/{feature}/providers/

Files:

  • lib/features/trades/providers/trades_provider.dart
🧠 Learnings (7)
📓 Common learnings
Learnt from: chebizarro
PR: MostroP2P/mobile#74
File: lib/features/trades/models/trade_state.dart:1-15
Timestamp: 2025-05-08T16:06:33.665Z
Learning: In the context of the Mostro Mobile app, the `TradeState` class is specifically constructed using the `tradeStateProvider`. While some fields are nullable (`lastAction` and `orderPayload`), they are still marked as required parameters to ensure they are explicitly considered during state construction.
lib/features/trades/screens/trades_screen.dart (10)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/shared/providers/mostro_database_provider.dart : Database initialization is in shared/providers/mostro_database_provider.dart

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/features//providers/**/.dart : Providers are organized by feature in features/{feature}/providers/

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/data/repositories/**/*.dart : All data access should go through repository classes in data/repositories/

Learnt from: chebizarro
PR: #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-20T01:48:43.335Z
Learning: Applies to lib/data/models.dart : Models should be exported through data/models.dart

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/core/mostro_fsm.dart : Order state transitions are managed by core/mostro_fsm.dart

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to **/*.dart : Remove unused imports and dependencies

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/background/**/*.dart : Background services are implemented in the background/ directory

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to test/mocks.mocks.dart : DO NOT modify test/mocks.mocks.dart - it already has file-level ignores

Learnt from: chebizarro
PR: #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.

lib/l10n/intl_it.arb (1)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/l10n/intl_{en,es,it}.arb : Add new localization keys to all three ARB files (intl_en.arb, intl_es.arb, intl_it.arb)

lib/features/trades/providers/trades_provider.dart (6)

Learnt from: chebizarro
PR: #74
File: lib/features/trades/models/trade_state.dart:1-15
Timestamp: 2025-05-08T16:06:33.665Z
Learning: In the context of the Mostro Mobile app, the TradeState class is specifically constructed using the tradeStateProvider. While some fields are nullable (lastAction and orderPayload), they are still marked as required parameters to ensure they are explicitly considered during state construction.

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/features//providers/**/.dart : Providers are organized by feature in features/{feature}/providers/

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/core/mostro_fsm.dart : Order state transitions are managed by core/mostro_fsm.dart

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/features//notifiers/**/.dart : Notifiers for complex state logic are placed in features/{feature}/notifiers/

Learnt from: chebizarro
PR: #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 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: #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.

lib/l10n/intl_en.arb (2)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/l10n/intl_{en,es,it}.arb : Add new localization keys to all three ARB files (intl_en.arb, intl_es.arb, intl_it.arb)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/l10n/*.arb : Use proper ARB metadata for parameterized strings

lib/features/trades/widgets/status_filter_widget.dart (1)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Use Riverpod for all state management

lib/l10n/intl_es.arb (2)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/l10n/intl_{en,es,it}.arb : Add new localization keys to all three ARB files (intl_en.arb, intl_es.arb, intl_it.arb)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/l10n/*.arb : Use proper ARB metadata for parameterized strings

🪛 RuboCop (1.76.1)
lib/l10n/intl_es.arb

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

(Lint/DuplicateHashKey)

🧰 Additional context used
📓 Path-based instructions (6)
lib/**/*.dart

📄 CodeRabbit Inference Engine (CLAUDE.md)

lib/**/*.dart: Use S.of(context).yourKey for all user-facing strings
Always check mounted before using context after async operations

Files:

  • lib/features/trades/screens/trades_screen.dart
  • lib/features/trades/providers/trades_provider.dart
  • lib/features/trades/widgets/status_filter_widget.dart
**/*.dart

📄 CodeRabbit Inference Engine (CLAUDE.md)

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

Files:

  • lib/features/trades/screens/trades_screen.dart
  • lib/features/trades/providers/trades_provider.dart
  • lib/features/trades/widgets/status_filter_widget.dart
lib/l10n/intl_{en,es,it}.arb

📄 CodeRabbit Inference Engine (CLAUDE.md)

Add new localization keys to all three ARB files (intl_en.arb, intl_es.arb, intl_it.arb)

Files:

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

📄 CodeRabbit Inference Engine (CLAUDE.md)

Use proper ARB metadata for parameterized strings

Files:

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

📄 CodeRabbit Inference Engine (CLAUDE.md)

Internationalization files are located in lib/l10n/

Files:

  • lib/l10n/intl_it.arb
  • lib/l10n/intl_en.arb
  • lib/l10n/intl_es.arb
lib/features/*/providers/**/*.dart

📄 CodeRabbit Inference Engine (CLAUDE.md)

Providers are organized by feature in features/{feature}/providers/

Files:

  • lib/features/trades/providers/trades_provider.dart
🧠 Learnings (7)
📓 Common learnings
Learnt from: chebizarro
PR: MostroP2P/mobile#74
File: lib/features/trades/models/trade_state.dart:1-15
Timestamp: 2025-05-08T16:06:33.665Z
Learning: In the context of the Mostro Mobile app, the `TradeState` class is specifically constructed using the `tradeStateProvider`. While some fields are nullable (`lastAction` and `orderPayload`), they are still marked as required parameters to ensure they are explicitly considered during state construction.
lib/features/trades/screens/trades_screen.dart (10)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/shared/providers/mostro_database_provider.dart : Database initialization is in shared/providers/mostro_database_provider.dart

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/features//providers/**/.dart : Providers are organized by feature in features/{feature}/providers/

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/data/repositories/**/*.dart : All data access should go through repository classes in data/repositories/

Learnt from: chebizarro
PR: #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-20T01:48:43.335Z
Learning: Applies to lib/data/models.dart : Models should be exported through data/models.dart

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/core/mostro_fsm.dart : Order state transitions are managed by core/mostro_fsm.dart

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to **/*.dart : Remove unused imports and dependencies

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/background/**/*.dart : Background services are implemented in the background/ directory

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to test/mocks.mocks.dart : DO NOT modify test/mocks.mocks.dart - it already has file-level ignores

Learnt from: chebizarro
PR: #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.

lib/l10n/intl_it.arb (1)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/l10n/intl_{en,es,it}.arb : Add new localization keys to all three ARB files (intl_en.arb, intl_es.arb, intl_it.arb)

lib/features/trades/providers/trades_provider.dart (6)

Learnt from: chebizarro
PR: #74
File: lib/features/trades/models/trade_state.dart:1-15
Timestamp: 2025-05-08T16:06:33.665Z
Learning: In the context of the Mostro Mobile app, the TradeState class is specifically constructed using the tradeStateProvider. While some fields are nullable (lastAction and orderPayload), they are still marked as required parameters to ensure they are explicitly considered during state construction.

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/features//providers/**/.dart : Providers are organized by feature in features/{feature}/providers/

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/core/mostro_fsm.dart : Order state transitions are managed by core/mostro_fsm.dart

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/features//notifiers/**/.dart : Notifiers for complex state logic are placed in features/{feature}/notifiers/

Learnt from: chebizarro
PR: #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 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: #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.

lib/l10n/intl_en.arb (2)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/l10n/intl_{en,es,it}.arb : Add new localization keys to all three ARB files (intl_en.arb, intl_es.arb, intl_it.arb)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/l10n/*.arb : Use proper ARB metadata for parameterized strings

lib/features/trades/widgets/status_filter_widget.dart (1)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Use Riverpod for all state management

lib/l10n/intl_es.arb (2)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/l10n/intl_{en,es,it}.arb : Add new localization keys to all three ARB files (intl_en.arb, intl_es.arb, intl_it.arb)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/l10n/*.arb : Use proper ARB metadata for parameterized strings

🪛 RuboCop (1.76.1)
lib/l10n/intl_es.arb

[warning] 580-580: 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 (9)
lib/features/trades/providers/trades_provider.dart (2)

18-19: Well-implemented status filter provider.

The StateProvider<Status?> is the appropriate choice for managing the selected status filter state, and the null initialization correctly represents "all statuses" selection.


40-51: Excellent filtering logic implementation.

The two-stage filtering approach is well-designed:

  1. First filters out statuses that should never be shown (canceled, expired, etc.)
  2. Then applies the user-selected status filter if one is chosen

The conversion to list and proper handling of the filtered iterable ensures correct data flow.

lib/features/trades/screens/trades_screen.dart (2)

9-9: Import correctly added for new widget.

The import follows the established pattern and is necessary for the StatusFilterWidget integration.


48-62: Well-designed header layout enhancement.

The Row layout with MainAxisAlignment.spaceBetween provides proper alignment between the title and filter widget. The StatusFilterWidget placement is visually balanced and maintains the existing styling consistency.

lib/l10n/intl_it.arb (1)

140-149: Comprehensive Italian localization for status filtering.

All necessary keys for the status filter functionality are properly added with accurate Italian translations. The key naming follows established conventions and integrates well with the existing localization structure.

lib/l10n/intl_en.arb (2)

140-149: Consistent English localization for status filter feature.

All required keys for the status filtering functionality are properly added with clear, professional English text. The localization keys are consistent with the Italian translation file.


191-191: Improved formatting for better readability.

The newline addition between bullet points in the walkthrough text enhances readability without affecting functionality.

lib/l10n/intl_es.arb (2)

181-182: Guided-walkthrough text change is fine
No functional impact—just improves readability.


568-577: New status-filter keys must be added to EN & IT files
statusFilter, allStatuses, and the individual status* values are present only in intl_es.arb. Per the coding-guidelines, every new key must exist in intl_en.arb and intl_it.arb (even if the translation is temporarily identical to the key).

Would you like a quick patch that injects the missing keys into the other two ARB files?

chebizarro and others added 6 commits July 21, 2025 23:55
- Replace CurrencyComboBox with reusable CurrencySelectionDialog component
- Synchronize selectedFiatCodeProvider with settings defaultFiatCode
- Add bidirectional sync between order flow and settings currency selection
- Remove deprecated currency combo box widget
- Ensure currency selection persists across app screens

Fixes issue where currency selection dialog would not update the selected currency when tapped.
- Add localized string for error message.
Fix currency selection dialog state management
Fix Order Status Hydration Bug issue #219
Since we can filter by non active trades let's change to
My trades, this also fix a overflow with the text and the filter
 in spanish and italian
Copy link
Member

@grunch grunch left a comment

Choose a reason for hiding this comment

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

The filter doesn't show active orders when I select active, with other orders it is working properly

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: 0

🧹 Nitpick comments (1)
lib/features/order/widgets/currency_section.dart (1)

46-58: Good refactoring but verify context safety after async operations.

The refactoring to use the centralized CurrencySelectionDialog is excellent and follows good separation of concerns. The dual state update pattern (both selectedFiatCodeProvider and settingsProvider) ensures proper synchronization.

However, consider checking mounted before using context after the async dialog operation, as per the coding guidelines.

Apply this diff to add context safety:

           onTap: () async {
             final selectedCode = await CurrencySelectionDialog.show(
               context,
               ref,
               currentSelection: selectedFiatCode,
             );
-            if (selectedCode != null) {
+            if (selectedCode != null && mounted) {
               ref.read(selectedFiatCodeProvider.notifier).state = selectedCode;
               // Also update the settings to keep them synchronized
               ref.read(settingsProvider.notifier).updateDefaultFiatCode(selectedCode);
               onCurrencySelected();
             }
           },
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1496b0b and 36e5c39.

📒 Files selected for processing (16)
  • .github/workflows/flutter.yml (1 hunks)
  • lib/features/home/providers/home_order_providers.dart (0 hunks)
  • lib/features/home/widgets/order_list_item.dart (4 hunks)
  • lib/features/order/models/order_state.dart (3 hunks)
  • lib/features/order/widgets/currency_section.dart (2 hunks)
  • lib/features/settings/settings_screen.dart (3 hunks)
  • lib/features/trades/providers/trades_provider.dart (2 hunks)
  • lib/features/trades/screens/trades_screen.dart (5 hunks)
  • lib/features/trades/widgets/status_filter_widget.dart (1 hunks)
  • lib/l10n/intl_en.arb (3 hunks)
  • lib/l10n/intl_es.arb (5 hunks)
  • lib/l10n/intl_it.arb (5 hunks)
  • lib/shared/providers/exchange_service_provider.dart (2 hunks)
  • lib/shared/providers/session_notifier_provider.dart (1 hunks)
  • lib/shared/widgets/currency_combo_box.dart (0 hunks)
  • lib/shared/widgets/currency_selection_dialog.dart (1 hunks)
📓 Path-based instructions (3)
lib/**/*.dart

📄 CodeRabbit Inference Engine (CLAUDE.md)

lib/**/*.dart: Use S.of(context).yourKey for all user-facing strings
Always check mounted before using context after async operations

Files:

  • lib/features/order/widgets/currency_section.dart
  • lib/shared/providers/exchange_service_provider.dart
  • lib/shared/providers/session_notifier_provider.dart
  • lib/features/settings/settings_screen.dart
  • lib/shared/widgets/currency_selection_dialog.dart
  • lib/features/home/widgets/order_list_item.dart
  • lib/features/order/models/order_state.dart
  • lib/features/trades/providers/trades_provider.dart
**/*.dart

📄 CodeRabbit Inference Engine (CLAUDE.md)

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

Files:

  • lib/features/order/widgets/currency_section.dart
  • lib/shared/providers/exchange_service_provider.dart
  • lib/shared/providers/session_notifier_provider.dart
  • lib/features/settings/settings_screen.dart
  • lib/shared/widgets/currency_selection_dialog.dart
  • lib/features/home/widgets/order_list_item.dart
  • lib/features/order/models/order_state.dart
  • lib/features/trades/providers/trades_provider.dart
lib/features/*/providers/**/*.dart

📄 CodeRabbit Inference Engine (CLAUDE.md)

Providers are organized by feature in features/{feature}/providers/

Files:

  • lib/features/trades/providers/trades_provider.dart
🧠 Learnings (9)
📓 Common learnings
Learnt from: chebizarro
PR: MostroP2P/mobile#74
File: lib/features/trades/models/trade_state.dart:1-15
Timestamp: 2025-05-08T16:06:33.665Z
Learning: In the context of the Mostro Mobile app, the `TradeState` class is specifically constructed using the `tradeStateProvider`. While some fields are nullable (`lastAction` and `orderPayload`), they are still marked as required parameters to ensure they are explicitly considered during state construction.
lib/features/order/widgets/currency_section.dart (5)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/data/models.dart : Models should be exported through data/models.dart

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/shared/providers/mostro_database_provider.dart : Database initialization is in shared/providers/mostro_database_provider.dart

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
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-20T01:48:43.335Z
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-20T01:48:43.335Z
Learning: Applies to lib/core/mostro_fsm.dart : Order state transitions are managed by core/mostro_fsm.dart

lib/shared/providers/exchange_service_provider.dart (7)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/features//providers/**/.dart : Providers are organized by feature in features/{feature}/providers/

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/shared/providers/mostro_database_provider.dart : Database initialization is in shared/providers/mostro_database_provider.dart

Learnt from: chebizarro
PR: #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-20T01:48:43.335Z
Learning: Applies to lib/data/models.dart : Models should be exported through data/models.dart

Learnt from: chebizarro
PR: #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-20T01:48:43.335Z
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-20T01:48:43.335Z
Learning: Applies to lib/services/nostr_service.dart : Nostr protocol interactions go through services/nostr_service.dart

lib/shared/providers/session_notifier_provider.dart (6)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/features//notifiers/**/.dart : Notifiers for complex state logic are placed in features/{feature}/notifiers/

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/features//providers/**/.dart : Providers are organized by feature in features/{feature}/providers/

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/services/nostr_service.dart : Nostr protocol interactions go through services/nostr_service.dart

Learnt from: chebizarro
PR: #110
File: lib/features/trades/widgets/mostro_message_detail_widget.dart:134-141
Timestamp: 2025-06-08T23:54:09.987Z
Learning: In the OrderState refactor, public keys should be accessed via tradeState.peer?.publicKey from the OrderState instance rather than through session?.peer?.publicKey, as the OrderState encapsulates peer information directly.

Learnt from: chebizarro
PR: #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: #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.

lib/features/settings/settings_screen.dart (10)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/shared/providers/mostro_database_provider.dart : Database initialization is in shared/providers/mostro_database_provider.dart

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/main.dart : Locales for the timeago package are configured in main.dart with timeago.setLocaleMessages()

Learnt from: chebizarro
PR: #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-20T01:48:43.335Z
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-20T01:48:43.335Z
Learning: Applies to lib/features//providers/**/.dart : Providers are organized by feature in features/{feature}/providers/

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/data/models.dart : Models should be exported through data/models.dart

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to **/*.dart : Remove unused imports and dependencies

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/background/**/*.dart : Background services are implemented in the background/ directory

Learnt from: chebizarro
PR: #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-20T01:48:43.335Z
Learning: Applies to test/mocks.mocks.dart : DO NOT modify test/mocks.mocks.dart - it already has file-level ignores

lib/shared/widgets/currency_selection_dialog.dart (1)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/**/*.dart : Use S.of(context).yourKey for all user-facing strings

lib/features/home/widgets/order_list_item.dart (12)

Learnt from: chebizarro
PR: #110
File: lib/features/trades/widgets/mostro_message_detail_widget.dart:134-141
Timestamp: 2025-06-08T23:54:09.987Z
Learning: In the OrderState refactor, public keys should be accessed via tradeState.peer?.publicKey from the OrderState instance rather than through session?.peer?.publicKey, as the OrderState encapsulates peer information directly.

Learnt from: chebizarro
PR: #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: #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-20T01:48:43.335Z
Learning: Applies to lib/data/models/nostr_event.dart : Custom timeAgoWithLocale() method is implemented in the NostrEvent extension

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/services/nostr_service.dart : Nostr protocol interactions go through services/nostr_service.dart

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/data/models.dart : Models should be exported through data/models.dart

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/core/mostro_fsm.dart : Order state transitions are managed by core/mostro_fsm.dart

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/shared/providers/mostro_database_provider.dart : Database initialization is in shared/providers/mostro_database_provider.dart

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/core/app_routes.dart : GoRouter navigation is configured in core/app_routes.dart

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Use Riverpod for all state management

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/features//notifiers/**/.dart : Notifiers for complex state logic are placed in features/{feature}/notifiers/

Learnt from: chebizarro
PR: #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 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/features/order/models/order_state.dart (2)

Learnt from: chebizarro
PR: #110
File: lib/features/trades/widgets/mostro_message_detail_widget.dart:134-141
Timestamp: 2025-06-08T23:54:09.987Z
Learning: In the OrderState refactor, public keys should be accessed via tradeState.peer?.publicKey from the OrderState instance rather than through session?.peer?.publicKey, as the OrderState encapsulates peer information directly.

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/core/mostro_fsm.dart : Order state transitions are managed by core/mostro_fsm.dart

lib/features/trades/providers/trades_provider.dart (10)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/features//providers/**/.dart : Providers are organized by feature in features/{feature}/providers/

Learnt from: chebizarro
PR: #74
File: lib/features/trades/models/trade_state.dart:1-15
Timestamp: 2025-05-08T16:06:33.665Z
Learning: In the context of the Mostro Mobile app, the TradeState class is specifically constructed using the tradeStateProvider. While some fields are nullable (lastAction and orderPayload), they are still marked as required parameters to ensure they are explicitly considered during state construction.

Learnt from: chebizarro
PR: #110
File: lib/features/trades/widgets/mostro_message_detail_widget.dart:134-141
Timestamp: 2025-06-08T23:54:09.987Z
Learning: In the OrderState refactor, public keys should be accessed via tradeState.peer?.publicKey from the OrderState instance rather than through session?.peer?.publicKey, as the OrderState encapsulates peer information directly.

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/features//notifiers/**/.dart : Notifiers for complex state logic are placed in features/{feature}/notifiers/

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/core/mostro_fsm.dart : Order state transitions are managed by core/mostro_fsm.dart

Learnt from: chebizarro
PR: #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 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: #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: #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-20T01:48:43.335Z
Learning: Applies to lib/services/nostr_service.dart : Nostr protocol interactions go through services/nostr_service.dart

Learnt from: chebizarro
PR: #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.

💤 Files with no reviewable changes (2)
  • lib/features/home/providers/home_order_providers.dart
  • lib/shared/widgets/currency_combo_box.dart
✅ Files skipped from review due to trivial changes (3)
  • .github/workflows/flutter.yml
  • lib/l10n/intl_es.arb
  • lib/l10n/intl_it.arb
🚧 Files skipped from review as they are similar to previous changes (3)
  • lib/features/trades/widgets/status_filter_widget.dart
  • lib/l10n/intl_en.arb
  • lib/features/trades/screens/trades_screen.dart
🧰 Additional context used
📓 Path-based instructions (3)
lib/**/*.dart

📄 CodeRabbit Inference Engine (CLAUDE.md)

lib/**/*.dart: Use S.of(context).yourKey for all user-facing strings
Always check mounted before using context after async operations

Files:

  • lib/features/order/widgets/currency_section.dart
  • lib/shared/providers/exchange_service_provider.dart
  • lib/shared/providers/session_notifier_provider.dart
  • lib/features/settings/settings_screen.dart
  • lib/shared/widgets/currency_selection_dialog.dart
  • lib/features/home/widgets/order_list_item.dart
  • lib/features/order/models/order_state.dart
  • lib/features/trades/providers/trades_provider.dart
**/*.dart

📄 CodeRabbit Inference Engine (CLAUDE.md)

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

Files:

  • lib/features/order/widgets/currency_section.dart
  • lib/shared/providers/exchange_service_provider.dart
  • lib/shared/providers/session_notifier_provider.dart
  • lib/features/settings/settings_screen.dart
  • lib/shared/widgets/currency_selection_dialog.dart
  • lib/features/home/widgets/order_list_item.dart
  • lib/features/order/models/order_state.dart
  • lib/features/trades/providers/trades_provider.dart
lib/features/*/providers/**/*.dart

📄 CodeRabbit Inference Engine (CLAUDE.md)

Providers are organized by feature in features/{feature}/providers/

Files:

  • lib/features/trades/providers/trades_provider.dart
🧠 Learnings (9)
📓 Common learnings
Learnt from: chebizarro
PR: MostroP2P/mobile#74
File: lib/features/trades/models/trade_state.dart:1-15
Timestamp: 2025-05-08T16:06:33.665Z
Learning: In the context of the Mostro Mobile app, the `TradeState` class is specifically constructed using the `tradeStateProvider`. While some fields are nullable (`lastAction` and `orderPayload`), they are still marked as required parameters to ensure they are explicitly considered during state construction.
lib/features/order/widgets/currency_section.dart (5)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/data/models.dart : Models should be exported through data/models.dart

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/shared/providers/mostro_database_provider.dart : Database initialization is in shared/providers/mostro_database_provider.dart

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
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-20T01:48:43.335Z
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-20T01:48:43.335Z
Learning: Applies to lib/core/mostro_fsm.dart : Order state transitions are managed by core/mostro_fsm.dart

lib/shared/providers/exchange_service_provider.dart (7)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/features//providers/**/.dart : Providers are organized by feature in features/{feature}/providers/

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/shared/providers/mostro_database_provider.dart : Database initialization is in shared/providers/mostro_database_provider.dart

Learnt from: chebizarro
PR: #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-20T01:48:43.335Z
Learning: Applies to lib/data/models.dart : Models should be exported through data/models.dart

Learnt from: chebizarro
PR: #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-20T01:48:43.335Z
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-20T01:48:43.335Z
Learning: Applies to lib/services/nostr_service.dart : Nostr protocol interactions go through services/nostr_service.dart

lib/shared/providers/session_notifier_provider.dart (6)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/features//notifiers/**/.dart : Notifiers for complex state logic are placed in features/{feature}/notifiers/

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/features//providers/**/.dart : Providers are organized by feature in features/{feature}/providers/

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/services/nostr_service.dart : Nostr protocol interactions go through services/nostr_service.dart

Learnt from: chebizarro
PR: #110
File: lib/features/trades/widgets/mostro_message_detail_widget.dart:134-141
Timestamp: 2025-06-08T23:54:09.987Z
Learning: In the OrderState refactor, public keys should be accessed via tradeState.peer?.publicKey from the OrderState instance rather than through session?.peer?.publicKey, as the OrderState encapsulates peer information directly.

Learnt from: chebizarro
PR: #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: #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.

lib/features/settings/settings_screen.dart (10)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/shared/providers/mostro_database_provider.dart : Database initialization is in shared/providers/mostro_database_provider.dart

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/main.dart : Locales for the timeago package are configured in main.dart with timeago.setLocaleMessages()

Learnt from: chebizarro
PR: #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-20T01:48:43.335Z
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-20T01:48:43.335Z
Learning: Applies to lib/features//providers/**/.dart : Providers are organized by feature in features/{feature}/providers/

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/data/models.dart : Models should be exported through data/models.dart

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to **/*.dart : Remove unused imports and dependencies

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/background/**/*.dart : Background services are implemented in the background/ directory

Learnt from: chebizarro
PR: #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-20T01:48:43.335Z
Learning: Applies to test/mocks.mocks.dart : DO NOT modify test/mocks.mocks.dart - it already has file-level ignores

lib/shared/widgets/currency_selection_dialog.dart (1)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/**/*.dart : Use S.of(context).yourKey for all user-facing strings

lib/features/home/widgets/order_list_item.dart (12)

Learnt from: chebizarro
PR: #110
File: lib/features/trades/widgets/mostro_message_detail_widget.dart:134-141
Timestamp: 2025-06-08T23:54:09.987Z
Learning: In the OrderState refactor, public keys should be accessed via tradeState.peer?.publicKey from the OrderState instance rather than through session?.peer?.publicKey, as the OrderState encapsulates peer information directly.

Learnt from: chebizarro
PR: #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: #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-20T01:48:43.335Z
Learning: Applies to lib/data/models/nostr_event.dart : Custom timeAgoWithLocale() method is implemented in the NostrEvent extension

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/services/nostr_service.dart : Nostr protocol interactions go through services/nostr_service.dart

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/data/models.dart : Models should be exported through data/models.dart

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/core/mostro_fsm.dart : Order state transitions are managed by core/mostro_fsm.dart

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/shared/providers/mostro_database_provider.dart : Database initialization is in shared/providers/mostro_database_provider.dart

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/core/app_routes.dart : GoRouter navigation is configured in core/app_routes.dart

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Use Riverpod for all state management

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/features//notifiers/**/.dart : Notifiers for complex state logic are placed in features/{feature}/notifiers/

Learnt from: chebizarro
PR: #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 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/features/order/models/order_state.dart (2)

Learnt from: chebizarro
PR: #110
File: lib/features/trades/widgets/mostro_message_detail_widget.dart:134-141
Timestamp: 2025-06-08T23:54:09.987Z
Learning: In the OrderState refactor, public keys should be accessed via tradeState.peer?.publicKey from the OrderState instance rather than through session?.peer?.publicKey, as the OrderState encapsulates peer information directly.

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/core/mostro_fsm.dart : Order state transitions are managed by core/mostro_fsm.dart

lib/features/trades/providers/trades_provider.dart (10)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/features//providers/**/.dart : Providers are organized by feature in features/{feature}/providers/

Learnt from: chebizarro
PR: #74
File: lib/features/trades/models/trade_state.dart:1-15
Timestamp: 2025-05-08T16:06:33.665Z
Learning: In the context of the Mostro Mobile app, the TradeState class is specifically constructed using the tradeStateProvider. While some fields are nullable (lastAction and orderPayload), they are still marked as required parameters to ensure they are explicitly considered during state construction.

Learnt from: chebizarro
PR: #110
File: lib/features/trades/widgets/mostro_message_detail_widget.dart:134-141
Timestamp: 2025-06-08T23:54:09.987Z
Learning: In the OrderState refactor, public keys should be accessed via tradeState.peer?.publicKey from the OrderState instance rather than through session?.peer?.publicKey, as the OrderState encapsulates peer information directly.

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/features//notifiers/**/.dart : Notifiers for complex state logic are placed in features/{feature}/notifiers/

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/core/mostro_fsm.dart : Order state transitions are managed by core/mostro_fsm.dart

Learnt from: chebizarro
PR: #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 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: #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: #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-20T01:48:43.335Z
Learning: Applies to lib/services/nostr_service.dart : Nostr protocol interactions go through services/nostr_service.dart

Learnt from: chebizarro
PR: #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.

⏰ 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 (18)
lib/shared/providers/session_notifier_provider.dart (1)

26-29: LGTM! Clean refactor to direct state filtering.

The change from calling a notifier method to directly filtering the watched state list is a good simplification that makes the provider more reactive and removes unnecessary indirection.

lib/features/order/models/order_state.dart (2)

115-120: LGTM! Cleaner peer assignment logic.

The refactoring improves readability by extracting the peer creation into separate variables, making the logic clearer without changing behavior.


169-220: Excellent enhancement to status mapping coverage.

The comprehensive addition of status mappings significantly improves the accuracy of synthetic status derivation:

  • Properly handles cooperative cancellation states
  • Adds dispute status mappings
  • Includes admin settlement actions
  • Correctly preserves status for informational actions

This provides the foundational logic needed for accurate trade filtering and UI display.

lib/features/home/widgets/order_list_item.dart (2)

38-48: LGTM! Excellent session-aware label enhancement.

The dynamic labeling logic properly distinguishes between viewing available orders versus the user's active trades, improving UX by clearly showing the user's role when they have an active session.


67-72: LGTM! Smart session-aware navigation logic.

The navigation enhancement properly routes to the trade detail page for active sessions while maintaining backward compatibility for orders without sessions. Good use of early return for cleaner code flow.

lib/features/trades/providers/trades_provider.dart (3)

14-15: LGTM! Clean status filter state management.

Simple and effective StateProvider for managing the selected status filter.


17-84: Excellent implementation of reactive synthetic status filtering.

The new provider addresses the core requirement of filtering by synthetic OrderState status rather than raw order status:

  • Reactive design: Watches individual OrderNotifier providers for each trade
  • Robust error handling: Falls back to raw status if OrderState unavailable
  • Comprehensive logging: Detailed debug information for troubleshooting
  • Performance consideration: Only watches OrderStates for orders that pass initial filtering

The approach correctly leverages the enhanced status mappings from OrderState._getStatusFromAction() to provide accurate filtering.


87-117: Good backward compatibility approach.

Properly deprecating the old provider while simplifying its logic maintains compatibility during the transition. The simplified implementation using direct status filtering is appropriate for the deprecated provider.

lib/shared/providers/exchange_service_provider.dart (2)

7-7: LGTM: Added settings provider import for reactive integration.

The import supports the new reactive implementation of selectedFiatCodeProvider.


31-34: LGTM: Excellent refactoring to make currency selection reactive.

The change from a hardcoded 'USD' default to a reactive provider that reads from user settings is a significant improvement. This creates a proper single source of truth for the selected fiat currency across the app.

The implementation correctly:

  • Watches the settingsProvider for changes
  • Falls back to 'USD' if no default is set
  • Maintains the same API while adding reactivity
lib/features/order/widgets/currency_section.dart (1)

6-7: LGTM: Added necessary imports for centralized currency selection.

The imports support the new centralized dialog approach and settings synchronization.

lib/shared/widgets/currency_selection_dialog.dart (4)

1-23: LGTM: Well-designed static factory method for dialog display.

The static show method provides a clean API for displaying the currency selection dialog. The implementation properly:

  • Uses localized strings with S.of(context)!
  • Provides sensible defaults for optional parameters
  • Returns a Future<String?> for async handling

25-42: LGTM: Proper widget structure with Riverpod integration.

The private stateful widget follows Flutter conventions and uses ConsumerStatefulWidget for proper Riverpod integration. The state management for search functionality is appropriately handled at the widget level.


44-95: LGTM: Excellent dialog UI implementation.

The dialog UI is well-structured with:

  • Consistent theming and colors
  • Proper accessibility with clear close button
  • Search functionality with appropriate styling
  • Good use of Container decorations for visual hierarchy

The search implementation correctly updates state on text changes and uses appropriate debouncing through setState.


96-170: LGTM: Comprehensive async data handling and filtering.

The implementation excellently handles:

  • Loading states with appropriate UI feedback
  • Error states with retry functionality
  • Empty search results with user-friendly messaging
  • Proper currency filtering by both code and name
  • Alphabetical sorting for better UX
  • Visual indication of current selection with check icon

The filtering logic is efficient and the UI states are properly managed through Riverpod's when method.

lib/features/settings/settings_screen.dart (3)

9-10: LGTM: Added necessary imports for centralized currency selection.

The imports support the refactored currency selection implementation using the centralized dialog and exchange service provider.


187-187: LGTM: Clean integration of the new currency selector.

The call to the new _buildCurrencySelector method maintains the existing widget structure while utilizing the refactored implementation.


367-451: Excellent implementation of the currency selector with proper async handling.

This is a well-implemented method that demonstrates good Flutter and Riverpod practices:

Strengths:

  • Proper async data handling with loading, error, and data states
  • Excellent context safety with context.mounted check after async operations
  • Good error handling with retry functionality
  • Consistent theming and styling
  • Clean separation of concerns using the centralized dialog
  • Proper state synchronization with settings provider

UI/UX:

  • Clear visual hierarchy with proper text styling
  • Appropriate loading indicators and error messages
  • Good use of localized strings throughout
  • Consistent with app theming patterns

The implementation follows the coding guidelines perfectly, especially the context safety after async operations.

@grunch
Copy link
Member

grunch commented Jul 22, 2025

The card of the order dissapeared

photo_2025-07-22_14-15-30

@grunch grunch merged commit ebdf91c into main Jul 22, 2025
2 checks passed
@grunch grunch deleted the chebizarro/issue122 branch July 22, 2025 19:34
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.

3 participants