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 '':
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<String, dynamic> message, BuildContext context, Map<String, dynamic> extra) {
Map<String, dynamic> 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(),
),
);
},

View File

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