Skip to content

Commit

Permalink
fixup! Handle broadcast error
Browse files Browse the repository at this point in the history
  • Loading branch information
hieutbui committed Dec 21, 2024
1 parent 43fdfa4 commit 9af1ef2
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lib/pages/ticket_details/ticket_details.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,19 @@ class TicketDetailsController extends State<TicketDetails>
final key = selectedTicketId ?? ticket?.id;

if (key == null) {
loggy.error('broadcast key is null');
return;
}

final channelName = 'error_$key';

Supabase.instance.client
.channel(channelName,
opts: RealtimeChannelConfig(
key: key,
private: true,
))
.channel(
channelName,
opts: RealtimeChannelConfig(
key: key,
),
)
.onBroadcast(
event: 'scan_ticket_error',
callback: _handleBroadcastError,
Expand All @@ -121,7 +123,8 @@ class TicketDetailsController extends State<TicketDetails>
await DialogUtils.show(
context: context,
title: 'Error',
description: 'Error occurred while scanning the ticket',
description:
'Error occurred while scanning the ticket.\n If you did not scan the ticket, please contact the parking lot staff.',
svgImage: ImagePaths.imgDialogError,
actions: (context) {
return <Widget>[
Expand Down

0 comments on commit 9af1ef2

Please sign in to comment.