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

View File

@ -36,104 +36,44 @@ Future<void> onMessageReceived(
FlutterFlowIconButton(
icon: const Icon(Icons.done),
onPressed: () async {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: Text(
FFLocalizations.of(context).getVariableText(
ptText: 'Aprovar Visita',
enText: 'Approve Visit',
),
),
content: Text(
FFLocalizations.of(context).getVariableText(
ptText:
'Você tem certeza que deseja aprovar essa visita?',
enText:
'Are you sure you want to approve this visit?',
),
),
backgroundColor: FlutterFlowTheme.of(context)
.primaryBackground,
actions: [
FFButtonWidget(
text: FFLocalizations.of(context)
.getVariableText(
enText: 'No',
ptText: 'Não',
),
onPressed: () {
context.pop();
},
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)),
),
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),
),
),
],
);
showAlertDialog(
context,
FFLocalizations.of(context).getVariableText(
ptText: 'Aprovar Visita',
enText: 'Approve Visit',
),
FFLocalizations.of(context).getVariableText(
ptText:
'Você tem certeza que deseja aprovar essa visita?',
enText:
'Are you sure you want to approve this visit?',
),
() 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);
});
},
);
},
),
FlutterFlowIconButton(

View File

@ -93,7 +93,9 @@ class _AppState extends State<App> {
FirebaseMessaging.onMessage.listen(foregroundHandleMessage);
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);