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