remove logs
This commit is contained in:
parent
0863e92e00
commit
17f8cf733f
|
@ -70,7 +70,7 @@ class GetOpenedVisits {
|
|||
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
|
||||
const String atividade = 'getOpenedVisits';
|
||||
const String pageSize = '10';
|
||||
return ApiManager.instance.makeApiCall(
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'getOpenedVisits',
|
||||
apiUrl: '$baseUrl/processRequest.php',
|
||||
callType: ApiCallType.POST,
|
||||
|
@ -102,7 +102,7 @@ class GetResidentsByProperty {
|
|||
final String cliID = await StorageHelper().g(KeychainStorageKey.clientUUID.value) ?? '';
|
||||
const String atividade = 'getResidentsByProperty';
|
||||
const String pageSize = '10';
|
||||
return ApiManager.instance.makeApiCall(
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'getResidentsByProperty',
|
||||
apiUrl: '$baseUrl/processRequest.php',
|
||||
callType: ApiCallType.POST,
|
||||
|
@ -133,7 +133,7 @@ class GetVehiclesByProperty {
|
|||
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
|
||||
const String atividade = 'getVehiclesByProperty';
|
||||
const String pageSize = '10';
|
||||
return ApiManager.instance.makeApiCall(
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'getVehiclesByProperty',
|
||||
apiUrl: '$baseUrl/processRequest.php',
|
||||
callType: ApiCallType.POST,
|
||||
|
@ -165,7 +165,7 @@ class TestCall {
|
|||
const String usuEmail = 'email_app@exemplo.com';
|
||||
const String idDestino = '1';
|
||||
|
||||
return ApiManager.instance.makeApiCall(
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'getLicense',
|
||||
apiUrl: 'https://residenceapi.fre.com.br/getLicenca.php',
|
||||
callType: ApiCallType.POST,
|
||||
|
@ -195,7 +195,7 @@ class GetLicense {
|
|||
final String userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
|
||||
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
|
||||
|
||||
return ApiManager.instance.makeApiCall(
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'getLicense',
|
||||
apiUrl: '$baseUrl/processRequest.php',
|
||||
callType: ApiCallType.POST,
|
||||
|
@ -225,7 +225,7 @@ class UnregisterDevice {
|
|||
final String devUUID = (await StorageHelper().g(KeychainStorageKey.devUUID.value)) ?? '';
|
||||
final String userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
|
||||
|
||||
return ApiManager.instance.makeApiCall(
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'unregisterDevice',
|
||||
apiUrl: '$baseUrl/unregisterDevice.php',
|
||||
callType: ApiCallType.POST,
|
||||
|
@ -255,7 +255,7 @@ class DeletePet {
|
|||
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
|
||||
const String atividade = 'excluirPet';
|
||||
|
||||
return ApiManager.instance.makeApiCall(
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'deletePet',
|
||||
apiUrl: '$baseUrl/processRequest.php',
|
||||
callType: ApiCallType.POST,
|
||||
|
@ -300,7 +300,7 @@ class UpdatePet {
|
|||
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
|
||||
const String atividade = 'atualizarPet';
|
||||
|
||||
return ApiManager.instance.makeApiCall(
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'updatePet',
|
||||
apiUrl: '$baseUrl/processRequest.php',
|
||||
callType: ApiCallType.POST,
|
||||
|
@ -346,7 +346,7 @@ class GetPets {
|
|||
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
|
||||
const String atividade = 'consultaPets';
|
||||
|
||||
return ApiManager.instance.makeApiCall(
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'getPets',
|
||||
apiUrl: '$baseUrl/processRequest.php',
|
||||
callType: ApiCallType.POST,
|
||||
|
@ -380,7 +380,7 @@ class GetPetPhoto {
|
|||
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
|
||||
const String atividade = 'consultaFotoPet';
|
||||
|
||||
return ApiManager.instance.makeApiCall(
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'getPetPhoto',
|
||||
apiUrl: '$baseUrl/getImage.php',
|
||||
callType: ApiCallType.POST,
|
||||
|
@ -423,7 +423,7 @@ class RegisterPet {
|
|||
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
|
||||
const String atividade = 'cadastrarPet';
|
||||
|
||||
return ApiManager.instance.makeApiCall(
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'registerPet',
|
||||
apiUrl: '$baseUrl/processRequest.php',
|
||||
callType: ApiCallType.POST,
|
||||
|
@ -470,7 +470,7 @@ class BuscaEnconcomendas {
|
|||
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
|
||||
return ApiManager.instance.makeApiCall(
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'getEncomendas',
|
||||
apiUrl: '$baseUrl/processRequest.php',
|
||||
callType: ApiCallType.POST,
|
||||
|
@ -512,7 +512,7 @@ class CancelaVisita {
|
|||
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
|
||||
const String atividade = 'cancelaVisita';
|
||||
|
||||
return ApiManager.instance.makeApiCall(
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'cancelaVisita',
|
||||
apiUrl: '$baseUrl/processRequest.php',
|
||||
callType: ApiCallType.POST,
|
||||
|
@ -545,7 +545,7 @@ class DeleteAccount {
|
|||
final String userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
|
||||
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
return ApiManager.instance.makeApiCall(
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'deleteAccount',
|
||||
apiUrl: '$baseUrl/deleteAccount.php',
|
||||
callType: ApiCallType.POST,
|
||||
|
@ -578,7 +578,7 @@ class ChangePanic {
|
|||
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
|
||||
const String atividade = 'updVisitado';
|
||||
|
||||
return ApiManager.instance.makeApiCall(
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'changePass',
|
||||
apiUrl: '$baseUrl/processRequest.php',
|
||||
callType: ApiCallType.POST,
|
||||
|
@ -614,7 +614,7 @@ class ChangePass {
|
|||
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
|
||||
const String atividade = 'updVisitado';
|
||||
|
||||
return ApiManager.instance.makeApiCall(
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'changePass',
|
||||
apiUrl: '$baseUrl/processRequest.php',
|
||||
callType: ApiCallType.POST,
|
||||
|
@ -649,7 +649,7 @@ class RespondeVinculo {
|
|||
final String userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
|
||||
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
|
||||
|
||||
return ApiManager.instance.makeApiCall(
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'respondeVinculo',
|
||||
apiUrl: '$baseUrl/responderVinculo.php',
|
||||
callType: ApiCallType.POST,
|
||||
|
@ -684,7 +684,7 @@ class ChangeNotifica {
|
|||
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
|
||||
const String atividade = 'updVisitado';
|
||||
|
||||
return ApiManager.instance.makeApiCall(
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'changeNotifica',
|
||||
apiUrl: '$baseUrl/processRequest.php',
|
||||
callType: ApiCallType.POST,
|
||||
|
@ -719,7 +719,7 @@ class UpdateIDE {
|
|||
final String newIde = (await StorageHelper().g(KeychainStorageKey.userDevUUID.value)) ?? '';
|
||||
const String atividade = 'updVisitado';
|
||||
|
||||
return ApiManager.instance.makeApiCall(
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'changeNotifica',
|
||||
apiUrl: '$baseUrl/processRequest.php',
|
||||
callType: ApiCallType.POST,
|
||||
|
@ -752,7 +752,7 @@ class UpdToken {
|
|||
final String userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
|
||||
final String token = (await StorageHelper().g(SecureStorageKey.token.value)) ?? '';
|
||||
|
||||
return ApiManager.instance.makeApiCall(
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'updToken',
|
||||
apiUrl: '$baseUrl/updtoken.php',
|
||||
callType: ApiCallType.POST,
|
||||
|
@ -792,7 +792,7 @@ class LoginCall {
|
|||
LogUtil.requestAPIFailed('login.php', email, "Login", e, s);
|
||||
}
|
||||
|
||||
return ApiManager.instance.makeApiCall(
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'login',
|
||||
apiUrl: '$baseUrl/login.php',
|
||||
callType: ApiCallType.POST,
|
||||
|
@ -830,7 +830,7 @@ class RegisterCall {
|
|||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
|
||||
return ApiManager.instance.makeApiCall(
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'register',
|
||||
apiUrl: '$baseUrl/registro.php',
|
||||
callType: ApiCallType.POST,
|
||||
|
@ -868,7 +868,7 @@ class ChangePasswordCall {
|
|||
final String userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
|
||||
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
|
||||
|
||||
return ApiManager.instance.makeApiCall(
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'changePassword',
|
||||
apiUrl: '$baseUrl/alterarSenha.php',
|
||||
callType: ApiCallType.POST,
|
||||
|
@ -900,7 +900,7 @@ class ForgotPasswordCall {
|
|||
}) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
|
||||
return ApiManager.instance.makeApiCall(
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'forgotPassword',
|
||||
apiUrl: '$baseUrl/iforgot.php',
|
||||
callType: ApiCallType.POST,
|
||||
|
@ -928,7 +928,7 @@ class GetLocalsCall {
|
|||
final String devUUID = await StorageHelper().g(KeychainStorageKey.devUUID.value) ?? '';
|
||||
final String userUUID = await StorageHelper().g(KeychainStorageKey.userUUID.value) ?? '';
|
||||
|
||||
return ApiManager.instance.makeApiCall(
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'getLocals',
|
||||
apiUrl: '$baseUrl/getLocais.php',
|
||||
callType: ApiCallType.POST,
|
||||
|
@ -970,7 +970,7 @@ class PostScheduleVisitorCall {
|
|||
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
|
||||
const String atividade = 'putVisitante';
|
||||
|
||||
return ApiManager.instance.makeApiCall(
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'postScheduleVisitor',
|
||||
apiUrl: '$baseUrl/processRequest.php',
|
||||
callType: ApiCallType.POST,
|
||||
|
@ -1025,7 +1025,7 @@ class PostScheduleVisitCall {
|
|||
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
|
||||
const String atividade = 'putVisita';
|
||||
|
||||
return ApiManager.instance.makeApiCall(
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'postScheduleVisit',
|
||||
apiUrl: '$baseUrl/processRequest.php',
|
||||
callType: ApiCallType.POST,
|
||||
|
@ -1079,7 +1079,7 @@ class GetScheduleVisitCall {
|
|||
final String cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
|
||||
const String atividade = 'getVisitas';
|
||||
|
||||
return ApiManager.instance.makeApiCall(
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'getScheduleVisit',
|
||||
apiUrl: '$baseUrl/processRequest.php',
|
||||
callType: ApiCallType.POST,
|
||||
|
@ -1353,7 +1353,7 @@ class GetDadosCall {
|
|||
final String cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
|
||||
const String atividade = 'getDados';
|
||||
|
||||
return ApiManager.instance.makeApiCall(
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'getDados',
|
||||
apiUrl: '$baseUrl/processRequest.php',
|
||||
callType: ApiCallType.POST,
|
||||
|
@ -1586,7 +1586,7 @@ class GetVisitorByDocCall {
|
|||
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
|
||||
const String atividade = 'getVisitante';
|
||||
|
||||
return ApiManager.instance.makeApiCall(
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'getVisitorByDoc',
|
||||
apiUrl: '$baseUrl/processRequest.php',
|
||||
callType: ApiCallType.POST,
|
||||
|
@ -1640,7 +1640,7 @@ class GetFotoVisitanteCall {
|
|||
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
|
||||
const String atividade = 'getFotoVisitante';
|
||||
|
||||
return ApiManager.instance.makeApiCall(
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'getFotoVisitante',
|
||||
apiUrl: '$baseUrl/getImage.php',
|
||||
callType: ApiCallType.GET,
|
||||
|
@ -1679,7 +1679,7 @@ class PostProvVisitSchedulingCall {
|
|||
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
|
||||
const String atividade = 'putAgendamentoProv';
|
||||
|
||||
return ApiManager.instance.makeApiCall(
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'postProvVisitScheduling',
|
||||
apiUrl: '$baseUrl/processRequest.php',
|
||||
callType: ApiCallType.POST,
|
||||
|
@ -1728,7 +1728,7 @@ class GetVisitsCall {
|
|||
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
|
||||
const String atividade = 'getVisitas';
|
||||
|
||||
return ApiManager.instance.makeApiCall(
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'getVisits',
|
||||
apiUrl: '$baseUrl/processRequest.php',
|
||||
callType: ApiCallType.POST,
|
||||
|
@ -1991,7 +1991,7 @@ class DeleteVisitCall {
|
|||
final String cliID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
|
||||
const String atividade = 'cancelaVisita';
|
||||
|
||||
return ApiManager.instance.makeApiCall(
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'deleteVisit',
|
||||
apiUrl: '$baseUrl/processRequest.php',
|
||||
callType: ApiCallType.POST,
|
||||
|
@ -2034,7 +2034,7 @@ class GetPessoasLocalCall {
|
|||
final String userUUID = (await StorageHelper().g(KeychainStorageKey.userUUID.value)) ?? '';
|
||||
final String cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
|
||||
|
||||
return ApiManager.instance.makeApiCall(
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'getPessoasLocal',
|
||||
apiUrl: '$baseUrl/getPessoasLocal.php',
|
||||
callType: ApiCallType.POST,
|
||||
|
@ -2100,7 +2100,7 @@ class RespondeSolicitacaoCall {
|
|||
final String cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
|
||||
const String atividade = 'respondeSolicitacao';
|
||||
|
||||
return ApiManager.instance.makeApiCall(
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'respondeSolicitacao',
|
||||
apiUrl: '$baseUrl/processRequest.php',
|
||||
callType: ApiCallType.POST,
|
||||
|
@ -2150,7 +2150,7 @@ class GetAccessCall {
|
|||
final String cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
|
||||
const String atividade = 'getAcessos';
|
||||
|
||||
return ApiManager.instance.makeApiCall(
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'getAccess',
|
||||
apiUrl: '$baseUrl/processRequest.php',
|
||||
callType: ApiCallType.POST,
|
||||
|
@ -2591,7 +2591,7 @@ class GetMessagesCall {
|
|||
final String cliUUID = (await StorageHelper().g(KeychainStorageKey.clientUUID.value)) ?? '';
|
||||
const String atividade = 'getMensagens';
|
||||
|
||||
return ApiManager.instance.makeApiCall(
|
||||
return await ApiManager.instance.makeApiCall(
|
||||
callName: 'getMessages',
|
||||
apiUrl: '$baseUrl/processRequest.php',
|
||||
callType: ApiCallType.POST,
|
||||
|
|
|
@ -147,15 +147,7 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
|
|||
try {
|
||||
final GetDadosCall callback = PhpGroup.getDadosCall;
|
||||
ApiCallResponse? response = await callback.call();
|
||||
final bool? isError = response.jsonBody['error'];
|
||||
|
||||
if (isError == true) {
|
||||
final GetLocalsCall callback = PhpGroup.getLocalsCall;
|
||||
response = await callback.call();
|
||||
final String errorMsg = response.jsonBody['error_msg'];
|
||||
await DialogUtil.error(context, errorMsg).whenComplete(() => selectLocal(context, response));
|
||||
return false;
|
||||
} else if (response.jsonBody == null) {
|
||||
if (response.jsonBody == null) {
|
||||
final GetLocalsCall callback = PhpGroup.getLocalsCall;
|
||||
response = await callback.call();
|
||||
final String errorMsg = FFLocalizations.of(context).getVariableText(
|
||||
|
@ -164,17 +156,24 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
|
|||
);
|
||||
await DialogUtil.error(context, errorMsg).whenComplete(() => selectLocal(context, response));
|
||||
return false;
|
||||
}
|
||||
|
||||
final bool? isError = response.jsonBody['error'];
|
||||
if (isError == true) {
|
||||
final GetLocalsCall callback = PhpGroup.getLocalsCall;
|
||||
response = await callback.call();
|
||||
final String errorMsg = response.jsonBody['error_msg'] ?? 'Unknown error';
|
||||
await DialogUtil.error(context, errorMsg).whenComplete(() => selectLocal(context, response));
|
||||
return false;
|
||||
} else {
|
||||
final bool isNewVersion = await _updateStorageUtil(response.jsonBody);
|
||||
await LicenseRepositoryImpl().setupLicense(isNewVersion);
|
||||
if (isNewVersion) {
|
||||
log('(A) => isNewVersion: $isNewVersion');
|
||||
return await LicenseRepositoryImpl().fetchLicense(isNewVersion);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} catch (e, s) {
|
||||
log('() => stack processData: $s');
|
||||
log('() => error processData: $e', stackTrace: s);
|
||||
final String errorMsg = FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Error getting data, verify your connection',
|
||||
|
@ -256,7 +255,6 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
|
|||
final bool isAuthenticated = userUUID.isNotEmpty && devUUID.isNotEmpty;
|
||||
final bool isDevLinked = !errorMsg.contains('Esse dispositivo nao pertence a esse usuario');
|
||||
log('() => isLinked: $errorMsg');
|
||||
log('() => isLinked: $errorMsg');
|
||||
if (!isAuthenticated) {
|
||||
errorMsg = FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Erro ao obter credenciais de autenticação',
|
||||
|
@ -316,21 +314,21 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
|
|||
}
|
||||
|
||||
Future<bool> _updateStorageUtil(Map<String, dynamic> jsonBody) async {
|
||||
await StorageHelper().s(KeychainStorageKey.whatsapp.value, jsonBody['whatsapp'] != null && jsonBody['whatsapp']);
|
||||
await StorageHelper().s(KeychainStorageKey.provisional.value, jsonBody['provisional'] != null && jsonBody['provisional']);
|
||||
await StorageHelper().s(KeychainStorageKey.pets.value, jsonBody['pet'] != null && jsonBody['pet']);
|
||||
await StorageHelper().s(KeychainStorageKey.petAmount.value,
|
||||
jsonBody['petAmountRegister'] != null && jsonBody['petAmountRegister'].toString().isEmpty ? '0' : jsonBody['petAmountRegister'].toString());
|
||||
await StorageHelper().s(KeychainStorageKey.userName.value, jsonBody['visitado']['VDO_NOME']);
|
||||
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'] ?? '');
|
||||
|
||||
late final bool isNewVersion;
|
||||
if (jsonBody['newVersion'] != null)
|
||||
isNewVersion = jsonBody['newVersion'];
|
||||
else
|
||||
isNewVersion = false;
|
||||
log('() => isNewVersion: ${jsonBody['newVersion']}');
|
||||
await StorageHelper().s(KeychainStorageKey.isNewVersion.value, isNewVersion);
|
||||
return isNewVersion;
|
||||
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) {
|
||||
|
|
|
@ -74,22 +74,19 @@ class MenuViewBloc extends Bloc<MenuViewEvent, MenuViewState> {
|
|||
String? licenseValue = await LicenseRepositoryImpl().g(opt.value);
|
||||
if (licenseValue != null) {
|
||||
Map<String, String> licenseMap = await stringToMap(licenseValue);
|
||||
if (opt.value == 'FRE-HUB-PROPERTY') log('AboutProperty: $licenseMap');
|
||||
log('Module: ${opt.value} - License: ${licenseMap['display']}');
|
||||
final String display = licenseMap['display'] ?? 'INVISIVEL';
|
||||
final String startDate = licenseMap['startDate'] ?? '';
|
||||
final String expirationDate = licenseMap['expirationDate'] ?? '';
|
||||
final bool isStarted = await processStartDate(startDate, opt);
|
||||
log('isStarted: $isStarted');
|
||||
final bool isExpired = await processExpirationDate(expirationDate, opt);
|
||||
log('isExpired: $isExpired');
|
||||
if (isStarted && !isExpired) {
|
||||
await processDisplay(display, opt, entries);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
log('Error generating menu entries: $e');
|
||||
} catch (e, s) {
|
||||
log('Error generating menu entries: $e', stackTrace: s);
|
||||
|
||||
}
|
||||
return entries;
|
||||
}
|
||||
|
@ -143,7 +140,6 @@ class MenuViewBloc extends Bloc<MenuViewEvent, MenuViewState> {
|
|||
}
|
||||
|
||||
Future nav(String link) async {
|
||||
log('Opening: $link');
|
||||
navigatorKey.currentContext!.push(link, extra: <String, dynamic>{
|
||||
kTransitionInfoKey: const TransitionInfo(
|
||||
hasTransition: false,
|
||||
|
|
|
@ -42,3 +42,15 @@
|
|||
|
||||
String get dropDisplayTrigger => 'DROP TRIGGER IF EXISTS update_display_trigger;';
|
||||
|
||||
String get updatePeopleDisplayTrigger => '''
|
||||
CREATE TRIGGER update_people_display_trigger
|
||||
AFTER UPDATE ON $tableLicense
|
||||
WHEN NEW.key = 'FRE-HUB-ABOUT-PROPERTY' AND NEW.display = 'VISIVEL'
|
||||
BEGIN
|
||||
UPDATE $tableLicense
|
||||
SET display = 'INVISIVEL'
|
||||
WHERE key = 'FRE-HUB-PEOPLE';
|
||||
END;
|
||||
''';
|
||||
|
||||
String get dropPeopleDisplayTrigger => 'DROP TRIGGER IF EXISTS update_people_display_trigger;';
|
|
@ -69,12 +69,9 @@ class LicenseRemoteDataSourceImpl implements LicenseRemoteDataSource {
|
|||
|
||||
@override
|
||||
Future<bool> fetchLicenses(bool isNewVersion) async {
|
||||
log('(A) => license');
|
||||
try {
|
||||
log('Obtendo licenças...');
|
||||
final response = await PhpGroup.getLicense();
|
||||
final dynamic responseBody = response.jsonBody;
|
||||
log('Licenças obtidas: $responseBody');
|
||||
|
||||
if (response.jsonBody is! List<dynamic>) {
|
||||
late final String error;
|
||||
|
@ -100,13 +97,12 @@ class LicenseRemoteDataSourceImpl implements LicenseRemoteDataSource {
|
|||
}
|
||||
await Future.wait(saveOperations);
|
||||
|
||||
log('() => License stream add');
|
||||
LicenseRepositoryImpl.license.add(true);
|
||||
_completerController.add(null);
|
||||
|
||||
return true;
|
||||
} catch (e) {
|
||||
log('Erro ao obter licenças: $e');
|
||||
} catch (e, s) {
|
||||
log('Erro ao obter licenças: $e', stackTrace: s);
|
||||
await setupLicense(DatabaseStorage.database, isNewVersion);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import 'dart:developer';
|
|||
|
||||
class DatabaseStorage {
|
||||
static final String _dbName = 'database.db';
|
||||
static final int _dbVersion = 3;
|
||||
static final int _dbVersion = 4;
|
||||
|
||||
static final DatabaseStorage instance = DatabaseStorage._internal();
|
||||
factory DatabaseStorage() => instance;
|
||||
|
@ -56,10 +56,16 @@ class DatabaseStorage {
|
|||
if (oldVersion < 3 && newVersion >= 3) {
|
||||
await database.execute(updateDisplayTrigger);
|
||||
}
|
||||
if (oldVersion < 4 && newVersion >= 4) {
|
||||
await database.execute(updatePeopleDisplayTrigger);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _onDowngrade(Database database, int oldVersion, int newVersion) async {
|
||||
log('Downgrading database from version $oldVersion to $newVersion...');
|
||||
if (oldVersion >= 4 && newVersion < 4) {
|
||||
await database.execute(dropPeopleDisplayTrigger);
|
||||
}
|
||||
if (oldVersion >= 3 && newVersion < 3) {
|
||||
await database.execute(dropDisplayTrigger);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import 'dart:developer';
|
||||
|
||||
import 'package:hub/shared/constants/index.dart';
|
||||
import 'package:hub/shared/helpers/database/database_helper.dart';
|
||||
import 'package:hub/shared/helpers/storage/base_storage.dart';
|
||||
import 'package:sqflite/sqflite.dart';
|
||||
|
@ -11,19 +12,7 @@ class KeychainHelper implements BaseStorage {
|
|||
|
||||
bool _isInitialized = false;
|
||||
|
||||
static const String tableKeychain = 'keychain';
|
||||
|
||||
static String get createKeychainTable => '''
|
||||
CREATE TABLE $tableKeychain (
|
||||
key TEXT UNIQUE,
|
||||
value TEXT,
|
||||
type TEXT,
|
||||
updateAt TEXT,
|
||||
resolvedAt TEXT,
|
||||
createdAt TEXT
|
||||
);
|
||||
''';
|
||||
static String get deleteKeychainTable => 'DROP TABLE IF EXISTS $tableKeychain;';
|
||||
|
||||
@override
|
||||
Future<void> init() async {
|
||||
|
@ -67,4 +56,6 @@ class KeychainHelper implements BaseStorage {
|
|||
Future<void> clearAll() async {
|
||||
await DatabaseStorage.database.delete(tableKeychain);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue