diff --git a/integration_test/app_test.dart b/integration_test/app_test.dart index 5e237910..05bdabcf 100644 --- a/integration_test/app_test.dart +++ b/integration_test/app_test.dart @@ -14,9 +14,8 @@ void main() { group('Initialization', () { group('Navigation', () { - setUpAll(() async => await initializeApp().then((_) async => - StorageHelper.instance.set(SecureStorageKey.isLogged.value, 'false', Storage.SecureStorage)) - ); + setUpAll(() async => await initializeApp().then( + (_) async => StorageHelper.instance.set(SecureStorageKey.isLogged.value, 'false', Storage.SecureStorage))); testWidgets('Test Welcome', (WidgetTester tester) async { widget = tester; await _testWelcome(); @@ -27,18 +26,16 @@ void main() { }); group('Authentication', () { group('Sign in', () { - setUpAll(() async => await initializeApp().then((_) async => - StorageHelper.instance.set(SecureStorageKey.isLogged.value, 'false', Storage.SecureStorage)) - ); + setUpAll(() async => await initializeApp().then( + (_) async => StorageHelper.instance.set(SecureStorageKey.isLogged.value, 'false', Storage.SecureStorage))); testWidgets('Test Sign In', (WidgetTester tester) async { widget = tester; await _testSignIn(); }); }); group('Sign up', () { - setUpAll(() async => await initializeApp().then((_) async => - StorageHelper.instance.set(SecureStorageKey.isLogged.value, 'false', Storage.SecureStorage)) - ); + setUpAll(() async => await initializeApp().then( + (_) async => StorageHelper.instance.set(SecureStorageKey.isLogged.value, 'false', Storage.SecureStorage))); testWidgets('Test Sign Up', (WidgetTester tester) async { widget = tester; await _testSignUp(); diff --git a/lib/backend/api_requests/api_calls.dart b/lib/backend/api_requests/api_calls.dart index 0d76e676..a6a8b9ad 100644 --- a/lib/backend/api_requests/api_calls.dart +++ b/lib/backend/api_requests/api_calls.dart @@ -57,8 +57,10 @@ class PhpGroup { class UnregisterDevice { Future call() async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; - final String userUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; + final String devUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; + final String userUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; return ApiManager.instance.makeApiCall( callName: 'unregisterDevice', @@ -85,9 +87,12 @@ class UnregisterDevice { class DeletePet { Future call({final int? petID = 0}) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; - final String userUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; - final String cliID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; + final String devUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; + final String userUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; + final String cliID = + (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; const String atividade = 'excluirPet'; return ApiManager.instance.makeApiCall( @@ -130,9 +135,12 @@ class UpdatePet { }) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; - final String userUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; - final String cliID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; + final String devUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; + final String userUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; + final String cliID = + (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; const String atividade = 'atualizarPet'; return ApiManager.instance.makeApiCall( @@ -176,9 +184,12 @@ class GetPets { }) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; - final String userUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; - final String cliID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; + final String devUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; + final String userUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; + final String cliID = + (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; const String atividade = 'consultaPets'; return ApiManager.instance.makeApiCall( @@ -210,9 +221,12 @@ class GetPetPhoto { Future call({final int? petId}) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; - final String userUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; - final String cliID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; + final String devUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; + final String userUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; + final String cliID = + (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; const String atividade = 'consultaFotoPet'; return ApiManager.instance.makeApiCall( @@ -253,9 +267,12 @@ class RegisterPet { }) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; - final String userUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; - final String cliID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; + final String devUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; + final String userUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; + final String cliID = + (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; const String atividade = 'cadastrarPet'; return ApiManager.instance.makeApiCall( @@ -298,9 +315,12 @@ class BuscaEnconcomendas { final String? adresseeType, final String? status, }) async { - final String devUUID = (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; - final String userUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; - final String cliID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; + final String devUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; + final String userUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; + final String cliID = + (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; const String atividade = 'getEncomendas'; final String baseUrl = PhpGroup.getBaseUrl(); @@ -342,9 +362,12 @@ class CancelaVisita { }) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; - final String userUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; - final String cliID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; + final String devUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; + final String userUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; + final String cliID = + (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; const String atividade = 'cancelaVisita'; return ApiManager.instance.makeApiCall( @@ -376,8 +399,10 @@ class CancelaVisita { class DeleteAccount { Future call() async { - final String devUUID = (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; - final String userUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; + final String devUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; + final String userUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; final String baseUrl = PhpGroup.getBaseUrl(); return ApiManager.instance.makeApiCall( @@ -408,9 +433,12 @@ class ChangePanic { }) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; - final String userUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; - final String cliID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; + final String devUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; + final String userUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; + final String cliID = + (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; const String atividade = 'updVisitado'; return ApiManager.instance.makeApiCall( @@ -444,9 +472,12 @@ class ChangePass { }) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; - final String userUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; - final String cliID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; + final String devUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; + final String userUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; + final String cliID = + (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; const String atividade = 'updVisitado'; return ApiManager.instance.makeApiCall( @@ -480,9 +511,12 @@ class RespondeVinculo { }) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; - final String userUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; - final String cliID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; + final String devUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; + final String userUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; + final String cliID = + (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; return ApiManager.instance.makeApiCall( callName: 'respondeVinculo', @@ -514,9 +548,12 @@ class ChangeNotifica { }) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; - final String userUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; - final String cliID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; + final String devUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; + final String userUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; + final String cliID = + (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; const String atividade = 'updVisitado'; return ApiManager.instance.makeApiCall( @@ -548,8 +585,10 @@ class UpdToken { Future call() async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; - final String userUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; + final String devUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; + final String userUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; final String token = (await StorageHelper.instance.get(SecureStorageKey.token.value, Storage.SecureStorage)) ?? ''; return ApiManager.instance.makeApiCall( @@ -577,11 +616,15 @@ class UpdToken { class LoginCall { Future call() async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; + final String devUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; final String email = (await StorageHelper.instance.get(SecureStorageKey.email.value, Storage.SecureStorage)) ?? ''; - final String password = (await StorageHelper.instance.get(SecureStorageKey.password.value, Storage.SecureStorage)) ?? ''; - final String type = (await StorageHelper.instance.get(SecureStorageKey.deviceType.value, Storage.SecureStorage)) ?? ''; - final String description = (await StorageHelper.instance.get(SecureStorageKey.deviceDescription.value, Storage.SecureStorage)) ?? ''; + final String password = + (await StorageHelper.instance.get(SecureStorageKey.password.value, Storage.SecureStorage)) ?? ''; + final String type = + (await StorageHelper.instance.get(SecureStorageKey.deviceType.value, Storage.SecureStorage)) ?? ''; + final String description = + (await StorageHelper.instance.get(SecureStorageKey.deviceDescription.value, Storage.SecureStorage)) ?? ''; final String token = await FirebaseMessagingService.getToken(); return ApiManager.instance.makeApiCall( @@ -656,9 +699,12 @@ class ChangePasswordCall { required final String psswd, }) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; - final String userUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; - final String cliID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; + final String devUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; + final String userUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; + final String cliID = + (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; return ApiManager.instance.makeApiCall( callName: 'changePassword', @@ -717,8 +763,10 @@ class GetLocalsCall { Future call() async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; - final String userUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; + final String devUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; + final String userUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; return ApiManager.instance.makeApiCall( callName: 'getLocals', @@ -757,9 +805,12 @@ class PostScheduleVisitorCall { }) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; - final String userUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; - final String cliID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; + final String devUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; + final String userUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; + final String cliID = + (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; const String atividade = 'putVisitante'; return ApiManager.instance.makeApiCall( @@ -812,9 +863,12 @@ class PostScheduleVisitCall { }) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; - final String userUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; - final String cliID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; + final String devUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; + final String userUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; + final String cliID = + (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; const String atividade = 'putVisita'; return ApiManager.instance.makeApiCall( @@ -866,9 +920,12 @@ class GetScheduleVisitCall { }) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; - final String userUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; - final String cliUUID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; + final String devUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; + final String userUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; + final String cliUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; const String atividade = 'getVisitas'; return ApiManager.instance.makeApiCall( @@ -1140,9 +1197,12 @@ class GetDadosCall { Future call() async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; - final String userUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; - final String cliUUID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; + final String devUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; + final String userUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; + final String cliUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; const String atividade = 'getDados'; return ApiManager.instance.makeApiCall( @@ -1373,9 +1433,12 @@ class GetVisitorByDocCall { }) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; - final String userUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; - final String cliID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; + final String devUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; + final String userUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; + final String cliID = + (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; const String atividade = 'getVisitante'; return ApiManager.instance.makeApiCall( @@ -1427,9 +1490,12 @@ class GetFotoVisitanteCall { }) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; - final String userUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; - final String cliID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; + final String devUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; + final String userUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; + final String cliID = + (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; const String atividade = 'getFotoVisitante'; return ApiManager.instance.makeApiCall( @@ -1466,9 +1532,12 @@ class PostProvVisitSchedulingCall { }) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; - final String userUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; - final String cliID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; + final String devUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; + final String userUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; + final String cliID = + (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; const String atividade = 'putAgendamentoProv'; return ApiManager.instance.makeApiCall( @@ -1515,9 +1584,12 @@ class GetVisitsCall { }) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; - final String userUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; - final String cliID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; + final String devUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; + final String userUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; + final String cliID = + (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; const String atividade = 'getVisitas'; return ApiManager.instance.makeApiCall( @@ -1778,9 +1850,12 @@ class DeleteVisitCall { }) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; - final String userUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; - final String cliID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; + final String devUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; + final String userUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; + final String cliID = + (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; const String atividade = 'cancelaVisita'; return ApiManager.instance.makeApiCall( @@ -1821,10 +1896,14 @@ class GetPessoasLocalCall { Future call() async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; - final String ownerUUID = (await StorageHelper.instance.get(SQLiteStorageKey.ownerUUID.value, Storage.SQLiteStorage)) ?? ''; - final String userUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; - final String cliUUID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; + final String devUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; + final String ownerUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.ownerUUID.value, Storage.SQLiteStorage)) ?? ''; + final String userUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; + final String cliUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; return ApiManager.instance.makeApiCall( callName: 'getPessoasLocal', @@ -1887,9 +1966,12 @@ class RespondeSolicitacaoCall { }) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; - final String userUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; - final String cliUUID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; + final String devUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; + final String userUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; + final String cliUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; const String atividade = 'respondeSolicitacao'; return ApiManager.instance.makeApiCall( @@ -1937,9 +2019,12 @@ class GetAccessCall { }) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; - final String userUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; - final String cliUUID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; + final String devUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; + final String userUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; + final String cliUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; const String atividade = 'getAcessos'; return ApiManager.instance.makeApiCall( @@ -2186,9 +2271,12 @@ class GetLiberationsCall { final StreamController controller = StreamController(); Future.microtask(() async { - final String devUUID = (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; - final String userUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; - final String cliUUID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; + final String devUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; + final String userUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; + final String cliUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; const String atividade = 'getSolicitacoes'; try { @@ -2378,9 +2466,12 @@ class GetMessagesCall { }) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; - final String userUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; - final String cliUUID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; + final String devUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; + final String userUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; + final String cliUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; const String atividade = 'getMensagens'; return ApiManager.instance.makeApiCall( diff --git a/lib/backend/notifications/notification_service.dart b/lib/backend/notifications/notification_service.dart index 5a25aa9f..9532c161 100644 --- a/lib/backend/notifications/notification_service.dart +++ b/lib/backend/notifications/notification_service.dart @@ -16,7 +16,7 @@ Future onMessageReceived(Map payload, String? extra, Stri final localId = jsonDecode(payload['local']!)['CLI_ID']; final cliUUID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; - + answersRequest( {required BuildContext context, required String? ref, @@ -270,7 +270,9 @@ class NotificationService { debug: kDebugMode); await AwesomeNotifications().isNotificationAllowed().then((isAllowed) async { - final bool requestOSnotification = (await StorageHelper.instance.get(SQLiteStorageKey.requestOSNotification.value, Storage.SQLiteStorage)) == 'true'; + final bool requestOSnotification = + (await StorageHelper.instance.get(SQLiteStorageKey.requestOSNotification.value, Storage.SQLiteStorage)) == + 'true'; if (requestOSnotification == false) { if (isAllowed == false) { diff --git a/lib/components/molecular_components/order_filter_modal/order_filter_modal_widget.dart b/lib/components/molecular_components/order_filter_modal/order_filter_modal_widget.dart index 4a08d4ad..ca85162f 100644 --- a/lib/components/molecular_components/order_filter_modal/order_filter_modal_widget.dart +++ b/lib/components/molecular_components/order_filter_modal/order_filter_modal_widget.dart @@ -27,11 +27,13 @@ class _OrderFilterModalWidgetState extends State { late Map selected; final List> adresseeTypeOptions = [ { - 'title': FFLocalizations.of(StorageHelper.instance.context!).getVariableText(enText: 'Resident', ptText: 'Morador'), + 'title': + FFLocalizations.of(StorageHelper.instance.context!).getVariableText(enText: 'Resident', ptText: 'Morador'), 'value': 'MOR' }, { - 'title': FFLocalizations.of(StorageHelper.instance.context!).getVariableText(enText: 'Property', ptText: 'Propriedade'), + 'title': FFLocalizations.of(StorageHelper.instance.context!) + .getVariableText(enText: 'Property', ptText: 'Propriedade'), 'value': 'PRO' }, ]; @@ -42,7 +44,8 @@ class _OrderFilterModalWidgetState extends State { 'value': 'notPickedUp' }, { - 'title': FFLocalizations.of(StorageHelper.instance.context!).getVariableText(ptText: 'Retirado', enText: 'Picked Up'), + 'title': + FFLocalizations.of(StorageHelper.instance.context!).getVariableText(ptText: 'Retirado', enText: 'Picked Up'), 'value': 'pickedUp' }, ]; diff --git a/lib/components/organism_components/bottom_arrow_linked_locals_component/bottom_arrow_linked_locals_component_widget.dart b/lib/components/organism_components/bottom_arrow_linked_locals_component/bottom_arrow_linked_locals_component_widget.dart index fdfe0d70..e6cfb14a 100644 --- a/lib/components/organism_components/bottom_arrow_linked_locals_component/bottom_arrow_linked_locals_component_widget.dart +++ b/lib/components/organism_components/bottom_arrow_linked_locals_component/bottom_arrow_linked_locals_component_widget.dart @@ -98,7 +98,8 @@ class _BottomArrowLinkedLocalsComponentWidgetState extends State getData() async { cliName = (await StorageHelper.instance.get(SQLiteStorageKey.clientName.value, Storage.SQLiteStorage)) ?? ''; - cliUUID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? '';; + cliUUID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; + ; setStateCallback?.call(); } diff --git a/lib/components/organism_components/menu_component/menu_component_model.dart b/lib/components/organism_components/menu_component/menu_component_model.dart index e5580a59..0238d1a0 100644 --- a/lib/components/organism_components/menu_component/menu_component_model.dart +++ b/lib/components/organism_components/menu_component/menu_component_model.dart @@ -60,7 +60,8 @@ class MenuComponentModel extends FlutterFlowModel { } Future openDeliverySchedule(BuildContext context) async { - final bool isProvisional = await StorageHelper.instance.get(SQLiteStorageKey.provisional.value, Storage.SQLiteStorage) == 'true'; + final bool isProvisional = + await StorageHelper.instance.get(SQLiteStorageKey.provisional.value, Storage.SQLiteStorage) == 'true'; if (isProvisional == true) { context.push( '/deliverySchedule', @@ -78,7 +79,8 @@ class MenuComponentModel extends FlutterFlowModel { } Future openProvisionalSchedule(BuildContext context) async { - final isProvisional = await StorageHelper.instance.get(SQLiteStorageKey.provisional.value, Storage.SQLiteStorage) == 'true'; + final isProvisional = + await StorageHelper.instance.get(SQLiteStorageKey.provisional.value, Storage.SQLiteStorage) == 'true'; if (isProvisional == true) { context.push( '/provisionalSchedule', @@ -205,7 +207,8 @@ class MenuComponentModel extends FlutterFlowModel { } Future openMyOrders(BuildContext context) async { - final isWpp = await StorageHelper.instance.get(SQLiteStorageKey.whatsapp.value, Storage.SQLiteStorage) == 'true';; + final isWpp = await StorageHelper.instance.get(SQLiteStorageKey.whatsapp.value, Storage.SQLiteStorage) == 'true'; + ; if (isWpp) { context.push( '/packageOrder', @@ -223,7 +226,8 @@ class MenuComponentModel extends FlutterFlowModel { } Future openReservations(BuildContext context) async { - final isWpp = await StorageHelper.instance.get(SQLiteStorageKey.whatsapp.value, Storage.SQLiteStorage) == 'true';; + final isWpp = await StorageHelper.instance.get(SQLiteStorageKey.whatsapp.value, Storage.SQLiteStorage) == 'true'; + ; if (isWpp) { context.push( '/reservation', @@ -339,7 +343,8 @@ class MenuComponentModel extends FlutterFlowModel { } Future openPetsRegister(BuildContext context) async { - bool isPet = await StorageHelper.instance.get(SQLiteStorageKey.pets.value, Storage.SQLiteStorage) == 'true';; + bool isPet = await StorageHelper.instance.get(SQLiteStorageKey.pets.value, Storage.SQLiteStorage) == 'true'; + ; if (isPet) { context.push( '/petsPage', diff --git a/lib/components/organism_components/up_arrow_linked_locals_component/up_arrow_linked_locals_component_model.dart b/lib/components/organism_components/up_arrow_linked_locals_component/up_arrow_linked_locals_component_model.dart index 9d584cab..999daa14 100644 --- a/lib/components/organism_components/up_arrow_linked_locals_component/up_arrow_linked_locals_component_model.dart +++ b/lib/components/organism_components/up_arrow_linked_locals_component/up_arrow_linked_locals_component_model.dart @@ -19,7 +19,7 @@ class UpArrowLinkedLocalsComponentModel extends FlutterFlowModel initDatabase() async { devUUID = (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; userUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; - cliUUID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? '';; + cliUUID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; + ; } @override diff --git a/lib/components/templates_components/provisional_schedule_template/provisional_schedule_template_model.dart b/lib/components/templates_components/provisional_schedule_template/provisional_schedule_template_model.dart index cd779405..c24edbfa 100644 --- a/lib/components/templates_components/provisional_schedule_template/provisional_schedule_template_model.dart +++ b/lib/components/templates_components/provisional_schedule_template/provisional_schedule_template_model.dart @@ -134,7 +134,8 @@ class ScheduleProvisionalVisitPageModel extends FlutterFlowModel init() async { devUUID = (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; userUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; - cliUUID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? '';; + cliUUID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; + ; cliName = (await StorageHelper.instance.get(SQLiteStorageKey.clientName.value, Storage.SQLiteStorage)) ?? ''; ownerUUID = (await StorageHelper.instance.get(SQLiteStorageKey.ownerUUID.value, Storage.SQLiteStorage)) ?? ''; setState?.call(); diff --git a/lib/components/templates_components/regisiter_vistor_template_component/regisiter_vistor_template_component_model.dart b/lib/components/templates_components/regisiter_vistor_template_component/regisiter_vistor_template_component_model.dart index 101f9f3b..45b5bdb9 100644 --- a/lib/components/templates_components/regisiter_vistor_template_component/regisiter_vistor_template_component_model.dart +++ b/lib/components/templates_components/regisiter_vistor_template_component/regisiter_vistor_template_component_model.dart @@ -131,7 +131,8 @@ class RegisiterVistorTemplateComponentModel extends FlutterFlowModel initializeDatabase() async { devUUID = (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; userUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; - cliUUID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? '';; + cliUUID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; + ; } @override diff --git a/lib/components/templates_components/view_visit_detail/view_visit_detail_model.dart b/lib/components/templates_components/view_visit_detail/view_visit_detail_model.dart index 610f832c..95489ed6 100644 --- a/lib/components/templates_components/view_visit_detail/view_visit_detail_model.dart +++ b/lib/components/templates_components/view_visit_detail/view_visit_detail_model.dart @@ -39,7 +39,8 @@ class ViewVisitDetailModel extends FlutterFlowModel { Future initializeDatabase() async { devUUID = (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; userUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; - cliUUID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? '';; + cliUUID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; + ; } @override diff --git a/lib/components/templates_components/visitor_search_modal_template_component/visitor_search_modal_template_component_model.dart b/lib/components/templates_components/visitor_search_modal_template_component/visitor_search_modal_template_component_model.dart index 9e9b85c4..252130d7 100644 --- a/lib/components/templates_components/visitor_search_modal_template_component/visitor_search_modal_template_component_model.dart +++ b/lib/components/templates_components/visitor_search_modal_template_component/visitor_search_modal_template_component_model.dart @@ -37,7 +37,8 @@ class VisitorSearchModalTemplateComponentModel extends FlutterFlowModel initDatabase() async { devUUID = (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; userUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; - cliUUID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? '';; + cliUUID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; + ; } @override diff --git a/lib/flutter_flow/nav/nav.dart b/lib/flutter_flow/nav/nav.dart index 66631037..857dd4d1 100644 --- a/lib/flutter_flow/nav/nav.dart +++ b/lib/flutter_flow/nav/nav.dart @@ -78,31 +78,39 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) { name: '_initialize', path: '/', builder: (context, _) { - return FutureBuilder( + return FutureBuilder( future: () async { - final bool isLogged = await StorageHelper.instance.get(SecureStorageKey.isLogged.value, Storage.SecureStorage) == 'true'; - final bool haveLocal = await StorageHelper.instance.get(SecureStorageKey.haveLocal.value, Storage.SecureStorage) == 'true'; - final bool haveUserUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage))?.isNotEmpty ?? false; - final bool haveDevUUID = (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage))?.isNotEmpty ?? false; + final bool isLogged = + await StorageHelper.instance.get(SecureStorageKey.isLogged.value, Storage.SecureStorage) == 'true'; + final bool haveLocal = + await StorageHelper.instance.get(SecureStorageKey.haveLocal.value, Storage.SecureStorage) == 'true'; + final bool haveUserUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) + ?.isNotEmpty ?? + false; + final bool haveDevUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) + ?.isNotEmpty ?? + false; if (isLogged && haveDevUUID && haveUserUUID) { - return haveLocal ? const HomePageWidget() : const ReceptionPageWidget(); + return haveLocal ? const HomePageWidget() : const ReceptionPageWidget(); } else { - return const WelcomePageWidget(); + return const WelcomePageWidget(); } }(), builder: (context, snapshot) { if (snapshot.connectionState == ConnectionState.waiting) { - return const Center(child: CircularProgressIndicator()); + return const Center(child: CircularProgressIndicator()); } else if (snapshot.hasError) { - DialogUtil.error(context, snapshot.error.toString()); - return const WelcomePageWidget(); + DialogUtil.error(context, snapshot.error.toString()); + return const WelcomePageWidget(); } else { - return snapshot.data!; + return snapshot.data!; } }, - ); - }, + ); + }, ), FFRoute( name: 'forgotPassword', diff --git a/lib/pages/fast_pass_page/fast_pass_page_widget.dart b/lib/pages/fast_pass_page/fast_pass_page_widget.dart index bd7aa6e6..9519242f 100644 --- a/lib/pages/fast_pass_page/fast_pass_page_widget.dart +++ b/lib/pages/fast_pass_page/fast_pass_page_widget.dart @@ -24,10 +24,14 @@ class _FastPassPageWidgetState extends State { Future> initVariables() async { final email = (await StorageHelper.instance.get(hub.SecureStorageKey.email.value, hub.Storage.SecureStorage)) ?? ''; - final name = (await StorageHelper.instance.get(hub.SQLiteStorageKey.userName.value, hub.Storage.SQLiteStorage)) ?? ''; - final devUUID = (await StorageHelper.instance.get(hub.SQLiteStorageKey.devUUID.value, hub.Storage.SQLiteStorage)) ?? ''; - final userUUID = (await StorageHelper.instance.get(hub.SQLiteStorageKey.userUUID.value, hub.Storage.SQLiteStorage)) ?? ''; - final cliUUID = (await StorageHelper.instance.get(hub.SQLiteStorageKey.clientUUID.value, hub.Storage.SQLiteStorage)) ?? ''; + final name = + (await StorageHelper.instance.get(hub.SQLiteStorageKey.userName.value, hub.Storage.SQLiteStorage)) ?? ''; + final devUUID = + (await StorageHelper.instance.get(hub.SQLiteStorageKey.devUUID.value, hub.Storage.SQLiteStorage)) ?? ''; + final userUUID = + (await StorageHelper.instance.get(hub.SQLiteStorageKey.userUUID.value, hub.Storage.SQLiteStorage)) ?? ''; + final cliUUID = + (await StorageHelper.instance.get(hub.SQLiteStorageKey.clientUUID.value, hub.Storage.SQLiteStorage)) ?? ''; const createdAt = '0000-00-00 00:00:00'; final url = 'https://hub.freaccess.com.br/hub/fast-pass/$cliUUID'; final freUserData = diff --git a/lib/pages/package_order_page/package_order_page.dart b/lib/pages/package_order_page/package_order_page.dart index c5c78c66..7c4dc226 100644 --- a/lib/pages/package_order_page/package_order_page.dart +++ b/lib/pages/package_order_page/package_order_page.dart @@ -216,7 +216,6 @@ class _PackageOrderPage extends State { } PreferredSizeWidget _appBar(BuildContext context) { - return AppBar( backgroundColor: FlutterFlowTheme.of(context).primaryBackground, automaticallyImplyLeading: false, diff --git a/lib/pages/pets_page/pets_history_screen.dart b/lib/pages/pets_page/pets_history_screen.dart index 1dc50ef2..03b421dd 100644 --- a/lib/pages/pets_page/pets_history_screen.dart +++ b/lib/pages/pets_page/pets_history_screen.dart @@ -233,9 +233,12 @@ class _PetsHistoryScreenState extends State with TickerProvid ], onTapCardItemAction: () async { final devUUID = (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; - final userUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; - final cliUUID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; - final cliName = (await StorageHelper.instance.get(SQLiteStorageKey.clientName.value, Storage.SQLiteStorage)) ?? ''; + final userUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; + final cliUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; + final cliName = + (await StorageHelper.instance.get(SQLiteStorageKey.clientName.value, Storage.SQLiteStorage)) ?? ''; await showDialog( useSafeArea: true, context: context, diff --git a/lib/pages/pets_page/pets_page_model.dart b/lib/pages/pets_page/pets_page_model.dart index 16981f6c..d4c1cab6 100644 --- a/lib/pages/pets_page/pets_page_model.dart +++ b/lib/pages/pets_page/pets_page_model.dart @@ -105,7 +105,8 @@ class PetsPageModel extends FlutterFlowModel { devUUID = (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; userUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; cliUUID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; - petAmountRegister = (await StorageHelper.instance.get(SQLiteStorageKey.petAmount.value, Storage.SQLiteStorage)) ?? ''; + petAmountRegister = + (await StorageHelper.instance.get(SQLiteStorageKey.petAmount.value, Storage.SQLiteStorage)) ?? ''; safeSetState?.call(); } diff --git a/lib/pages/preferences_settings_page/preferences_settings_model.dart b/lib/pages/preferences_settings_page/preferences_settings_model.dart index be375d53..44eca848 100644 --- a/lib/pages/preferences_settings_page/preferences_settings_model.dart +++ b/lib/pages/preferences_settings_page/preferences_settings_model.dart @@ -16,7 +16,6 @@ import '../../shared/utils/snackbar_util.dart'; class PreferencesPageModel with ChangeNotifier { final unfocusNode = FocusNode(); - late bool isFingerprint = false; late bool isPerson = false; late bool isNotify = false; @@ -24,7 +23,8 @@ class PreferencesPageModel with ChangeNotifier { late bool isPanic = false; Future _initialize() async { - isFingerprint = await StorageHelper.instance.get(SQLiteStorageKey.fingerprint.value, Storage.SQLiteStorage) == 'true'; + isFingerprint = + await StorageHelper.instance.get(SQLiteStorageKey.fingerprint.value, Storage.SQLiteStorage) == 'true'; isPerson = await StorageHelper.instance.get(SQLiteStorageKey.person.value, Storage.SQLiteStorage) == 'true'; isNotify = await StorageHelper.instance.get(SQLiteStorageKey.notify.value, Storage.SQLiteStorage) == 'true'; isAccess = await StorageHelper.instance.get(SQLiteStorageKey.access.value, Storage.SQLiteStorage) == 'true'; @@ -37,7 +37,8 @@ class PreferencesPageModel with ChangeNotifier { } Future enablePerson(BuildContext context) async { - final String userDevUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userDevUUID.value, Storage.SQLiteStorage)) ?? ''; + final String userDevUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.userDevUUID.value, Storage.SQLiteStorage)) ?? ''; notifyListeners(); Share.share( FFLocalizations.of(context).getVariableText( @@ -56,37 +57,41 @@ class PreferencesPageModel with ChangeNotifier { enText: 'Are you sure you want to change your notification?', ptText: 'Tem certeza que deseja alterar sua notificação?', ); - onConfirm() async { String content; String value = !isNotify ? 'N' : 'S'; - await PhpGroup.changeNotifica.call(notifica: value).then((value) async { - if (value.jsonBody['error'] == false) { - await StorageHelper.instance.set(SQLiteStorageKey.notify.value, isNotify ? 'false' : 'true',Storage.SQLiteStorage); - content = FFLocalizations.of(context).getVariableText( - enText: 'Notification changed successfully', - ptText: 'Notificação alterada com sucesso', - ); - notifyListeners(); - SnackBarUtil.showSnackBar(context, content); - } else { - content = FFLocalizations.of(context).getVariableText( - enText: 'Error changing notification', - ptText: 'Erro ao alterar notificação', - ); - SnackBarUtil.showSnackBar(context, content, isError: true); - } - }).catchError((e, s) { - log('toggleNotify', error: e, stackTrace: s); - content = FFLocalizations.of(context).getVariableText( - enText: 'Error changing notification', - ptText: 'Erro ao alterar notificação', - ); - SnackBarUtil.showSnackBar(context, content, isError: true); - }) - .then((_) async => isNotify = await StorageHelper.instance.get(SQLiteStorageKey.notify.value, Storage.SQLiteStorage) == 'true') - .whenComplete(() => notifyListeners()); + await PhpGroup.changeNotifica + .call(notifica: value) + .then((value) async { + if (value.jsonBody['error'] == false) { + await StorageHelper.instance + .set(SQLiteStorageKey.notify.value, isNotify ? 'false' : 'true', Storage.SQLiteStorage); + content = FFLocalizations.of(context).getVariableText( + enText: 'Notification changed successfully', + ptText: 'Notificação alterada com sucesso', + ); + notifyListeners(); + SnackBarUtil.showSnackBar(context, content); + } else { + content = FFLocalizations.of(context).getVariableText( + enText: 'Error changing notification', + ptText: 'Erro ao alterar notificação', + ); + SnackBarUtil.showSnackBar(context, content, isError: true); + } + }) + .catchError((e, s) { + log('toggleNotify', error: e, stackTrace: s); + content = FFLocalizations.of(context).getVariableText( + enText: 'Error changing notification', + ptText: 'Erro ao alterar notificação', + ); + SnackBarUtil.showSnackBar(context, content, isError: true); + }) + .then((_) async => isNotify = + await StorageHelper.instance.get(SQLiteStorageKey.notify.value, Storage.SQLiteStorage) == 'true') + .whenComplete(() => notifyListeners()); context.pop(); } @@ -96,32 +101,37 @@ class PreferencesPageModel with ChangeNotifier { Future toggleAccess(BuildContext context) async { onChange(String key) async { await StorageHelper.instance.set(SecureStorageKey.accessPass.value, key, Storage.SecureStorage); - await PhpGroup.changePass.call(newSenha: key).then((value) async { - final String content; - if (jsonDecode(value.jsonBody['error'].toString()) == false) { - await StorageHelper.instance.set(SQLiteStorageKey.access.value, isAccess ? 'false' : 'true', Storage.SQLiteStorage); - notifyListeners(); - content = FFLocalizations.of(context).getVariableText( - enText: 'Access pass changed successfully', - ptText: 'Senha de acesso alterada com sucesso', - ); - SnackBarUtil.showSnackBar(context, content); - } else { - content = FFLocalizations.of(context).getVariableText( - ptText: 'Erro ao alterar senha de acesso', - enText: 'Error changing access pass', - ); - SnackBarUtil.showSnackBar(context, content, isError: true); - } - }).catchError((e, s) { - final String content = FFLocalizations.of(context).getVariableText( - ptText: 'Erro ao alterar senha de acesso', - enText: 'Error changing access pass', - ); - SnackBarUtil.showSnackBar(context, content, isError: true); - }) - .then((_) async => isAccess = await StorageHelper.instance.get(SQLiteStorageKey.access.value, Storage.SQLiteStorage) == 'true') - .whenComplete(() => notifyListeners()); + await PhpGroup.changePass + .call(newSenha: key) + .then((value) async { + final String content; + if (jsonDecode(value.jsonBody['error'].toString()) == false) { + await StorageHelper.instance + .set(SQLiteStorageKey.access.value, isAccess ? 'false' : 'true', Storage.SQLiteStorage); + notifyListeners(); + content = FFLocalizations.of(context).getVariableText( + enText: 'Access pass changed successfully', + ptText: 'Senha de acesso alterada com sucesso', + ); + SnackBarUtil.showSnackBar(context, content); + } else { + content = FFLocalizations.of(context).getVariableText( + ptText: 'Erro ao alterar senha de acesso', + enText: 'Error changing access pass', + ); + SnackBarUtil.showSnackBar(context, content, isError: true); + } + }) + .catchError((e, s) { + final String content = FFLocalizations.of(context).getVariableText( + ptText: 'Erro ao alterar senha de acesso', + enText: 'Error changing access pass', + ); + SnackBarUtil.showSnackBar(context, content, isError: true); + }) + .then((_) async => isAccess = + await StorageHelper.instance.get(SQLiteStorageKey.access.value, Storage.SQLiteStorage) == 'true') + .whenComplete(() => notifyListeners()); } _showPassKey(context, onChange); @@ -133,31 +143,34 @@ class PreferencesPageModel with ChangeNotifier { await PhpGroup.changePanic .call(newSenhaPanico: key) .then((value) async { - final String content; - if (jsonDecode(value.jsonBody['error'].toString()) == false) { - await StorageHelper.instance.set(SQLiteStorageKey.panic.value, isPanic ? 'false' : 'true', Storage.SQLiteStorage); - notifyListeners(); - content = FFLocalizations.of(context).getVariableText( - enText: 'Panic password changed successfully', - ptText: 'Senha de pânico alterada com sucesso', - ); - SnackBarUtil.showSnackBar(context, content); - } else { - content = FFLocalizations.of(context).getVariableText( - ptText: 'Erro ao alterar senha de pânico', - enText: 'Error changing panic password', - ); - SnackBarUtil.showSnackBar(context, content, isError: true); - } - }).catchError((e, s) { - final String content = FFLocalizations.of(context).getVariableText( - ptText: 'Erro ao alterar senha de pânico', - enText: 'Error changing panic password', - ); - SnackBarUtil.showSnackBar(context, content, isError: true); - }) - .then((_) async => isPanic = await StorageHelper.instance.get(SQLiteStorageKey.panic.value, Storage.SQLiteStorage) == 'true') - .whenComplete(() => notifyListeners()); + final String content; + if (jsonDecode(value.jsonBody['error'].toString()) == false) { + await StorageHelper.instance + .set(SQLiteStorageKey.panic.value, isPanic ? 'false' : 'true', Storage.SQLiteStorage); + notifyListeners(); + content = FFLocalizations.of(context).getVariableText( + enText: 'Panic password changed successfully', + ptText: 'Senha de pânico alterada com sucesso', + ); + SnackBarUtil.showSnackBar(context, content); + } else { + content = FFLocalizations.of(context).getVariableText( + ptText: 'Erro ao alterar senha de pânico', + enText: 'Error changing panic password', + ); + SnackBarUtil.showSnackBar(context, content, isError: true); + } + }) + .catchError((e, s) { + final String content = FFLocalizations.of(context).getVariableText( + ptText: 'Erro ao alterar senha de pânico', + enText: 'Error changing panic password', + ); + SnackBarUtil.showSnackBar(context, content, isError: true); + }) + .then((_) async => + isPanic = await StorageHelper.instance.get(SQLiteStorageKey.panic.value, Storage.SQLiteStorage) == 'true') + .whenComplete(() => notifyListeners()); } _showPassKey(context, onChange); @@ -169,15 +182,15 @@ class PreferencesPageModel with ChangeNotifier { ptText: 'Impressão digital alterada com sucesso', ); - onChange(String? key) async { isFingerprint = !isFingerprint; await StorageHelper.instance.set(SecureStorageKey.fingerprintPass.value, key ?? '', Storage.SecureStorage); - await StorageHelper.instance.set(SQLiteStorageKey.fingerprint.value, isFingerprint ? 'true' : 'false', Storage.SQLiteStorage); + await StorageHelper.instance + .set(SQLiteStorageKey.fingerprint.value, isFingerprint ? 'true' : 'false', Storage.SQLiteStorage); notifyListeners(); SnackBarUtil.showSnackBar(context, content); - isFingerprint = await StorageHelper.instance.get(SQLiteStorageKey.fingerprint.value, Storage.SQLiteStorage) == 'true'; - + isFingerprint = + await StorageHelper.instance.get(SQLiteStorageKey.fingerprint.value, Storage.SQLiteStorage) == 'true'; } isFingerprint ? onChange(null) : _showPassKey(context, onChange); @@ -249,7 +262,4 @@ class PreferencesPageModel with ChangeNotifier { SnackBarUtil.showSnackBar(context, content, isError: true); }).whenComplete(() => notifyListeners()); } - - - } diff --git a/lib/pages/preferences_settings_page/preferences_settings_widget.dart b/lib/pages/preferences_settings_page/preferences_settings_widget.dart index f90314d2..88a978a5 100644 --- a/lib/pages/preferences_settings_page/preferences_settings_widget.dart +++ b/lib/pages/preferences_settings_page/preferences_settings_widget.dart @@ -1,4 +1,3 @@ - import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:hub/flutter_flow/flutter_flow_icon_button.dart'; @@ -17,7 +16,6 @@ class PreferencesPageWidget extends StatefulWidget { } class _PreferencesPageWidgetState extends State { - @override void initState() { super.initState(); diff --git a/lib/pages/qr_code_page/qr_code_page_model.dart b/lib/pages/qr_code_page/qr_code_page_model.dart index 8a23c908..d52488dd 100644 --- a/lib/pages/qr_code_page/qr_code_page_model.dart +++ b/lib/pages/qr_code_page/qr_code_page_model.dart @@ -11,8 +11,6 @@ import 'package:qr_flutter/qr_flutter.dart'; class QrCodePageModel extends FlutterFlowModel { /// Local state fields for this page. - - String? key; DateTime? time; @@ -31,7 +29,8 @@ class QrCodePageModel extends FlutterFlowModel { } Future initVariable() async { - isFingerprint = await StorageHelper.instance.get(SQLiteStorageKey.fingerprint.value, Storage.SQLiteStorage) == 'true'; + isFingerprint = + await StorageHelper.instance.get(SQLiteStorageKey.fingerprint.value, Storage.SQLiteStorage) == 'true'; userDevUUID = await StorageHelper.instance.get(SQLiteStorageKey.userDevUUID.value, Storage.SQLiteStorage) ?? ''; safeSetState?.call(); } @@ -83,7 +82,6 @@ class QrCodePageModel extends FlutterFlowModel { packet.add(check); } - return Uint8List.fromList(packet); } diff --git a/lib/pages/qr_code_page/qr_code_page_widget.dart b/lib/pages/qr_code_page/qr_code_page_widget.dart index 83b7eff6..d4723892 100644 --- a/lib/pages/qr_code_page/qr_code_page_widget.dart +++ b/lib/pages/qr_code_page/qr_code_page_widget.dart @@ -71,7 +71,6 @@ class _QrCodePageWidgetState extends State with TickerProvider animationsMap.values.where((anim) => anim.trigger == AnimationTrigger.onActionTrigger || !anim.applyInitialState), this, ); - } @override @@ -127,7 +126,7 @@ class _QrCodePageWidgetState extends State with TickerProvider alignment: const AlignmentDirectional(0.0, 0.0), child: InkWell( onTap: () async { - _resetAnimationAndToggleAccess(); + _resetAnimationAndToggleAccess(); log('isFingerprint: ${_model.isFingerprint}'); _model.isFingerprint ? await _showBiometricsAuth(context) : await _showQrCodeBottomSheet(context); }, @@ -325,20 +324,21 @@ class _QrCodePageWidgetState extends State with TickerProvider Future _showBiometricsAuth(BuildContext context) async { await BiometricHelper.checkBiometrics() .then((value) async => await BiometricHelper.authenticateBiometric().then((value) async { - final key = await StorageHelper.instance.get(SecureStorageKey.fingerprintPass.value, Storage.SecureStorage) ?? ''; - safeSetState(() { - if (animationsMap['barcodeOnActionTriggerAnimation'] != null) { - animationsMap['barcodeOnActionTriggerAnimation']!.controller.stop(); - animationsMap['barcodeOnActionTriggerAnimation']!.controller.reverse(); - } - _model.isAccess = !_model.isAccess; - _model.key = key; - }); + final key = + await StorageHelper.instance.get(SecureStorageKey.fingerprintPass.value, Storage.SecureStorage) ?? ''; + safeSetState(() { + if (animationsMap['barcodeOnActionTriggerAnimation'] != null) { + animationsMap['barcodeOnActionTriggerAnimation']!.controller.stop(); + animationsMap['barcodeOnActionTriggerAnimation']!.controller.reverse(); + } + _model.isAccess = !_model.isAccess; + _model.key = key; + }); })) .onError((error, stackTrace) { - log('Error', error: error, stackTrace: stackTrace); - if (mounted) _showQrCodeBottomSheet(context); - }); + log('Error', error: error, stackTrace: stackTrace); + if (mounted) _showQrCodeBottomSheet(context); + }); } Future _showQrCodeBottomSheet(BuildContext context) async { @@ -369,7 +369,7 @@ class _QrCodePageWidgetState extends State with TickerProvider ), ); }, - ).catchError((error) => safeSetState(() => _resetAnimationAndToggleAccess())); + ).catchError((error) => safeSetState(() => _resetAnimationAndToggleAccess())); unawaited( () async { await _model.qrCodeEncoder(context, key: _model.key); diff --git a/lib/pages/reception_page/reception_page_model.dart b/lib/pages/reception_page/reception_page_model.dart index 9cc67c08..02823e9f 100644 --- a/lib/pages/reception_page/reception_page_model.dart +++ b/lib/pages/reception_page/reception_page_model.dart @@ -6,7 +6,8 @@ import 'package:share_plus/share_plus.dart'; class ReceptionPageModel with ChangeNotifier { Future getIdenfifier(BuildContext context) async { - final String userDevUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userDevUUID.value, Storage.SQLiteStorage)) ?? ''; + final String userDevUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.userDevUUID.value, Storage.SQLiteStorage)) ?? ''; notifyListeners(); Share.share( diff --git a/lib/pages/reservation_page/reservation_page_widget.dart b/lib/pages/reservation_page/reservation_page_widget.dart index 3327a521..e6474a14 100644 --- a/lib/pages/reservation_page/reservation_page_widget.dart +++ b/lib/pages/reservation_page/reservation_page_widget.dart @@ -23,10 +23,14 @@ class _ReservationPageWidgetState extends State { Future> initVariables() async { final email = (await StorageHelper.instance.get(hub.SecureStorageKey.email.value, hub.Storage.SecureStorage)) ?? ''; - final name = (await StorageHelper.instance.get(hub.SQLiteStorageKey.userName.value, hub.Storage.SQLiteStorage)) ?? ''; - final devUUID = (await StorageHelper.instance.get(hub.SQLiteStorageKey.devUUID.value, hub.Storage.SQLiteStorage)) ?? ''; - final userUUID = (await StorageHelper.instance.get(hub.SQLiteStorageKey.userUUID.value, hub.Storage.SQLiteStorage)) ?? ''; - final clientId = (await StorageHelper.instance.get(hub.SQLiteStorageKey.clientUUID.value, hub.Storage.SQLiteStorage)) ?? ''; + final name = + (await StorageHelper.instance.get(hub.SQLiteStorageKey.userName.value, hub.Storage.SQLiteStorage)) ?? ''; + final devUUID = + (await StorageHelper.instance.get(hub.SQLiteStorageKey.devUUID.value, hub.Storage.SQLiteStorage)) ?? ''; + final userUUID = + (await StorageHelper.instance.get(hub.SQLiteStorageKey.userUUID.value, hub.Storage.SQLiteStorage)) ?? ''; + final clientId = + (await StorageHelper.instance.get(hub.SQLiteStorageKey.clientUUID.value, hub.Storage.SQLiteStorage)) ?? ''; const createdAt = '0000-00-00 00:00:00'; final url = 'https://hub.freaccess.com.br/hub/reservation/$clientId'; diff --git a/lib/pages/schedule_complete_visit_page/visit_history_page_widget.dart b/lib/pages/schedule_complete_visit_page/visit_history_page_widget.dart index 35d2aada..ba38941e 100644 --- a/lib/pages/schedule_complete_visit_page/visit_history_page_widget.dart +++ b/lib/pages/schedule_complete_visit_page/visit_history_page_widget.dart @@ -234,9 +234,12 @@ class _VisitHistoryWidgetState extends State with TickerProv ], onTapCardItemAction: () async { final devUUID = (await StorageHelper.instance.get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? ''; - final userUUID = (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; - final cliUUID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; - final cliName = (await StorageHelper.instance.get(SQLiteStorageKey.clientName.value, Storage.SQLiteStorage)) ?? ''; + final userUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? ''; + final cliUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; + final cliName = + (await StorageHelper.instance.get(SQLiteStorageKey.clientName.value, Storage.SQLiteStorage)) ?? ''; await showDialog( useSafeArea: true, diff --git a/lib/shared/helpers/base_storage.dart b/lib/shared/helpers/base_storage.dart index 37530a13..11bc2509 100644 --- a/lib/shared/helpers/base_storage.dart +++ b/lib/shared/helpers/base_storage.dart @@ -1,5 +1,4 @@ abstract class BaseStorage { - Future init(); Future set(String key, String value); @@ -141,4 +140,4 @@ extension SQLIteStorageKeyExtension on SQLiteStorageKey { return ''; } } -} \ No newline at end of file +} diff --git a/lib/shared/helpers/secure_storage.dart b/lib/shared/helpers/secure_storage.dart index 9f3dd979..24181fc9 100644 --- a/lib/shared/helpers/secure_storage.dart +++ b/lib/shared/helpers/secure_storage.dart @@ -3,7 +3,6 @@ import 'package:flutter_secure_storage/flutter_secure_storage.dart'; import 'package:hub/shared/helpers/base_storage.dart'; class SecureStorage extends ChangeNotifier implements BaseStorage { - SecureStorage._(); static final SecureStorage instance = SecureStorage._(); @@ -37,5 +36,4 @@ class SecureStorage extends ChangeNotifier implements BaseStorage { await _secureStorage.deleteAll(); notifyListeners(); } - -} \ No newline at end of file +} diff --git a/lib/shared/helpers/shared_preferences_storage.dart b/lib/shared/helpers/shared_preferences_storage.dart index 9e02ad33..0dd19da1 100644 --- a/lib/shared/helpers/shared_preferences_storage.dart +++ b/lib/shared/helpers/shared_preferences_storage.dart @@ -3,7 +3,6 @@ import 'package:hub/shared/helpers/base_storage.dart'; import 'package:shared_preferences/shared_preferences.dart'; class SharedPreferencesStorage extends ChangeNotifier implements BaseStorage { - SharedPreferencesStorage._(); static final SharedPreferencesStorage instance = SharedPreferencesStorage._(); @@ -37,5 +36,4 @@ class SharedPreferencesStorage extends ChangeNotifier implements BaseStorage { await _prefs.clear(); notifyListeners(); } - -} \ No newline at end of file +} diff --git a/lib/shared/helpers/sqlite_storage.dart b/lib/shared/helpers/sqlite_storage.dart index f8d870bd..6f387759 100644 --- a/lib/shared/helpers/sqlite_storage.dart +++ b/lib/shared/helpers/sqlite_storage.dart @@ -1,4 +1,3 @@ - import 'package:flutter/material.dart'; import 'package:hub/shared/helpers/base_storage.dart'; import 'package:sqflite/sqflite.dart'; @@ -6,7 +5,6 @@ import 'package:sqflite/sqlite_api.dart'; import 'package:path/path.dart'; class SQLiteStorage extends ChangeNotifier implements BaseStorage { - SQLiteStorage._(); final String _dbName = 'database.db'; @@ -62,26 +60,26 @@ class SQLiteStorage extends ChangeNotifier implements BaseStorage { '''; List> get _localVariables => [ - {'key': SQLiteStorageKey.devUUID.value, 'value': '', 'type': 'user'}, - {'key': SQLiteStorageKey.userUUID.value, 'value': '', 'type': 'user'}, - {'key': SQLiteStorageKey.userDevUUID.value, 'value': '', 'type': 'user'}, - {'key': SQLiteStorageKey.status.value, 'value': '', 'type': 'user'}, - {'key': SQLiteStorageKey.userName.value, 'value': '', 'type': 'user'}, - {'key': SQLiteStorageKey.clientUUID.value, 'value': '', 'type': 'local'}, - {'key': SQLiteStorageKey.ownerUUID.value, 'value': '', 'type': 'local'}, - {'key': SQLiteStorageKey.clientName.value, 'value': '', 'type': 'local'}, - {'key': SQLiteStorageKey.whatsapp.value, 'value': 'false', 'type': 'util'}, - {'key': SQLiteStorageKey.provisional.value, 'value': 'false', 'type': 'util'}, - {'key': SQLiteStorageKey.pets.value, 'value': 'false', 'type': 'util'}, - {'key': SQLiteStorageKey.local.value, 'value': 'false', 'type': 'util'}, - {'key': SQLiteStorageKey.notify.value, 'value': 'false', 'type': 'util'}, - {'key': SQLiteStorageKey.fingerprint.value, 'value': 'false', 'type': 'util'}, - {'key': SQLiteStorageKey.access.value, 'value': 'false', 'type': 'util'}, - {'key': SQLiteStorageKey.panic.value, 'value': 'false', 'type': 'util'}, - {'key': SQLiteStorageKey.person.value, 'value': 'false', 'type': 'util'}, - {'key': SQLiteStorageKey.requestOSNotification.value, 'value': 'false', 'type': 'util'}, - {'key': SQLiteStorageKey.petAmount.value, 'value': '', 'type': 'local'}, - ]; + {'key': SQLiteStorageKey.devUUID.value, 'value': '', 'type': 'user'}, + {'key': SQLiteStorageKey.userUUID.value, 'value': '', 'type': 'user'}, + {'key': SQLiteStorageKey.userDevUUID.value, 'value': '', 'type': 'user'}, + {'key': SQLiteStorageKey.status.value, 'value': '', 'type': 'user'}, + {'key': SQLiteStorageKey.userName.value, 'value': '', 'type': 'user'}, + {'key': SQLiteStorageKey.clientUUID.value, 'value': '', 'type': 'local'}, + {'key': SQLiteStorageKey.ownerUUID.value, 'value': '', 'type': 'local'}, + {'key': SQLiteStorageKey.clientName.value, 'value': '', 'type': 'local'}, + {'key': SQLiteStorageKey.whatsapp.value, 'value': 'false', 'type': 'util'}, + {'key': SQLiteStorageKey.provisional.value, 'value': 'false', 'type': 'util'}, + {'key': SQLiteStorageKey.pets.value, 'value': 'false', 'type': 'util'}, + {'key': SQLiteStorageKey.local.value, 'value': 'false', 'type': 'util'}, + {'key': SQLiteStorageKey.notify.value, 'value': 'false', 'type': 'util'}, + {'key': SQLiteStorageKey.fingerprint.value, 'value': 'false', 'type': 'util'}, + {'key': SQLiteStorageKey.access.value, 'value': 'false', 'type': 'util'}, + {'key': SQLiteStorageKey.panic.value, 'value': 'false', 'type': 'util'}, + {'key': SQLiteStorageKey.person.value, 'value': 'false', 'type': 'util'}, + {'key': SQLiteStorageKey.requestOSNotification.value, 'value': 'false', 'type': 'util'}, + {'key': SQLiteStorageKey.petAmount.value, 'value': '', 'type': 'local'}, + ]; @override Future get(String key) async { @@ -107,8 +105,7 @@ class SQLiteStorage extends ChangeNotifier implements BaseStorage { 'resolvedAt': date, 'createdAt': date, }, - conflictAlgorithm: ConflictAlgorithm.replace - ); + conflictAlgorithm: ConflictAlgorithm.replace); notifyListeners(); } @@ -128,5 +125,4 @@ class SQLiteStorage extends ChangeNotifier implements BaseStorage { await _database.delete('keychain'); notifyListeners(); } - -} \ No newline at end of file +} diff --git a/lib/shared/helpers/storage_helper.dart b/lib/shared/helpers/storage_helper.dart index 5339fc0d..e93cfbdf 100644 --- a/lib/shared/helpers/storage_helper.dart +++ b/lib/shared/helpers/storage_helper.dart @@ -77,5 +77,4 @@ class StorageHelper { return SQLiteStorage.instance.clearAll(); } } - -} \ No newline at end of file +} diff --git a/lib/shared/services/authentication/authentication_service.dart b/lib/shared/services/authentication/authentication_service.dart index 866a102f..85770e80 100644 --- a/lib/shared/services/authentication/authentication_service.dart +++ b/lib/shared/services/authentication/authentication_service.dart @@ -44,7 +44,8 @@ class AuthenticationService { final ApiCallResponse? response; final LoginCall callback = PhpGroup.loginCall; String deviceDescription = randomString(10, 10, true, false, false); - await StorageHelper.instance.set(SecureStorageKey.deviceDescription.value, deviceDescription, Storage.SecureStorage); + await StorageHelper.instance + .set(SecureStorageKey.deviceDescription.value, deviceDescription, Storage.SecureStorage); final String? devUUID; final String userUUID; diff --git a/lib/shared/services/localization/localization_service.dart b/lib/shared/services/localization/localization_service.dart index 86ac7a9a..1e38d0f6 100644 --- a/lib/shared/services/localization/localization_service.dart +++ b/lib/shared/services/localization/localization_service.dart @@ -207,7 +207,8 @@ class LocalizationService { log('() => isUnavailable'); try { await StorageHelper.instance.set(SQLiteStorageKey.clientUUID.value, locals[0]['CLI_ID'], Storage.SQLiteStorage); - await StorageHelper.instance.set(SQLiteStorageKey.ownerUUID.value, locals[0]['CLU_OWNER_ID'], Storage.SQLiteStorage); + await StorageHelper.instance + .set(SQLiteStorageKey.ownerUUID.value, locals[0]['CLU_OWNER_ID'], Storage.SQLiteStorage); await StorageHelper.instance.set(SQLiteStorageKey.clientName.value, locals[0]['CLI_NOME'], Storage.SQLiteStorage); var response = await PhpGroup.resopndeVinculo.call(tarefa: 'A'); if (response.jsonBody['error'] == true) { @@ -257,7 +258,8 @@ class LocalizationService { static Future _isUnselected() async { String cliUUID = (await StorageHelper.instance.get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? ''; String cliName = (await StorageHelper.instance.get(SQLiteStorageKey.clientName.value, Storage.SQLiteStorage)) ?? ''; - String ownerUUID = (await StorageHelper.instance.get(SQLiteStorageKey.ownerUUID.value, Storage.SQLiteStorage)) ?? ''; + String ownerUUID = + (await StorageHelper.instance.get(SQLiteStorageKey.ownerUUID.value, Storage.SQLiteStorage)) ?? ''; return cliUUID.isEmpty && cliName.isEmpty && ownerUUID.isEmpty; } @@ -274,11 +276,19 @@ class LocalizationService { } static Future _updateStorageUtil(Map jsonBody) async { - await StorageHelper.instance.set(SQLiteStorageKey.whatsapp.value, jsonBody['whatsapp'] != null && jsonBody['whatsapp'] ? 'true' : 'false', Storage.SQLiteStorage); - await StorageHelper.instance.set(SQLiteStorageKey.provisional.value, jsonBody['provisional'] != null && jsonBody['provisional'] ? 'true' : 'false', Storage.SQLiteStorage); - await StorageHelper.instance.set(SQLiteStorageKey.pets.value, jsonBody['pet'] != null && jsonBody['pet'] ? 'true' : 'false', Storage.SQLiteStorage); - await StorageHelper.instance.set(SQLiteStorageKey.petAmount.value, jsonBody['petAmountRegister'] != null && jsonBody['petAmountRegister'].toString().isEmpty ? '0' : jsonBody['petAmountRegister'].toString(), Storage.SQLiteStorage); - await StorageHelper.instance.set(SQLiteStorageKey.userName.value, jsonBody['visitado']['VDO_NOME'], Storage.SQLiteStorage); - + await StorageHelper.instance.set(SQLiteStorageKey.whatsapp.value, + jsonBody['whatsapp'] != null && jsonBody['whatsapp'] ? 'true' : 'false', Storage.SQLiteStorage); + await StorageHelper.instance.set(SQLiteStorageKey.provisional.value, + jsonBody['provisional'] != null && jsonBody['provisional'] ? 'true' : 'false', Storage.SQLiteStorage); + await StorageHelper.instance.set(SQLiteStorageKey.pets.value, + jsonBody['pet'] != null && jsonBody['pet'] ? 'true' : 'false', Storage.SQLiteStorage); + await StorageHelper.instance.set( + SQLiteStorageKey.petAmount.value, + jsonBody['petAmountRegister'] != null && jsonBody['petAmountRegister'].toString().isEmpty + ? '0' + : jsonBody['petAmountRegister'].toString(), + Storage.SQLiteStorage); + await StorageHelper.instance + .set(SQLiteStorageKey.userName.value, jsonBody['visitado']['VDO_NOME'], Storage.SQLiteStorage); } }