chore: Refactor pushNotificationService.dart and home_page_widget.dart
This commit is contained in:
parent
ac1653fe5c
commit
20c8d9ab8f
|
@ -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(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
@ -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,
|
||||||
|
|
Loading…
Reference in New Issue