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

View File

@ -43,7 +43,7 @@ class FirebaseMessagingService {
final String? deviceToken = await _firebaseMessaging.getToken(); final String? deviceToken = await _firebaseMessaging.getToken();
if (deviceToken != null) { if (deviceToken != null) {
await StorageHelper().s(SecureStorageKey.token.value, deviceToken); await StorageHelper().set(SecureStorageKey.token.value, deviceToken);
final ApiCallResponse? response; final ApiCallResponse? response;
response = await PhpGroup.updToken.call(); 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 { Future<void> onMessageReceived(Map<String, dynamic> payload, String? extra, String? handleClick) async {
final localId = jsonDecode(payload['local']!)['CLI_ID']; final localId = jsonDecode(payload['local']!)['CLI_ID'];
final cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? ''; final cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
answersRequest( answersRequest(
{required BuildContext context, {required BuildContext context,
@ -239,7 +239,7 @@ Future<void> onMessageReceived(Map<String, dynamic> payload, String? extra, Stri
break; break;
case 'enroll_cond': case 'enroll_cond':
await StorageHelper().s(SecureStorageKey.haveLocal.value, true); await StorageHelper().set(SecureStorageKey.haveLocal.value, true);
StorageHelper().context!.go('/homePage'); StorageHelper().context!.go('/homePage');
break; break;
default: default:
@ -271,11 +271,11 @@ class NotificationService {
await AwesomeNotifications().isNotificationAllowed().then((isAllowed) async { await AwesomeNotifications().isNotificationAllowed().then((isAllowed) async {
final bool requestOSnotification = final bool requestOSnotification =
(await StorageHelper().g(KeychainStorageKey.requestOSNotification.value)) == 'true'; (await StorageHelper().get(KeychainStorageKey.requestOSNotification.value)) == 'true';
if (requestOSnotification == false) { if (requestOSnotification == false) {
if (isAllowed == false) { if (isAllowed == false) {
await StorageHelper().s(KeychainStorageKey.requestOSNotification.value, true); await StorageHelper().set(KeychainStorageKey.requestOSNotification.value, true);
await AwesomeNotifications().requestPermissionToSendNotifications(); await AwesomeNotifications().requestPermissionToSendNotifications();
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,7 +6,7 @@ import 'package:share_plus/share_plus.dart';
class ReceptionPageModel with ChangeNotifier { class ReceptionPageModel with ChangeNotifier {
Future<void> getIdenfifier(BuildContext context) async { 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(); notifyListeners();
Share.share( Share.share(

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -189,10 +189,10 @@ class CustomDrawer extends StatelessWidget {
} }
Widget _buildDrawerBody(BuildContext context) { Widget _buildDrawerBody(BuildContext context) {
return MenuFactory( return Menufactory(
menuEntry: MenuEntries.drawer, entry: MenuEntry.getEntriesByType(MenuEntryType.Property),
menuItem: EnumMenuItem.tile, item: EnumMenuItem.tile,
menuView: MenuView.list, 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/flutter_flow_util.dart';
import 'package:hub/flutter_flow/internationalization.dart'; import 'package:hub/flutter_flow/internationalization.dart';
import 'package:hub/flutter_flow/nav/nav.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/components/molecules/modules/index.dart';
import 'package:hub/shared/helpers/storage/base_storage.dart'; import 'package:hub/shared/helpers/storage/base_storage.dart';
import 'package:hub/shared/helpers/storage/storage_helper.dart'; import 'package:hub/shared/helpers/storage/storage_helper.dart';
import 'package:hub/shared/services/authentication/authentication_service.dart'; import 'package:hub/shared/services/authentication/authentication_service.dart';
import 'package:hub/shared/utils/dialog_util.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'; import 'package:hub/shared/utils/snackbar_util.dart';
abstract class LocalsRemoteDataSource { abstract class LocalsRemoteDataSource {
@ -22,7 +22,7 @@ abstract class LocalsRemoteDataSource {
Future<bool> processLocals(BuildContext context) async => false; Future<bool> processLocals(BuildContext context) async => false;
Future<bool> processData(BuildContext context) async => false; Future<bool> processData(BuildContext context) async => false;
Future<bool> selectLocal(BuildContext context, ApiCallResponse? response) 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 { class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
@ -38,7 +38,7 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
final bool? isError = response.jsonBody['error']; final bool? isError = response.jsonBody['error'];
if (isError == true) { if (isError == true) {
_handleError(context, response.jsonBody['error_msg']); LocalUtil.handleError(context, response.jsonBody['error_msg']);
return; return;
} }
if (response.jsonBody == null) { if (response.jsonBody == null) {
@ -56,11 +56,11 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
final bool isEnable = !isEmpty && isActive; final bool isEnable = !isEmpty && isActive;
if (isEnable) { if (isEnable) {
await StorageHelper().s(SecureStorageKey.haveLocal.value, true); await StorageHelper().set(SecureStorageKey.haveLocal.value, true);
await StorageHelper().s(SecureStorageKey.isLogged.value, true); await StorageHelper().set(SecureStorageKey.isLogged.value, true);
await WidgetsBinding.instance.endOfFrame; await WidgetsBinding.instance.endOfFrame;
await StorageHelper().s(KeychainStorageKey.clientUUID.value, ''); await StorageHelper().set(KeychainStorageKey.clientUUID.value, '');
await StorageHelper().s(KeychainStorageKey.ownerUUID.value, ''); await StorageHelper().set(KeychainStorageKey.ownerUUID.value, '');
StorageHelper().context?.go('/homePage'); StorageHelper().context?.go('/homePage');
} }
} catch (e, s) { } catch (e, s) {
@ -78,7 +78,7 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
if (isError == true) { if (isError == true) {
final String errorMsg = response.jsonBody['error_msg']; final String errorMsg = response.jsonBody['error_msg'];
_handleError(context, errorMsg); LocalUtil.handleError(context, errorMsg);
return false; return false;
} }
if (response.jsonBody == null) { if (response.jsonBody == null) {
@ -91,27 +91,27 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
} }
final List<dynamic> locals = response.jsonBody['locais'].toList() ?? []; final List<dynamic> locals = response.jsonBody['locais'].toList() ?? [];
_logLocalsStatus(locals); LocalUtil.logLocalsStatus(locals);
final bool isActive = _isActive(locals); final bool isActive = LocalUtil.isActive(locals);
final bool isInactived = await _isInactived(locals); final bool isInactived = await LocalUtil.isInactived(locals);
final bool isPending = _isPending(locals); final bool isPending = LocalUtil.isPending(locals);
final bool isUnique = locals.length == 1; final bool isUnique = locals.length == 1;
final bool isBlocked = locals.where((local) => local['CLU_STATUS'] == 'B').isNotEmpty; final bool isBlocked = locals.where((local) => local['CLU_STATUS'] == 'B').isNotEmpty;
final bool isEnabled = isUnique && isActive; final bool isEnabled = isUnique && isActive;
final bool isDisabled = isUnique && isBlocked; final bool isDisabled = isUnique && isBlocked;
final bool isUnselected = await _isUnselected(); final bool isUnselected = await LocalUtil.isUnselected();
final bool isSelected = await _isSelected(isInactived); final bool isSelected = await LocalUtil.isSelected(isInactived);
final bool isUnavailable = isPending && isUnselected && isUnique; final bool isUnavailable = isPending && isUnselected && isUnique;
final bool isAvailable = await _isAvailable(); final bool isAvailable = await LocalUtil.isAvailable();
if (isDisabled) { if (isDisabled) {
AuthenticationService.signOut(context); AuthenticationService.signOut(context);
return true; return true;
} else if (isUnavailable) { } else if (isUnavailable) {
return await _handleUnavailable(context, locals); return await LocalUtil.handleUnavailable(context, locals);
} else if (isEnabled) { } else if (isEnabled) {
return await _handleEnabled(context, locals[0]); return await LocalUtil.handleEnabled(context, locals[0]);
} else if (isUnselected) { } else if (isUnselected) {
log('() => isUnselected'); log('() => isUnselected');
return await selectLocal(context, response); return await selectLocal(context, response);
@ -166,12 +166,8 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
await DialogUtil.error(context, errorMsg).whenComplete(() => selectLocal(context, response)); await DialogUtil.error(context, errorMsg).whenComplete(() => selectLocal(context, response));
return false; return false;
} else { } else {
final bool isNewVersion = await _updateStorageUtil(response.jsonBody); final bool isNewVersion = await LocalUtil.updateStorageUtil(response.jsonBody);
await LicenseRepositoryImpl().setupLicense(isNewVersion); return await LicenseRepositoryImpl().updateLicense(isNewVersion);
if (isNewVersion) {
return await LicenseRepositoryImpl().fetchLicense(isNewVersion);
}
return false;
} }
} catch (e, s) { } catch (e, s) {
log('() => error processData: $e', stackTrace: s); log('() => error processData: $e', stackTrace: s);
@ -205,7 +201,7 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
} }
@override @override
Future<void> unlinkLocal(BuildContext context) async { Future<void> detachLocal(BuildContext context) async {
String content; String content;
try { try {
content = FFLocalizations.of(context).getVariableText( content = FFLocalizations.of(context).getVariableText(
@ -215,8 +211,8 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
await PhpGroup.resopndeVinculo.call(tarefa: 'I').then((value) async { await PhpGroup.resopndeVinculo.call(tarefa: 'I').then((value) async {
if (value.jsonBody['error'] == false) { if (value.jsonBody['error'] == false) {
await StorageHelper().s(KeychainStorageKey.clientName.value, ''); await StorageHelper().set(KeychainStorageKey.clientName.value, '');
await StorageHelper().s(KeychainStorageKey.clientUUID.value, ''); await StorageHelper().set(KeychainStorageKey.clientUUID.value, '');
context.pop(); context.pop();
context.go( context.go(
'/homePage', '/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/material.dart';
import 'package:flutter_bloc/flutter_bloc.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'; import 'package:hub/shared/components/molecules/locals/index.dart';
class LocalsRepositoryImpl implements LocalsRepository { class LocalsRepositoryImpl implements LocalsRepository {
final LocalsRemoteDataSource remoteDataSource = LocalsRemoteDataSourceImpl(); final LocalsRemoteDataSource remoteDataSource = LocalsRemoteDataSourceImpl();
@override @override
Future<void> checkLocals(BuildContext context) async { Future<void> validateLocal(BuildContext context) async {
return await remoteDataSource.checkLocals(context); return await remoteDataSource.checkLocals(context);
} }
@override @override
Future<bool> processData(BuildContext context) async { Future<bool> update(BuildContext context) async {
return await remoteDataSource.processData(context);
}
@override
Future<bool> processLocals(BuildContext context) async {
final bool response = await remoteDataSource.processLocals(context); final bool response = await remoteDataSource.processLocals(context);
context.read<LocalProfileBloc>().add(LocalProfileEvent()); context.read<LocalProfileBloc>().add(LocalProfileEvent());
return response; return response;
} }
@override
Future<bool> selectLocal(BuildContext context, ApiCallResponse? response) async {
return await remoteDataSource.selectLocal(context, response);
}
@override @override
Future<void> unlinkLocal(BuildContext context) { 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:flutter/material.dart';
import 'package:hub/backend/api_requests/api_calls.dart';
abstract class LocalsRepository { abstract class LocalsRepository {
Future<void> checkLocals(BuildContext context) async {} Future<void> validateLocal(BuildContext context) async {}
Future<bool> processLocals(BuildContext context) async => false; Future<bool> update(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> unlinkLocal(BuildContext context) async {}
} }

View File

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

View File

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

View File

@ -22,8 +22,8 @@ class _LocalProfileComponentWidgetState extends State<LocalProfileComponentWidge
Future callback() async { Future callback() async {
await StorageHelper().s(KeychainStorageKey.clientUUID.value, ''); await StorageHelper().set(KeychainStorageKey.clientUUID.value, '');
await LocalsRepositoryImpl().processLocals(context); await LocalsRepositoryImpl().update(context);
} }
@override @override
@ -95,8 +95,8 @@ class _LocalProfileComponentWidgetState extends State<LocalProfileComponentWidge
hoverColor: Colors.transparent, hoverColor: Colors.transparent,
highlightColor: Colors.transparent, highlightColor: Colors.transparent,
onTap: () async { onTap: () async {
await StorageHelper().s(KeychainStorageKey.clientUUID.value, ''); await StorageHelper().set(KeychainStorageKey.clientUUID.value, '');
await LocalsRepositoryImpl().processLocals(context); await LocalsRepositoryImpl().update(context);
}, },
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(200.0), 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_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) { MenuItem getInstance(final Function() action, final String title, final IconData icon) {
switch (this) { switch (this) {
case EnumMenuItem.button: case EnumMenuItem.button:
return MenuButtonWidget(action: action, title: title, icon: icon); return ButtonMenuItem(action: action, title: title, icon: icon);
case EnumMenuItem.card: case EnumMenuItem.card:
return MenuCardItem(action: action, title: title, icon: icon); return CardMenuItem(action: action, title: title, icon: icon);
case EnumMenuItem.tile: 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: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:flutter_bloc/flutter_bloc.dart';
import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:hub/flutter_flow/nav/nav.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/menu/index.dart';
import 'package:hub/shared/components/molecules/modules/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 {} class MenuViewEvent {}
@ -32,15 +26,14 @@ class MenuViewState {
class MenuViewBloc extends Bloc<MenuViewEvent, MenuViewState> { class MenuViewBloc extends Bloc<MenuViewEvent, MenuViewState> {
final MenuView style; final MenuView style;
final EnumMenuItem item; final EnumMenuItem item;
final bool expandable;
final List<MenuEntry> menuOptions; final List<MenuEntry> menuOptions;
late StreamSubscription<void> _completer; 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 { on<MenuViewEvent>((event, emit) async {
await LicenseRemoteDataSourceImpl().waitForSaveCompletion(); await LicenseRemoteDataSourceImpl().waitForSaveCompletion();
final entries = await generateMenuEntries(); final entries = await MenuRepositoryImpl().generateMenuEntries(menuOptions, item);
emit(state.copyWith(menuEntries: entries)); emit(state.copyWith(menuEntries: entries));
}); });
@ -54,104 +47,6 @@ class MenuViewBloc extends Bloc<MenuViewEvent, MenuViewState> {
_completer.cancel(); _completer.cancel();
return super.close(); 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 'blocs/index.dart';
export 'widgets/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_item/index.dart';
export 'menu_view/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/components/molecules/menu/index.dart';
import 'package:hub/shared/utils/loading_util.dart'; import 'package:hub/shared/utils/loading_util.dart';
class MenuViewFactory extends StatelessWidget { class Menufactory extends StatelessWidget {
final MenuView view; final MenuView view;
final EnumMenuItem item; final EnumMenuItem item;
final bool expandable; final List<MenuEntry> entry;
final MenuEntries entry;
const MenuViewFactory({ const Menufactory({
super.key, super.key,
required this.view, required this.view,
required this.item, required this.item,
required this.expandable,
required this.entry, required this.entry,
}); });
@ -49,15 +47,13 @@ class MenuViewFactory extends StatelessWidget {
create: (context) => MenuViewBloc( create: (context) => MenuViewBloc(
style: view, style: view,
item: item, item: item,
menuOptions: entry.getValues, menuOptions: entry,
expandable: expandable,
)..add(MenuViewEvent()), )..add(MenuViewEvent()),
child: BlocBuilder<MenuViewBloc, MenuViewState>( child: BlocBuilder<MenuViewBloc, MenuViewState>(
builder: (context, state) { builder: (context, state) {
if (view == MenuView.list_grid) { if (view == MenuView.list_grid) {
return MenuStaggeredView( return MenuStaggeredView(
options: state.menuEntries, options: state.menuEntries,
expandable: expandable,
item: item, item: item,
changeMenuStyle: () async {}, changeMenuStyle: () async {},
isGrid: state.isGrid, isGrid: state.isGrid,
@ -65,7 +61,6 @@ class MenuViewFactory extends StatelessWidget {
} else if (view == MenuView.list) { } else if (view == MenuView.list) {
return MenuListView( return MenuListView(
options: state.menuEntries, options: state.menuEntries,
expandable: expandable,
item: item, item: item,
changeMenuStyle: () async {}, 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_button.dart';
export 'menu_item_card.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'; import 'package:hub/shared/components/molecules/menu/index.dart';
class MenuButtonWidget extends MenuItem { class ButtonMenuItem extends MenuItem {
const MenuButtonWidget({ const ButtonMenuItem({
super.key, super.key,
required this.action, required this.action,
required this.title, required this.title,
@ -23,7 +23,7 @@ class MenuButtonWidget extends MenuItem {
_MenuButtonWidgetState createState() => _MenuButtonWidgetState(); _MenuButtonWidgetState createState() => _MenuButtonWidgetState();
} }
class _MenuButtonWidgetState extends State<MenuButtonWidget> { class _MenuButtonWidgetState extends State<ButtonMenuItem> {
bool _isProcessing = false; bool _isProcessing = false;
@override @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'; import 'package:hub/shared/components/molecules/menu/index.dart';
class MenuCardItem extends MenuItem { class CardMenuItem extends MenuItem {
const MenuCardItem({ const CardMenuItem({
super.key, super.key,
required this.action, required this.action,
required this.title, required this.title,
@ -23,7 +23,7 @@ class MenuCardItem extends MenuItem {
_MenuCardItemState createState() => _MenuCardItemState(); _MenuCardItemState createState() => _MenuCardItemState();
} }
class _MenuCardItemState extends State<MenuCardItem> { class _MenuCardItemState extends State<CardMenuItem> {
bool _isProcessing = false; bool _isProcessing = false;
@override @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_list_view.dart';
export 'menu_staggered_view.dart'; export 'menu_staggered_view.dart';
export 'menu_view_factory.dart';

View File

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

View File

@ -13,9 +13,8 @@ class MenuStaggeredViewModel extends FlutterFlowModel<MenuStaggeredView> {
} }
class MenuStaggeredView extends StatefulWidget { 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 EnumMenuItem item;
final bool isGrid; final bool isGrid;
final List<MenuItem?> options; final List<MenuItem?> options;

View File

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

View File

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

View File

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

View File

@ -1,81 +1,41 @@
import 'package:hub/shared/extensions/string_extensions.dart'; 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/base_storage.dart';
import 'package:hub/shared/helpers/storage/storage_helper.dart'; import 'package:hub/shared/helpers/storage/storage_helper.dart';
import 'module.dart'; import 'module.dart';
enum LicenseKeys { enum LicenseKeys {
messages,
liberations, messages('FRE-HUB-MESSAGES'),
reservations, liberations('FRE-HUB-LIBERATIONS'),
access, reservations('FRE-HUB-RESERVATIONS'),
openedVisits, access('FRE-HUB-ACCESS'),
vehicles, openedVisits('FRE-HUB-OPENED-VISITS'),
residents, vehicles('FRE-HUB-VEHICLES'),
pets, residents('FRE-HUB-RESIDENTS'),
orders, pets('FRE-HUB-PETS'),
completeSchedule, orders('FRE-HUB-ORDERS'),
providerSchedule, completeSchedule('FRE-HUB-COMPLETE-SCHEDULE'),
deliverySchedule, providerSchedule('FRE-HUB-AGE-PROV-PRESTADOR'),
property, deliverySchedule('FRE-HUB-AGE-PROV-DELIVERY'),
fastPass, property('FRE-HUB-PROPERTY'),
visitors, fastPass('FRE-HUB-FASTPASS'),
qrCode, visitors('FRE-HUB-VISITORS'),
people, qrCode('FRE-HUB-QRCODE'),
petsHistory, people('FRE-HUB-PEOPLE'),
settings, petsHistory('FRE-HUB-PETS-HISTORY'),
logout, 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 { class License {
final List<Module> modules; final List<Module> modules;
@ -84,28 +44,6 @@ class License {
this.modules, 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 { static Future<String> _proceessOldVersion(LicenseKeys key) async {
switch(key) { switch(key) {
@ -125,22 +63,25 @@ class License {
} }
static Future<String> _precessWpp() async { 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; if (whatsapp) return ModuleStatus.active.key;
else return ModuleStatus.inactive.key; else return ModuleStatus.inactive.key;
} }
static Future<String> _processProvisional() async { 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; if (provisional) return ModuleStatus.active.key;
else return ModuleStatus.inactive.key; else return ModuleStatus.inactive.key;
} }
static Future<String> _processPets() async { 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; if (pets) return ModuleStatus.active.key;
else return ModuleStatus.inactive.key; else return ModuleStatus.inactive.key;
} }
static getKeyByModule(String s) {
}
static Future<License> getLicense(bool isNewVersion) async { 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 { abstract class LicenseRepository {
Future<bool> fetchLicense(bool isNewVersion); Future<bool> updateLicense(bool isNewVersion);
Future<void> setupLicense(bool isNewVersion);
Future<void> cleanLicense(); Future<void> cleanLicense();
Future<String?> g(String key); Future<String?> getLicense(String key);
Future<void> s<T>(String key, T value); Future<void> setLicense<T>(String key, T value);
} }

View File

@ -32,7 +32,7 @@ class DatabaseStorage {
onUpgrade: _onUpgrade, onUpgrade: _onUpgrade,
onDowngrade: _onDowngrade, onDowngrade: _onDowngrade,
); );
await LicenseRepositoryImpl().setupLicense(false); await LicenseRepositoryImpl().updateLicense(false);
isInitialized = true; 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); 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); 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); return await getInstanceByKey(key).delete(key);
} }
Future<void> c(Storage storage) async { Future<void> clean(Storage storage) async {
return await getInstance(storage).clearAll(); return await getInstance(storage).clearAll();
} }
} }

View File

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