From 20c8d9ab8f26f5f6124dd329383bc66171144a78 Mon Sep 17 00:00:00 2001 From: jantunesmesias Date: Thu, 11 Jul 2024 13:16:34 -0300 Subject: [PATCH] chore: Refactor pushNotificationService.dart and home_page_widget.dart --- lib/backend/push_notification/pushNotificationService.dart | 7 ++++--- lib/pages/home_page/home_page_widget.dart | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/backend/push_notification/pushNotificationService.dart b/lib/backend/push_notification/pushNotificationService.dart index 4c4ae5ca..2b1c4886 100644 --- a/lib/backend/push_notification/pushNotificationService.dart +++ b/lib/backend/push_notification/pushNotificationService.dart @@ -321,7 +321,7 @@ class NotificationHandler { case '': break; case 'access': - _showAcessNotificationModal(message, context, extra); + _showAcessNotificationModal(message, context); break; case 'mensagem': _showMessageNotificationDialog(message, context, extra); @@ -349,7 +349,7 @@ class NotificationHandler { } void _showAcessNotificationModal( - Map message, BuildContext context, Map extra) { + Map message, BuildContext context) { debugPrint('Showing access notification dialog'); debugPrint('USR_TIPO: ${message['USR_TIPO']}'); debugPrint('USR_ID: ${message['USR_ID']}'); @@ -382,6 +382,7 @@ class NotificationHandler { debugPrint('Showing message notification dialog'); debugPrint('Notification "message": $message'); showDialog( + useSafeArea: true, context: context, builder: (BuildContext context) { return Dialog( @@ -390,7 +391,7 @@ class NotificationHandler { id: message['local']['CLI_ID'].toString(), from: message['remetente'].toString(), to: message['destinatario'].toString() == 'O' ? 'Morador' : 'Visitante', - message: extra['body'].toString(), + message: extra['body'].toString().isEmpty ? 'Unknown' : extra['body'].toString(), ), ); }, diff --git a/lib/pages/home_page/home_page_widget.dart b/lib/pages/home_page/home_page_widget.dart index 2fb8f6c8..ab475387 100644 --- a/lib/pages/home_page/home_page_widget.dart +++ b/lib/pages/home_page/home_page_widget.dart @@ -38,7 +38,7 @@ class _HomePageWidgetState extends State { SchedulerBinding.instance.addPostFrameCallback((_) async { await PushNotificationService().initialize(context); - if (FFAppState().cliUUID == '') { + if (FFAppState().cliUUID == null || FFAppState().cliUUID.isEmpty) { showModalBottomSheet( isScrollControlled: true, backgroundColor: Colors.transparent,