Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions lib/features/order/notfiers/abstract_mostro_notifier.dart
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,34 @@ class AbstractMostroNotifier extends StateNotifier<OrderState> {
// Enable chat
final chat = ref.read(chatRoomsProvider(orderId).notifier);
chat.subscribe();

// Check if Lightning address was used and show notification
if (session.role == Role.buyer) {
try {
final storage = ref.read(mostroStorageProvider);
final messages = await storage.getAllMessagesForOrderId(orderId);

// Find the order confirmation message (incoming Action.newOrder)
final orderConfirmation = messages
.where((m) => m.action == Action.newOrder)
.where((m) => m.getPayload<Order>()?.buyerInvoice != null)
.firstOrNull;

if (orderConfirmation != null) {
final confirmationOrder = orderConfirmation.getPayload<Order>();
final buyerInvoice = confirmationOrder?.buyerInvoice;

if (buyerInvoice != null && _isValidLightningAddress(buyerInvoice)) {
// Show Lightning address used notification
final notificationNotifier = ref.read(notificationActionsProvider.notifier);
notificationNotifier.showCustomMessage('lightningAddressUsed');
}
}
} catch (e) {
logger.w('Error checking lightning address usage: $e');
// Fail silently, don't affect main functionality
}
}
break;

case Action.holdInvoicePaymentSettled:
Expand Down