chore: Refactor pushNotificationService.dart and home_page_widget.dart

This commit is contained in:
jantunesmesias 2024-07-11 13:16:34 -03:00
parent ac1653fe5c
commit 20c8d9ab8f
2 changed files with 5 additions and 4 deletions

View File

@ -321,7 +321,7 @@ class NotificationHandler {
case '': case '':
break; break;
case 'access': case 'access':
_showAcessNotificationModal(message, context, extra); _showAcessNotificationModal(message, context);
break; break;
case 'mensagem': case 'mensagem':
_showMessageNotificationDialog(message, context, extra); _showMessageNotificationDialog(message, context, extra);
@ -349,7 +349,7 @@ class NotificationHandler {
} }
void _showAcessNotificationModal( void _showAcessNotificationModal(
Map<String, dynamic> message, BuildContext context, Map<String, dynamic> extra) { Map<String, dynamic> message, BuildContext context) {
debugPrint('Showing access notification dialog'); debugPrint('Showing access notification dialog');
debugPrint('USR_TIPO: ${message['USR_TIPO']}'); debugPrint('USR_TIPO: ${message['USR_TIPO']}');
debugPrint('USR_ID: ${message['USR_ID']}'); debugPrint('USR_ID: ${message['USR_ID']}');
@ -382,6 +382,7 @@ class NotificationHandler {
debugPrint('Showing message notification dialog'); debugPrint('Showing message notification dialog');
debugPrint('Notification "message": $message'); debugPrint('Notification "message": $message');
showDialog( showDialog(
useSafeArea: true,
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return Dialog( return Dialog(
@ -390,7 +391,7 @@ class NotificationHandler {
id: message['local']['CLI_ID'].toString(), id: message['local']['CLI_ID'].toString(),
from: message['remetente'].toString(), from: message['remetente'].toString(),
to: message['destinatario'].toString() == 'O' ? 'Morador' : 'Visitante', to: message['destinatario'].toString() == 'O' ? 'Morador' : 'Visitante',
message: extra['body'].toString(), message: extra['body'].toString().isEmpty ? 'Unknown' : extra['body'].toString(),
), ),
); );
}, },

View File

@ -38,7 +38,7 @@ class _HomePageWidgetState extends State<HomePageWidget> {
SchedulerBinding.instance.addPostFrameCallback((_) async { SchedulerBinding.instance.addPostFrameCallback((_) async {
await PushNotificationService().initialize(context); await PushNotificationService().initialize(context);
if (FFAppState().cliUUID == '') { if (FFAppState().cliUUID == null || FFAppState().cliUUID.isEmpty) {
showModalBottomSheet( showModalBottomSheet(
isScrollControlled: true, isScrollControlled: true,
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,