This commit is contained in:
J. A. Messias 2024-12-03 15:58:50 -03:00
parent f964598d07
commit a4ee7331ab
85 changed files with 895 additions and 1891 deletions

View File

@ -65,9 +65,9 @@ class PhpGroup {
class GetOpenedVisits {
Future<ApiCallResponse> call(final String page) async {
final String baseUrl = PhpGroup.getBaseUrl();
final String devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
const String atividade = 'getOpenedVisits';
const String pageSize = '10';
return await ApiManager.instance.makeApiCall(
@ -97,9 +97,9 @@ class GetOpenedVisits {
class GetResidentsByProperty {
Future<ApiCallResponse> call(final String page) async {
final String baseUrl = PhpGroup.getBaseUrl();
final String devUUID = await StorageHelper().g(KeychainStorageKey.devUUID.value) ?? '';
final String userUUID = await StorageHelper().g(KeychainStorageKey.userUUID.value) ?? '';
final String cliID = await StorageHelper().g(KeychainStorageKey.clientUUID.value) ?? '';
final String devUUID = await StorageHelper().get(KeychainStorageKey.devUUID.value) ?? '';
final String userUUID = await StorageHelper().get(KeychainStorageKey.userUUID.value) ?? '';
final String cliID = await StorageHelper().get(KeychainStorageKey.clientUUID.value) ?? '';
const String atividade = 'getResidentsByProperty';
const String pageSize = '10';
return await ApiManager.instance.makeApiCall(
@ -128,9 +128,9 @@ class GetResidentsByProperty {
class GetVehiclesByProperty {
Future<ApiCallResponse> call(final String page) async {
final String baseUrl = PhpGroup.getBaseUrl();
final String devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
const String atividade = 'getVehiclesByProperty';
const String pageSize = '10';
return await ApiManager.instance.makeApiCall(
@ -191,9 +191,9 @@ class TestCall {
class GetLicense {
Future<ApiCallResponse> call() async {
final String baseUrl = PhpGroup.getBaseUrl();
final String devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
return await ApiManager.instance.makeApiCall(
callName: 'getLicense',
@ -222,8 +222,8 @@ class GetLicense {
class UnregisterDevice {
Future<ApiCallResponse> call() async {
final String baseUrl = PhpGroup.getBaseUrl();
final String devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
return await ApiManager.instance.makeApiCall(
callName: 'unregisterDevice',
@ -250,9 +250,9 @@ class UnregisterDevice {
class DeletePet {
Future<ApiCallResponse> call({final int? petID = 0}) async {
final String baseUrl = PhpGroup.getBaseUrl();
final String devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
const String atividade = 'excluirPet';
return await ApiManager.instance.makeApiCall(
@ -295,9 +295,9 @@ class UpdatePet {
}) async {
final String baseUrl = PhpGroup.getBaseUrl();
final String devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
const String atividade = 'atualizarPet';
return await ApiManager.instance.makeApiCall(
@ -341,9 +341,9 @@ class GetPets {
}) async {
final String baseUrl = PhpGroup.getBaseUrl();
final String devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
const String atividade = 'consultaPets';
return await ApiManager.instance.makeApiCall(
@ -375,9 +375,9 @@ class GetPetPhoto {
Future<ApiCallResponse> call({final int? petId}) async {
final String baseUrl = PhpGroup.getBaseUrl();
final String devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
const String atividade = 'consultaFotoPet';
return await ApiManager.instance.makeApiCall(
@ -418,9 +418,9 @@ class RegisterPet {
}) async {
final String baseUrl = PhpGroup.getBaseUrl();
final String devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
const String atividade = 'cadastrarPet';
return await ApiManager.instance.makeApiCall(
@ -463,9 +463,9 @@ class BuscaEnconcomendas {
final String? adresseeType,
final String? status,
}) async {
final String devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
const String atividade = 'getEncomendas';
final String baseUrl = PhpGroup.getBaseUrl();
@ -507,9 +507,9 @@ class CancelaVisita {
}) async {
final String baseUrl = PhpGroup.getBaseUrl();
final String devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
const String atividade = 'cancelaVisita';
return await ApiManager.instance.makeApiCall(
@ -541,8 +541,8 @@ class CancelaVisita {
class DeleteAccount {
Future<ApiCallResponse> call() async {
final String devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
final String baseUrl = PhpGroup.getBaseUrl();
return await ApiManager.instance.makeApiCall(
@ -573,9 +573,9 @@ class ChangePanic {
}) async {
final String baseUrl = PhpGroup.getBaseUrl();
final String devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
const String atividade = 'updVisitado';
return await ApiManager.instance.makeApiCall(
@ -609,9 +609,9 @@ class ChangePass {
}) async {
final String baseUrl = PhpGroup.getBaseUrl();
final String devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
const String atividade = 'updVisitado';
return await ApiManager.instance.makeApiCall(
@ -645,9 +645,9 @@ class RespondeVinculo {
}) async {
final String baseUrl = PhpGroup.getBaseUrl();
final String devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
return await ApiManager.instance.makeApiCall(
callName: 'respondeVinculo',
@ -679,9 +679,9 @@ class ChangeNotifica {
}) async {
final String baseUrl = PhpGroup.getBaseUrl();
final String devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
const String atividade = 'updVisitado';
return await ApiManager.instance.makeApiCall(
@ -713,10 +713,10 @@ class UpdateIDE {
Future<ApiCallResponse> call() async {
final String baseUrl = PhpGroup.getBaseUrl();
final String devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
final String cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
final String newIde = (await StorageHelper().g(KeychainStorageKey.userDevUUID.value)) ?? '';
final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
final String cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
final String newIde = (await StorageHelper().get(KeychainStorageKey.userDevUUID.value)) ?? '';
const String atividade = 'updVisitado';
return await ApiManager.instance.makeApiCall(
@ -748,9 +748,9 @@ class UpdToken {
Future<ApiCallResponse> call() async {
final String baseUrl = PhpGroup.getBaseUrl();
final String devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
final String token = (await StorageHelper().g(SecureStorageKey.token.value)) ?? '';
final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
final String token = (await StorageHelper().get(SecureStorageKey.token.value)) ?? '';
return await ApiManager.instance.makeApiCall(
callName: 'updToken',
@ -777,11 +777,11 @@ class UpdToken {
class LoginCall {
Future<ApiCallResponse> call() async {
final String baseUrl = PhpGroup.getBaseUrl();
final String devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
final String email = (await StorageHelper().g(SecureStorageKey.email.value)) ?? '';
final String password = (await StorageHelper().g(SecureStorageKey.password.value)) ?? '';
final String type = (await StorageHelper().g(SecureStorageKey.deviceType.value)) ?? '';
final String description = (await StorageHelper().g(SecureStorageKey.deviceDescription.value)) ?? '';
final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
final String email = (await StorageHelper().get(SecureStorageKey.email.value)) ?? '';
final String password = (await StorageHelper().get(SecureStorageKey.password.value)) ?? '';
final String type = (await StorageHelper().get(SecureStorageKey.deviceType.value)) ?? '';
final String description = (await StorageHelper().get(SecureStorageKey.deviceDescription.value)) ?? '';
late final String token;
try {
token = await FirebaseMessagingService.getToken();
@ -864,9 +864,9 @@ class ChangePasswordCall {
required final String psswd,
}) async {
final String baseUrl = PhpGroup.getBaseUrl();
final String devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
return await ApiManager.instance.makeApiCall(
callName: 'changePassword',
@ -925,8 +925,8 @@ class GetLocalsCall {
Future<ApiCallResponse> call() async {
final String baseUrl = PhpGroup.getBaseUrl();
final String devUUID = await StorageHelper().g(KeychainStorageKey.devUUID.value) ?? '';
final String userUUID = await StorageHelper().g(KeychainStorageKey.userUUID.value) ?? '';
final String devUUID = await StorageHelper().get(KeychainStorageKey.devUUID.value) ?? '';
final String userUUID = await StorageHelper().get(KeychainStorageKey.userUUID.value) ?? '';
return await ApiManager.instance.makeApiCall(
callName: 'getLocals',
@ -965,9 +965,9 @@ class PostScheduleVisitorCall {
}) async {
final String baseUrl = PhpGroup.getBaseUrl();
final String devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
const String atividade = 'putVisitante';
return await ApiManager.instance.makeApiCall(
@ -1020,9 +1020,9 @@ class PostScheduleVisitCall {
}) async {
final String baseUrl = PhpGroup.getBaseUrl();
final String devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
const String atividade = 'putVisita';
return await ApiManager.instance.makeApiCall(
@ -1074,9 +1074,9 @@ class GetScheduleVisitCall {
}) async {
final String baseUrl = PhpGroup.getBaseUrl();
final String devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
final String cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
final String cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
const String atividade = 'getVisitas';
return await ApiManager.instance.makeApiCall(
@ -1348,9 +1348,9 @@ class GetDadosCall {
Future<ApiCallResponse> call() async {
final String baseUrl = PhpGroup.getBaseUrl();
final String devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
final String cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
final String cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
const String atividade = 'getDados';
return await ApiManager.instance.makeApiCall(
@ -1581,9 +1581,9 @@ class GetVisitorByDocCall {
}) async {
final String baseUrl = PhpGroup.getBaseUrl();
final String devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
const String atividade = 'getVisitante';
return await ApiManager.instance.makeApiCall(
@ -1635,9 +1635,9 @@ class GetFotoVisitanteCall {
}) async {
final String baseUrl = PhpGroup.getBaseUrl();
final String devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
const String atividade = 'getFotoVisitante';
return await ApiManager.instance.makeApiCall(
@ -1674,9 +1674,9 @@ class PostProvVisitSchedulingCall {
}) async {
final String baseUrl = PhpGroup.getBaseUrl();
final String devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
const String atividade = 'putAgendamentoProv';
return await ApiManager.instance.makeApiCall(
@ -1723,9 +1723,9 @@ class GetVisitsCall {
}) async {
final String baseUrl = PhpGroup.getBaseUrl();
final String devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
const String atividade = 'getVisitas';
return await ApiManager.instance.makeApiCall(
@ -1986,9 +1986,9 @@ class DeleteVisitCall {
}) async {
final String baseUrl = PhpGroup.getBaseUrl();
final String devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
const String atividade = 'cancelaVisita';
return await ApiManager.instance.makeApiCall(
@ -2029,10 +2029,10 @@ class GetPessoasLocalCall {
Future<ApiCallResponse> call() async {
final String baseUrl = PhpGroup.getBaseUrl();
final String devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
final String ownerUUID = (await StorageHelper().g(KeychainStorageKey.ownerUUID.value)) ?? '';
final String userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
final String cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
final String ownerUUID = (await StorageHelper().get(KeychainStorageKey.ownerUUID.value)) ?? '';
final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
final String cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
return await ApiManager.instance.makeApiCall(
callName: 'getPessoasLocal',
@ -2095,9 +2095,9 @@ class RespondeSolicitacaoCall {
}) async {
final String baseUrl = PhpGroup.getBaseUrl();
final String devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
final String cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
final String cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
const String atividade = 'respondeSolicitacao';
return await ApiManager.instance.makeApiCall(
@ -2145,9 +2145,9 @@ class GetAccessCall {
}) async {
final String baseUrl = PhpGroup.getBaseUrl();
final String devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
final String cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
final String cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
const String atividade = 'getAcessos';
return await ApiManager.instance.makeApiCall(
@ -2394,9 +2394,9 @@ class GetLiberationsCall {
final StreamController<ApiCallResponse> controller = StreamController();
Future.microtask(() async {
final String devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
final String cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
final String cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
const String atividade = 'getSolicitacoes';
try {
@ -2586,9 +2586,9 @@ class GetMessagesCall {
}) async {
final String baseUrl = PhpGroup.getBaseUrl();
final String devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
final String cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
final String cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
const String atividade = 'getMensagens';
return await ApiManager.instance.makeApiCall(

View File

@ -43,7 +43,7 @@ class FirebaseMessagingService {
final String? deviceToken = await _firebaseMessaging.getToken();
if (deviceToken != null) {
await StorageHelper().s(SecureStorageKey.token.value, deviceToken);
await StorageHelper().set(SecureStorageKey.token.value, deviceToken);
final ApiCallResponse? response;
response = await PhpGroup.updToken.call();

View File

@ -15,7 +15,7 @@ import 'package:hub/shared/utils/dialog_util.dart';
Future<void> onMessageReceived(Map<String, dynamic> payload, String? extra, String? handleClick) async {
final localId = jsonDecode(payload['local']!)['CLI_ID'];
final cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
final cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
answersRequest(
{required BuildContext context,
@ -239,7 +239,7 @@ Future<void> onMessageReceived(Map<String, dynamic> payload, String? extra, Stri
break;
case 'enroll_cond':
await StorageHelper().s(SecureStorageKey.haveLocal.value, true);
await StorageHelper().set(SecureStorageKey.haveLocal.value, true);
StorageHelper().context!.go('/homePage');
break;
default:
@ -271,11 +271,11 @@ class NotificationService {
await AwesomeNotifications().isNotificationAllowed().then((isAllowed) async {
final bool requestOSnotification =
(await StorageHelper().g(KeychainStorageKey.requestOSNotification.value)) == 'true';
(await StorageHelper().get(KeychainStorageKey.requestOSNotification.value)) == 'true';
if (requestOSnotification == false) {
if (isAllowed == false) {
await StorageHelper().s(KeychainStorageKey.requestOSNotification.value, true);
await StorageHelper().set(KeychainStorageKey.requestOSNotification.value, true);
await AwesomeNotifications().requestPermissionToSendNotifications();
}
}

View File

@ -105,9 +105,9 @@ class _BottomArrowLinkedLocalsComponentWidgetState extends State<BottomArrowLink
if (isEnabled) {
final local = locals[0];
await StorageHelper().s(KeychainStorageKey.clientName.value, local['CLI_NOME']);
await StorageHelper().s(KeychainStorageKey.clientUUID.value, local['CLI_ID']);
await StorageHelper().s(KeychainStorageKey.ownerUUID.value, local['CLU_OWNER_ID']);
await StorageHelper().set(KeychainStorageKey.clientName.value, local['CLI_NOME']);
await StorageHelper().set(KeychainStorageKey.clientUUID.value, local['CLI_ID']);
await StorageHelper().set(KeychainStorageKey.ownerUUID.value, local['CLU_OWNER_ID']);
context.pop();
return widget.response;
@ -137,7 +137,7 @@ class _BottomArrowLinkedLocalsComponentWidgetState extends State<BottomArrowLink
Future<dynamic> _fetchResponseLink(String status, String cliID) async {
try {
await StorageHelper().s(KeychainStorageKey.clientUUID.value, cliID);
await StorageHelper().set(KeychainStorageKey.clientUUID.value, cliID);
var response = await PhpGroup.resopndeVinculo.call(tarefa: status);
if (response.jsonBody['error'] == false) {
@ -147,7 +147,7 @@ class _BottomArrowLinkedLocalsComponentWidgetState extends State<BottomArrowLink
.getVariableText(ptText: "Vínculo Ativado com Sucesso", enText: "Link Activated Successfully")
};
} else {
await StorageHelper().s(KeychainStorageKey.clientUUID.value, '');
await StorageHelper().set(KeychainStorageKey.clientUUID.value, '');
return response.jsonBody;
}
} catch (e, s) {
@ -195,9 +195,9 @@ class _BottomArrowLinkedLocalsComponentWidgetState extends State<BottomArrowLink
statusHashMap: [_statusHashMap(local)],
onTapCardItemAction: () async {
if (local['CLU_STATUS'] == 'A') {
await StorageHelper().s(KeychainStorageKey.clientUUID.value, local['CLI_ID']);
await StorageHelper().s(KeychainStorageKey.clientName.value, local['CLI_NOME']);
await StorageHelper().s(KeychainStorageKey.ownerUUID.value, local['CLU_OWNER_ID']);
await StorageHelper().set(KeychainStorageKey.clientUUID.value, local['CLI_ID']);
await StorageHelper().set(KeychainStorageKey.clientName.value, local['CLI_NOME']);
await StorageHelper().set(KeychainStorageKey.ownerUUID.value, local['CLU_OWNER_ID']);
context.pop(true);
return true;

View File

@ -57,9 +57,9 @@ class ScheduleVisitDetailModel extends FlutterFlowModel<ScheduleVisitDetailWidge
}
Future<void> initDB() async {
devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
}
@override

View File

@ -16,10 +16,10 @@ class UpArrowLinkedLocalsComponentModel extends FlutterFlowModel<UpArrowLinkedLo
}
Future<void> initDB() async {
devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
cliName = (await StorageHelper().g(KeychainStorageKey.clientName.value)) ?? '';
devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
cliName = (await StorageHelper().get(KeychainStorageKey.clientName.value)) ?? '';
}
@override

View File

@ -32,9 +32,9 @@ class AccessNotificationModalTemplateComponentModel
}
Future<void> initDB() async {
devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
}
@override

View File

@ -49,7 +49,7 @@ class _PassKeyTemplateWidgetState extends State<PassKeyTemplateWidget> {
}
Future<void> _initialize() async {
_accessPass = await StorageHelper().g(SecureStorageKey.accessPass.value) ?? '';
_accessPass = await StorageHelper().get(SecureStorageKey.accessPass.value) ?? '';
}
@override

View File

@ -27,9 +27,9 @@ class LiberationHistoryItemDetailsTemplateComponentModel
void initState(BuildContext context) {}
Future<void> initDatabase() async {
devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
;
}

View File

@ -137,12 +137,12 @@ class ScheduleProvisionalVisitPageModel extends FlutterFlowModel<ScheduleProvisi
}
Future<void> init() async {
devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
;
cliName = (await StorageHelper().g(KeychainStorageKey.clientName.value)) ?? '';
ownerUUID = (await StorageHelper().g(KeychainStorageKey.ownerUUID.value)) ?? '';
cliName = (await StorageHelper().get(KeychainStorageKey.clientName.value)) ?? '';
ownerUUID = (await StorageHelper().get(KeychainStorageKey.ownerUUID.value)) ?? '';
setState?.call();
}
}

View File

@ -129,9 +129,9 @@ class RegisiterVistorTemplateComponentModel extends FlutterFlowModel<RegisiterVi
}
Future<void> initializeDatabase() async {
devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
;
}

View File

@ -91,7 +91,7 @@ class _SignUpTemplateComponentWidgetState extends State<SignUpTemplateComponentW
}
Future<void> _initialize() async {
_deviceType = (await StorageHelper().g(SecureStorageKey.deviceType.value)) ?? '';
_deviceType = (await StorageHelper().get(SecureStorageKey.deviceType.value)) ?? '';
}
@override

View File

@ -37,9 +37,9 @@ class ViewVisitDetailModel extends FlutterFlowModel<ViewVisitDetailWidget> {
}
Future<void> initializeDatabase() async {
devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
;
}

View File

@ -35,9 +35,9 @@ class VisitorSearchModalTemplateComponentModel extends FlutterFlowModel<VisitorS
}
Future<void> initDatabase() async {
devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
;
}

View File

@ -7,11 +7,11 @@ import 'index.dart';
class HomeBloc extends Bloc<HomeEvent, HomeState> {
HomeBloc() : super(HomeState()) {
on<HomeEvent>((event, emit) async {
final devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
final userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
final cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
final userName = (await StorageHelper().g(KeychainStorageKey.userName.value)) ?? '';
final userEmail = (await StorageHelper().g(SecureStorageKey.email.value)) ?? '';
final devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
final userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
final cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
final userName = (await StorageHelper().get(KeychainStorageKey.userName.value)) ?? '';
final userEmail = (await StorageHelper().get(SecureStorageKey.email.value)) ?? '';
emit(state.copyWith(
devUUID: devUUID,

View File

@ -128,10 +128,10 @@ class _HomePageWidgetState extends State<HomePageWidget> {
color: FlutterFlowTheme.of(context).primaryBackground,
child: Padding(
padding: const EdgeInsets.only(bottom: 40),
child: MenuFactory(
menuEntry: MenuEntries.home,
menuItem: EnumMenuItem.button,
menuView: MenuView.list_grid,
child: Menufactory(
entry: MenuEntry.getEntriesByType(MenuEntryType.Home),
item: EnumMenuItem.button,
view: MenuView.list_grid,
),
),
);

View File

@ -77,10 +77,10 @@ class _AboutPropertyPageState extends State<AboutPropertyPage> with SingleTicker
return SingleChildScrollView(
child: Container(
color: FlutterFlowTheme.of(context).primaryBackground,
child: MenuFactory(
menuEntry: MenuEntries.AboutProperty,
menuItem: EnumMenuItem.button,
menuView: MenuView.list_grid,
child: Menufactory(
entry: MenuEntry.getEntriesByType(MenuEntryType.Drawer),
item: EnumMenuItem.button,
view: MenuView.list_grid,
),
),
);

View File

@ -85,10 +85,10 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) {
builder: (context, _) {
return FutureBuilder<Widget>(
future: () async {
final bool isLogged = await StorageHelper().g(SecureStorageKey.isLogged.value) == 'true';
final bool haveLocal = await StorageHelper().g(SecureStorageKey.haveLocal.value) == 'true';
final bool haveUserUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value))?.isNotEmpty ?? false;
final bool haveDevUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value))?.isNotEmpty ?? false;
final bool isLogged = await StorageHelper().get(SecureStorageKey.isLogged.value) == 'true';
final bool haveLocal = await StorageHelper().get(SecureStorageKey.haveLocal.value) == 'true';
final bool haveUserUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value))?.isNotEmpty ?? false;
final bool haveDevUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value))?.isNotEmpty ?? false;
if (isLogged && haveDevUUID && haveUserUUID) {
return haveLocal ? const HomePageWidget() : const ReceptionPageWidget();

View File

@ -30,7 +30,7 @@ void main() async {
Future<void> _foregroundHandlerMessage(RemoteMessage message) async {
if (message.data['click_action'] == 'enroll_cond') {
await StorageHelper().s(SecureStorageKey.haveLocal.value, true);
await StorageHelper().set(SecureStorageKey.haveLocal.value, true);
StorageHelper().context?.go('/homePage');
}
@ -41,7 +41,7 @@ Future<void> _foregroundHandlerMessage(RemoteMessage message) async {
Future<void> _backgroundHandlerMessage(RemoteMessage message) async {
if (message.data['click_action'] == 'enroll_cond') {
await StorageHelper().s(SecureStorageKey.haveLocal.value, true);
await StorageHelper().set(SecureStorageKey.haveLocal.value, true);
StorageHelper().context?.go('/homePage');
}
}
@ -133,7 +133,7 @@ class _AppState extends State<App> with WidgetsBindingObserver {
FirebaseMessaging.onMessage.listen(_foregroundHandlerMessage);
FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) async {
if (message.data['click_action'] == 'enroll_cond') {
await StorageHelper().s(SecureStorageKey.haveLocal.value, true);
await StorageHelper().set(SecureStorageKey.haveLocal.value, true);
log('onMessageOpenedApp');
} else {
onMessageReceived(message.data, message.notification!.body, message.data['click_action']);
@ -142,7 +142,7 @@ class _AppState extends State<App> with WidgetsBindingObserver {
FirebaseMessaging.instance.getInitialMessage().then((message) async {
if (message != null) {
if (message.data['click_action'] == 'enroll_cond') {
await StorageHelper().s(SecureStorageKey.haveLocal.value, true);
await StorageHelper().set(SecureStorageKey.haveLocal.value, true);
log('getInitialMessage');
}
}
@ -187,7 +187,7 @@ class _AppState extends State<App> with WidgetsBindingObserver {
@override
void didChangeAppLifecycleState(AppLifecycleState state) async {
if (state == AppLifecycleState.detached) {
await LocalsRepositoryImpl().processLocals(context);
await LocalsRepositoryImpl().update(context);
await FirebaseMessagingService().updateDeviceToken();
}
}

View File

@ -33,9 +33,9 @@ class AcessHistoryPageModel extends FlutterFlowModel<AccessHistoryScreen> {
}
Future<void> initDatabase() async {
devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
}
@override

View File

@ -25,11 +25,11 @@ class _FastPassPageWidgetState extends State<FastPassPageWidget> {
late InAppWebViewController _controllerIOS;
Future<Map<String, String>> initVariables() async {
final email = (await StorageHelper().g(SecureStorageKey.email.value)) ?? '';
final name = (await StorageHelper().g(KeychainStorageKey.userName.value)) ?? '';
final devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
final userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
final cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
final email = (await StorageHelper().get(SecureStorageKey.email.value)) ?? '';
final name = (await StorageHelper().get(KeychainStorageKey.userName.value)) ?? '';
final devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
final userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
final cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
const createdAt = '0000-00-00 00:00:00';
final url = 'https://hub.freaccess.com.br/hub/fast-pass/$cliUUID';
final freUserData =

View File

@ -36,9 +36,9 @@ class LiberationHistoryModel extends FlutterFlowModel<LiberationHistoryWidget> {
}
Future<void> init() async {
devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
}
Future answersRequest(

View File

@ -39,9 +39,9 @@ class MessageHistoryPageModel extends FlutterFlowModel<MessageHistoryPageWidget>
}
Future<void> init() async {
devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
}
@override

View File

@ -64,7 +64,7 @@ class _PackageOrderPage extends State<PackageOrderPage> {
}
Future<void> initDatabase() async {
cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
}
@override

View File

@ -291,10 +291,10 @@ class _PetsHistoryScreenState extends State<PetsHistoryScreen> with TickerProvid
}
],
onTapCardItemAction: () async {
final devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
final userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
final cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
final cliName = (await StorageHelper().g(KeychainStorageKey.clientName.value)) ?? '';
final devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
final userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
final cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
final cliName = (await StorageHelper().get(KeychainStorageKey.clientName.value)) ?? '';
await showDialog(
useSafeArea: true,
context: context,

View File

@ -147,10 +147,10 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
textControllerObservation = TextEditingController();
WidgetsBinding.instance.addPostFrameCallback((_) async {
devUUID = await StorageHelper().g(KeychainStorageKey.devUUID.value) ?? '';
userUUID = await StorageHelper().g(KeychainStorageKey.userUUID.value) ?? '';
cliUUID = await StorageHelper().g(KeychainStorageKey.clientUUID.value) ?? '';
petAmountRegister = await StorageHelper().g(KeychainStorageKey.petAmount.value) ?? '';
devUUID = await StorageHelper().get(KeychainStorageKey.devUUID.value) ?? '';
userUUID = await StorageHelper().get(KeychainStorageKey.userUUID.value) ?? '';
cliUUID = await StorageHelper().get(KeychainStorageKey.clientUUID.value) ?? '';
petAmountRegister = await StorageHelper().get(KeychainStorageKey.petAmount.value) ?? '';
});
}

View File

@ -23,11 +23,11 @@ class PreferencesPageModel with ChangeNotifier {
late bool isPanic = false;
Future<void> _initialize() async {
isFingerprint = await StorageHelper().g(KeychainStorageKey.fingerprint.value) == 'true';
isPerson = await StorageHelper().g(KeychainStorageKey.person.value) == 'true';
isNotify = await StorageHelper().g(KeychainStorageKey.notify.value) == 'true';
isAccess = await StorageHelper().g(KeychainStorageKey.access.value) == 'true';
isPanic = await StorageHelper().g(KeychainStorageKey.panic.value) == 'true';
isFingerprint = await StorageHelper().get(KeychainStorageKey.fingerprint.value) == 'true';
isPerson = await StorageHelper().get(KeychainStorageKey.person.value) == 'true';
isNotify = await StorageHelper().get(KeychainStorageKey.notify.value) == 'true';
isAccess = await StorageHelper().get(KeychainStorageKey.access.value) == 'true';
isPanic = await StorageHelper().get(KeychainStorageKey.panic.value) == 'true';
notifyListeners();
}
@ -36,7 +36,7 @@ class PreferencesPageModel with ChangeNotifier {
}
Future<void> enablePerson(BuildContext context) async {
final String userDevUUID = (await StorageHelper().g(KeychainStorageKey.userDevUUID.value)) ?? '';
final String userDevUUID = (await StorageHelper().get(KeychainStorageKey.userDevUUID.value)) ?? '';
notifyListeners();
Share.share(
FFLocalizations.of(context).getVariableText(
@ -63,7 +63,7 @@ class PreferencesPageModel with ChangeNotifier {
.call(notifica: value)
.then((value) async {
if (value.jsonBody['error'] == false) {
await StorageHelper().s(KeychainStorageKey.notify.value, isNotify ? 'false' : 'true');
await StorageHelper().set(KeychainStorageKey.notify.value, isNotify ? 'false' : 'true');
content = FFLocalizations.of(context).getVariableText(
enText: 'Notification changed successfully',
ptText: 'Notificação alterada com sucesso',
@ -85,7 +85,7 @@ class PreferencesPageModel with ChangeNotifier {
);
SnackBarUtil.showSnackBar(context, content, isError: true);
})
.then((_) async => isNotify = await StorageHelper().g(KeychainStorageKey.notify.value) == 'true')
.then((_) async => isNotify = await StorageHelper().get(KeychainStorageKey.notify.value) == 'true')
.whenComplete(() => notifyListeners());
context.pop();
}
@ -134,13 +134,13 @@ class PreferencesPageModel with ChangeNotifier {
Future<void> toggleAccess(BuildContext context) async {
onChange(String key) async {
await StorageHelper().s(SecureStorageKey.accessPass.value, key);
await StorageHelper().set(SecureStorageKey.accessPass.value, key);
await PhpGroup.changePass
.call(newSenha: key)
.then((value) async {
final String content;
if (jsonDecode(value.jsonBody['error'].toString()) == false) {
await StorageHelper().s(KeychainStorageKey.access.value, isAccess ? 'false' : 'true');
await StorageHelper().set(KeychainStorageKey.access.value, isAccess ? 'false' : 'true');
notifyListeners();
content = FFLocalizations.of(context).getVariableText(
enText: 'Access pass changed successfully',
@ -162,7 +162,7 @@ class PreferencesPageModel with ChangeNotifier {
);
SnackBarUtil.showSnackBar(context, content, isError: true);
})
.then((_) async => isAccess = await StorageHelper().g(KeychainStorageKey.access.value) == 'true')
.then((_) async => isAccess = await StorageHelper().get(KeychainStorageKey.access.value) == 'true')
.whenComplete(() => notifyListeners());
}
@ -171,13 +171,13 @@ class PreferencesPageModel with ChangeNotifier {
Future<void> togglePanic(BuildContext context) async {
onChange(String key) async {
await StorageHelper().s(SecureStorageKey.panicPass.value, key);
await StorageHelper().set(SecureStorageKey.panicPass.value, key);
await PhpGroup.changePanic
.call(newSenhaPanico: key)
.then((value) async {
final String content;
if (jsonDecode(value.jsonBody['error'].toString()) == false) {
await StorageHelper().s(KeychainStorageKey.panic.value, isPanic ? 'false' : 'true');
await StorageHelper().set(KeychainStorageKey.panic.value, isPanic ? 'false' : 'true');
notifyListeners();
content = FFLocalizations.of(context).getVariableText(
enText: 'Panic password changed successfully',
@ -199,7 +199,7 @@ class PreferencesPageModel with ChangeNotifier {
);
SnackBarUtil.showSnackBar(context, content, isError: true);
})
.then((_) async => isPanic = await StorageHelper().g(KeychainStorageKey.panic.value) == 'true')
.then((_) async => isPanic = await StorageHelper().get(KeychainStorageKey.panic.value) == 'true')
.whenComplete(() => notifyListeners());
}
@ -214,11 +214,11 @@ class PreferencesPageModel with ChangeNotifier {
onChange(String? key) async {
isFingerprint = !isFingerprint;
await StorageHelper().s(SecureStorageKey.fingerprintPass.value, key ?? '');
await StorageHelper().s(KeychainStorageKey.fingerprint.value, isFingerprint ? 'true' : 'false');
await StorageHelper().set(SecureStorageKey.fingerprintPass.value, key ?? '');
await StorageHelper().set(KeychainStorageKey.fingerprint.value, isFingerprint ? 'true' : 'false');
notifyListeners();
SnackBarUtil.showSnackBar(context, content);
isFingerprint = await StorageHelper().g(KeychainStorageKey.fingerprint.value) == 'true';
isFingerprint = await StorageHelper().get(KeychainStorageKey.fingerprint.value) == 'true';
}
isFingerprint ? onChange(null) : _showPassKey(context, onChange);

View File

@ -29,8 +29,8 @@ class QrCodePageModel extends FlutterFlowModel<QrCodePageWidget> {
}
Future<void> initVariable() async {
isFingerprint = await StorageHelper().g(KeychainStorageKey.fingerprint.value) == 'true';
userDevUUID = await StorageHelper().g(KeychainStorageKey.userDevUUID.value) ?? '';
isFingerprint = await StorageHelper().get(KeychainStorageKey.fingerprint.value) == 'true';
userDevUUID = await StorageHelper().get(KeychainStorageKey.userDevUUID.value) ?? '';
safeSetState?.call();
}

View File

@ -353,7 +353,7 @@ class _QrCodePageWidgetState extends State<QrCodePageWidget> with TickerProvider
await BiometricHelper.checkBiometrics()
.then((value) async => await BiometricHelper.authenticateBiometric().then((value) async {
if (value == false) throw Exception('Biometric authentication failed');
final key = await StorageHelper().g(SecureStorageKey.fingerprintPass.value);
final key = await StorageHelper().get(SecureStorageKey.fingerprintPass.value);
if (key == null || key.isEmpty) throw Exception('No key found');
safeSetState(() {
if (animationsMap['barcodeOnActionTriggerAnimation'] != null) {

View File

@ -6,7 +6,7 @@ import 'package:share_plus/share_plus.dart';
class ReceptionPageModel with ChangeNotifier {
Future<void> getIdenfifier(BuildContext context) async {
final String userDevUUID = (await StorageHelper().g(KeychainStorageKey.userDevUUID.value)) ?? '';
final String userDevUUID = (await StorageHelper().get(KeychainStorageKey.userDevUUID.value)) ?? '';
notifyListeners();
Share.share(

View File

@ -33,7 +33,7 @@ class _ReceptionPageWidgetState extends State<ReceptionPageWidget> with WidgetsB
}();
FirebaseMessagingService().updateDeviceToken();
LocalsRepositoryImpl().checkLocals(context);
LocalsRepositoryImpl().validateLocal(context);
}
@override
@ -46,7 +46,7 @@ class _ReceptionPageWidgetState extends State<ReceptionPageWidget> with WidgetsB
void didChangeAppLifecycleState(AppLifecycleState state) {
if (state == AppLifecycleState.resumed) {
setState(() {
LocalsRepositoryImpl().checkLocals(context);
LocalsRepositoryImpl().validateLocal(context);
});
}
}

View File

@ -22,11 +22,11 @@ class _ReservationPageWidgetState extends State<ReservationPageWidget> {
late WebViewController _controllerAll;
Future<Map<String, String>> initVariables() async {
final email = (await StorageHelper().g(SecureStorageKey.email.value)) ?? '';
final name = (await StorageHelper().g(KeychainStorageKey.userName.value)) ?? '';
final devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
final userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
final clientId = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
final email = (await StorageHelper().get(SecureStorageKey.email.value)) ?? '';
final name = (await StorageHelper().get(KeychainStorageKey.userName.value)) ?? '';
final devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
final userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
final clientId = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
const createdAt = '0000-00-00 00:00:00';
final url = 'https://hub.freaccess.com.br/hub/reservation/$clientId';
final freUserData =

View File

@ -18,8 +18,8 @@ class ResidentsOnThePropertyModel extends FlutterFlowModel<ResidentsOnThePropert
}
void initVariables() async {
devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
onRefresh?.call();
}

View File

@ -218,9 +218,9 @@ class ScheduleCompleteVisitPageModel extends FlutterFlowModel<ScheduleComplete>
}
Future<void> _initVariables() async {
devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
}
@override

View File

@ -35,9 +35,9 @@ class _VisitHistoryWidgetState extends State<VisitHistoryWidget> with TickerProv
List<dynamic> _visitWrap = [];
Future<void> _initVariables() async {
devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
}
@override
@ -245,10 +245,10 @@ class _VisitHistoryWidgetState extends State<VisitHistoryWidget> with TickerProv
},
],
onTapCardItemAction: () async {
final devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
final userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
final cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
final cliName = (await StorageHelper().g(KeychainStorageKey.clientName.value)) ?? '';
final devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
final userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
final cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
final cliName = (await StorageHelper().get(KeychainStorageKey.clientName.value)) ?? '';
await showDialog(
useSafeArea: true,

View File

@ -30,8 +30,8 @@ class VisitsModel extends FlutterFlowModel<VehicleOnTheProperty> {
void dispose() {}
Future<void> initAsync() async {
devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
onRefresh?.call();
}

View File

@ -32,13 +32,13 @@ class _WelcomePageWidgetState extends State<WelcomePageWidget> {
// On page load action.
SchedulerBinding.instance.addPostFrameCallback((_) async {
if (isAndroid == true) {
await StorageHelper().s(SecureStorageKey.deviceType.value, 'Android');
await StorageHelper().set(SecureStorageKey.deviceType.value, 'Android');
setState(() {});
} else if (isiOS == true) {
await StorageHelper().s(SecureStorageKey.deviceType.value, 'iOS');
await StorageHelper().set(SecureStorageKey.deviceType.value, 'iOS');
setState(() {});
} else {
await StorageHelper().s(SecureStorageKey.deviceType.value, 'Web');
await StorageHelper().set(SecureStorageKey.deviceType.value, 'Web');
setState(() {});
}
});

View File

@ -189,10 +189,10 @@ class CustomDrawer extends StatelessWidget {
}
Widget _buildDrawerBody(BuildContext context) {
return MenuFactory(
menuEntry: MenuEntries.drawer,
menuItem: EnumMenuItem.tile,
menuView: MenuView.list,
return Menufactory(
entry: MenuEntry.getEntriesByType(MenuEntryType.Property),
item: EnumMenuItem.tile,
view: MenuView.list,
);
}
}

View File

@ -8,13 +8,13 @@ import 'package:hub/components/organism_components/bottom_arrow_linked_locals_co
import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:hub/flutter_flow/internationalization.dart';
import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:hub/shared/components/molecules/locals/index.dart';
import 'package:hub/shared/components/molecules/modules/index.dart';
import 'package:hub/shared/helpers/storage/base_storage.dart';
import 'package:hub/shared/helpers/storage/storage_helper.dart';
import 'package:hub/shared/services/authentication/authentication_service.dart';
import 'package:hub/shared/utils/dialog_util.dart';
import 'package:hub/shared/utils/log_util.dart';
import 'package:hub/shared/utils/snackbar_util.dart';
abstract class LocalsRemoteDataSource {
@ -22,7 +22,7 @@ abstract class LocalsRemoteDataSource {
Future<bool> processLocals(BuildContext context) async => false;
Future<bool> processData(BuildContext context) async => false;
Future<bool> selectLocal(BuildContext context, ApiCallResponse? response) async => false;
Future<void> unlinkLocal(BuildContext context) async {}
Future<void> detachLocal(BuildContext context) async {}
}
class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
@ -38,7 +38,7 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
final bool? isError = response.jsonBody['error'];
if (isError == true) {
_handleError(context, response.jsonBody['error_msg']);
LocalUtil.handleError(context, response.jsonBody['error_msg']);
return;
}
if (response.jsonBody == null) {
@ -56,11 +56,11 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
final bool isEnable = !isEmpty && isActive;
if (isEnable) {
await StorageHelper().s(SecureStorageKey.haveLocal.value, true);
await StorageHelper().s(SecureStorageKey.isLogged.value, true);
await StorageHelper().set(SecureStorageKey.haveLocal.value, true);
await StorageHelper().set(SecureStorageKey.isLogged.value, true);
await WidgetsBinding.instance.endOfFrame;
await StorageHelper().s(KeychainStorageKey.clientUUID.value, '');
await StorageHelper().s(KeychainStorageKey.ownerUUID.value, '');
await StorageHelper().set(KeychainStorageKey.clientUUID.value, '');
await StorageHelper().set(KeychainStorageKey.ownerUUID.value, '');
StorageHelper().context?.go('/homePage');
}
} catch (e, s) {
@ -78,7 +78,7 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
if (isError == true) {
final String errorMsg = response.jsonBody['error_msg'];
_handleError(context, errorMsg);
LocalUtil.handleError(context, errorMsg);
return false;
}
if (response.jsonBody == null) {
@ -91,27 +91,27 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
}
final List<dynamic> locals = response.jsonBody['locais'].toList() ?? [];
_logLocalsStatus(locals);
LocalUtil.logLocalsStatus(locals);
final bool isActive = _isActive(locals);
final bool isInactived = await _isInactived(locals);
final bool isPending = _isPending(locals);
final bool isActive = LocalUtil.isActive(locals);
final bool isInactived = await LocalUtil.isInactived(locals);
final bool isPending = LocalUtil.isPending(locals);
final bool isUnique = locals.length == 1;
final bool isBlocked = locals.where((local) => local['CLU_STATUS'] == 'B').isNotEmpty;
final bool isEnabled = isUnique && isActive;
final bool isDisabled = isUnique && isBlocked;
final bool isUnselected = await _isUnselected();
final bool isSelected = await _isSelected(isInactived);
final bool isUnselected = await LocalUtil.isUnselected();
final bool isSelected = await LocalUtil.isSelected(isInactived);
final bool isUnavailable = isPending && isUnselected && isUnique;
final bool isAvailable = await _isAvailable();
final bool isAvailable = await LocalUtil.isAvailable();
if (isDisabled) {
AuthenticationService.signOut(context);
return true;
} else if (isUnavailable) {
return await _handleUnavailable(context, locals);
return await LocalUtil.handleUnavailable(context, locals);
} else if (isEnabled) {
return await _handleEnabled(context, locals[0]);
return await LocalUtil.handleEnabled(context, locals[0]);
} else if (isUnselected) {
log('() => isUnselected');
return await selectLocal(context, response);
@ -166,12 +166,8 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
await DialogUtil.error(context, errorMsg).whenComplete(() => selectLocal(context, response));
return false;
} else {
final bool isNewVersion = await _updateStorageUtil(response.jsonBody);
await LicenseRepositoryImpl().setupLicense(isNewVersion);
if (isNewVersion) {
return await LicenseRepositoryImpl().fetchLicense(isNewVersion);
}
return false;
final bool isNewVersion = await LocalUtil.updateStorageUtil(response.jsonBody);
return await LicenseRepositoryImpl().updateLicense(isNewVersion);
}
} catch (e, s) {
log('() => error processData: $e', stackTrace: s);
@ -205,7 +201,7 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
}
@override
Future<void> unlinkLocal(BuildContext context) async {
Future<void> detachLocal(BuildContext context) async {
String content;
try {
content = FFLocalizations.of(context).getVariableText(
@ -215,8 +211,8 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
await PhpGroup.resopndeVinculo.call(tarefa: 'I').then((value) async {
if (value.jsonBody['error'] == false) {
await StorageHelper().s(KeychainStorageKey.clientName.value, '');
await StorageHelper().s(KeychainStorageKey.clientUUID.value, '');
await StorageHelper().set(KeychainStorageKey.clientName.value, '');
await StorageHelper().set(KeychainStorageKey.clientUUID.value, '');
context.pop();
context.go(
'/homePage',
@ -249,117 +245,5 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
}
}
void _handleError(BuildContext context, String errorMsg) async {
final String devUUID = await StorageHelper().g(KeychainStorageKey.devUUID.value) ?? '';
final String userUUID = await StorageHelper().g(KeychainStorageKey.userUUID.value) ?? '';
final bool isAuthenticated = userUUID.isNotEmpty && devUUID.isNotEmpty;
final bool isDevLinked = !errorMsg.contains('Esse dispositivo nao pertence a esse usuario');
log('() => isLinked: $errorMsg');
if (!isAuthenticated) {
errorMsg = FFLocalizations.of(context).getVariableText(
ptText: 'Erro ao obter credenciais de autenticação',
enText: 'Error getting authentication credentials',
);
await DialogUtil.error(context, errorMsg);
return;
// await DialogUtil.error(context, errorMsg).whenComplete(() async => await AuthenticationService.signOut(context));
}
if (!isDevLinked) {
errorMsg = FFLocalizations.of(context).getVariableText(
ptText: 'Não foi possível vincular o dispositivo, tente novamente.',
enText: 'Unable to link device, try again',
);
await DialogUtil.warning(context, errorMsg);
return;
}
await DialogUtil.error(context, errorMsg).whenComplete(() async => await selectLocal(context, null));
}
Future<bool> _handleUnavailable(BuildContext context, List<dynamic> locals) async {
log('() => isUnavailable');
try {
await StorageHelper().s(KeychainStorageKey.clientUUID.value, locals[0]['CLI_ID']);
await StorageHelper().s(KeychainStorageKey.ownerUUID.value, locals[0]['CLU_OWNER_ID']);
await StorageHelper().s(KeychainStorageKey.clientName.value, locals[0]['CLI_NOME']);
var response = await PhpGroup.resopndeVinculo.call(tarefa: 'A');
if (response.jsonBody['error'] == true) {
await StorageHelper().s(KeychainStorageKey.clientUUID.value, '');
await StorageHelper().s(KeychainStorageKey.ownerUUID.value, '');
await StorageHelper().s(KeychainStorageKey.clientName.value, '');
return false;
}
if (response.jsonBody['error'] == false) return await processData(context).then((value) => value);
} catch (e, s) {
await DialogUtil.errorDefault(context);
LogUtil.requestAPIFailed('responderVinculo.php', '', 'Responder Vínculo', e, s);
return false;
}
return false;
}
Future<bool> _handleEnabled(BuildContext context, dynamic local) async {
log('() => isEnabled');
await StorageHelper().s(KeychainStorageKey.clientUUID.value, local['CLI_ID']);
await StorageHelper().s(KeychainStorageKey.ownerUUID.value, local['CLU_OWNER_ID']);
await StorageHelper().s(KeychainStorageKey.clientName.value, local['CLI_NOME']);
await StorageHelper().s(KeychainStorageKey.userName.value, local['USU_NOME']);
return await processData(context);
}
void _logLocalsStatus(List<dynamic> locals) {
for (var local in locals) {
final String status = local['CLU_STATUS'];
log('() => CLU_STATUS: $status');
}
}
Future<bool> _updateStorageUtil(Map<String, dynamic> jsonBody) async {
try {
await StorageHelper().s(KeychainStorageKey.whatsapp.value, jsonBody['whatsapp'] ?? false);
await StorageHelper().s(KeychainStorageKey.provisional.value, jsonBody['provisional'] ?? false);
await StorageHelper().s(KeychainStorageKey.pets.value, jsonBody['pet'] ?? false);
await StorageHelper().s(KeychainStorageKey.petAmount.value,
jsonBody['petAmountRegister']?.toString().isEmpty ?? true ? '0' : jsonBody['petAmountRegister'].toString());
await StorageHelper().s(KeychainStorageKey.userName.value, jsonBody['visitado']['VDO_NOME'] ?? '');
final bool isNewVersion = jsonBody['newVersion'] ?? false;
await StorageHelper().s(KeychainStorageKey.isNewVersion.value, isNewVersion);
return isNewVersion;
} catch (e, s) {
log('Error in _updateStorageUtil: $e', stackTrace: s);
return false;
}
}
bool _isActive(List<dynamic> locals) {
return locals.where((local) => local['CLU_STATUS'] == 'A').isNotEmpty;
}
Future<bool> _isInactived(List<dynamic> locals) async {
String cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
return locals.where((local) => local['CLI_ID'] != cliUUID && local['CLU_STATUS'] == 'A').isNotEmpty;
}
bool _isPending(List<dynamic> locals) {
return locals.where((local) => local['CLU_STATUS'] != 'B' && local['CLU_STATUS'] != 'A').isNotEmpty;
}
Future<bool> _isUnselected() async {
String cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
String cliName = (await StorageHelper().g(KeychainStorageKey.clientName.value)) ?? '';
String ownerUUID = (await StorageHelper().g(KeychainStorageKey.ownerUUID.value)) ?? '';
return cliUUID.isEmpty && cliName.isEmpty && ownerUUID.isEmpty;
}
Future<bool> _isSelected(bool isInactived) async {
String cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
String cliName = (await StorageHelper().g(KeychainStorageKey.clientName.value)) ?? '';
return cliUUID.isNotEmpty && cliName.isNotEmpty && isInactived;
}
Future<bool> _isAvailable() async {
String cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
String cliName = (await StorageHelper().g(KeychainStorageKey.clientName.value)) ?? '';
return cliUUID.isNotEmpty && cliName.isNotEmpty;
}
}

View File

@ -1,35 +1,24 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:hub/backend/api_requests/api_manager.dart';
import 'package:hub/shared/components/molecules/locals/index.dart';
class LocalsRepositoryImpl implements LocalsRepository {
final LocalsRemoteDataSource remoteDataSource = LocalsRemoteDataSourceImpl();
@override
Future<void> checkLocals(BuildContext context) async {
Future<void> validateLocal(BuildContext context) async {
return await remoteDataSource.checkLocals(context);
}
@override
Future<bool> processData(BuildContext context) async {
return await remoteDataSource.processData(context);
}
@override
Future<bool> processLocals(BuildContext context) async {
Future<bool> update(BuildContext context) async {
final bool response = await remoteDataSource.processLocals(context);
context.read<LocalProfileBloc>().add(LocalProfileEvent());
return response;
}
@override
Future<bool> selectLocal(BuildContext context, ApiCallResponse? response) async {
return await remoteDataSource.selectLocal(context, response);
}
@override
Future<void> unlinkLocal(BuildContext context) {
return remoteDataSource.unlinkLocal(context);
return remoteDataSource.detachLocal(context);
}
}

View File

@ -1,10 +1,7 @@
import 'package:flutter/material.dart';
import 'package:hub/backend/api_requests/api_calls.dart';
abstract class LocalsRepository {
Future<void> checkLocals(BuildContext context) async {}
Future<bool> processLocals(BuildContext context) async => false;
Future<bool> processData(BuildContext context) async => false;
Future<bool> selectLocal(BuildContext context, ApiCallResponse? response) async => false;
Future<void> validateLocal(BuildContext context) async {}
Future<bool> update(BuildContext context) async => false;
Future<void> unlinkLocal(BuildContext context) async {}
}

View File

@ -1,3 +1,4 @@
export 'data/index.dart';
export 'domain/index.dart';
export 'presentation/index.dart';
export 'utils/index.dart';

View File

@ -24,8 +24,8 @@ class LocalProfileState {
class LocalProfileBloc extends Bloc<LocalProfileEvent, LocalProfileState> {
LocalProfileBloc() : super(LocalProfileState()) {
on<LocalProfileEvent>((event, emit) async {
final cliName = (await StorageHelper().g(KeychainStorageKey.clientName.value)) ?? '';
final cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
final cliName = (await StorageHelper().get(KeychainStorageKey.clientName.value)) ?? '';
final cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
emit(state.copyWith(cliName: cliName, cliUUID: cliUUID));
});
}
@ -42,8 +42,8 @@ class LocalProfileComponentModel extends FlutterFlowModel<LocalProfileComponentW
}
Future<void> getData() async {
cliName = (await StorageHelper().g(KeychainStorageKey.clientName.value)) ?? '';
cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
cliName = (await StorageHelper().get(KeychainStorageKey.clientName.value)) ?? '';
cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
setStateCallback?.call();
}

View File

@ -22,8 +22,8 @@ class _LocalProfileComponentWidgetState extends State<LocalProfileComponentWidge
Future callback() async {
await StorageHelper().s(KeychainStorageKey.clientUUID.value, '');
await LocalsRepositoryImpl().processLocals(context);
await StorageHelper().set(KeychainStorageKey.clientUUID.value, '');
await LocalsRepositoryImpl().update(context);
}
@override
@ -95,8 +95,8 @@ class _LocalProfileComponentWidgetState extends State<LocalProfileComponentWidge
hoverColor: Colors.transparent,
highlightColor: Colors.transparent,
onTap: () async {
await StorageHelper().s(KeychainStorageKey.clientUUID.value, '');
await LocalsRepositoryImpl().processLocals(context);
await StorageHelper().set(KeychainStorageKey.clientUUID.value, '');
await LocalsRepositoryImpl().update(context);
},
child: ClipRRect(
borderRadius: BorderRadius.circular(200.0),

View File

@ -0,0 +1 @@
export 'local_util.dart';

View File

@ -0,0 +1,130 @@
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:hub/backend/api_requests/api_calls.dart';
import 'package:hub/flutter_flow/internationalization.dart';
import 'package:hub/shared/components/molecules/locals/index.dart';
import 'package:hub/shared/helpers/storage/base_storage.dart';
import 'package:hub/shared/helpers/storage/storage_helper.dart';
import 'package:hub/shared/utils/dialog_util.dart';
import 'package:hub/shared/utils/log_util.dart';
class LocalUtil {
static void handleError(BuildContext context, String errorMsg) async {
final String devUUID = await StorageHelper().get(KeychainStorageKey.devUUID.value) ?? '';
final String userUUID = await StorageHelper().get(KeychainStorageKey.userUUID.value) ?? '';
final bool isAuthenticated = userUUID.isNotEmpty && devUUID.isNotEmpty;
final bool isDevLinked = !errorMsg.contains('Esse dispositivo nao pertence a esse usuario');
log('() => isLinked: $errorMsg');
if (!isAuthenticated) {
errorMsg = FFLocalizations.of(context).getVariableText(
ptText: 'Erro ao obter credenciais de autenticação',
enText: 'Error getting authentication credentials',
);
await DialogUtil.error(context, errorMsg);
return;
// await DialogUtil.error(context, errorMsg).whenComplete(() async => await AuthenticationService.signOut(context));
}
if (!isDevLinked) {
errorMsg = FFLocalizations.of(context).getVariableText(
ptText: 'Não foi possível vincular o dispositivo, tente novamente.',
enText: 'Unable to link device, try again',
);
await DialogUtil.warning(context, errorMsg);
return;
}
await DialogUtil.error(context, errorMsg).whenComplete(() async => await LocalsRemoteDataSourceImpl().selectLocal(context, null));
}
static Future<bool> handleUnavailable(BuildContext context, List<dynamic> locals) async {
log('() => isUnavailable');
try {
await StorageHelper().set(KeychainStorageKey.clientUUID.value, locals[0]['CLI_ID']);
await StorageHelper().set(KeychainStorageKey.ownerUUID.value, locals[0]['CLU_OWNER_ID']);
await StorageHelper().set(KeychainStorageKey.clientName.value, locals[0]['CLI_NOME']);
var response = await PhpGroup.resopndeVinculo.call(tarefa: 'A');
if (response.jsonBody['error'] == true) {
await StorageHelper().set(KeychainStorageKey.clientUUID.value, '');
await StorageHelper().set(KeychainStorageKey.ownerUUID.value, '');
await StorageHelper().set(KeychainStorageKey.clientName.value, '');
return false;
}
if (response.jsonBody['error'] == false) return await LocalsRemoteDataSourceImpl().processData(context).then((value) => value);
} catch (e, s) {
await DialogUtil.errorDefault(context);
LogUtil.requestAPIFailed('responderVinculo.php', '', 'Responder Vínculo', e, s);
return false;
}
return false;
}
static Future<bool> handleEnabled(BuildContext context, dynamic local) async {
log('() => isEnabled');
await StorageHelper().set(KeychainStorageKey.clientUUID.value, local['CLI_ID']);
await StorageHelper().set(KeychainStorageKey.ownerUUID.value, local['CLU_OWNER_ID']);
await StorageHelper().set(KeychainStorageKey.clientName.value, local['CLI_NOME']);
await StorageHelper().set(KeychainStorageKey.userName.value, local['USU_NOME']);
return await LocalsRemoteDataSourceImpl().processData(context);
}
static void logLocalsStatus(List<dynamic> locals) {
for (var local in locals) {
final String status = local['CLU_STATUS'];
log('() => CLU_STATUS: $status');
}
}
static Future<bool> updateStorageUtil(Map<String, dynamic> jsonBody) async {
try {
await StorageHelper().set(KeychainStorageKey.whatsapp.value, jsonBody['whatsapp'] ?? false);
await StorageHelper().set(KeychainStorageKey.provisional.value, jsonBody['provisional'] ?? false);
await StorageHelper().set(KeychainStorageKey.pets.value, jsonBody['pet'] ?? false);
await StorageHelper().set(KeychainStorageKey.petAmount.value,
jsonBody['petAmountRegister']?.toString().isEmpty ?? true ? '0' : jsonBody['petAmountRegister'].toString());
await StorageHelper().set(KeychainStorageKey.userName.value, jsonBody['visitado']['VDO_NOME'] ?? '');
final bool isNewVersion = jsonBody['newVersion'] ?? false;
await StorageHelper().set(KeychainStorageKey.isNewVersion.value, isNewVersion);
return isNewVersion;
} catch (e, s) {
log('Error in _updateStorageUtil: $e', stackTrace: s);
return false;
}
}
static bool isActive(List<dynamic> locals) {
return locals.where((local) => local['CLU_STATUS'] == 'A').isNotEmpty;
}
static Future<bool> isInactived(List<dynamic> locals) async {
String cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
return locals.where((local) => local['CLI_ID'] != cliUUID && local['CLU_STATUS'] == 'A').isNotEmpty;
}
static bool isPending(List<dynamic> locals) {
return locals.where((local) => local['CLU_STATUS'] != 'B' && local['CLU_STATUS'] != 'A').isNotEmpty;
}
static Future<bool> isUnselected() async {
String cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
String cliName = (await StorageHelper().get(KeychainStorageKey.clientName.value)) ?? '';
String ownerUUID = (await StorageHelper().get(KeychainStorageKey.ownerUUID.value)) ?? '';
return cliUUID.isEmpty && cliName.isEmpty && ownerUUID.isEmpty;
}
static Future<bool> isSelected(bool isInactived) async {
String cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
String cliName = (await StorageHelper().get(KeychainStorageKey.clientName.value)) ?? '';
return cliUUID.isNotEmpty && cliName.isNotEmpty && isInactived;
}
static Future<bool> isAvailable() async {
String cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
String cliName = (await StorageHelper().get(KeychainStorageKey.clientName.value)) ?? '';
return cliUUID.isNotEmpty && cliName.isNotEmpty;
}
}

View File

@ -0,0 +1 @@
export 'menu_local_data_source.dart';

View File

@ -0,0 +1,98 @@
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:hub/shared/components/molecules/menu/index.dart';
import 'package:hub/shared/extensions/dialog_extensions.dart';
import 'package:hub/shared/services/authentication/authentication_service.dart';
import 'package:hub/shared/utils/path_util.dart';
abstract class MenuLocalDataSource {
Future<MenuItem?> addMenuEntry(EnumMenuItem item, List<MenuItem?> entries, IconData icon, String text, Function() action);
Future<bool> processDisplayDefault(EnumMenuItem item, MenuEntry opt, List<MenuItem?> entries);
Future<void> processDisplay(EnumMenuItem item, String display, MenuEntry opt, List<MenuItem?> entries);
Future<bool> processStartDate(String startDate, MenuEntry opt);
Future<bool> processExpirationDate(String expirationDate, MenuEntry opt);
}
class MenuLocalDataSourceImpl implements MenuLocalDataSource {
static final MenuLocalDataSourceImpl _instance = MenuLocalDataSourceImpl._internal();
factory MenuLocalDataSourceImpl() => _instance;
MenuLocalDataSourceImpl._internal();
@override
Future<MenuItem?> addMenuEntry(EnumMenuItem item, List<MenuItem?> entries, IconData icon, String text, Function() action) async {
final menuItem = item == EnumMenuItem.button
? ButtonMenuItem(icon: icon, action: action, title: text)
: item == EnumMenuItem.card || item == EnumMenuItem.tile
? CardMenuItem(icon: icon, action: action, title: text)
: null;
if (menuItem != null) {
entries.add(menuItem);
}
return null;
}
@override
Future<bool> processDisplayDefault(EnumMenuItem item, MenuEntry opt, List<MenuItem?> entries) async {
if (opt.value == 'FRE-HUB-LOGOUT') {
await addMenuEntry(item, entries, opt.icon, opt.name, () async {
await AuthenticationService.signOut(navigatorKey.currentContext!);
});
return true;
}
else return false;
}
@override
Future<void> processDisplay(EnumMenuItem item, String display, MenuEntry opt, List<MenuItem?> entries) async {
try {
switch (display) {
case 'VISIVEL':
await addMenuEntry(item, entries, opt.icon, opt.name, () async {
await PathUtil.nav(opt.route);
});
break;
case 'DESABILITADO':
await addMenuEntry(item, entries, opt.icon, opt.name, () async {
await DialogUnavailable.unavailableFeature(navigatorKey.currentContext!);
});
break;
case 'INVISIVEL':
break;
}
} catch (e) {
log('Error processing display for module ${opt.value}: $e');
}
}
@override
Future<bool> processStartDate(String startDate, MenuEntry opt) async {
try {
if (startDate.isEmpty) return true;
final start = DateTime.tryParse(startDate);
return start != null && DateTime.now().isAfter(start);
} catch (e) {
log('Error processing start date for module ${opt.value}: $e');
}
return false;
}
@override
Future<bool> processExpirationDate(String expirationDate, MenuEntry opt) async {
try {
if (expirationDate.isEmpty) return false;
final expiration = DateTime.tryParse(expirationDate);
return expiration != null && DateTime.now().isAfter(expiration);
} catch (e) {
log('Error processing expiration date for module ${opt.value}: $e');
}
return false;
}
}

View File

@ -0,0 +1 @@
export 'menu_repository_impl.dart';

View File

@ -0,0 +1,45 @@
import 'dart:developer';
import 'package:hub/flutter_flow/custom_functions.dart';
import 'package:hub/shared/components/molecules/menu/data/data_sources/menu_local_data_source.dart';
import 'package:hub/shared/components/molecules/menu/domain/respositories/menu_repository.dart';
import 'package:hub/shared/components/molecules/menu/index.dart';
import 'package:hub/shared/components/molecules/modules/index.dart';
class MenuRepositoryImpl implements MenuRepository {
final MenuLocalDataSource menuDataSource = MenuLocalDataSourceImpl();
@override
Future<List<MenuItem?>> generateMenuEntries(List<MenuEntry> menuOptions, EnumMenuItem item) async {
List<MenuItem?> entries = [];
try {
for (var opt in menuOptions) {
final bool isDefault = await menuDataSource.processDisplayDefault(item, opt, entries);
if (isDefault) continue;
final licenseValue = await LicenseRepositoryImpl().getLicense(opt.value);
if (licenseValue != null) {
final licenseMap = await stringToMap(licenseValue);
final display = licenseMap['display'] ?? 'INVISIVEL';
final startDate = licenseMap['startDate'] ?? '';
final expirationDate = licenseMap['expirationDate'] ?? '';
final isStarted = await menuDataSource.processStartDate(startDate, opt);
final isExpired = await menuDataSource.processExpirationDate(expirationDate, opt);
if (isStarted && !isExpired) {
await menuDataSource.processDisplay(item, display, opt, entries);
}
}
}
} catch (e, s) {
log('Error generating menu entries: $e', stackTrace: s);
}
return entries;
}
}

View File

@ -1,3 +1 @@
export 'menu_entry.dart';
export 'menu_item.dart';
export 'menu_view.dart';

View File

@ -1,20 +0,0 @@
import 'package:flutter/material.dart';
import 'package:hub/shared/components/molecules/modules/domain/entities/base_module.dart';
class MenuEntry implements BaseModule {
@override
IconData get icon => throw UnimplementedError();
@override
String get name => throw UnimplementedError();
@override
String get route => throw UnimplementedError();
@override
String get value => throw UnimplementedError();
}

View File

@ -9,11 +9,11 @@ enum EnumMenuItem {
MenuItem getInstance(final Function() action, final String title, final IconData icon) {
switch (this) {
case EnumMenuItem.button:
return MenuButtonWidget(action: action, title: title, icon: icon);
return ButtonMenuItem(action: action, title: title, icon: icon);
case EnumMenuItem.card:
return MenuCardItem(action: action, title: title, icon: icon);
return CardMenuItem(action: action, title: title, icon: icon);
case EnumMenuItem.tile:
return MenuCardItem(action: action, title: title, icon: icon);
return CardMenuItem(action: action, title: title, icon: icon);
}
}
}

View File

@ -0,0 +1,6 @@
import 'package:hub/shared/components/molecules/menu/domain/entities/menu_item.dart';
import 'package:hub/shared/components/molecules/menu/index.dart';
abstract class MenuRepository {
Future<List<MenuItem?>> generateMenuEntries(List<MenuEntry> menuOptions, EnumMenuItem item);
}

View File

@ -1,17 +1,11 @@
import 'dart:async';
import 'dart:convert';
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:hub/backend/schema/enums/enums.dart';
import 'package:hub/flutter_flow/custom_functions.dart';
import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:hub/shared/components/molecules/menu/data/repositories/menu_repository_impl.dart';
import 'package:hub/shared/components/molecules/menu/index.dart';
import 'package:hub/shared/components/molecules/modules/index.dart';
import 'package:hub/shared/extensions/dialog_extensions.dart';
import 'package:hub/shared/services/authentication/authentication_service.dart';
class MenuViewEvent {}
@ -32,15 +26,14 @@ class MenuViewState {
class MenuViewBloc extends Bloc<MenuViewEvent, MenuViewState> {
final MenuView style;
final EnumMenuItem item;
final bool expandable;
final List<MenuEntry> menuOptions;
late StreamSubscription<void> _completer;
MenuViewBloc({required this.style, required this.item, required this.expandable, required this.menuOptions}) : super(MenuViewState()) {
MenuViewBloc({required this.style, required this.item, required this.menuOptions}) : super(MenuViewState()) {
on<MenuViewEvent>((event, emit) async {
await LicenseRemoteDataSourceImpl().waitForSaveCompletion();
final entries = await generateMenuEntries();
final entries = await MenuRepositoryImpl().generateMenuEntries(menuOptions, item);
emit(state.copyWith(menuEntries: entries));
});
@ -54,104 +47,6 @@ class MenuViewBloc extends Bloc<MenuViewEvent, MenuViewState> {
_completer.cancel();
return super.close();
}
Future<MenuItem?> addMenuEntry(List<MenuItem?> entries, IconData icon, String text, Function() action) async {
entries.add(
item == EnumMenuItem.button
? MenuButtonWidget(icon: icon, action: action, title: text)
: item == EnumMenuItem.card
? MenuCardItem(icon: icon, action: action, title: text)
: item == EnumMenuItem.tile
? MenuCardItem(icon: icon, action: action, title: text)
: null,
);
return null;
}
Future<List<MenuItem?>> generateMenuEntries() async {
List<MenuItem?> entries = [];
try {
for (var opt in menuOptions) {
String? licenseValue = await LicenseRepositoryImpl().g(opt.value);
if (licenseValue != null) {
Map<String, String> licenseMap = await stringToMap(licenseValue);
final String display = licenseMap['display'] ?? 'INVISIVEL';
final String startDate = licenseMap['startDate'] ?? '';
final String expirationDate = licenseMap['expirationDate'] ?? '';
final bool isStarted = await processStartDate(startDate, opt);
final bool isExpired = await processExpirationDate(expirationDate, opt);
if (isStarted && !isExpired) {
await processDisplay(display, opt, entries);
}
}
}
} catch (e, s) {
log('Error generating menu entries: $e', stackTrace: s);
}
return entries;
}
Future<void> processDisplay(String display, MenuEntry opt, List<MenuItem?> entries) async {
try {
switch (display) {
case 'VISIVEL':
if(opt.value == 'FRE-HUB-LOGOUT')
await addMenuEntry(entries, opt.icon, opt.name, () async {
await AuthenticationService.signOut(navigatorKey.currentContext!);
});
else
await addMenuEntry(entries, opt.icon, opt.name, () async {
await nav(opt.route);
});
break;
case 'DESABILITADO':
await addMenuEntry(entries, opt.icon, opt.name, () async {
await DialogUnavailable.unavailableFeature(navigatorKey.currentContext!);
});
break;
case 'INVISIVEL':
default:
break;
}
} catch (e) {
log('Error processing display for module ${opt.value}: $e');
}
}
Future<bool> processStartDate(String startDate, MenuEntry opt) async {
try {
if (startDate.isEmpty) return true;
final DateTime? start = DateTime.tryParse(startDate);
if (start != null) {
return DateTime.now().isAfter(start);
}
} catch (e) {
log('Error processing start date for module ${opt.value}: $e');
}
return false;
}
Future<bool> processExpirationDate(String expirationDate, MenuEntry opt) async {
try {
if (expirationDate.isEmpty) return false;
final DateTime? expiration = DateTime.tryParse(expirationDate);
if (expiration != null) {
return DateTime.now().isAfter(expiration);
}
} catch (e) {
log('Error processing expiration date for module ${opt.value}: $e');
}
return false;
}
Future nav(String link) async {
navigatorKey.currentContext!.push(link, extra: <String, dynamic>{
kTransitionInfoKey: const TransitionInfo(
hasTransition: false,
transitionType: PageTransitionType.scale,
alignment: Alignment.bottomCenter,
),
});
}
}

View File

@ -1,2 +1,3 @@
export 'blocs/index.dart';
export 'widgets/index.dart';
export 'mappers/index.dart';

View File

@ -0,0 +1 @@
export 'menu_entry.dart';

View File

@ -0,0 +1,219 @@
import 'package:flutter/material.dart';
import 'package:hub/flutter_flow/internationalization.dart';
import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:hub/shared/components/molecules/modules/domain/entities/base_module.dart';
enum MenuEntryType { Home, Drawer, Property }
class MenuEntry implements BaseModule {
final String value;
final IconData icon;
final String name;
final String route;
final List<MenuEntryType> types;
const MenuEntry({
required this.value,
required this.icon,
required this.name,
required this.route,
required this.types,
});
static List<MenuEntry> entries = [
MenuEntry(
value: 'FRE-HUB-MESSAGES',
icon: Icons.chat_outlined,
name: FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Consultar Mensagens',
enText: 'Messages History',
),
route: '/messageHistoryPage',
types: [MenuEntryType.Home, MenuEntryType.Drawer],
),
MenuEntry(
value: 'FRE-HUB-LIBERATIONS',
icon: Icons.how_to_reg_outlined,
name: FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Consultar Liberações',
enText: 'Liberations History',
),
route: '/liberationHistory',
types: [MenuEntryType.Home, MenuEntryType.Drawer],
),
MenuEntry(
value: 'FRE-HUB-RESERVATIONS',
icon: Icons.event_available,
name: FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Reservas',
enText: 'Reservations',
),
route: '/reservation',
types: [MenuEntryType.Home, MenuEntryType.Drawer],
),
MenuEntry(
value: 'FRE-HUB-ACCESS',
icon: Icons.transfer_within_a_station_outlined,
name: FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Consultar Acessos',
enText: 'Access History',
),
route: '/acessHistoryPage',
types: [MenuEntryType.Home, MenuEntryType.Drawer],
),
MenuEntry(
value: 'FRE-HUB-PETS',
icon: Icons.pets,
name: FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Pets',
enText: 'Pets',
),
route: '/petsPage',
types: [MenuEntryType.Home, MenuEntryType.Drawer],
),
MenuEntry(
value: 'FRE-HUB-PEOPLE',
icon: Icons.groups,
name: FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Pessoas na Propriedade',
enText: 'People on the Property',
),
route: '/peopleOnThePropertyPage',
types: [MenuEntryType.Home, MenuEntryType.Drawer],
),
MenuEntry(
value: 'FRE-HUB-ORDERS',
icon: Icons.inventory_2_outlined,
name: FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Minhas Encomendas',
enText: 'My Orders',
),
route: '/packageOrder',
types: [MenuEntryType.Home, MenuEntryType.Drawer],
),
MenuEntry(
value: 'FRE-HUB-COMPLETE-SCHEDULE',
icon: Icons.event,
name: FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Agenda Completa',
enText: 'Complete Schedule',
),
route: '/scheduleCompleteVisitPage',
types: [MenuEntryType.Home, MenuEntryType.Drawer],
),
MenuEntry(
value: 'FRE-HUB-AGE-PROV-PRESTADOR',
icon: Icons.engineering_outlined,
name: FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Agendar Prestadores',
enText: 'Schedule Providers',
),
route: '/provisionalSchedule',
types: [MenuEntryType.Home, MenuEntryType.Drawer],
),
MenuEntry(
value: 'FRE-HUB-AGE-PROV-DELIVERY',
icon: Icons.sports_motorsports_outlined,
name: FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Agendar Delivery',
enText: 'Schedule Delivery',
),
route: '/deliverySchedule',
types: [MenuEntryType.Home, MenuEntryType.Drawer],
),
MenuEntry(
value: 'FRE-HUB-FASTPASS',
icon: Icons.attach_email_outlined,
name: FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Fast Pass',
enText: 'Fast Pass',
),
route: '/fastPassPage',
types: [MenuEntryType.Home, MenuEntryType.Drawer],
),
MenuEntry(
value: 'FRE-HUB-QRCODE',
icon: Icons.qr_code,
name: FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'QRCode de Acesso',
enText: 'Access QRCode',
),
route: '/qrCodePage',
types: [MenuEntryType.Home, MenuEntryType.Drawer],
),
MenuEntry(
value: 'FRE-HUB-VISITORS',
icon: Icons.person_add_alt_1_outlined,
name: FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Cadastrar Visitantes',
enText: 'Register Visitors',
),
route: '/registerVisitorPage',
types: [MenuEntryType.Home, MenuEntryType.Drawer],
),
MenuEntry(
value: 'FRE-HUB-PROPERTY',
icon: Icons.home,
name: FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Sobre a Propriedade',
enText: 'About the Property',
),
route: '/aboutProperty',
types: [MenuEntryType.Home, MenuEntryType.Drawer],
),
MenuEntry(
value: 'FRE-HUB-SETTINGS',
icon: Icons.settings,
name: FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Configurações',
enText: 'Settings',
),
route: '/preferencesSettings',
types: [MenuEntryType.Home, MenuEntryType.Drawer],
),
MenuEntry(
value: 'FRE-HUB-LOGOUT',
icon: Icons.exit_to_app,
name: FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Sair',
enText: 'Logout',
),
route: '/WelcomePage',
types: [MenuEntryType.Drawer],
),
MenuEntry(
value: 'FRE-HUB-RESIDENTS',
icon: Icons.groups,
name: 'Residents',
route: '/residentsOnThePropertyPage',
types: [MenuEntryType.Property],
),
MenuEntry(
value: 'FRE-HUB-VEHICLES',
icon: Icons.directions_car,
name: 'Vehicles',
route: '/vehiclesOnThePropertyPage',
types: [MenuEntryType.Property],
),
MenuEntry(
value: 'FRE-HUB-OPENED-VISITS',
icon: Icons.perm_contact_calendar,
name: 'Opened Visits',
route: '/openedVisitsPage',
types: [MenuEntryType.Property],
),
MenuEntry(
value: 'FRE-HUB-PETS-HISTORY',
icon: Icons.pets,
name: 'Pets History',
route: '/petsOnThePropertyPage',
types: [MenuEntryType.Property],
),
];
static List<MenuEntry> getEntriesByType(MenuEntryType type) {
return entries.where((entry) => entry.types.contains(type)).toList();
}
}

View File

@ -1,4 +1,4 @@
export 'menu_item/index.dart';
export 'menu_view/index.dart';
export 'menu_factory/index.dart';
export 'menu_entry/index.dart';
export 'menu_factory.dart';

View File

@ -1,228 +0,0 @@
import 'package:flutter/material.dart';
import 'package:hub/flutter_flow/internationalization.dart';
import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:hub/shared/components/molecules/menu/index.dart';
enum DrawerMenuEntries implements MenuEntry {
providerSchedule,
deliverySchedule,
fastPass,
completeSchedule,
orders,
reservations,
visitors,
qrCode,
pets,
access,
liberations,
messages,
aboutProperty,
peopleOnTheProperty,
settings,
logout;
@override
String get value {
switch (this) {
case DrawerMenuEntries.messages:
return 'FRE-HUB-MESSAGES';
case DrawerMenuEntries.liberations:
return 'FRE-HUB-LIBERATIONS';
case DrawerMenuEntries.reservations:
return 'FRE-HUB-RESERVATIONS';
case DrawerMenuEntries.access:
return 'FRE-HUB-ACCESS';
case DrawerMenuEntries.pets:
return 'FRE-HUB-PETS';
case DrawerMenuEntries.orders:
return 'FRE-HUB-ORDERS';
case DrawerMenuEntries.completeSchedule:
return 'FRE-HUB-COMPLETE-SCHEDULE';
case DrawerMenuEntries.providerSchedule:
return 'FRE-HUB-AGE-PROV-PRESTADOR';
case DrawerMenuEntries.deliverySchedule:
return 'FRE-HUB-AGE-PROV-DELIVERY';
case DrawerMenuEntries.aboutProperty:
return 'FRE-HUB-PROPERTY';
case DrawerMenuEntries.fastPass:
return 'FRE-HUB-FASTPASS';
case DrawerMenuEntries.visitors:
return 'FRE-HUB-VISITORS';
case DrawerMenuEntries.qrCode:
return 'FRE-HUB-QRCODE';
case DrawerMenuEntries.peopleOnTheProperty:
return 'FRE-HUB-PEOPLE';
case DrawerMenuEntries.settings:
return 'FRE-HUB-SETTINGS';
case DrawerMenuEntries.logout:
return 'FRE-HUB-LOGOUT';
default:
return '';
}
}
@override
String get name {
switch (this) {
case DrawerMenuEntries.messages:
return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Consultar Mensagens',
enText: 'Messages History',
);
case DrawerMenuEntries.liberations:
return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Consultar Liberações',
enText: 'Liberations History',
);
case DrawerMenuEntries.reservations:
return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Reservas',
enText: 'Reservations',
);
case DrawerMenuEntries.access:
return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Consultar Acessos',
enText: 'Access History',
);
case DrawerMenuEntries.pets:
return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Pets',
enText: 'Pets',
);
case DrawerMenuEntries.peopleOnTheProperty:
return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Pessoas na Propriedade',
enText: 'People on the Property',
);
case DrawerMenuEntries.orders:
return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Minhas Encomendas',
enText: 'My Orders',
);
case DrawerMenuEntries.completeSchedule:
return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Agenda Completa',
enText: 'Complete Schedule',
);
case DrawerMenuEntries.providerSchedule:
return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Agendar Prestadores',
enText: 'Schedule Providers',
);
case DrawerMenuEntries.deliverySchedule:
return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Agendar Delivery',
enText: 'Schedule Delivery',
);
case DrawerMenuEntries.fastPass:
return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Fast Pass',
enText: 'Fast Pass',
);
case DrawerMenuEntries.qrCode:
return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'QRCode de Acesso',
enText: 'Access QRCode',
);
case DrawerMenuEntries.visitors:
return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Cadastrar Visitantes',
enText: 'Register Visitors',
);
case DrawerMenuEntries.aboutProperty:
return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Sobre a Propriedade',
enText: 'About the Property',
);
case DrawerMenuEntries.settings:
return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Configurações',
enText: 'Settings',
);
case DrawerMenuEntries.logout:
return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Sair',
enText: 'Logout',
);
}
}
@override
IconData get icon {
switch (this) {
case DrawerMenuEntries.messages:
return Icons.chat_outlined;
case DrawerMenuEntries.liberations:
return Icons.how_to_reg_outlined;
case DrawerMenuEntries.reservations:
return Icons.event_available;
case DrawerMenuEntries.access:
return Icons.transfer_within_a_station_outlined;
case DrawerMenuEntries.pets:
return Icons.pets;
case DrawerMenuEntries.peopleOnTheProperty:
return Icons.groups;
case DrawerMenuEntries.orders:
return Icons.inventory_2_outlined;
case DrawerMenuEntries.completeSchedule:
return Icons.event;
case DrawerMenuEntries.providerSchedule:
return Icons.engineering_outlined;
case DrawerMenuEntries.deliverySchedule:
return Icons.sports_motorsports_outlined;
case DrawerMenuEntries.fastPass:
return Icons.attach_email_outlined;
case DrawerMenuEntries.qrCode:
return Icons.qr_code;
case DrawerMenuEntries.visitors:
return Icons.person_add_alt_1_outlined;
case DrawerMenuEntries.aboutProperty:
return Icons.home;
case DrawerMenuEntries.settings:
return Icons.settings;
case DrawerMenuEntries.logout:
return Icons.exit_to_app;
}
}
@override
String get route {
switch (this) {
case DrawerMenuEntries.messages:
return '/messageHistoryPage';
case DrawerMenuEntries.liberations:
return '/liberationHistory';
case DrawerMenuEntries.reservations:
return '/reservation';
case DrawerMenuEntries.access:
return '/acessHistoryPage';
case DrawerMenuEntries.pets:
return '/petsPage';
case DrawerMenuEntries.peopleOnTheProperty:
return '/peopleOnThePropertyPage';
case DrawerMenuEntries.orders:
return '/packageOrder';
case DrawerMenuEntries.completeSchedule:
return '/scheduleCompleteVisitPage';
case DrawerMenuEntries.providerSchedule:
return '/provisionalSchedule';
case DrawerMenuEntries.aboutProperty:
return '/aboutProperty';
case DrawerMenuEntries.deliverySchedule:
return '/deliverySchedule';
case DrawerMenuEntries.fastPass:
return '/fastPassPage';
case DrawerMenuEntries.qrCode:
return '/qrCodePage';
case DrawerMenuEntries.visitors:
return '/registerVisitorPage';
case DrawerMenuEntries.settings:
return '/preferencesSettings';
case DrawerMenuEntries.logout:
return '/WelcomePage';
default:
return '';
}
}
}

View File

@ -1,217 +0,0 @@
import 'package:flutter/material.dart';
import 'package:hub/flutter_flow/internationalization.dart';
import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:hub/shared/components/molecules/menu/index.dart';
enum HomeMenuEntries implements MenuEntry {
providerSchedule,
deliverySchedule,
fastPass,
completeSchedule,
orders,
reservations,
visitors,
qrCode,
pets,
access,
liberations,
messages,
aboutProperty,
peopleOnTheProperty,
settings;
@override
String get value {
switch (this) {
case HomeMenuEntries.messages:
return 'FRE-HUB-MESSAGES';
case HomeMenuEntries.liberations:
return 'FRE-HUB-LIBERATIONS';
case HomeMenuEntries.reservations:
return 'FRE-HUB-RESERVATIONS';
case HomeMenuEntries.access:
return 'FRE-HUB-ACCESS';
case HomeMenuEntries.pets:
return 'FRE-HUB-PETS';
case HomeMenuEntries.orders:
return 'FRE-HUB-ORDERS';
case HomeMenuEntries.completeSchedule:
return 'FRE-HUB-COMPLETE-SCHEDULE';
case HomeMenuEntries.providerSchedule:
return 'FRE-HUB-AGE-PROV-PRESTADOR';
case HomeMenuEntries.deliverySchedule:
return 'FRE-HUB-AGE-PROV-DELIVERY';
case HomeMenuEntries.aboutProperty:
return 'FRE-HUB-PROPERTY';
case HomeMenuEntries.fastPass:
return 'FRE-HUB-FASTPASS';
case HomeMenuEntries.visitors:
return 'FRE-HUB-VISITORS';
case HomeMenuEntries.qrCode:
return 'FRE-HUB-QRCODE';
case HomeMenuEntries.peopleOnTheProperty:
return 'FRE-HUB-PEOPLE';
case HomeMenuEntries.settings:
return 'FRE-HUB-SETTINGS';
default:
return '';
}
}
@override
String get name {
switch (this) {
case HomeMenuEntries.messages:
return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Consultar Mensagens',
enText: 'Messages History',
);
case HomeMenuEntries.liberations:
return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Consultar Liberações',
enText: 'Liberations History',
);
case HomeMenuEntries.reservations:
return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Reservas',
enText: 'Reservations',
);
case HomeMenuEntries.access:
return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Consultar Acessos',
enText: 'Access History',
);
case HomeMenuEntries.pets:
return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Pets',
enText: 'Pets',
);
case HomeMenuEntries.peopleOnTheProperty:
return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Pessoas na Propriedade',
enText: 'People on the Property',
);
case HomeMenuEntries.orders:
return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Minhas Encomendas',
enText: 'My Orders',
);
case HomeMenuEntries.completeSchedule:
return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Agenda Completa',
enText: 'Complete Schedule',
);
case HomeMenuEntries.providerSchedule:
return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Agendar Prestadores',
enText: 'Schedule Providers',
);
case HomeMenuEntries.deliverySchedule:
return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Agendar Delivery',
enText: 'Schedule Delivery',
);
case HomeMenuEntries.fastPass:
return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Fast Pass',
enText: 'Fast Pass',
);
case HomeMenuEntries.qrCode:
return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'QRCode de Acesso',
enText: 'Access QRCode',
);
case HomeMenuEntries.visitors:
return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Cadastrar Visitantes',
enText: 'Register Visitors',
);
case HomeMenuEntries.aboutProperty:
return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Sobre a Propriedade',
enText: 'About the Property',
);
case HomeMenuEntries.settings:
return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
ptText: 'Configurações',
enText: 'Settings',
);
}
}
@override
IconData get icon {
switch (this) {
case HomeMenuEntries.messages:
return Icons.chat_outlined;
case HomeMenuEntries.liberations:
return Icons.how_to_reg_outlined;
case HomeMenuEntries.reservations:
return Icons.event_available;
case HomeMenuEntries.access:
return Icons.transfer_within_a_station_outlined;
case HomeMenuEntries.pets:
return Icons.pets;
case HomeMenuEntries.peopleOnTheProperty:
return Icons.groups;
case HomeMenuEntries.orders:
return Icons.inventory_2_outlined;
case HomeMenuEntries.completeSchedule:
return Icons.event;
case HomeMenuEntries.providerSchedule:
return Icons.engineering_outlined;
case HomeMenuEntries.deliverySchedule:
return Icons.sports_motorsports_outlined;
case HomeMenuEntries.fastPass:
return Icons.attach_email_outlined;
case HomeMenuEntries.qrCode:
return Icons.qr_code;
case HomeMenuEntries.visitors:
return Icons.person_add_alt_1_outlined;
case HomeMenuEntries.aboutProperty:
return Icons.home;
case HomeMenuEntries.settings:
return Icons.settings;
}
}
@override
String get route {
switch (this) {
case HomeMenuEntries.messages:
return '/messageHistoryPage';
case HomeMenuEntries.liberations:
return '/liberationHistory';
case HomeMenuEntries.reservations:
return '/reservation';
case HomeMenuEntries.access:
return '/acessHistoryPage';
case HomeMenuEntries.pets:
return '/petsPage';
case HomeMenuEntries.peopleOnTheProperty:
return '/peopleOnThePropertyPage';
case HomeMenuEntries.orders:
return '/packageOrder';
case HomeMenuEntries.completeSchedule:
return '/scheduleCompleteVisitPage';
case HomeMenuEntries.providerSchedule:
return '/provisionalSchedule';
case HomeMenuEntries.aboutProperty:
return '/aboutProperty';
case HomeMenuEntries.deliverySchedule:
return '/deliverySchedule';
case HomeMenuEntries.fastPass:
return '/fastPassPage';
case HomeMenuEntries.qrCode:
return '/qrCodePage';
case HomeMenuEntries.visitors:
return '/registerVisitorPage';
case HomeMenuEntries.settings:
return '/preferencesSettings';
default:
return '';
}
}
}

View File

@ -1,4 +0,0 @@
export 'drawer_menu_entry.dart';
export 'home_menu_entry.dart';
export 'property_menu_entry.dart';
export 'menu_entry_factory.dart';

View File

@ -1,38 +0,0 @@
import 'package:flutter/material.dart';
import 'package:hub/shared/components/molecules/menu/index.dart';
enum MenuEntries {
home,
drawer,
AboutProperty;
List<MenuEntry> get getValues {
switch (this) {
case MenuEntries.home:
return HomeMenuEntries.values.toList();
case MenuEntries.drawer:
return DrawerMenuEntries.values.toList();
case MenuEntries.AboutProperty:
return AboutPropertyMenuEntries.values.toList();
}
}
}
class MenuEntryFactory {
static List<MenuEntry> createMenuEntry(MenuEntry type) {
switch (type) {
case HomeMenuEntries _:
return HomeMenuEntries.values.toList();
case DrawerMenuEntries _:
return DrawerMenuEntries.values.toList();
case AboutPropertyMenuEntries _:
return AboutPropertyMenuEntries.values.toList();
default:
throw ArgumentError('Invalid menu entry type');
}
}
List<MenuEntry> buildMenuEntry(MenuEntry type) {
return createMenuEntry(type);
}
}

View File

@ -1,69 +0,0 @@
import 'package:flutter/material.dart';
import 'package:hub/shared/components/molecules/menu/index.dart';
enum AboutPropertyMenuEntries implements MenuEntry {
residents,
vehicles,
openedVisits,
petsHistory;
@override
String get value {
switch (this) {
case AboutPropertyMenuEntries.openedVisits:
return 'FRE-HUB-OPENED-VISITS';
case AboutPropertyMenuEntries.vehicles:
return 'FRE-HUB-VEHICLES';
case AboutPropertyMenuEntries.residents:
return 'FRE-HUB-RESIDENTS';
case AboutPropertyMenuEntries.petsHistory:
return 'FRE-HUB-PETS-HISTORY';
default:
return '';
}
}
@override
IconData get icon {
switch (this) {
case AboutPropertyMenuEntries.residents:
return Icons.groups;
case AboutPropertyMenuEntries.vehicles:
return Icons.directions_car;
case AboutPropertyMenuEntries.openedVisits:
return Icons.perm_contact_calendar;
case AboutPropertyMenuEntries.petsHistory:
return Icons.pets;
}
}
@override
String get name {
switch (this) {
case AboutPropertyMenuEntries.residents:
return 'Residents';
case AboutPropertyMenuEntries.vehicles:
return 'Vehicles';
case AboutPropertyMenuEntries.openedVisits:
return 'Opened Visits';
case AboutPropertyMenuEntries.petsHistory:
return 'Pets History';
}
}
@override
String get route {
switch (this) {
case AboutPropertyMenuEntries.residents:
return '/residentsOnThePropertyPage';
case AboutPropertyMenuEntries.vehicles:
return '/vehiclesOnThePropertyPage';
case AboutPropertyMenuEntries.openedVisits:
return '/openedVisitsPage';
case AboutPropertyMenuEntries.petsHistory:
return '/petsOnThePropertyPage';
}
}
}

View File

@ -7,17 +7,15 @@ import 'package:hub/shared/components/molecules/modules/index.dart';
import 'package:hub/shared/components/molecules/menu/index.dart';
import 'package:hub/shared/utils/loading_util.dart';
class MenuViewFactory extends StatelessWidget {
class Menufactory extends StatelessWidget {
final MenuView view;
final EnumMenuItem item;
final bool expandable;
final MenuEntries entry;
final List<MenuEntry> entry;
const MenuViewFactory({
const Menufactory({
super.key,
required this.view,
required this.item,
required this.expandable,
required this.entry,
});
@ -49,15 +47,13 @@ class MenuViewFactory extends StatelessWidget {
create: (context) => MenuViewBloc(
style: view,
item: item,
menuOptions: entry.getValues,
expandable: expandable,
menuOptions: entry,
)..add(MenuViewEvent()),
child: BlocBuilder<MenuViewBloc, MenuViewState>(
builder: (context, state) {
if (view == MenuView.list_grid) {
return MenuStaggeredView(
options: state.menuEntries,
expandable: expandable,
item: item,
changeMenuStyle: () async {},
isGrid: state.isGrid,
@ -65,7 +61,6 @@ class MenuViewFactory extends StatelessWidget {
} else if (view == MenuView.list) {
return MenuListView(
options: state.menuEntries,
expandable: expandable,
item: item,
changeMenuStyle: () async {},
);

View File

@ -1 +0,0 @@
export 'menu_factory.dart';

View File

@ -1,25 +0,0 @@
import 'package:flutter/material.dart';
import 'package:hub/shared/components/molecules/menu/index.dart';
class MenuFactory extends StatelessWidget {
final MenuView menuView;
final MenuEntries menuEntry;
final EnumMenuItem menuItem;
const MenuFactory({
super.key,
required this.menuView,
required this.menuEntry,
required this.menuItem,
});
@override
Widget build(BuildContext context) {
return MenuViewFactory(
view: menuView,
item: menuItem,
expandable: false,
entry: menuEntry,
);
}
}

View File

@ -1,3 +1,2 @@
export 'menu_item_button.dart';
export 'menu_item_card.dart';
export 'menu_item_factory.dart';

View File

@ -4,8 +4,8 @@ import 'package:hub/flutter_flow/flutter_flow_theme.dart';
import 'package:hub/shared/components/molecules/menu/index.dart';
class MenuButtonWidget extends MenuItem {
const MenuButtonWidget({
class ButtonMenuItem extends MenuItem {
const ButtonMenuItem({
super.key,
required this.action,
required this.title,
@ -23,7 +23,7 @@ class MenuButtonWidget extends MenuItem {
_MenuButtonWidgetState createState() => _MenuButtonWidgetState();
}
class _MenuButtonWidgetState extends State<MenuButtonWidget> {
class _MenuButtonWidgetState extends State<ButtonMenuItem> {
bool _isProcessing = false;
@override

View File

@ -4,8 +4,8 @@ import 'package:hub/flutter_flow/flutter_flow_theme.dart';
import 'package:hub/shared/components/molecules/menu/index.dart';
class MenuCardItem extends MenuItem {
const MenuCardItem({
class CardMenuItem extends MenuItem {
const CardMenuItem({
super.key,
required this.action,
required this.title,
@ -23,7 +23,7 @@ class MenuCardItem extends MenuItem {
_MenuCardItemState createState() => _MenuCardItemState();
}
class _MenuCardItemState extends State<MenuCardItem> {
class _MenuCardItemState extends State<CardMenuItem> {
bool _isProcessing = false;
@override

View File

@ -1,24 +0,0 @@
import 'package:flutter/material.dart';
import 'package:hub/shared/components/molecules/menu/index.dart';
class MenuItemFactory {
static MenuItem createMenuItem(
EnumMenuItem type, {
Key? key,
required Function() action,
required String title,
required IconData icon,
}) {
return MenuItem.create(type, key: key, action: action, title: title, icon: icon);
}
MenuItem buildMenuItem(
EnumMenuItem type, {
Key? key,
required Function() action,
required String title,
required IconData icon,
}) {
return createMenuItem(type, key: key, action: action, title: title, icon: icon);
}
}

View File

@ -1,3 +1,2 @@
export 'menu_list_view.dart';
export 'menu_staggered_view.dart';
export 'menu_view_factory.dart';

View File

@ -19,12 +19,10 @@ class MenuListView extends StatefulWidget {
const MenuListView({
super.key,
required this.changeMenuStyle,
required this.expandable,
required this.item,
required this.options,
});
final bool expandable;
final EnumMenuItem item;
final List<MenuItem?> options;
final Future Function()? changeMenuStyle;

View File

@ -13,9 +13,8 @@ class MenuStaggeredViewModel extends FlutterFlowModel<MenuStaggeredView> {
}
class MenuStaggeredView extends StatefulWidget {
const MenuStaggeredView({super.key, required this.changeMenuStyle, required this.expandable, required this.item, required this.options, required this.isGrid});
const MenuStaggeredView({super.key, required this.changeMenuStyle, required this.item, required this.options, required this.isGrid});
final bool expandable;
final EnumMenuItem item;
final bool isGrid;
final List<MenuItem?> options;

View File

@ -7,7 +7,7 @@ import 'package:sqflite/sqflite.dart';
abstract class LicenseLocalDataSource {
Future<void> init();
Future<void> setByKey(final List<String> key, final String display);
Future<void> setDisplayByKey(final List<String> key, final String display);
Future<bool> isNewVersion();
Future<String?> g(String key);
Future<void> s<T>(String key, T value);
@ -25,7 +25,7 @@ class LicenseLocalDataSourceImpl implements LicenseLocalDataSource {
await DatabaseStorage.instance.init();
}
Future<void> setByKey(final List<String?> key, final String display) async {
Future<void> setDisplayByKey(final List<String?> key, final String display) async {
if (key.isEmpty) return;
for (var element in key) {
if (element != null) {

View File

@ -55,13 +55,13 @@ class LicenseRemoteDataSourceImpl implements LicenseRemoteDataSource {
.map((module) => module.key)
.toList();
await LicenseLocalDataSourceImpl().setByKey(inactiveModuleKey, 'INVISIVEL');
await LicenseLocalDataSourceImpl().setByKey(activeModuleKey, 'VISIVEL');
await LicenseLocalDataSourceImpl().setDisplayByKey(inactiveModuleKey, 'INVISIVEL');
await LicenseLocalDataSourceImpl().setDisplayByKey(activeModuleKey, 'VISIVEL');
if (isNewVersion == true) {
await LicenseLocalDataSourceImpl().setByKey(disabledModuleKey, 'VISIVEL');
await LicenseLocalDataSourceImpl().setByKey(['FRE-HUB-PROPERTY'], 'VISIVEL');
await LicenseLocalDataSourceImpl().setDisplayByKey(disabledModuleKey, 'VISIVEL');
await LicenseLocalDataSourceImpl().setDisplayByKey(['FRE-HUB-PROPERTY'], 'VISIVEL');
} else {
await LicenseLocalDataSourceImpl().setByKey(disabledModuleKey, 'DESABILITADO');
await LicenseLocalDataSourceImpl().setDisplayByKey(disabledModuleKey, 'DESABILITADO');
}
LicenseRepositoryImpl.license.add(true);

View File

@ -17,23 +17,24 @@ class LicenseRepositoryImpl implements LicenseRepository {
static final license = BehaviorSubject<LicenseStatus>();
static get stream => license.stream;
Future<bool> fetchLicense(bool isNewVersion) async {
return await remoteDataSource.fetchLicenses(isNewVersion);
}
Future<bool> updateLicense(bool isNewVersion) async {
await remoteDataSource.setupLicense(database, isNewVersion);
if (isNewVersion) {
return await remoteDataSource.fetchLicenses(isNewVersion);
}
return false;
Future<void> setupLicense(bool isNewVersion) async {
return await remoteDataSource.setupLicense(database, isNewVersion);
}
Future<void> cleanLicense() async {
return await remoteDataSource.cleanLicense();
}
Future<String?> g(String key) async {
Future<String?> getLicense(String key) async {
return await localDataSource.g(key);
}
Future<void> s<T>(String key, T value) async {
Future<void> setLicense<T>(String key, T value) async {
return await localDataSource.s(key, value);
}
}

View File

@ -1,81 +1,41 @@
import 'package:hub/shared/extensions/string_extensions.dart';
import 'package:hub/shared/helpers/database/database_helper.dart';
import 'package:hub/shared/helpers/storage/base_storage.dart';
import 'package:hub/shared/helpers/storage/storage_helper.dart';
import 'module.dart';
enum LicenseKeys {
messages,
liberations,
reservations,
access,
openedVisits,
vehicles,
residents,
pets,
orders,
completeSchedule,
providerSchedule,
deliverySchedule,
property,
fastPass,
visitors,
qrCode,
people,
petsHistory,
settings,
logout,
messages('FRE-HUB-MESSAGES'),
liberations('FRE-HUB-LIBERATIONS'),
reservations('FRE-HUB-RESERVATIONS'),
access('FRE-HUB-ACCESS'),
openedVisits('FRE-HUB-OPENED-VISITS'),
vehicles('FRE-HUB-VEHICLES'),
residents('FRE-HUB-RESIDENTS'),
pets('FRE-HUB-PETS'),
orders('FRE-HUB-ORDERS'),
completeSchedule('FRE-HUB-COMPLETE-SCHEDULE'),
providerSchedule('FRE-HUB-AGE-PROV-PRESTADOR'),
deliverySchedule('FRE-HUB-AGE-PROV-DELIVERY'),
property('FRE-HUB-PROPERTY'),
fastPass('FRE-HUB-FASTPASS'),
visitors('FRE-HUB-VISITORS'),
qrCode('FRE-HUB-QRCODE'),
people('FRE-HUB-PEOPLE'),
petsHistory('FRE-HUB-PETS-HISTORY'),
settings('FRE-HUB-SETTINGS'),
logout('FRE-HUB-LOGOUT');
final String value;
const LicenseKeys(this.value);
}
extension LicenseKeysExtension on LicenseKeys {
String get value {
switch (this) {
case LicenseKeys.messages:
return 'FRE-HUB-MESSAGES';
case LicenseKeys.liberations:
return 'FRE-HUB-LIBERATIONS';
case LicenseKeys.reservations:
return 'FRE-HUB-RESERVATIONS';
case LicenseKeys.access:
return 'FRE-HUB-ACCESS';
case LicenseKeys.openedVisits:
return 'FRE-HUB-OPENED-VISITS';
case LicenseKeys.vehicles:
return 'FRE-HUB-VEHICLES';
case LicenseKeys.residents:
return 'FRE-HUB-RESIDENTS';
case LicenseKeys.pets:
return 'FRE-HUB-PETS';
case LicenseKeys.orders:
return 'FRE-HUB-ORDERS';
case LicenseKeys.completeSchedule:
return 'FRE-HUB-COMPLETE-SCHEDULE';
case LicenseKeys.providerSchedule:
return 'FRE-HUB-AGE-PROV-PRESTADOR';
case LicenseKeys.deliverySchedule:
return 'FRE-HUB-AGE-PROV-DELIVERY';
case LicenseKeys.property:
return 'FRE-HUB-PROPERTY';
case LicenseKeys.fastPass:
return 'FRE-HUB-FASTPASS';
case LicenseKeys.visitors:
return 'FRE-HUB-VISITORS';
case LicenseKeys.qrCode:
return 'FRE-HUB-QRCODE';
case LicenseKeys.people:
return 'FRE-HUB-PEOPLE';
case LicenseKeys.petsHistory:
return 'FRE-HUB-PETS-HISTORY';
case LicenseKeys.settings:
return 'FRE-HUB-SETTINGS';
case LicenseKeys.logout:
return 'FRE-HUB-LOGOUT';
}
}
}
class License {
final List<Module> modules;
@ -84,28 +44,6 @@ class License {
this.modules,
);
// static List<String> mods = [
// 'FRE-HUB-MESSAGES',
// 'FRE-HUB-LIBERATIONS',
// 'FRE-HUB-RESERVATIONS',
// 'FRE-HUB-ACCESS',
// 'FRE-HUB-OPENED-VISITS',
// 'FRE-HUB-VEHICLES',
// 'FRE-HUB-RESIDENTS',
// 'FRE-HUB-PETS',
// 'FRE-HUB-ORDERS',
// 'FRE-HUB-COMPLETE-SCHEDULE',
// 'FRE-HUB-AGE-PROV-PRESTADOR',
// 'FRE-HUB-AGE-PROV-DELIVERY',
// 'FRE-HUB-PROPERTY',
// 'FRE-HUB-FASTPASS',
// 'FRE-HUB-VISITORS',
// 'FRE-HUB-QRCODE',
// 'FRE-HUB-PEOPLE',
// 'FRE-HUB-PETS-HISTORY'
// 'FRE-HUB-SETTINGS',
// 'FRE-HUB-LOGOUT',
// ];
static Future<String> _proceessOldVersion(LicenseKeys key) async {
switch(key) {
@ -125,22 +63,25 @@ class License {
}
static Future<String> _precessWpp() async {
final bool whatsapp = await StorageHelper().g(KeychainStorageKey.whatsapp.value).then((v) => v.toBoolean());
final bool whatsapp = await StorageHelper().get(KeychainStorageKey.whatsapp.value).then((v) => v.toBoolean());
if (whatsapp) return ModuleStatus.active.key;
else return ModuleStatus.inactive.key;
}
static Future<String> _processProvisional() async {
final bool provisional = await StorageHelper().g(KeychainStorageKey.provisional.value).then((v) => v.toBoolean());
final bool provisional = await StorageHelper().get(KeychainStorageKey.provisional.value).then((v) => v.toBoolean());
if (provisional) return ModuleStatus.active.key;
else return ModuleStatus.inactive.key;
}
static Future<String> _processPets() async {
final bool pets = await StorageHelper().g(KeychainStorageKey.pets.value).then((v) => v.toBoolean());
final bool pets = await StorageHelper().get(KeychainStorageKey.pets.value).then((v) => v.toBoolean());
if (pets) return ModuleStatus.active.key;
else return ModuleStatus.inactive.key;
}
static getKeyByModule(String s) {
}
static Future<License> getLicense(bool isNewVersion) async {
@ -290,588 +231,3 @@ class License {
}
}
// import 'package:equatable/equatable.dart';
// import 'module.dart';
// import 'package:flutter/material.dart';
// import 'package:hub/flutter_flow/internationalization.dart';
// import 'package:hub/flutter_flow/nav/nav.dart';
// import 'package:hub/shared/components/molecules/modules/index.dart';
// enum ModuleStatus { active, inactive, disabled }
// extension ModuleStatusExtension on ModuleStatus {
// String get value {
// switch (this) {
// case ModuleStatus.active:
// return 'VISIVEL';
// case ModuleStatus.inactive:
// return 'INVISIVEL';
// case ModuleStatus.disabled:
// return 'DESABILITADO';
// }
// }
// }
// class ModuleExt {
// final String value;
// final String name;
// final IconData icon;
// final String route;
// final (ModuleStatus inOldVersion, ModuleStatus inNewVersion) status;
// const ModuleExt({
// required this.value,
// required this.name,
// required this.icon,
// required this.route,
// required this.status,
// });
// static List<ModuleExt> get license => [
// ModuleExt(
// value: 'FRE-HUB-MESSAGES',
// name: FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'Consultar Mensagens',
// enText: 'Messages History',
// ),
// icon: Icons.chat_outlined,
// route: '/messageHistoryPage',
// status: (ModuleStatus.active, ModuleStatus.disabled),
// ),
// ];
// }
// enum EModule implements BaseModule {
// providerSchedule,
// deliverySchedule,
// fastPass,
// completeSchedule,
// orders,
// reservations,
// visitors,
// vehicles,
// residents,
// openedVisits,
// qrCode,
// pets,
// access,
// liberations,
// messages,
// aboutProperty,
// petsHistory,
// peopleOnTheProperty,
// settings,
// logout;
// @override
// String get value {
// switch (this) {
// case Module.messages:
// return 'FRE-HUB-MESSAGES';
// case Module.liberations:
// return 'FRE-HUB-LIBERATIONS';
// case Module.reservations:
// return 'FRE-HUB-RESERVATIONS';
// case Module.access:
// return 'FRE-HUB-ACCESS';
// case Module.openedVisits:
// return 'FRE-HUB-OPENED-VISITS';
// case Module.vehicles:
// return 'FRE-HUB-VEHICLES';
// case Module.residents:
// return 'FRE-HUB-RESIDENTS';
// case Module.pets:
// return 'FRE-HUB-PETS';
// case Module.orders:
// return 'FRE-HUB-ORDERS';
// case Module.completeSchedule:
// return 'FRE-HUB-COMPLETE-SCHEDULE';
// case Module.providerSchedule:
// return 'FRE-HUB-AGE-PROV-PRESTADOR';
// case Module.deliverySchedule:
// return 'FRE-HUB-AGE-PROV-DELIVERY';
// case Module.aboutProperty:
// return 'FRE-HUB-PROPERTY';
// case Module.fastPass:
// return 'FRE-HUB-FASTPASS';
// case Module.visitors:
// return 'FRE-HUB-VISITORS';
// case Module.qrCode:
// return 'FRE-HUB-QRCODE';
// case Module.peopleOnTheProperty:
// return 'FRE-HUB-PEOPLE';
// case Module.petsHistory:
// return 'FRE-HUB-PETS-HISTORY';
// default:
// return '';
// }
// }
// @override
// String get name {
// switch (this) {
// case Module.messages:
// return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'Consultar Mensagens',
// enText: 'Messages History',
// );
// case Module.liberations:
// return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'Consultar Liberações',
// enText: 'Liberations History',
// );
// case Module.reservations:
// return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'Reservas',
// enText: 'Reservations',
// );
// case Module.access:
// return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'Consultar Acessos',
// enText: 'Access History',
// );
// case Module.openedVisits:
// return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'Visitas em Aberto',
// enText: 'Opened Visits',
// );
// case Module.vehicles:
// return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'Veículos',
// enText: 'Vehicles',
// );
// case Module.residents:
// return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'Moradores',
// enText: 'Residents',
// );
// case Module.pets:
// return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'Pets',
// enText: 'Pets',
// );
// case Module.petsHistory:
// return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'Pets',
// enText: 'Pets',
// );
// case Module.peopleOnTheProperty:
// return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'Pessoas na Propriedade',
// enText: 'People on the Property',
// );
// case Module.orders:
// return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'Minhas Encomendas',
// enText: 'My Orders',
// );
// case Module.completeSchedule:
// return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'Agenda Completa',
// enText: 'Complete Schedule',
// );
// case Module.providerSchedule:
// return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'Agendar Prestadores',
// enText: 'Schedule Providers',
// );
// case Module.deliverySchedule:
// return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'Agendar Delivery',
// enText: 'Schedule Delivery',
// );
// case Module.fastPass:
// return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'Fast Pass',
// enText: 'Fast Pass',
// );
// case Module.qrCode:
// return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'QRCode de Acesso',
// enText: 'Access QRCode',
// );
// case Module.visitors:
// return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'Cadastrar Visitantes',
// enText: 'Register Visitors',
// );
// case Module.aboutProperty:
// return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'Sobre a Propriedade',
// enText: 'About the Property',
// );
// case Module.settings:
// return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'Configurações',
// enText: 'Settings',
// );
// case Module.logout:
// return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'Sair',
// enText: 'Logout',
// );
// }
// }
// @override
// IconData get icon {
// switch (this) {
// case Module.messages:
// return Icons.chat_outlined;
// case Module.liberations:
// return Icons.how_to_reg_outlined;
// case Module.reservations:
// return Icons.event_available;
// case Module.access:
// return Icons.transfer_within_a_station_outlined;
// case Module.openedVisits:
// return Icons.perm_contact_calendar;
// case Module.vehicles:
// return Icons.directions_car;
// case Module.residents:
// return Icons.groups;
// case Module.pets:
// return Icons.pets;
// case Module.petsHistory:
// return Icons.pets;
// case Module.peopleOnTheProperty:
// return Icons.groups;
// case Module.orders:
// return Icons.inventory_2_outlined;
// case Module.completeSchedule:
// return Icons.event;
// case Module.providerSchedule:
// return Icons.engineering_outlined;
// case Module.deliverySchedule:
// return Icons.sports_motorsports_outlined;
// case Module.fastPass:
// return Icons.attach_email_outlined;
// case Module.qrCode:
// return Icons.qr_code;
// case Module.visitors:
// return Icons.person_add_alt_1_outlined;
// case Module.aboutProperty:
// return Icons.home;
// case Module.settings:
// return Icons.settings;
// case Module.logout:
// return Icons.logout;
// }
// }
// @override
// String get route {
// switch (this) {
// case Module.messages:
// return '/messageHistoryPage';
// case Module.liberations:
// return '/liberationHistory';
// case Module.reservations:
// return '/reservation';
// case Module.access:
// return '/acessHistoryPage';
// case Module.openedVisits:
// return '/visitsOnThePropertyPage';
// case Module.vehicles:
// return '/vehiclesOnThePropertyPage';
// case Module.residents:
// return '/residentsOnThePropertyPage';
// case Module.pets:
// return '/petsPage';
// case Module.petsHistory:
// return '/petsHistoryPage';
// case Module.peopleOnTheProperty:
// return '/peopleOnThePropertyPage';
// case Module.orders:
// return '/packageOrder';
// case Module.completeSchedule:
// return '/scheduleCompleteVisitPage';
// case Module.providerSchedule:
// return '/provisionalSchedule';
// case Module.aboutProperty:
// return '/aboutProperty';
// case Module.deliverySchedule:
// return '/deliverySchedule';
// case Module.fastPass:
// return '/fastPassPage';
// case Module.qrCode:
// return '/qrCodePage';
// case Module.visitors:
// return '/registerVisitorPage';
// case Module.settings:
// return '/preferencesSettings';
// case Module.logout:
// return '/WelcomePage';
// default:
// return '';
// }
// }
// }
// enum ELicense implements BaseModule {
// providerSchedule,
// deliverySchedule,
// fastPass,
// completeSchedule,
// orders,
// reservations,
// visitors,
// vehicles,
// residents,
// openedVisits,
// qrCode,
// pets,
// access,
// liberations,
// messages,
// aboutProperty,
// petsHistory,
// peopleOnTheProperty,
// settings,
// logout;
// @override
// String get value {
// switch (this) {
// case License.messages:
// return 'FRE-HUB-MESSAGES';
// case License.liberations:
// return 'FRE-HUB-LIBERATIONS';
// case License.reservations:
// return 'FRE-HUB-RESERVATIONS';
// case License.access:
// return 'FRE-HUB-ACCESS';
// case License.openedVisits:
// return 'FRE-HUB-OPENED-VISITS';
// case License.vehicles:
// return 'FRE-HUB-VEHICLES';
// case License.residents:
// return 'FRE-HUB-RESIDENTS';
// case License.pets:
// return 'FRE-HUB-PETS';
// case License.orders:
// return 'FRE-HUB-ORDERS';
// case License.completeSchedule:
// return 'FRE-HUB-COMPLETE-SCHEDULE';
// case License.providerSchedule:
// return 'FRE-HUB-AGE-PROV-PRESTADOR';
// case License.deliverySchedule:
// return 'FRE-HUB-AGE-PROV-DELIVERY';
// case License.aboutProperty:
// return 'FRE-HUB-PROPERTY';
// case License.fastPass:
// return 'FRE-HUB-FASTPASS';
// case License.visitors:
// return 'FRE-HUB-VISITORS';
// case License.qrCode:
// return 'FRE-HUB-QRCODE';
// case License.peopleOnTheProperty:
// return 'FRE-HUB-PEOPLE';
// case License.petsHistory:
// return 'FRE-HUB-PETS-HISTORY';
// default:
// return '';
// }
// }
// @override
// String get name {
// switch (this) {
// case License.messages:
// return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'Consultar Mensagens',
// enText: 'Messages History',
// );
// case License.liberations:
// return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'Consultar Liberações',
// enText: 'Liberations History',
// );
// case License.reservations:
// return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'Reservas',
// enText: 'Reservations',
// );
// case License.access:
// return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'Consultar Acessos',
// enText: 'Access History',
// );
// case License.openedVisits:
// return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'Visitas em Aberto',
// enText: 'Opened Visits',
// );
// case License.vehicles:
// return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'Veículos',
// enText: 'Vehicles',
// );
// case License.residents:
// return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'Moradores',
// enText: 'Residents',
// );
// case License.pets:
// return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'Pets',
// enText: 'Pets',
// );
// case License.petsHistory:
// return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'Pets',
// enText: 'Pets',
// );
// case License.peopleOnTheProperty:
// return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'Pessoas na Propriedade',
// enText: 'People on the Property',
// );
// case License.orders:
// return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'Minhas Encomendas',
// enText: 'My Orders',
// );
// case License.completeSchedule:
// return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'Agenda Completa',
// enText: 'Complete Schedule',
// );
// case License.providerSchedule:
// return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'Agendar Prestadores',
// enText: 'Schedule Providers',
// );
// case License.deliverySchedule:
// return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'Agendar Delivery',
// enText: 'Schedule Delivery',
// );
// case License.fastPass:
// return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'Fast Pass',
// enText: 'Fast Pass',
// );
// case License.qrCode:
// return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'QRCode de Acesso',
// enText: 'Access QRCode',
// );
// case License.visitors:
// return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'Cadastrar Visitantes',
// enText: 'Register Visitors',
// );
// case License.aboutProperty:
// return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'Sobre a Propriedade',
// enText: 'About the Property',
// );
// case License.settings:
// return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'Configurações',
// enText: 'Settings',
// );
// case License.logout:
// return FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'Sair',
// enText: 'Logout',
// );
// }
// }
// @override
// IconData get icon {
// switch (this) {
// case License.messages:
// return Icons.chat_outlined;
// case License.liberations:
// return Icons.how_to_reg_outlined;
// case License.reservations:
// return Icons.event_available;
// case License.access:
// return Icons.transfer_within_a_station_outlined;
// case License.openedVisits:
// return Icons.perm_contact_calendar;
// case License.vehicles:
// return Icons.directions_car;
// case License.residents:
// return Icons.groups;
// case License.pets:
// return Icons.pets;
// case License.petsHistory:
// return Icons.pets;
// case License.peopleOnTheProperty:
// return Icons.groups;
// case License.orders:
// return Icons.inventory_2_outlined;
// case License.completeSchedule:
// return Icons.event;
// case License.providerSchedule:
// return Icons.engineering_outlined;
// case License.deliverySchedule:
// return Icons.sports_motorsports_outlined;
// case License.fastPass:
// return Icons.attach_email_outlined;
// case License.qrCode:
// return Icons.qr_code;
// case License.visitors:
// return Icons.person_add_alt_1_outlined;
// case License.aboutProperty:
// return Icons.home;
// case License.settings:
// return Icons.settings;
// case License.logout:
// return Icons.logout;
// }
// }
// @override
// String get route {
// switch (this) {
// case License.messages:
// return '/messageHistoryPage';
// case License.liberations:
// return '/liberationHistory';
// case License.reservations:
// return '/reservation';
// case License.access:
// return '/acessHistoryPage';
// case License.openedVisits:
// return '/visitsOnThePropertyPage';
// case License.vehicles:
// return '/vehiclesOnThePropertyPage';
// case License.residents:
// return '/residentsOnThePropertyPage';
// case License.pets:
// return '/petsPage';
// case License.petsHistory:
// return '/petsHistoryPage';
// case License.peopleOnTheProperty:
// return '/peopleOnThePropertyPage';
// case License.orders:
// return '/packageOrder';
// case License.completeSchedule:
// return '/scheduleCompleteVisitPage';
// case License.providerSchedule:
// return '/provisionalSchedule';
// case License.aboutProperty:
// return '/aboutProperty';
// case License.deliverySchedule:
// return '/deliverySchedule';
// case License.fastPass:
// return '/fastPassPage';
// case License.qrCode:
// return '/qrCodePage';
// case License.visitors:
// return '/registerVisitorPage';
// case License.settings:
// return '/preferencesSettings';
// case License.logout:
// return '/WelcomePage';
// default:
// return '';
// }
// }
// }

View File

@ -1,8 +1,7 @@
abstract class LicenseRepository {
Future<bool> fetchLicense(bool isNewVersion);
Future<void> setupLicense(bool isNewVersion);
Future<bool> updateLicense(bool isNewVersion);
Future<void> cleanLicense();
Future<String?> g(String key);
Future<void> s<T>(String key, T value);
Future<String?> getLicense(String key);
Future<void> setLicense<T>(String key, T value);
}

View File

@ -32,7 +32,7 @@ class DatabaseStorage {
onUpgrade: _onUpgrade,
onDowngrade: _onDowngrade,
);
await LicenseRepositoryImpl().setupLicense(false);
await LicenseRepositoryImpl().updateLicense(false);
isInitialized = true;
}

View File

@ -51,19 +51,19 @@ class StorageHelper {
}
}
Future<String?> g(String key) async {
Future<String?> get(String key) async {
return await getInstanceByKey(key).get(key);
}
Future<void> s<T>(String key, T value) async {
Future<void> set<T>(String key, T value) async {
return await getInstanceByKey(key).set(key, value);
}
Future<void> d(String key) async {
Future<void> del(String key) async {
return await getInstanceByKey(key).delete(key);
}
Future<void> c(Storage storage) async {
Future<void> clean(Storage storage) async {
return await getInstance(storage).clearAll();
}
}

View File

@ -25,14 +25,14 @@ class AuthenticationService {
List<dynamic> locals = response.jsonBody['locais'] ?? [];
if (locals.isEmpty) {
await StorageHelper().s(SecureStorageKey.haveLocal.value, false);
await StorageHelper().set(SecureStorageKey.haveLocal.value, false);
context.go('/receptionPage');
} else {
await StorageHelper().s(SecureStorageKey.haveLocal.value, true);
await StorageHelper().set(SecureStorageKey.haveLocal.value, true);
context.go('/homePage');
}
await StorageHelper().s(SecureStorageKey.isLogged.value, true);
await StorageHelper().set(SecureStorageKey.isLogged.value, true);
}
static Future signIn(
@ -45,7 +45,7 @@ class AuthenticationService {
final ApiCallResponse? response;
final LoginCall callback = PhpGroup.loginCall;
String deviceDescription = randomString(10, 10, true, false, false);
await StorageHelper().s(SecureStorageKey.deviceDescription.value, deviceDescription);
await StorageHelper().set(SecureStorageKey.deviceDescription.value, deviceDescription);
final String? devUUID;
final String userUUID;
@ -60,9 +60,9 @@ class AuthenticationService {
devUUID = await DeviceUtil.getDevUUID();
if ((email != '') && (passwd != '')) {
await StorageHelper().s(SecureStorageKey.email.value, email);
await StorageHelper().s(SecureStorageKey.password.value, passwd);
await StorageHelper().s(KeychainStorageKey.devUUID.value, devUUID!);
await StorageHelper().set(SecureStorageKey.email.value, email);
await StorageHelper().set(SecureStorageKey.password.value, passwd);
await StorageHelper().set(KeychainStorageKey.devUUID.value, devUUID!);
response = await callback.call();
if (response.jsonBody['error'] == false) {
@ -71,10 +71,10 @@ class AuthenticationService {
userDevUUID = response.jsonBody['user']['dev_id'];
userName = response.jsonBody['user']['name'];
await StorageHelper().s(KeychainStorageKey.userUUID.value, userUUID);
await StorageHelper().s(KeychainStorageKey.userDevUUID.value, userDevUUID);
await StorageHelper().s(KeychainStorageKey.status.value, status);
await StorageHelper().s(KeychainStorageKey.userName.value, userName);
await StorageHelper().set(KeychainStorageKey.userUUID.value, userUUID);
await StorageHelper().set(KeychainStorageKey.userDevUUID.value, userDevUUID);
await StorageHelper().set(KeychainStorageKey.status.value, status);
await StorageHelper().set(KeychainStorageKey.userName.value, userName);
await login(context);
} else {
@ -138,8 +138,8 @@ class AuthenticationService {
alignment: Alignment.bottomCenter,
),
};
await StorageHelper().c(Storage.secureStorage);
await StorageHelper().c(Storage.databaseStorage);
await StorageHelper().clean(Storage.secureStorage);
await StorageHelper().clean(Storage.databaseStorage);
context.go('/welcomePage', extra: extra);
}

View File

@ -0,0 +1,17 @@
import 'package:flutter/material.dart';
import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:hub/flutter_flow/nav/nav.dart';
class PathUtil {
static Future<void> nav(String link) async {
navigatorKey.currentContext!.push(link, extra: <String, dynamic>{
kTransitionInfoKey: const TransitionInfo(
hasTransition: false,
transitionType: PageTransitionType.scale,
alignment: Alignment.bottomCenter,
),
});
}
}

View File

@ -4,8 +4,8 @@ import 'package:share_plus/share_plus.dart';
class ShareUtil {
static Future<void> showShare(payload) async {
final cliName = await StorageHelper().g(KeychainStorageKey.clientName.value);
final cliUUID = await StorageHelper().g(KeychainStorageKey.clientUUID.value);
final cliName = await StorageHelper().get(KeychainStorageKey.clientName.value);
final cliUUID = await StorageHelper().get(KeychainStorageKey.clientUUID.value);
for (var i = 0; i < payload['convites'].length; i++) {
await Share.share('''