This commit is contained in:
J. A. Messias 2024-09-12 13:31:50 -03:00
parent e903683f07
commit b184f2adf9
3 changed files with 51 additions and 101 deletions

View File

@ -62,6 +62,14 @@
<category android:name="android.intent.category.BROWSABLE" /> <category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="frehub" android:host="frehub.com" /> <data android:scheme="frehub" android:host="frehub.com" />
</intent-filter> </intent-filter>
<intent-filter>
<action android:name="visit_request" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="access" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter> <intent-filter>
<action android:name="mensagem" /> <action android:name="mensagem" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
@ -71,9 +79,9 @@
</activity> </activity>
<!-- <meta-data <meta-data
android:name="com.google.firebase.messaging.notification_icon" android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/notification_icon" /> --> android:resource="@drawable/notification_icon" />
<!-- Don't delete the meta-data below. <!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java --> This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->

View File

@ -36,104 +36,44 @@ Future<void> onMessageReceived(
FlutterFlowIconButton( FlutterFlowIconButton(
icon: const Icon(Icons.done), icon: const Icon(Icons.done),
onPressed: () async { onPressed: () async {
showDialog( showAlertDialog(
context: context, context,
builder: (context) { FFLocalizations.of(context).getVariableText(
return AlertDialog( ptText: 'Aprovar Visita',
title: Text( enText: 'Approve Visit',
FFLocalizations.of(context).getVariableText( ),
ptText: 'Aprovar Visita', FFLocalizations.of(context).getVariableText(
enText: 'Approve Visit', ptText:
), 'Você tem certeza que deseja aprovar essa visita?',
), enText:
content: Text( 'Are you sure you want to approve this visit?',
FFLocalizations.of(context).getVariableText( ),
ptText: () async {
'Você tem certeza que deseja aprovar essa visita?', log("payload: $payload");
enText: await answersRequest
'Are you sure you want to approve this visit?', .call(
), context,
), payload['referencia'].toString(),
backgroundColor: FlutterFlowTheme.of(context) 'L',
.primaryBackground, 'Mensagem',
actions: [ payload['idVisitante'].toString(),
FFButtonWidget( )
text: FFLocalizations.of(context) .then((value) {
.getVariableText( if (value) {
enText: 'No', context.pop();
ptText: 'Não', context.pop();
), } else {
onPressed: () { context.pop();
context.pop(); context.pop();
}, DialogUtil.errorDefault(context);
options: FFButtonOptions( }
width: 100, }).catchError((e) {
height: 40, context.pop();
color: FlutterFlowTheme.of(context) context.pop();
.primaryBackground, DialogUtil.errorDefault(context);
textStyle: TextStyle(
color: FlutterFlowTheme.of(context)
.primaryText,
),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context)
.primaryBackground,
width: 1,
),
borderRadius:
BorderRadius.circular(10)),
),
FFButtonWidget(
text: FFLocalizations.of(context)
.getVariableText(
enText: 'Yes',
ptText: 'Sim',
),
onPressed: () async {
log("payload: $payload");
await answersRequest
.call(
context,
payload['referencia'].toString(),
'L',
'Mensagem',
payload['idVisitante'].toString(),
)
.then((value) {
if (value) {
context.pop();
context.pop();
} else {
context.pop();
context.pop();
DialogUtil.errorDefault(context);
}
}).catchError((e) {
context.pop();
context.pop();
DialogUtil.errorDefault(context);
});
},
options: FFButtonOptions(
width: 100,
height: 40,
color: FlutterFlowTheme.of(context)
.primaryBackground,
textStyle: TextStyle(
color: FlutterFlowTheme.of(context)
.primaryText,
),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context)
.primaryBackground,
width: 1,
),
borderRadius: BorderRadius.circular(10),
),
),
],
);
}); });
},
);
}, },
), ),
FlutterFlowIconButton( FlutterFlowIconButton(

View File

@ -93,7 +93,9 @@ class _AppState extends State<App> {
FirebaseMessaging.onMessage.listen(foregroundHandleMessage); FirebaseMessaging.onMessage.listen(foregroundHandleMessage);
FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) { FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) {
onMessageReceived(message.data, '', message.data['click_action']); log(message.toMap().toString());
onMessageReceived(message.data, message.notification!.body,
message.data['click_action']);
}); });
FirebaseMessaging.onBackgroundMessage(_backgroundHandleMessage); FirebaseMessaging.onBackgroundMessage(_backgroundHandleMessage);