From f1701f4498ab1f3a609f6ac93e3c7e10d7e89672 Mon Sep 17 00:00:00 2001 From: Jason Chen Date: Tue, 24 Mar 2026 15:07:18 -0400 Subject: [PATCH] =?UTF-8?q?fix:=20rename=20notfiers=20=E2=86=92=20notifier?= =?UTF-8?q?s=20directory?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #544 --- docs/architecture/LN_ADDRESS_CONFIRMATION.md | 2 +- docs/architecture/ORDER_CREATION_PROCESS.md | 16 ++++++++-------- docs/architecture/README.md | 2 +- docs/architecture/REQUEST_ID_ANALYSIS.md | 2 +- .../architecture/SESSION_AND_KEY_MANAGEMENT.md | 6 +++--- .../TIMEOUT_DETECTION_AND_SESSION_CLEANUP.md | 18 +++++++++--------- .../abstract_mostro_notifier.dart | 0 .../add_order_notifier.dart | 2 +- .../order_notifier.dart | 2 +- .../providers/order_notifier_provider.dart | 4 ++-- test/mocks.dart | 2 +- 11 files changed, 28 insertions(+), 28 deletions(-) rename lib/features/order/{notfiers => notifiers}/abstract_mostro_notifier.dart (100%) rename lib/features/order/{notfiers => notifiers}/add_order_notifier.dart (98%) rename lib/features/order/{notfiers => notifiers}/order_notifier.dart (98%) diff --git a/docs/architecture/LN_ADDRESS_CONFIRMATION.md b/docs/architecture/LN_ADDRESS_CONFIRMATION.md index ddddf1774..216d14b2c 100644 --- a/docs/architecture/LN_ADDRESS_CONFIRMATION.md +++ b/docs/architecture/LN_ADDRESS_CONFIRMATION.md @@ -36,7 +36,7 @@ All three receiving methods follow the same confirm-then-send pattern: |------|--------| | `lib/shared/widgets/ln_address_confirmation_widget.dart` | Confirmation widget with address display and confirm/fallback buttons | | `lib/features/order/screens/add_lightning_invoice_screen.dart` | Shows confirmation when `lnAddress` param present | -| `lib/features/order/notfiers/abstract_mostro_notifier.dart` | Navigates to confirmation screen instead of auto-sending | +| `lib/features/order/notifiers/abstract_mostro_notifier.dart` | Navigates to confirmation screen instead of auto-sending | | `lib/core/app_routes.dart` | Passes `lnAddress` query parameter to the screen | ## Design Decisions diff --git a/docs/architecture/ORDER_CREATION_PROCESS.md b/docs/architecture/ORDER_CREATION_PROCESS.md index a7234a4ff..f393c9264 100644 --- a/docs/architecture/ORDER_CREATION_PROCESS.md +++ b/docs/architecture/ORDER_CREATION_PROCESS.md @@ -9,8 +9,8 @@ This document provides a detailed explanation of how order creation works in the ### Key Files and Classes - **`lib/services/mostro_service.dart`** - Main service for Mostro communication -- **`lib/features/order/notfiers/order_notifier.dart`** - Manages order state and lifecycle -- **`lib/features/order/notfiers/abstract_mostro_notifier.dart`** - Base class for Mostro message handling +- **`lib/features/order/notifiers/order_notifier.dart`** - Manages order state and lifecycle +- **`lib/features/order/notifiers/abstract_mostro_notifier.dart`** - Base class for Mostro message handling - **`lib/data/repositories/mostro_storage.dart`** - Local storage for Mostro messages - **`lib/features/order/models/order_state.dart`** - Order state management - **`lib/shared/providers/mostro_storage_provider.dart`** - Riverpod providers for message streams @@ -33,7 +33,7 @@ The user creates an order through the UI (sell or buy order). This typically hap When the user submits the order, the `AddOrderNotifier` handles the complete flow: ```dart -// lib/features/order/notfiers/add_order_notifier.dart:71-85 +// lib/features/order/notifiers/add_order_notifier.dart:71-85 Future submitOrder(Order order) async { // 1. Create MostroMessage with new-order action final message = MostroMessage( @@ -191,7 +191,7 @@ Future _onData(NostrEvent event) async { When Mostro sends the confirmation message back with the order ID, the `AddOrderNotifier` processes it: ```dart -// lib/features/order/notfiers/add_order_notifier.dart:28-58 +// lib/features/order/notifiers/add_order_notifier.dart:28-58 @override void subscribe() { subscription = ref.listen( @@ -227,7 +227,7 @@ void subscribe() { **Confirmation Processing**: ```dart -// lib/features/order/notfiers/add_order_notifier.dart:60-69 +// lib/features/order/notifiers/add_order_notifier.dart:60-69 Future _confirmOrder(MostroMessage message) async { // 1. Update state with confirmed order state = state.updateWith(message); @@ -320,7 +320,7 @@ Future addMessage(String key, MostroMessage message) async { After confirmation, the `OrderNotifier` takes over for ongoing trade management: ```dart -// lib/features/order/notfiers/order_notifier.dart:15-25 +// lib/features/order/notifiers/order_notifier.dart:15-25 class OrderNotifier extends AbstractMostroNotifier { late final MostroService mostroService; @@ -344,7 +344,7 @@ class OrderNotifier extends AbstractMostroNotifier { The notifier subscribes to message streams using Riverpod providers: ```dart -// lib/features/order/notfiers/abstract_mostro_notifier.dart:35-55 +// lib/features/order/notifiers/abstract_mostro_notifier.dart:35-55 void subscribe() { subscription = ref.listen( mostroMessageStreamProvider(orderId), @@ -470,7 +470,7 @@ OrderState updateWith(MostroMessage message) { The `new-order` action is handled in the `AbstractMostroNotifier`: ```dart -// lib/features/order/notfiers/abstract_mostro_notifier.dart lines 75-77 +// lib/features/order/notifiers/abstract_mostro_notifier.dart lines 75-77 switch (event.action) { case Action.newOrder: break; // No special handling needed, state is already updated diff --git a/docs/architecture/README.md b/docs/architecture/README.md index 7e60f53f9..ec3d0cc73 100755 --- a/docs/architecture/README.md +++ b/docs/architecture/README.md @@ -42,7 +42,7 @@ This directory contains comprehensive technical documentation for the Mostro Mob ### **Code Example Standards** - Use actual code from the codebase, not pseudo-code -- Include file paths: `lib/features/order/notfiers/order_notifier.dart` +- Include file paths: `lib/features/order/notifiers/order_notifier.dart` - Add line numbers for specific references: `// Line 45-67` - Show complete context, not just isolated snippets - Validate examples still compile and work diff --git a/docs/architecture/REQUEST_ID_ANALYSIS.md b/docs/architecture/REQUEST_ID_ANALYSIS.md index 5f992823f..3637c2d95 100644 --- a/docs/architecture/REQUEST_ID_ANALYSIS.md +++ b/docs/architecture/REQUEST_ID_ANALYSIS.md @@ -100,7 +100,7 @@ Similarly: ### Primary Files -#### A. `lib/features/order/notfiers/add_order_notifier.dart` +#### A. `lib/features/order/notifiers/add_order_notifier.dart` ```dart class AddOrderNotifier extends AbstractMostroNotifier { late int requestId; // Line 13 diff --git a/docs/architecture/SESSION_AND_KEY_MANAGEMENT.md b/docs/architecture/SESSION_AND_KEY_MANAGEMENT.md index 7dc08de59..6ff4f3470 100644 --- a/docs/architecture/SESSION_AND_KEY_MANAGEMENT.md +++ b/docs/architecture/SESSION_AND_KEY_MANAGEMENT.md @@ -331,7 +331,7 @@ The orphan session prevention system uses static timer storage with differentiat ### Complete Order Creation Process #### 1. Order Submission -When a user creates a new order, the flow starts in `AddOrderNotifier.submitOrder()` (`lib/features/order/notfiers/add_order_notifier.dart:71-85`): +When a user creates a new order, the flow starts in `AddOrderNotifier.submitOrder()` (`lib/features/order/notifiers/add_order_notifier.dart:71-85`): ```dart Future submitOrder(Order order) async { @@ -377,7 +377,7 @@ Future publishOrder(MostroMessage order) async { ``` #### 3. Order Confirmation -When mostrod confirms the order, `AddOrderNotifier._confirmOrder()` is called (`lib/features/order/notfiers/add_order_notifier.dart:60-69`): +When mostrod confirms the order, `AddOrderNotifier._confirmOrder()` is called (`lib/features/order/notifiers/add_order_notifier.dart:60-69`): ```dart Future _confirmOrder(MostroMessage message) async { @@ -1119,7 +1119,7 @@ final childSession = Session( ### Complete Order Creation Flow with Key Logging ```dart -// File: lib/features/order/notfiers/add_order_notifier.dart:71-85 +// File: lib/features/order/notifiers/add_order_notifier.dart:71-85 Future submitOrder(Order order) async { logger.d('=== ORDER CREATION START ==='); diff --git a/docs/architecture/TIMEOUT_DETECTION_AND_SESSION_CLEANUP.md b/docs/architecture/TIMEOUT_DETECTION_AND_SESSION_CLEANUP.md index 127ed4337..2e754cfb9 100755 --- a/docs/architecture/TIMEOUT_DETECTION_AND_SESSION_CLEANUP.md +++ b/docs/architecture/TIMEOUT_DETECTION_AND_SESSION_CLEANUP.md @@ -46,7 +46,7 @@ The timeout detection system receives direct instructions from Mostro via encryp #### **OrderNotifier Implementation** ```dart -// lib/features/order/notfiers/order_notifier.dart +// lib/features/order/notifiers/order_notifier.dart class OrderNotifier extends AbstractMostroNotifier { // Simplified implementation - timeout/cancellation logic moved to AbstractMostroNotifier @override @@ -69,7 +69,7 @@ The system processes timeout and cancellation instructions directly from Mostro #### **AbstractMostroNotifier Gift Wrap Processing** ```dart -// lib/features/order/notfiers/abstract_mostro_notifier.dart +// lib/features/order/notifiers/abstract_mostro_notifier.dart Future handleEvent(MostroMessage event, {bool bypassTimestampGate = false}) async { switch (event.action) { case Action.newOrder: @@ -773,7 +773,7 @@ final session = ref.read(sessionNotifierProvider.notifier).getSessionByOrderId(o ## Related Documentation ### Implementation Files -- **`lib/features/order/notfiers/order_notifier.dart`** - Core timeout detection and synthetic event creation +- **`lib/features/order/notifiers/order_notifier.dart`** - Core timeout detection and synthetic event creation - **`lib/data/models/mostro_message.dart`** - MostroMessage.createTimeoutReversal() factory - **`lib/shared/providers/time_provider.dart`** - Countdown timer system - **`lib/shared/notifiers/session_notifier.dart`** - Session management @@ -797,7 +797,7 @@ The system automatically starts cleanup timers for both order creation and order When users take orders, a cleanup timer is automatically started to prevent sessions from becoming orphaned if Mostro doesn't respond: ```dart -// lib/features/order/notfiers/abstract_mostro_notifier.dart - startSessionTimeoutCleanup method +// lib/features/order/notifiers/abstract_mostro_notifier.dart - startSessionTimeoutCleanup method static void startSessionTimeoutCleanup(String orderId, Ref ref) { // Cancel existing timer if any _sessionTimeouts[orderId]?.cancel(); @@ -824,7 +824,7 @@ static void startSessionTimeoutCleanup(String orderId, Ref ref) { The cleanup timer is automatically cancelled when any response is received from Mostro: ```dart -// lib/features/order/notfiers/abstract_mostro_notifier.dart:92-93 +// lib/features/order/notifiers/abstract_mostro_notifier.dart:92-93 void handleEvent(MostroMessage event) { // Cancel timer on ANY response from Mostro for this order _cancelSessionTimeoutCleanup(orderId); @@ -836,7 +836,7 @@ void handleEvent(MostroMessage event) { When users create new orders, a similar cleanup timer prevents orphan sessions if Mostro doesn't respond to the order creation request: ```dart -// lib/features/order/notfiers/abstract_mostro_notifier.dart +// lib/features/order/notifiers/abstract_mostro_notifier.dart static void startSessionTimeoutCleanupForRequestId(int requestId, Ref ref) { final key = 'request:$requestId'; // Cancel existing timer if any @@ -865,7 +865,7 @@ static void startSessionTimeoutCleanupForRequestId(int requestId, Ref ref) { The cleanup timer is started automatically when users take orders: ```dart -// lib/features/order/notfiers/order_notifier.dart:107-108 +// lib/features/order/notifiers/order_notifier.dart:107-108 Future takeSellOrder(String orderId, int? amount, String? lnAddress) async { // ... session creation @@ -880,7 +880,7 @@ Future takeSellOrder(String orderId, int? amount, String? lnAddress) async The cleanup timer is started automatically when users create orders: ```dart -// lib/features/order/notfiers/add_order_notifier.dart +// lib/features/order/notifiers/add_order_notifier.dart Future submitOrder(Order order) async { // ... session creation @@ -898,7 +898,7 @@ Future submitOrder(Order order) async { When the 10-second timer expires, users receive a localized notification and are automatically navigated back to the order book: ```dart -// lib/features/order/notfiers/abstract_mostro_notifier.dart:381-393 +// lib/features/order/notifiers/abstract_mostro_notifier.dart:381-393 static void _showTimeoutNotificationAndNavigate(Ref ref) { try { // Show snackbar with localized timeout message diff --git a/lib/features/order/notfiers/abstract_mostro_notifier.dart b/lib/features/order/notifiers/abstract_mostro_notifier.dart similarity index 100% rename from lib/features/order/notfiers/abstract_mostro_notifier.dart rename to lib/features/order/notifiers/abstract_mostro_notifier.dart diff --git a/lib/features/order/notfiers/add_order_notifier.dart b/lib/features/order/notifiers/add_order_notifier.dart similarity index 98% rename from lib/features/order/notfiers/add_order_notifier.dart rename to lib/features/order/notifiers/add_order_notifier.dart index 78e14ee88..c068ea353 100644 --- a/lib/features/order/notfiers/add_order_notifier.dart +++ b/lib/features/order/notifiers/add_order_notifier.dart @@ -3,7 +3,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:mostro_mobile/data/enums.dart'; import 'package:mostro_mobile/data/models.dart'; import 'package:mostro_mobile/shared/providers.dart'; -import 'package:mostro_mobile/features/order/notfiers/abstract_mostro_notifier.dart'; +import 'package:mostro_mobile/features/order/notifiers/abstract_mostro_notifier.dart'; import 'package:mostro_mobile/features/order/providers/order_notifier_provider.dart'; import 'package:mostro_mobile/features/order/models/order_state.dart'; import 'package:mostro_mobile/services/logger_service.dart'; diff --git a/lib/features/order/notfiers/order_notifier.dart b/lib/features/order/notifiers/order_notifier.dart similarity index 98% rename from lib/features/order/notfiers/order_notifier.dart rename to lib/features/order/notifiers/order_notifier.dart index 30da568f6..effc4c6d5 100644 --- a/lib/features/order/notfiers/order_notifier.dart +++ b/lib/features/order/notifiers/order_notifier.dart @@ -5,7 +5,7 @@ import 'package:mostro_mobile/data/models.dart'; import 'package:mostro_mobile/features/order/models/order_state.dart'; import 'package:mostro_mobile/features/notifications/providers/notifications_provider.dart'; import 'package:mostro_mobile/shared/providers.dart'; -import 'package:mostro_mobile/features/order/notfiers/abstract_mostro_notifier.dart'; +import 'package:mostro_mobile/features/order/notifiers/abstract_mostro_notifier.dart'; import 'package:mostro_mobile/services/logger_service.dart'; import 'package:mostro_mobile/services/mostro_service.dart'; diff --git a/lib/features/order/providers/order_notifier_provider.dart b/lib/features/order/providers/order_notifier_provider.dart index d56b37ba2..f56112e25 100644 --- a/lib/features/order/providers/order_notifier_provider.dart +++ b/lib/features/order/providers/order_notifier_provider.dart @@ -2,8 +2,8 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:mostro_mobile/data/models/enums/order_type.dart'; import 'package:mostro_mobile/data/models/mostro_message.dart'; import 'package:mostro_mobile/features/order/models/order_state.dart'; -import 'package:mostro_mobile/features/order/notfiers/add_order_notifier.dart'; -import 'package:mostro_mobile/features/order/notfiers/order_notifier.dart'; +import 'package:mostro_mobile/features/order/notifiers/add_order_notifier.dart'; +import 'package:mostro_mobile/features/order/notifiers/order_notifier.dart'; import 'package:mostro_mobile/shared/providers/mostro_storage_provider.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; part 'order_notifier_provider.g.dart'; diff --git a/test/mocks.dart b/test/mocks.dart index 1c9fadc2d..182261526 100644 --- a/test/mocks.dart +++ b/test/mocks.dart @@ -18,7 +18,7 @@ import 'package:mostro_mobile/services/mostro_service.dart'; import 'package:mostro_mobile/services/nostr_service.dart'; import 'package:mostro_mobile/shared/notifiers/session_notifier.dart'; import 'package:mostro_mobile/features/order/models/order_state.dart'; -import 'package:mostro_mobile/features/order/notfiers/order_notifier.dart'; +import 'package:mostro_mobile/features/order/notifiers/order_notifier.dart'; import 'package:mostro_mobile/services/blossom_client.dart'; import 'package:mostro_mobile/services/encrypted_file_upload_service.dart'; import 'package:mostro_mobile/services/encrypted_image_upload_service.dart';