From 0f2c5c2fd46dada9dec8136d0df562323915ab90 Mon Sep 17 00:00:00 2001 From: "J. A. Messias" Date: Tue, 12 Nov 2024 14:21:55 -0300 Subject: [PATCH] =?UTF-8?q?fix=20fluxo=20de=20sele=C3=A7=C3=A3o=20de=20loc?= =?UTF-8?q?ais,=20showRoom?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- integration_test/app_test.dart | 12 ++--- .../notifications/notification_service.dart | 16 +++---- ..._arrow_linked_locals_component_widget.dart | 46 ++++++++++--------- .../local_profile_component_widget.dart | 3 +- .../provisional_shcedule_template_widget.dart | 8 ++-- ...iter_vistor_template_component_widget.dart | 2 +- lib/flutter_flow/upload_data.dart | 4 +- .../acess_history_page_widget.dart | 2 +- .../liberation_history_widget.dart | 2 +- .../message_history_page_widget.dart | 2 +- .../package_order_page.dart | 2 +- lib/pages/pets_page/pets_history_screen.dart | 6 +-- .../visit_history_page_widget.dart | 6 +-- .../authentication_service.dart | 28 +++++------ .../localization/localization_service.dart | 10 ++-- 15 files changed, 75 insertions(+), 74 deletions(-) diff --git a/integration_test/app_test.dart b/integration_test/app_test.dart index e9ffa21c..f8ab2568 100644 --- a/integration_test/app_test.dart +++ b/integration_test/app_test.dart @@ -14,8 +14,8 @@ void main() { group('Initialization', () { group('Navigation', () { - setUpAll(() async => await initializeApp() - .then((_) async => StorageHelper().set(SecureStorageKey.isLogged.value, 'false', Storage.SecureStorage))); + setUpAll(() async => await initializeApp().then( + (_) async => await StorageHelper().set(SecureStorageKey.isLogged.value, 'false', Storage.SecureStorage))); testWidgets('Test Welcome', (WidgetTester tester) async { widget = tester; await _testWelcome(); @@ -26,16 +26,16 @@ void main() { }); group('Authentication', () { group('Sign in', () { - setUpAll(() async => await initializeApp() - .then((_) async => StorageHelper().set(SecureStorageKey.isLogged.value, 'false', Storage.SecureStorage))); + setUpAll(() async => await initializeApp().then( + (_) async => await StorageHelper().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().set(SecureStorageKey.isLogged.value, 'false', Storage.SecureStorage))); + setUpAll(() async => await initializeApp().then( + (_) async => await StorageHelper().set(SecureStorageKey.isLogged.value, 'false', Storage.SecureStorage))); testWidgets('Test Sign Up', (WidgetTester tester) async { widget = tester; await _testSignUp(); diff --git a/lib/backend/notifications/notification_service.dart b/lib/backend/notifications/notification_service.dart index 53d7eaff..b15eb326 100644 --- a/lib/backend/notifications/notification_service.dart +++ b/lib/backend/notifications/notification_service.dart @@ -73,19 +73,19 @@ Future onMessageReceived(Map payload, String? extra, Stri task: 'L', response: '', id: payload['idVisitante'].toString(), - ).then((value) { + ).then((value) async { if (value) { context.pop(); context.pop(); } else { context.pop(); context.pop(); - DialogUtil.errorDefault(context); + await DialogUtil.errorDefault(context); } - }).catchError((e) { + }).catchError((e) async { context.pop(); context.pop(); - DialogUtil.errorDefault(context); + await DialogUtil.errorDefault(context); }); }, ); @@ -112,19 +112,19 @@ Future onMessageReceived(Map payload, String? extra, Stri response: '', id: payload['idVisitante'].toString(), ) - .then((value) { + .then((value) async { if (value) { context.pop(); context.pop(); } else { context.pop(); context.pop(); - DialogUtil.errorDefault(context); + await DialogUtil.errorDefault(context); } - }).catchError((e) { + }).catchError((e) async { context.pop(); context.pop(); - DialogUtil.errorDefault(context); + await DialogUtil.errorDefault(context); }); }); }, 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 1fd0f164..e5ebe5e3 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 @@ -77,7 +77,7 @@ class _BottomArrowLinkedLocalsComponentWidgetState extends State _handleError(BuildContext context, String errorMsg) async { + await DialogUtil.error(context, errorMsg); } Future _fetchResponseLink(String status, String cliID) async { @@ -151,7 +151,7 @@ class _BottomArrowLinkedLocalsComponentWidgetState extends State value == true ? onUpdate() : null); + await LocalizationService.processLocals(context).whenComplete(() => onUpdate()); }, child: ClipRRect( borderRadius: BorderRadius.circular(200.0), diff --git a/lib/components/templates_components/provisional_schedule_template/provisional_shcedule_template_widget.dart b/lib/components/templates_components/provisional_schedule_template/provisional_shcedule_template_widget.dart index 35f8a6fd..d098ecfb 100644 --- a/lib/components/templates_components/provisional_schedule_template/provisional_shcedule_template_widget.dart +++ b/lib/components/templates_components/provisional_schedule_template/provisional_shcedule_template_widget.dart @@ -604,7 +604,7 @@ class _ScheduleProvisionalVisitPageWidgetState extends State?> selectMediaWithSourceBottomSheetandFaceDetection({ if (faces.isEmpty) { final String message = FFLocalizations.of(context) .getVariableText(ptText: "Nenhuma face detectada na imagem", enText: "No face detected in the image"); - DialogUtil.error(context, message); + await DialogUtil.error(context, message); return null; } if (faces.length > 1) { final String message = FFLocalizations.of(context).getVariableText( ptText: "Mais de uma face detectada na imagem", enText: "More than one face detected in the image"); - DialogUtil.error(context, message); + await DialogUtil.error(context, message); return null; } } diff --git a/lib/pages/acess_history_page/acess_history_page_widget.dart b/lib/pages/acess_history_page/acess_history_page_widget.dart index cb44168f..1f239f26 100644 --- a/lib/pages/acess_history_page/acess_history_page_widget.dart +++ b/lib/pages/acess_history_page/acess_history_page_widget.dart @@ -209,7 +209,7 @@ class _AccessHistoryState extends State { }); return null; } catch (e, s) { - DialogUtil.errorDefault(context); + await DialogUtil.errorDefault(context); LogUtil.requestAPIFailed('processRequest', "", "Busca Acesso", e, s); setState(() { _hasData = false; diff --git a/lib/pages/liberation_history/liberation_history_widget.dart b/lib/pages/liberation_history/liberation_history_widget.dart index 89847e87..8f688a59 100644 --- a/lib/pages/liberation_history/liberation_history_widget.dart +++ b/lib/pages/liberation_history/liberation_history_widget.dart @@ -333,7 +333,7 @@ class _LiberationHistoryWidgetState extends State { return null; } catch (e, s) { - DialogUtil.errorDefault(context); + await DialogUtil.errorDefault(context); LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Solicitações", e, s); setState(() { _hasData = false; diff --git a/lib/pages/message_history_page/message_history_page_widget.dart b/lib/pages/message_history_page/message_history_page_widget.dart index 92e01bd5..84624c22 100644 --- a/lib/pages/message_history_page/message_history_page_widget.dart +++ b/lib/pages/message_history_page/message_history_page_widget.dart @@ -119,7 +119,7 @@ class _MessageHistoryPageWidgetState extends State wit }); return null; } catch (e, s) { - DialogUtil.errorDefault(context); + await DialogUtil.errorDefault(context); LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Mensagems", e, s); setState(() { _hasData = false; diff --git a/lib/pages/package_order_page/package_order_page.dart b/lib/pages/package_order_page/package_order_page.dart index 4e2f1246..d480b952 100644 --- a/lib/pages/package_order_page/package_order_page.dart +++ b/lib/pages/package_order_page/package_order_page.dart @@ -122,7 +122,7 @@ class _PackageOrderPage extends State { return null; } catch (e, s) { - DialogUtil.errorDefault(context); + await DialogUtil.errorDefault(context); LogUtil.requestAPIFailed('processRequest', "", "Busca Encomendas", e, s); setState(() { _hasData = false; diff --git a/lib/pages/pets_page/pets_history_screen.dart b/lib/pages/pets_page/pets_history_screen.dart index 2e8727eb..917a041d 100644 --- a/lib/pages/pets_page/pets_history_screen.dart +++ b/lib/pages/pets_page/pets_history_screen.dart @@ -79,7 +79,7 @@ class _PetsHistoryScreenState extends State with TickerProvid return null; } catch (e, s) { - DialogUtil.errorDefault(context); + await DialogUtil.errorDefault(context); LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Pets", e, s); setState(() { _hasData = false; @@ -256,8 +256,8 @@ class _PetsHistoryScreenState extends State with TickerProvid _petsWrap = []; _petsFuture = _fetch().then((value) => value!.jsonBody['pets'] ?? []); }); - }).catchError((e, s) { - DialogUtil.errorDefault(context); + }).catchError((e, s) async { + await DialogUtil.errorDefault(context); LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Pets", e, s); safeSetState(() { _hasData = false; 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 68ae370c..56022372 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 @@ -94,7 +94,7 @@ class _VisitHistoryWidgetState extends State with TickerProv return null; } catch (e, s) { - DialogUtil.errorDefault(context); + await DialogUtil.errorDefault(context); LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Visitas", e, s); setState(() { _hasData = false; @@ -273,8 +273,8 @@ class _VisitHistoryWidgetState extends State with TickerProv _visitWrap = []; _visitFuture = _fetchVisits(); }); - }).catchError((e, s) { - DialogUtil.errorDefault(context); + }).catchError((e, s) async { + await DialogUtil.errorDefault(context); LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Visitas", e, s); safeSetState(() { _hasData = false; diff --git a/lib/shared/services/authentication/authentication_service.dart b/lib/shared/services/authentication/authentication_service.dart index 25529e38..81afd3a1 100644 --- a/lib/shared/services/authentication/authentication_service.dart +++ b/lib/shared/services/authentication/authentication_service.dart @@ -18,7 +18,7 @@ class AuthenticationService { final response = await callback.call(); if (response.jsonBody['error']) { - DialogUtil.errorDefault(context); + await DialogUtil.errorDefault(context); return; } List locals = response.jsonBody['locais'] ?? []; @@ -78,16 +78,16 @@ class AuthenticationService { await login(context); } else { if (response.jsonBody['error'] == null) { - DialogUtil.errorDefault(context); + await DialogUtil.errorDefault(context); } else { - DialogUtil.error(context, response.jsonBody['error_msg'].toString()); - DialogUtil.error(context, response.jsonBody['error_msg'].toString()); + await DialogUtil.error(context, response.jsonBody['error_msg'].toString()); + await DialogUtil.error(context, response.jsonBody['error_msg'].toString()); } } } return; } catch (e, s) { - DialogUtil.errorDefault(context); + await DialogUtil.errorDefault(context); LogUtil.requestAPIFailed('login.php', emailAdress.toString(), "Login", e, s); } } @@ -115,14 +115,14 @@ class AuthenticationService { ); if (response.jsonBody['error'] == false) return true; - DialogUtil.error(context, response.jsonBody['error_msg']); + await DialogUtil.error(context, response.jsonBody['error_msg']); return false; } else { - DialogUtil.errorDefault(context); + await DialogUtil.errorDefault(context); return false; } } catch (e, s) { - DialogUtil.errorDefault(context); + await DialogUtil.errorDefault(context); LogUtil.requestAPIFailed('registro.php', email.toString(), "Register", e, s); return false; } @@ -152,12 +152,12 @@ class AuthenticationService { response = await callback.call(email: email); if (response.jsonBody['error'] == false) { - DialogUtil.success(context, message); + await DialogUtil.success(context, message); } else { - DialogUtil.error(context, response.jsonBody['error_msg']); + await DialogUtil.error(context, response.jsonBody['error_msg']); } } catch (e, s) { - DialogUtil.errorDefault(context); + await DialogUtil.errorDefault(context); LogUtil.requestAPIFailed('forgotPassword.php', email, "Forgot Password", e, s); } } @@ -172,13 +172,13 @@ class AuthenticationService { enText: "Password changed successfully!", ptText: "Senha alterada com sucesso!", ); - DialogUtil.success(context, message).then((_) => context.pop); + await DialogUtil.success(context, message).then((_) => context.pop); } else { final String message = response.jsonBody['error_msg']; - DialogUtil.error(context, message); + await DialogUtil.error(context, message); } } catch (e, s) { - DialogUtil.errorDefault(context); + await DialogUtil.errorDefault(context); LogUtil.requestAPIFailed('changePassword.php', email, "Change Password", e, s); } } diff --git a/lib/shared/services/localization/localization_service.dart b/lib/shared/services/localization/localization_service.dart index 48c92848..e1319084 100644 --- a/lib/shared/services/localization/localization_service.dart +++ b/lib/shared/services/localization/localization_service.dart @@ -34,7 +34,7 @@ class LocalizationService { enText: 'Verify your connection', ptText: 'Verifique sua conexão', ); - DialogUtil.error(context, errorMsg).whenComplete(() => selectLocal(context, response)); + await DialogUtil.error(context, errorMsg).whenComplete(() => selectLocal(context, response)); return; } @@ -72,7 +72,7 @@ class LocalizationService { enText: 'Verify your connection', ptText: 'Verifique sua conexão', ); - DialogUtil.error(context, errorMsg).whenComplete(() => selectLocal(context, response)); + await DialogUtil.error(context, errorMsg).whenComplete(() => selectLocal(context, response)); return false; } @@ -123,7 +123,7 @@ class LocalizationService { enText: 'Error getting locals, verify your connection', ptText: 'Erro ao obter locais, verifique sua conexão', ); - DialogUtil.error(context, errorMsg).whenComplete(() => selectLocal(context, null)); + await DialogUtil.error(context, errorMsg).whenComplete(() => selectLocal(context, null)); return false; } } @@ -160,7 +160,7 @@ class LocalizationService { enText: 'Error getting data, verify your connection', ptText: 'Erro ao obter dados, verifique sua conexão', ); - DialogUtil.error(context, errorMsg).whenComplete(() => selectLocal(context, null)); + await DialogUtil.error(context, errorMsg).whenComplete(() => selectLocal(context, null)); return false; } } @@ -270,7 +270,7 @@ class LocalizationService { } if (response.jsonBody['error'] == false) return await processData(context).then((value) => value); } catch (e, s) { - DialogUtil.errorDefault(context); + await DialogUtil.errorDefault(context); LogUtil.requestAPIFailed('responderVinculo.php', '', 'Responder Vínculo', e, s); return false; }