Merge pull request #54 from FRE-Informatica/fix/fd-941
Campo nome na notificação de acesso em locais que usam php-freaccess-ws
This commit is contained in:
commit
8f14860666
|
@ -11,17 +11,11 @@ import 'package:hub/flutter_flow/nav/nav.dart';
|
||||||
import 'package:hub/shared/utils/dialog_util.dart';
|
import 'package:hub/shared/utils/dialog_util.dart';
|
||||||
import 'package:hub/shared/utils/storage_util.dart';
|
import 'package:hub/shared/utils/storage_util.dart';
|
||||||
|
|
||||||
Future<void> onMessageReceived(
|
Future<void> onMessageReceived(Map<String, dynamic> payload, String? extra, String? handleClick) async {
|
||||||
Map<String, dynamic> payload, String? extra, String? handleClick) async {
|
|
||||||
final localId = jsonDecode(payload['local']!)['CLI_ID'];
|
final localId = jsonDecode(payload['local']!)['CLI_ID'];
|
||||||
|
|
||||||
final cliUUID = StorageUtil().cliUUID;
|
final cliUUID = StorageUtil().cliUUID;
|
||||||
answersRequest(
|
answersRequest({required BuildContext context, required String? ref, required String? task, required String? response, required String? id}) async {
|
||||||
{required BuildContext context,
|
|
||||||
required String? ref,
|
|
||||||
required String? task,
|
|
||||||
required String? response,
|
|
||||||
required String? id}) async {
|
|
||||||
final ApiCallResponse? respondeSolicitacaoCall;
|
final ApiCallResponse? respondeSolicitacaoCall;
|
||||||
final RespondeSolicitacaoCall callback = PhpGroup.respondeSolicitacaoCall;
|
final RespondeSolicitacaoCall callback = PhpGroup.respondeSolicitacaoCall;
|
||||||
|
|
||||||
|
@ -62,10 +56,8 @@ Future<void> onMessageReceived(
|
||||||
enText: 'Approve Visit',
|
enText: 'Approve Visit',
|
||||||
),
|
),
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
ptText:
|
ptText: 'Você tem certeza que deseja aprovar essa visita?',
|
||||||
'Você tem certeza que deseja aprovar essa visita?',
|
enText: 'Are you sure you want to approve this visit?',
|
||||||
enText:
|
|
||||||
'Are you sure you want to approve this visit?',
|
|
||||||
),
|
),
|
||||||
() async {
|
() async {
|
||||||
await answersRequest(
|
await answersRequest(
|
||||||
|
@ -102,10 +94,8 @@ Future<void> onMessageReceived(
|
||||||
enText: 'Block Visit',
|
enText: 'Block Visit',
|
||||||
),
|
),
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
ptText:
|
ptText: 'Você tem certeza que deseja bloquear essa visita?',
|
||||||
'Você tem certeza que deseja bloquear essa visita?',
|
enText: 'Are you sure you want to block this visit?',
|
||||||
enText:
|
|
||||||
'Are you sure you want to block this visit?',
|
|
||||||
), () async {
|
), () async {
|
||||||
await answersRequest
|
await answersRequest
|
||||||
.call(
|
.call(
|
||||||
|
@ -147,8 +137,7 @@ Future<void> onMessageReceived(
|
||||||
ptText: 'Mensagem',
|
ptText: 'Mensagem',
|
||||||
): payload['mensagem'],
|
): payload['mensagem'],
|
||||||
}),
|
}),
|
||||||
imagePath:
|
imagePath: 'https://freaccess.com.br/freaccess/getImage.php?cliID=$cliUUID&atividade=getFoto&Documento=${payload['documento'] ?? ''}&tipo=E',
|
||||||
'https://freaccess.com.br/freaccess/getImage.php?cliID=$cliUUID&atividade=getFoto&Documento=${payload['documento'] ?? ''}&tipo=E',
|
|
||||||
statusHashMap: [
|
statusHashMap: [
|
||||||
{
|
{
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
@ -180,19 +169,16 @@ Future<void> onMessageReceived(
|
||||||
return Dialog(
|
return Dialog(
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
child: DetailsComponentWidget(
|
child: DetailsComponentWidget(
|
||||||
imagePath:
|
imagePath: 'https://freaccess.com.br/freaccess/getImage.php?cliID=$cliUUID&atividade=getFoto&Documento=$id&tipo=$type',
|
||||||
'https://freaccess.com.br/freaccess/getImage.php?cliID=$cliUUID&atividade=getFoto&Documento=$id&tipo=$type',
|
|
||||||
labelsHashMap: Map<String, String>.from({
|
labelsHashMap: Map<String, String>.from({
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
enText: 'Name',
|
enText: 'Name',
|
||||||
ptText: 'Nome',
|
ptText: 'Nome',
|
||||||
): payload['PES_NOME'].toString(),
|
): payload['PES_NOME'] != null ? payload['PES_NOME'].toString() : payload['USR_NOME'].toString(),
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
enText: 'Type',
|
enText: 'Type',
|
||||||
ptText: 'Tipo',
|
ptText: 'Tipo',
|
||||||
): payload['USR_TIPO'].toString() == 'O'
|
): payload['USR_TIPO'].toString() == 'O' ? 'Morador' : 'Visitante',
|
||||||
? 'Morador'
|
|
||||||
: 'Visitante',
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
enText: 'Access Date',
|
enText: 'Access Date',
|
||||||
ptText: 'Data de Acesso',
|
ptText: 'Data de Acesso',
|
||||||
|
@ -235,11 +221,8 @@ Future<void> onMessageReceived(
|
||||||
child: MessageNotificationModalTemplateComponentWidget(
|
child: MessageNotificationModalTemplateComponentWidget(
|
||||||
id: localId,
|
id: localId,
|
||||||
from: payload['remetente'].toString(),
|
from: payload['remetente'].toString(),
|
||||||
to: payload['destinatario'].toString() == 'O'
|
to: payload['destinatario'].toString() == 'O' ? 'Morador' : 'Visitante',
|
||||||
? 'Morador'
|
message: extra.toString().isEmpty ? 'Unknown' : extra.toString(),
|
||||||
: 'Visitante',
|
|
||||||
message:
|
|
||||||
extra.toString().isEmpty ? 'Unknown' : extra.toString(),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -274,16 +257,10 @@ class NotificationService {
|
||||||
ledColor: Colors.white,
|
ledColor: Colors.white,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
channelGroups: [
|
channelGroups: [NotificationChannelGroup(channelGroupKey: 'basic_channel_group', channelGroupName: 'group_1')],
|
||||||
NotificationChannelGroup(
|
|
||||||
channelGroupKey: 'basic_channel_group',
|
|
||||||
channelGroupName: 'group_1')
|
|
||||||
],
|
|
||||||
debug: kDebugMode);
|
debug: kDebugMode);
|
||||||
|
|
||||||
await AwesomeNotifications()
|
await AwesomeNotifications().isNotificationAllowed().then((isAllowed) async {
|
||||||
.isNotificationAllowed()
|
|
||||||
.then((isAllowed) async {
|
|
||||||
final bool requestOSnotification = StorageUtil().requestOSnotification;
|
final bool requestOSnotification = StorageUtil().requestOSnotification;
|
||||||
|
|
||||||
if (requestOSnotification == false) {
|
if (requestOSnotification == false) {
|
||||||
|
@ -295,29 +272,21 @@ class NotificationService {
|
||||||
return;
|
return;
|
||||||
});
|
});
|
||||||
|
|
||||||
await AwesomeNotifications().setListeners(
|
await AwesomeNotifications().setListeners(onActionReceivedMethod: onActionReceivedMethod, onNotificationCreatedMethod: onNotificationCreatedMethod, onNotificationDisplayedMethod: onNotificationDisplayedMethod, onDismissActionReceivedMethod: onDismissActionReceivedMethod);
|
||||||
onActionReceivedMethod: onActionReceivedMethod,
|
|
||||||
onNotificationCreatedMethod: onNotificationCreatedMethod,
|
|
||||||
onNotificationDisplayedMethod: onNotificationDisplayedMethod,
|
|
||||||
onDismissActionReceivedMethod: onDismissActionReceivedMethod);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<void> onActionReceivedMethod(
|
static Future<void> onActionReceivedMethod(ReceivedAction receivedAction) async {
|
||||||
ReceivedAction receivedAction) async {
|
|
||||||
final payload = receivedAction.payload ?? {};
|
final payload = receivedAction.payload ?? {};
|
||||||
final extra = receivedAction.body;
|
final extra = receivedAction.body;
|
||||||
final handleClick = payload['click_action'];
|
final handleClick = payload['click_action'];
|
||||||
onMessageReceived(payload, extra, handleClick);
|
onMessageReceived(payload, extra, handleClick);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<void> onNotificationCreatedMethod(
|
static Future<void> onNotificationCreatedMethod(ReceivedNotification receivedNotification) async {}
|
||||||
ReceivedNotification receivedNotification) async {}
|
|
||||||
|
|
||||||
static Future<void> onNotificationDisplayedMethod(
|
static Future<void> onNotificationDisplayedMethod(ReceivedNotification receivedNotification) async {}
|
||||||
ReceivedNotification receivedNotification) async {}
|
|
||||||
|
|
||||||
static Future<void> onDismissActionReceivedMethod(
|
static Future<void> onDismissActionReceivedMethod(ReceivedAction receivedAction) async {}
|
||||||
ReceivedAction receivedAction) async {}
|
|
||||||
|
|
||||||
static Future<void> show({
|
static Future<void> show({
|
||||||
required final String title,
|
required final String title,
|
||||||
|
@ -348,12 +317,6 @@ class NotificationService {
|
||||||
badge: 0,
|
badge: 0,
|
||||||
),
|
),
|
||||||
actionButtons: actionButtons,
|
actionButtons: actionButtons,
|
||||||
schedule: scheduled
|
schedule: scheduled ? NotificationInterval(interval: Duration(seconds: interval!), timeZone: await AwesomeNotifications().getLocalTimeZoneIdentifier(), preciseAlarm: true) : null);
|
||||||
? NotificationInterval(
|
|
||||||
interval: Duration(seconds: interval!),
|
|
||||||
timeZone:
|
|
||||||
await AwesomeNotifications().getLocalTimeZoneIdentifier(),
|
|
||||||
preciseAlarm: true)
|
|
||||||
: null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue