diff --git a/ios/Podfile.lock b/ios/Podfile.lock index dbd080c3..0aa4fbd2 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -42,6 +42,9 @@ PODS: - FirebaseAnalytics (~> 10.27.0) - Firebase/CoreOnly (10.27.0): - FirebaseCore (= 10.27.0) + - Firebase/Crashlytics (10.27.0): + - Firebase/CoreOnly + - FirebaseCrashlytics (~> 10.27.0) - Firebase/Messaging (10.27.0): - Firebase/CoreOnly - FirebaseMessaging (~> 10.27.0) @@ -52,6 +55,10 @@ PODS: - firebase_core (3.1.0): - Firebase/CoreOnly (= 10.27.0) - Flutter + - firebase_crashlytics (4.0.1): + - Firebase/Crashlytics (= 10.27.0) + - firebase_core + - Flutter - firebase_messaging (15.0.1): - Firebase/Messaging (= 10.27.0) - firebase_core @@ -78,8 +85,19 @@ PODS: - FirebaseCoreInternal (~> 10.0) - GoogleUtilities/Environment (~> 7.12) - GoogleUtilities/Logger (~> 7.12) + - FirebaseCoreExtension (10.29.0): + - FirebaseCore (~> 10.0) - FirebaseCoreInternal (10.28.0): - "GoogleUtilities/NSData+zlib (~> 7.8)" + - FirebaseCrashlytics (10.27.0): + - FirebaseCore (~> 10.5) + - FirebaseInstallations (~> 10.0) + - FirebaseRemoteConfigInterop (~> 10.23) + - FirebaseSessions (~> 10.5) + - GoogleDataTransport (~> 9.2) + - GoogleUtilities/Environment (~> 7.8) + - nanopb (< 2.30911.0, >= 2.30908.0) + - PromisesObjC (~> 2.1) - FirebaseInstallations (10.28.0): - FirebaseCore (~> 10.0) - GoogleUtilities/Environment (~> 7.8) @@ -94,6 +112,16 @@ PODS: - GoogleUtilities/Reachability (~> 7.8) - GoogleUtilities/UserDefaults (~> 7.8) - nanopb (< 2.30911.0, >= 2.30908.0) + - FirebaseRemoteConfigInterop (10.29.0) + - FirebaseSessions (10.29.0): + - FirebaseCore (~> 10.5) + - FirebaseCoreExtension (~> 10.0) + - FirebaseInstallations (~> 10.0) + - GoogleDataTransport (~> 9.2) + - GoogleUtilities/Environment (~> 7.13) + - GoogleUtilities/UserDefaults (~> 7.13) + - nanopb (< 2.30911.0, >= 2.30908.0) + - PromisesSwift (~> 2.1) - Flutter (1.0.0) - flutter_inappwebview_ios (0.0.1): - Flutter @@ -174,6 +202,8 @@ PODS: - permission_handler_apple (9.3.0): - Flutter - PromisesObjC (2.4.0) + - PromisesSwift (2.4.0): + - PromisesObjC (= 2.4.0) - SDWebImage (5.19.2): - SDWebImage/Core (= 5.19.2) - SDWebImage/Core (5.19.2) @@ -199,6 +229,7 @@ DEPENDENCIES: - file_picker (from `.symlinks/plugins/file_picker/ios`) - firebase_analytics (from `.symlinks/plugins/firebase_analytics/ios`) - firebase_core (from `.symlinks/plugins/firebase_core/ios`) + - firebase_crashlytics (from `.symlinks/plugins/firebase_crashlytics/ios`) - firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`) - Flutter (from `Flutter`) - flutter_inappwebview_ios (from `.symlinks/plugins/flutter_inappwebview_ios/ios`) @@ -222,15 +253,20 @@ SPEC REPOS: - Firebase - FirebaseAnalytics - FirebaseCore + - FirebaseCoreExtension - FirebaseCoreInternal + - FirebaseCrashlytics - FirebaseInstallations - FirebaseMessaging + - FirebaseRemoteConfigInterop + - FirebaseSessions - GoogleAppMeasurement - GoogleDataTransport - GoogleUtilities - nanopb - OrderedSet - PromisesObjC + - PromisesSwift - SDWebImage - SwiftyGif @@ -243,6 +279,8 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/firebase_analytics/ios" firebase_core: :path: ".symlinks/plugins/firebase_core/ios" + firebase_crashlytics: + :path: ".symlinks/plugins/firebase_crashlytics/ios" firebase_messaging: :path: ".symlinks/plugins/firebase_messaging/ios" Flutter: @@ -282,12 +320,17 @@ SPEC CHECKSUMS: Firebase: 26b040b20866a55f55eb3611b9fcf3ae64816b86 firebase_analytics: 0627e95b73eb9e04f59167687ed5bc3f6fb50f23 firebase_core: 483cfad66d24d8f3c233f31db4263830c625c909 + firebase_crashlytics: 8f04c663c8734f97c4ccbe81b8511ce7060e3b28 firebase_messaging: e60c0694699d8a2e56a319e043709583f6544123 FirebaseAnalytics: f9211b719db260cc91aebee8bb539cb367d0dfd1 FirebaseCore: a2b95ae4ce7c83ceecfbbbe3b6f1cddc7415a808 + FirebaseCoreExtension: 705ca5b14bf71d2564a0ddc677df1fc86ffa600f FirebaseCoreInternal: 58d07f1362fddeb0feb6a857d1d1d1c5e558e698 + FirebaseCrashlytics: 81ea6ec96519388687f6061beb838a8eec482293 FirebaseInstallations: 60c1d3bc1beef809fd1ad1189a8057a040c59f2e FirebaseMessaging: 585984d0a1df120617eb10b44cad8968b859815e + FirebaseRemoteConfigInterop: 6efda51fb5e2f15b16585197e26eaa09574e8a4d + FirebaseSessions: dbd14adac65ce996228652c1fc3a3f576bdf3ecc Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 flutter_inappwebview_ios: 97215cf7d4677db55df76782dbd2930c5e1c1ea0 flutter_local_notifications: 4cde75091f6327eb8517fa068a0a5950212d2086 @@ -302,6 +345,7 @@ SPEC CHECKSUMS: path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46 permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2 PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47 + PromisesSwift: 9d77319bbe72ebf6d872900551f7eeba9bce2851 SDWebImage: dfe95b2466a9823cf9f0c6d01217c06550d7b29a share_plus: 8875f4f2500512ea181eef553c3e27dba5135aad shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 8b276ad6..93d93c55 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -51,8 +51,8 @@ 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; - 6436409D27A31CDC00820AF7 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/InfoPlist.strings; sourceTree = ""; }; - 6436409227A31CDD00820AF7 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + 6436409227A31CD800820AF7 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/InfoPlist.strings; sourceTree = ""; }; + 6436409127A31CDB00820AF7 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; C1B4A503715BC7B0F8826983 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -301,8 +301,8 @@ 6436409C27A31CD800820AF7 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( - 6436409D27A31CDC00820AF7 /* pt */, - 6436409227A31CDD00820AF7 /* en */, + 6436409227A31CD800820AF7 /* pt */, + 6436409127A31CDB00820AF7 /* en */, ); name = InfoPlist.strings; sourceTree = ""; diff --git a/lib/actions/actions.dart b/lib/actions/actions.dart index 5d80d184..2a864382 100644 --- a/lib/actions/actions.dart +++ b/lib/actions/actions.dart @@ -14,6 +14,7 @@ import 'package:hub/flutter_flow/nav/nav.dart'; import 'package:flutter/material.dart'; import 'package:hub/flutter_flow/random_data_util.dart'; import 'package:hub/pages/home_page/home_page_model.dart'; +import 'package:hub/shared/utils/dialog_util.dart'; import 'package:qr_flutter/qr_flutter.dart'; @@ -21,6 +22,8 @@ import 'package:qr_flutter/qr_flutter.dart'; import 'package:url_launcher/url_launcher.dart'; +import '../shared/utils/log_util.dart'; + Future openTermsOfUse(BuildContext context) async { log('openTermsOfUse'); final Uri url = Uri.parse('https://freaccess.com.br/pp/'); @@ -108,92 +111,89 @@ Future singInLoginAction( String? emailAdress, String? password, }) async { - String? devUUID; - ApiCallResponse? loginCall; - await Future.wait([ - Future(() async { - FFAppState().email = emailAdress!; - }), - Future(() async { - FFAppState().passwd = password!; - }), - ]); - if ((FFAppState().email != '') && (FFAppState().passwd != '')) { - devUUID = await getDevUUID(); - FFAppState().devUUID = devUUID!; - loginCall = await PhpGroup.loginCall.call( - email: FFAppState().email, - password: FFAppState().passwd, - uuid: FFAppState().devUUID, - type: FFAppState().device, - description: randomString( - 10, - 10, - true, - false, - false, - ), - ); + try { + String? devUUID; + ApiCallResponse? loginCall; - if (PhpGroup.loginCall.error( + await Future.wait([ + Future(() async { + FFAppState().email = emailAdress!; + }), + Future(() async { + FFAppState().passwd = password!; + }), + ]); + + if ((FFAppState().email != '') && (FFAppState().passwd != '')) { + devUUID = await getDevUUID(); + + FFAppState().devUUID = devUUID!; + + loginCall = await PhpGroup.loginCall.call( + email: FFAppState().email, + password: FFAppState().passwd, + uuid: FFAppState().devUUID, + type: FFAppState().device, + description: randomString( + 10, + 10, + true, + false, + false, + ), + ); + + if (PhpGroup.loginCall.error((loginCall.jsonBody ?? '')) == false) { + + FFAppState().userUUID = PhpGroup.loginCall.userUUID( (loginCall.jsonBody ?? ''), - ) == - false) { - FFAppState().userUUID = PhpGroup.loginCall.userUUID( - (loginCall.jsonBody ?? ''), - )!; - // FFAppState().token = await FirebaseMessaging.instance.getToken(); - FFAppState().createdAt = dateTimeFormat( - 'd/M/y H:mm:ss', - getCurrentTimestamp, - locale: FFLocalizations.of(context).languageCode, - ); - FFAppState().updatedAt = '00/00/0000 00:00:00'; - FFAppState().status = PhpGroup.loginCall.userStatus( - (loginCall.jsonBody ?? ''), - )!; - FFAppState().userDevUUID = PhpGroup.loginCall.userDeviceId( - (loginCall.jsonBody ?? ''), - )!; - FFAppState().name = PhpGroup.loginCall.userName( - (loginCall.jsonBody ?? ''), - )!; - FFAppState().serialNumber = await getSerialNumber() ?? ''; - FFAppState().isLogged = true; - await toggleHomePage(context); - return; - } else { - await showModalBottomSheet( - isScrollControlled: true, - backgroundColor: Colors.transparent, - useSafeArea: true, - context: context, - builder: (context) { - return Padding( - padding: MediaQuery.viewInsetsOf(context), - child: ThrowExceptionWidget( - msg: PhpGroup.loginCall.msg( - (loginCall?.jsonBody ?? ''), - )!, - ), - ); - }, - ); + )!; - FFAppState().deleteEmail(); - FFAppState().email = ''; + FFAppState().createdAt = dateTimeFormat( + 'd/M/y H:mm:ss', + getCurrentTimestamp, + locale: FFLocalizations.of(context).languageCode, + ); - FFAppState().deletePasswd(); - FFAppState().passwd = ''; + FFAppState().updatedAt = '00/00/0000 00:00:00'; - FFAppState().update(() {}); + FFAppState().status = PhpGroup.loginCall.userStatus((loginCall.jsonBody ?? ''))!; + + FFAppState().userDevUUID = PhpGroup.loginCall.userDeviceId((loginCall.jsonBody ?? ''))!; + + FFAppState().name = PhpGroup.loginCall.userName((loginCall.jsonBody ?? ''))!; + + FFAppState().serialNumber = await getSerialNumber() ?? ''; + + FFAppState().isLogged = true; + + await toggleHomePage(context); + } else { + + if (PhpGroup.loginCall.msg((loginCall?.jsonBody ?? '')) == null) { + DialogUtil.errorDefault(context); + } else { + DialogUtil.error(context, PhpGroup.loginCall.msg((loginCall?.jsonBody ?? '')).toString()); + } + + FFAppState().deleteEmail(); + FFAppState().email = ''; + + FFAppState().deletePasswd(); + FFAppState().passwd = ''; + + FFAppState().update(() {}); + } } return; - } else { - return; + + } catch (e, s) { + DialogUtil.errorDefault(context); + LogUtil.requestAPIFailed('login.php', emailAdress.toString(), "Login", e, s); } + } Future signUpRegisterAction( diff --git a/lib/components/molecular_components/throw_exception/throw_exception_widget.dart b/lib/components/molecular_components/throw_exception/throw_exception_widget.dart index 95333ddd..6026a836 100644 --- a/lib/components/molecular_components/throw_exception/throw_exception_widget.dart +++ b/lib/components/molecular_components/throw_exception/throw_exception_widget.dart @@ -1,3 +1,5 @@ +import 'package:hub/shared/enums/enum_throw_exception.dart'; + import '/flutter_flow/flutter_flow_animations.dart'; import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; @@ -7,15 +9,16 @@ import 'package:google_fonts/google_fonts.dart'; import 'throw_exception_model.dart'; export 'throw_exception_model.dart'; -/// - class ThrowExceptionWidget extends StatefulWidget { - const ThrowExceptionWidget({ + + ThrowExceptionWidget({ super.key, required this.msg, + this.type = EnumThrowException.error }); final String? msg; + EnumThrowException type; @override State createState() => _ThrowExceptionWidgetState(); @@ -61,6 +64,39 @@ class _ThrowExceptionWidgetState extends State super.dispose(); } + Color _getColorByType(BuildContext context) { + switch (widget.type) { + case EnumThrowException.error: + return FlutterFlowTheme.of(context).error; + case EnumThrowException.warning: + return FlutterFlowTheme.of(context).warning; + case EnumThrowException.success: + return FlutterFlowTheme.of(context).success; + } + } + + IconData _getIconByType(BuildContext context) { + switch (widget.type) { + case EnumThrowException.error: + return Icons.cancel_outlined; + case EnumThrowException.warning: + return Icons.warning_amber_outlined; + case EnumThrowException.success: + return Icons.check_circle_outline; + } + } + + String _getTitleByType(BuildContext context) { + switch (widget.type) { + case EnumThrowException.error: + return FFLocalizations.of(context).getVariableText(ptText: "Falha :(", enText: "Fail :("); + case EnumThrowException.warning: + return FFLocalizations.of(context).getVariableText(ptText: "Aviso :O", enText: "Warning :O"); + case EnumThrowException.success: + return FFLocalizations.of(context).getVariableText(ptText: "Sucesso ;)", enText: "Success ;)");; + } + } + @override Widget build(BuildContext context) { return Column( @@ -77,85 +113,62 @@ class _ThrowExceptionWidgetState extends State onTap: () async { Navigator.pop(context); }, - child: Container( - height: 400.0, - decoration: BoxDecoration( - color: FlutterFlowTheme.of(context).primaryBackground, - borderRadius: const BorderRadius.only( - bottomLeft: Radius.circular(10.0), - bottomRight: Radius.circular(10.0), - topLeft: Radius.circular(10.0), - topRight: Radius.circular(10.0), - ), - ), - child: Column( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Stack( - children: [ - Align( - alignment: const AlignmentDirectional(0.0, 0.0), - child: Icon( - Icons.circle_outlined, - color: FlutterFlowTheme.of(context).error, - size: 200.0, - ), + child: Column( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Stack( + children: [ + Align( + alignment: const AlignmentDirectional(0.0, 0.0), + child: Icon( + _getIconByType(context), + color: _getColorByType(context), + size: 150.0, ), - Align( - alignment: const AlignmentDirectional(0.0, 0.0), - child: Icon( - Icons.close_outlined, - color: FlutterFlowTheme.of(context).error, - size: 200.0, + ), + ], + ).animateOnPageLoad( + animationsMap['stackOnPageLoadAnimation']!), + Column( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + _getTitleByType(context), + style: FlutterFlowTheme.of(context).bodyMedium.override( + fontFamily: + FlutterFlowTheme.of(context).bodyMediumFamily, + fontSize: 20.0, + letterSpacing: 0.0, + fontWeight: FontWeight.bold, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + ), + ), + Padding( + padding: const EdgeInsetsDirectional.fromSTEB(0.0, 10.0, 0.0, 0.0), + child: Text( + valueOrDefault( + widget.msg, + 'Message Not Found', ), - ), - ], - ).animateOnPageLoad( - animationsMap['stackOnPageLoadAnimation']!), - Column( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Text( - FFLocalizations.of(context).getText( - 'e58xxxiq' /* ERRO */, - ), - style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: - FlutterFlowTheme.of(context).bodyMediumFamily, - fontSize: 20.0, + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .bodyMediumFamily, letterSpacing: 0.0, - fontWeight: FontWeight.bold, useGoogleFonts: GoogleFonts.asMap().containsKey( FlutterFlowTheme.of(context) .bodyMediumFamily), ), ), - Padding( - padding: - const EdgeInsetsDirectional.fromSTEB(0.0, 10.0, 0.0, 0.0), - child: Text( - valueOrDefault( - widget.msg, - 'Message Not Found', - ), - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: FlutterFlowTheme.of(context) - .bodyMediumFamily, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey( - FlutterFlowTheme.of(context) - .bodyMediumFamily), - ), - ), - ), - ].addToStart(const SizedBox(height: 50.0)), - ), - ], - ), + ), + ].addToStart(const SizedBox(height: 20.0)), + ), + ], ), ), ), diff --git a/lib/components/templates_components/forgot_password_template_component/forgot_password_template_component_model.dart b/lib/components/templates_components/forgot_password_template_component/forgot_password_template_component_model.dart index 4b79c7c0..13c3c56a 100644 --- a/lib/components/templates_components/forgot_password_template_component/forgot_password_template_component_model.dart +++ b/lib/components/templates_components/forgot_password_template_component/forgot_password_template_component_model.dart @@ -1,24 +1,43 @@ +import 'package:hub/shared/utils/validator_util.dart'; + import '/backend/api_requests/api_calls.dart'; import '/flutter_flow/flutter_flow_util.dart'; import 'forgot_password_template_component_widget.dart' show ForgotPasswordTemplateComponentWidget; import 'package:flutter/material.dart'; - - class ForgotPasswordTemplateComponentModel extends FlutterFlowModel { /// State fields for stateful widgets in this component. + final formKey = GlobalKey(); // State field(s) for emailAddress widget. FocusNode? emailAddressFocusNode; TextEditingController? emailAddressTextController; String? Function(BuildContext, String?)? emailAddressTextControllerValidator; + String? _emailAddressTextControllerValidator( + BuildContext context, String? val) { + if (val == null || val.isEmpty) { + return FFLocalizations.of(context).getText( + '3hqg8buh' /* E-mail é Obrigatório */, + ); + } + + if (!ValidatorUtil.isValidEmail(val)) { + return FFLocalizations.of(context).getText( + 'jh5r2b1w' /* E-mail Inválido */, + ); + } + return null; + } + // Stores action output result for [Backend Call - API (forgotPassword)] action in Button-Login widget. ApiCallResponse? req; @override - void initState(BuildContext context) {} + void initState(BuildContext context) { + emailAddressTextControllerValidator = _emailAddressTextControllerValidator; + } @override void dispose() { diff --git a/lib/components/templates_components/forgot_password_template_component/forgot_password_template_component_widget.dart b/lib/components/templates_components/forgot_password_template_component/forgot_password_template_component_widget.dart index 156672de..1c7a7c0a 100644 --- a/lib/components/templates_components/forgot_password_template_component/forgot_password_template_component_widget.dart +++ b/lib/components/templates_components/forgot_password_template_component/forgot_password_template_component_widget.dart @@ -1,18 +1,21 @@ +import 'dart:developer'; + import 'package:hub/flutter_flow/nav/nav.dart'; +import 'package:hub/shared/utils/dialog_util.dart'; +import 'package:hub/shared/utils/log_util.dart'; +import 'package:hub/shared/utils/validator_util.dart'; import '/backend/api_requests/api_calls.dart'; import '/components/molecular_components/throw_exception/throw_exception_widget.dart'; import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; import '/flutter_flow/flutter_flow_widgets.dart'; +import 'package:easy_debounce/easy_debounce.dart'; import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'forgot_password_template_component_model.dart'; export 'forgot_password_template_component_model.dart'; -// - - class ForgotPasswordTemplateComponentWidget extends StatefulWidget { const ForgotPasswordTemplateComponentWidget({super.key}); @@ -101,19 +104,19 @@ class _ForgotPasswordTemplateComponentWidgetState ), Padding( padding: - const EdgeInsetsDirectional.fromSTEB(12.0, 0.0, 0.0, 0.0), + const EdgeInsetsDirectional.fromSTEB(12.0, 0.0, 0.0, 0.0), child: Text( '', style: - FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: 'Plus Jakarta Sans', - color: const Color(0xFF15161E), - fontSize: 14.0, - letterSpacing: 0.0, - fontWeight: FontWeight.w500, - useGoogleFonts: GoogleFonts.asMap() - .containsKey('Plus Jakarta Sans'), - ), + FlutterFlowTheme.of(context).bodyMedium.override( + fontFamily: 'Plus Jakarta Sans', + color: const Color(0xFF15161E), + fontSize: 14.0, + letterSpacing: 0.0, + fontWeight: FontWeight.w500, + useGoogleFonts: GoogleFonts.asMap() + .containsKey('Plus Jakarta Sans'), + ), ), ), ], @@ -127,13 +130,13 @@ class _ForgotPasswordTemplateComponentWidgetState 'xxm3ajsy' /* ESQUECEU SUA SENHA? */, ), style: FlutterFlowTheme.of(context).headlineMedium.override( - fontFamily: 'Outfit', - color: FlutterFlowTheme.of(context).primaryText, - fontSize: 24.0, - letterSpacing: 0.0, - fontWeight: FontWeight.w500, - useGoogleFonts: GoogleFonts.asMap().containsKey('Outfit'), - ), + fontFamily: 'Outfit', + color: FlutterFlowTheme.of(context).primaryText, + fontSize: 24.0, + letterSpacing: 0.0, + fontWeight: FontWeight.w500, + useGoogleFonts: GoogleFonts.asMap().containsKey('Outfit'), + ), ), ), Padding( @@ -143,105 +146,100 @@ class _ForgotPasswordTemplateComponentWidgetState 'wu2f7yzo' /* Não se preucupe nós vamos te a... */, ), style: FlutterFlowTheme.of(context).labelMedium.override( + fontFamily: 'Plus Jakarta Sans', + color: FlutterFlowTheme.of(context).primaryText, + fontSize: 14.0, + letterSpacing: 0.0, + fontWeight: FontWeight.w500, + useGoogleFonts: + GoogleFonts.asMap().containsKey('Plus Jakarta Sans'), + ), + ), + ), + Form( + key: _model.formKey, + autovalidateMode: AutovalidateMode.onUserInteraction, + child: Padding( + padding: const EdgeInsetsDirectional.fromSTEB(16.0, 12.0, 16.0, 0.0), + child: SizedBox( + width: double.infinity, + child: TextFormField( + controller: _model.emailAddressTextController, + focusNode: _model.emailAddressFocusNode, + onChanged: (_) => EasyDebounce.debounce( + '_model.emailAddressTextController', + const Duration(milliseconds: 500), + () => setState(() {}), + ), + autofocus: true, + autofillHints: const [AutofillHints.email], + obscureText: false, + decoration: InputDecoration( + isDense: true, + labelText: FFLocalizations.of(context).getText( + 'mtz8l7ft' /* E-mail */, + ), + labelStyle: + FlutterFlowTheme.of(context).labelMedium.override( + fontFamily: 'Plus Jakarta Sans', + color: FlutterFlowTheme.of(context).primary, + fontSize: 14.0, + letterSpacing: 0.0, + fontWeight: FontWeight.w500, + useGoogleFonts: GoogleFonts.asMap() + .containsKey('Plus Jakarta Sans'), + ), + enabledBorder: OutlineInputBorder( + borderSide: const BorderSide( + color: Colors.black, + width: 2.00, + ), + borderRadius: BorderRadius.circular(12.0), + ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).primary, + width: 2.00, + ), + borderRadius: BorderRadius.circular(12.0), + ), + errorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).error, + width: 2.00, + ), + borderRadius: BorderRadius.circular(12.0), + ), + focusedErrorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).error, + width: 2.00, + ), + borderRadius: BorderRadius.circular(12.0), + ), + contentPadding: const EdgeInsetsDirectional.fromSTEB( + 24.0, 24.0, 20.0, 24.0), + suffixIcon: Icon( + Icons.email, + color: FlutterFlowTheme.of(context).primary, + size: 22.0, + ), + ), + style: FlutterFlowTheme.of(context).bodyMedium.override( fontFamily: 'Plus Jakarta Sans', color: FlutterFlowTheme.of(context).primaryText, fontSize: 14.0, letterSpacing: 0.0, fontWeight: FontWeight.w500, - useGoogleFonts: - GoogleFonts.asMap().containsKey('Plus Jakarta Sans'), - ), - ), - ), - Padding( - padding: const EdgeInsetsDirectional.fromSTEB(16.0, 12.0, 16.0, 0.0), - child: SizedBox( - width: double.infinity, - child: TextFormField( - controller: _model.emailAddressTextController, - focusNode: _model.emailAddressFocusNode, - autofillHints: const [AutofillHints.email], - obscureText: false, - decoration: InputDecoration( - isDense: true, - labelText: FFLocalizations.of(context).getText( - 'mtz8l7ft' /* Email */, - ), - labelStyle: - FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: 'Plus Jakarta Sans', - color: FlutterFlowTheme.of(context).accent1, - fontSize: 14.0, - letterSpacing: 0.0, - fontWeight: FontWeight.w500, - useGoogleFonts: GoogleFonts.asMap() - .containsKey('Plus Jakarta Sans'), - ), - hintText: FFLocalizations.of(context).getText( - 'w7y5wlnv' /* digite o seu email..... */, - ), - hintStyle: - FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: 'Plus Jakarta Sans', - color: FlutterFlowTheme.of(context).primaryText, - fontSize: 14.0, - letterSpacing: 0.0, - fontWeight: FontWeight.w500, - useGoogleFonts: GoogleFonts.asMap() - .containsKey('Plus Jakarta Sans'), - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).accent1, - width: 2.0, - ), - borderRadius: BorderRadius.circular(12.0), - ), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).accent3, - width: 2.0, - ), - borderRadius: BorderRadius.circular(12.0), - ), - errorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, - width: 2.0, - ), - borderRadius: BorderRadius.circular(12.0), - ), - focusedErrorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, - width: 2.0, - ), - borderRadius: BorderRadius.circular(12.0), - ), - filled: true, - fillColor: FlutterFlowTheme.of(context).primaryBackground, - contentPadding: - const EdgeInsetsDirectional.fromSTEB(24.0, 24.0, 20.0, 24.0), - suffixIcon: Icon( - Icons.email, - color: FlutterFlowTheme.of(context).accent1, - size: 22.0, + useGoogleFonts: GoogleFonts.asMap() + .containsKey('Plus Jakarta Sans'), ), + maxLines: null, + keyboardType: TextInputType.emailAddress, + cursorColor: FlutterFlowTheme.of(context).primary, + validator: _model.emailAddressTextControllerValidator + .asValidator(context), ), - style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: 'Plus Jakarta Sans', - color: FlutterFlowTheme.of(context).primaryText, - fontSize: 14.0, - letterSpacing: 0.0, - fontWeight: FontWeight.w500, - useGoogleFonts: GoogleFonts.asMap() - .containsKey('Plus Jakarta Sans'), - ), - maxLines: null, - keyboardType: TextInputType.emailAddress, - cursorColor: const Color(0xFF6F61EF), - validator: _model.emailAddressTextControllerValidator - .asValidator(context), ), ), ), @@ -250,36 +248,31 @@ class _ForgotPasswordTemplateComponentWidgetState child: Padding( padding: const EdgeInsetsDirectional.fromSTEB(0.0, 24.0, 0.0, 0.0), child: FFButtonWidget( - onPressed: () async { - _model.req = await PhpGroup.forgotPasswordCall.call( - email: _model.emailAddressTextController.text, - ); + onPressed: (_model.emailAddressTextController.text == '' || !ValidatorUtil.isValidEmail(_model.emailAddressTextController.text)) + ? null + : () async { - if (PhpGroup.forgotPasswordCall.error( - (_model.req?.jsonBody ?? ''), - ) == - false) { - Navigator.pop(context); - } else { - await showModalBottomSheet( - isScrollControlled: true, - backgroundColor: Colors.transparent, - enableDrag: false, - context: context, - builder: (context) { - return Padding( - padding: MediaQuery.viewInsetsOf(context), - child: ThrowExceptionWidget( - msg: PhpGroup.forgotPasswordCall.msg( - (_model.req?.jsonBody ?? ''), - )!, - ), - ); - }, - ).then((value) => safeSetState(() {})); + try { + _model.req = await PhpGroup.forgotPasswordCall.call( + email: _model.emailAddressTextController.text, + ); + + if (PhpGroup.forgotPasswordCall.error((_model.req?.jsonBody ?? '')) == false) { + await DialogUtil.success(context, FFLocalizations.of(context).getVariableText( + enText: "Send E-mail Successful!", + ptText: "E-mail Enviado com Sucesso!" + )); + Navigator.pop(context); + } else { + await DialogUtil.error(context, PhpGroup.forgotPasswordCall.msg((_model.req?.jsonBody ?? ''))!); + } + + setState(() {}); + + } catch (error, stack) { + LogUtil.requestAPIFailed("iforgot.php", _model.emailAddressTextController.text, "Recuperar Senha", error, stack); + await DialogUtil.errorDefault(context); } - - setState(() {}); }, text: FFLocalizations.of(context).getText( '74rnd5bu' /* Enviar */, @@ -289,24 +282,30 @@ class _ForgotPasswordTemplateComponentWidgetState height: 50.0, padding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0), iconPadding: - const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0), - color: const Color(0xFF1AAB5F), + const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0), + color: FlutterFlowTheme.of(context).primary, textStyle: FlutterFlowTheme.of(context).titleSmall.override( - fontFamily: 'Plus Jakarta Sans', - color: Colors.white, - fontSize: 16.0, - letterSpacing: 0.0, - fontWeight: FontWeight.w500, - useGoogleFonts: GoogleFonts.asMap() - .containsKey('Plus Jakarta Sans'), - ), + fontFamily: 'Plus Jakarta Sans', + color: Colors.white, + fontSize: 16.0, + letterSpacing: 0.0, + fontWeight: FontWeight.w500, + useGoogleFonts: GoogleFonts.asMap() + .containsKey('Plus Jakarta Sans'), + ), elevation: 3.0, borderSide: const BorderSide( color: Colors.transparent, width: 1.0, ), + disabledColor: + FlutterFlowTheme.of( + context) + .customColor5, + disabledTextColor: + Colors.white, ), - showLoadingIndicator: false, + showLoadingIndicator: true, ), ), ), diff --git a/lib/components/templates_components/sign_in_template_component/sign_in_template_component_widget.dart b/lib/components/templates_components/sign_in_template_component/sign_in_template_component_widget.dart index ae8cc9df..572d14f9 100644 --- a/lib/components/templates_components/sign_in_template_component/sign_in_template_component_widget.dart +++ b/lib/components/templates_components/sign_in_template_component/sign_in_template_component_widget.dart @@ -1,3 +1,9 @@ +import 'package:hub/components/atomic_components/shared_components_atoms/atom_image_svg_theme.dart'; +import 'package:hub/shared/components/atoms/atom_terms_of_use.dart'; +import 'package:hub/shared/utils/dialog_util.dart'; +import 'package:hub/shared/utils/log_util.dart'; +import 'package:hub/shared/utils/validator_util.dart'; + import '/components/templates_components/forgot_password_template_component/forgot_password_template_component_widget.dart'; import '/flutter_flow/flutter_flow_animations.dart'; import '/flutter_flow/flutter_flow_theme.dart'; @@ -93,6 +99,18 @@ class _SignInTemplateComponentWidgetState super.dispose(); } + bool _isFormInvalid() { + if (_model.emailAddressTextController.text == '' || _model.passwordTextController.text == '') { + return true; + } + + if (!ValidatorUtil.isValidEmail(_model.emailAddressTextController.text)) { + return true; + } + + return false; + } + @override Widget build(BuildContext context) { return Row( @@ -166,12 +184,7 @@ class _SignInTemplateComponentWidgetState decoration: const BoxDecoration(), child: ClipRRect( borderRadius: BorderRadius.circular(8.0), - child: Image.network( - 'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/sr43ucngg4a4/Vector.png', - width: 603.0, - height: 155.0, - fit: BoxFit.contain, - ), + child: const AtomImageSvgTheme(filename: 'login', width: 600, height: 155), ), ), Column( @@ -205,7 +218,7 @@ class _SignInTemplateComponentWidgetState Form( key: _model.formKey, autovalidateMode: - AutovalidateMode.always, + AutovalidateMode.onUserInteraction, child: Column( mainAxisSize: MainAxisSize.max, children: [ @@ -518,12 +531,7 @@ class _SignInTemplateComponentWidgetState .fromSTEB( 0.0, 0.0, 0.0, 16.0), child: FFButtonWidget( - onPressed: ((_model.emailAddressTextController - .text == - '') && - (_model.passwordTextController - .text == - '')) + onPressed: _isFormInvalid() ? null : () async { await action_blocks @@ -689,34 +697,25 @@ class _SignInTemplateComponentWidgetState .fromSTEB(0.0, 0.0, 0.0, 16.0), child: FFButtonWidget( - onPressed: (((_model.emailAddressTextController - .text == - '') || - ((_model.emailAddressFocusNode - ?.hasFocus ?? - false) != - null)) && - ((_model.emailAddressTextController - .text == - '') || - ((_model.passwordTextController.text == - '') || - ((_model.passwordFocusNode?.hasFocus ?? - false) != - null)))) + onPressed: _isFormInvalid() ? null : () async { - await action_blocks - .singInLoginAction( - context, - emailAdress: _model - .emailAddressTextController - .text, - password: _model - .passwordTextController - .text, - ); - setState(() {}); + try { + await action_blocks + .singInLoginAction( + context, + emailAdress: _model + .emailAddressTextController + .text, + password: _model + .passwordTextController + .text, + ); + setState(() {}); + } catch (e, s) { + await DialogUtil.errorDefault(context); + LogUtil.requestAPIFailed('login.php', _model.emailAddressTextController.text, "Login", e, s); + } }, text: FFLocalizations.of( context) @@ -778,8 +777,7 @@ class _SignInTemplateComponentWidgetState disabledColor: const Color(0xE81AAB5F), ), - showLoadingIndicator: - false, + showLoadingIndicator: true, ), ), ), @@ -876,21 +874,15 @@ class _SignInTemplateComponentWidgetState onTap: () async { await showModalBottomSheet( isScrollControlled: true, - backgroundColor: - Colors.transparent, - enableDrag: false, + backgroundColor: Colors.transparent, context: context, builder: (context) { return Padding( - padding: - MediaQuery.viewInsetsOf( - context), - child: - const ForgotPasswordTemplateComponentWidget(), + padding: MediaQuery.viewInsetsOf(context), + child: const ForgotPasswordTemplateComponentWidget(), ); }, - ).then( - (value) => safeSetState(() {})); + ).then((value) => safeSetState(() {})); }, child: RichText( textScaler: MediaQuery.of(context) @@ -936,29 +928,23 @@ class _SignInTemplateComponentWidgetState ), mouseCursor: SystemMouseCursors.click, - recognizer: - TapGestureRecognizer() - ..onTap = () async { - await showModalBottomSheet( - isScrollControlled: - true, - backgroundColor: - Colors - .transparent, - context: context, - builder: (context) { - return Padding( - padding: MediaQuery - .viewInsetsOf( - context), - child: - const ForgotPasswordTemplateComponentWidget(), - ); - }, - ).then((value) => - safeSetState( - () {})); - }, + // recognizer: TapGestureRecognizer() + // ..onTap = () async { + // await showModalBottomSheet( + // isScrollControlled: true, + // backgroundColor: Colors.transparent, + // context: context, + // useRootNavigator: true, + // builder: (context) { + // return Padding( + // padding: MediaQuery.viewInsetsOf(context), + // child: const ForgotPasswordTemplateComponentWidget(), + // ); + // }, + // ).then((value) => + // safeSetState( + // () {})); + // }, ) ], style: @@ -981,29 +967,7 @@ class _SignInTemplateComponentWidgetState ), ), ), - Text( - FFLocalizations.of(context).getText( - 'olf967cj' /* Termo de Uso */, - ), - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: - FlutterFlowTheme.of(context) - .bodyMediumFamily, - color: - FlutterFlowTheme.of(context) - .primaryText, - fontSize: 14.0, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts - .asMap() - .containsKey( - FlutterFlowTheme.of( - context) - .bodyMediumFamily), - ), - ), + const AtomTermsOfUse(), ], ), ), diff --git a/lib/flutter_flow/internationalization.dart b/lib/flutter_flow/internationalization.dart index 9123791e..1a825db4 100644 --- a/lib/flutter_flow/internationalization.dart +++ b/lib/flutter_flow/internationalization.dart @@ -569,8 +569,8 @@ final kTranslationsMap = >>[ // throwException { 'e58xxxiq': { - 'pt': 'ERRO', - 'en': 'ERROR', + 'pt': 'Falha :(', + 'en': 'Fail :(', }, }, // regisiterVistorTemplateComponent @@ -873,28 +873,28 @@ final kTranslationsMap = >>[ 'en': 'LET\'S GO! SIGN IN WITH YOUR ACCOUNT', }, '1ltg0ylb': { - 'pt': 'Email', - 'en': 'Email', + 'pt': 'E-mail', + 'en': 'E-mail', }, '2x19ce8k': { 'pt': 'Senha', 'en': 'Password', }, 'xhnawzcb': { - 'pt': 'Campo é necessário', - 'en': 'Field is required', + 'pt': 'E-mail é Obrigatório', + 'en': 'E-mail is required', }, 's3j1hjqx': { - 'pt': 'E-mail Inv', - 'en': '', + 'pt': 'E-mail Inválido', + 'en': 'Invalid E-mail', }, '2ib9bf67': { 'pt': 'Please choose an option from the dropdown', 'en': '', }, '9cs5wlmc': { - 'pt': 'Campo é necessário', - 'en': 'Field is required', + 'pt': 'Senha é Obrigatório', + 'en': 'Password is required', }, 'rkxwb0sg': { 'pt': 'Please choose an option from the dropdown', @@ -922,7 +922,7 @@ final kTranslationsMap = >>[ }, 'p5c6d54y': { 'pt': ' Recupere aqui', - 'en': ' recover here', + 'en': ' Recover here', }, 'olf967cj': { 'pt': 'Termo de Uso', @@ -1032,12 +1032,24 @@ final kTranslationsMap = >>[ 'Don\'t worry, we will help you, enter the email registered in the application and click send.', }, 'mtz8l7ft': { - 'pt': 'Email', - 'en': 'Email', + 'pt': 'E-mail', + 'en': 'E-mail', }, 'w7y5wlnv': { - 'pt': 'digite o seu email.....', - 'en': 'enter your email.....', + 'pt': '', + 'en': '', + }, + '3hqg8buh': { + 'pt': 'E-mail é Obrigatório', + 'en': 'E-mail is Required', + }, + 'jh5r2b1w': { + 'pt': 'E-mail Inválido', + 'en': 'Invalid E-mail', + }, + '1p76vmkn': { + 'pt': 'Please choose an option from the dropdown', + 'en': '', }, '74rnd5bu': { 'pt': 'Enviar', diff --git a/lib/main.dart b/lib/main.dart index 3348f78f..2590c721 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,5 +1,6 @@ import 'package:firebase_core/firebase_core.dart'; +import 'package:firebase_crashlytics/firebase_crashlytics.dart'; import 'package:hub/app_state.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/internationalization.dart'; @@ -29,6 +30,8 @@ void main() async { Future initializeApp() async { await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform); + FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterError; + await FlutterFlowTheme.initialize(); await FFLocalizations.initialize(); final appState = FFAppState(); @@ -57,6 +60,9 @@ class _MyAppState extends State { @override void initState() { super.initState(); + + FirebaseCrashlytics.instance.setCrashlyticsCollectionEnabled(true); + _appStateNotifier = AppStateNotifier.instance; _router = createRouter(_appStateNotifier); Future.delayed(const Duration(milliseconds: 1000), diff --git a/lib/pages/schedule_complete_visit_page/schedule_complete_visit_page_widget.dart b/lib/pages/schedule_complete_visit_page/schedule_complete_visit_page_widget.dart index 8b684610..e1fdf3b6 100644 --- a/lib/pages/schedule_complete_visit_page/schedule_complete_visit_page_widget.dart +++ b/lib/pages/schedule_complete_visit_page/schedule_complete_visit_page_widget.dart @@ -1773,7 +1773,7 @@ Widget scheduleVisit( : FocusScope.of(context).unfocus(), child: Padding( padding: MediaQuery.viewInsetsOf(context), - child: const ThrowExceptionWidget( + child: ThrowExceptionWidget( msg: 'Campos obrigatórios imcompletos.', ), ), diff --git a/lib/shared/components/atoms/atom_terms_of_use.dart b/lib/shared/components/atoms/atom_terms_of_use.dart new file mode 100644 index 00000000..e1f29b9b --- /dev/null +++ b/lib/shared/components/atoms/atom_terms_of_use.dart @@ -0,0 +1,40 @@ +import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; + +import '../../../flutter_flow/flutter_flow_theme.dart'; +import '../../../flutter_flow/flutter_flow_util.dart'; + +class AtomTermsOfUse extends StatelessWidget { + + const AtomTermsOfUse({super.key}); + + @override + Widget build(BuildContext context) { + return InkWell( + child: Text( + FFLocalizations.of(context).getText( + 'olf967cj' /* Termo de Uso */, + ), + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: + FlutterFlowTheme.of(context) + .bodyMediumFamily, + color: + FlutterFlowTheme.of(context) + .primaryText, + fontSize: 14.0, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts + .asMap() + .containsKey( + FlutterFlowTheme.of( + context) + .bodyMediumFamily), + ), + ), + onTap: () => launchURL('https://freaccess.com.br/pp'), + ); + } +} \ No newline at end of file diff --git a/lib/shared/enums/enum_throw_exception.dart b/lib/shared/enums/enum_throw_exception.dart new file mode 100644 index 00000000..f1bf2a08 --- /dev/null +++ b/lib/shared/enums/enum_throw_exception.dart @@ -0,0 +1,5 @@ +enum EnumThrowException { + success, + error, + warning +} \ No newline at end of file diff --git a/lib/shared/utils/dialog_util.dart b/lib/shared/utils/dialog_util.dart new file mode 100644 index 00000000..6db1ed89 --- /dev/null +++ b/lib/shared/utils/dialog_util.dart @@ -0,0 +1,59 @@ + +import 'package:flutter/material.dart'; +import 'package:hub/components/molecular_components/throw_exception/throw_exception_widget.dart'; +import 'package:hub/flutter_flow/flutter_flow_util.dart'; +import 'package:hub/shared/enums/enum_throw_exception.dart'; + +class DialogUtil { + static const double _height = 350; + + static Future errorDefault(BuildContext context) { + return error(context, FFLocalizations.of(context).getVariableText( + ptText: "Falha ao efetuar operação, Tente Novamente mais tarde.", + enText: "Failed to perform operation, please try again later." + )); + } + + static Future error(BuildContext context, String message) async { + return await showDialog( + context: context, + builder: (context) { + return Dialog( + child: SizedBox( + height: _height, + child: Padding(padding: MediaQuery.viewInsetsOf(context), child: ThrowExceptionWidget(msg: message, type: EnumThrowException.error)) + ) + ); + } + ); + } + + static Future warning(BuildContext context, String message) async { + return await showDialog( + context: context, + builder: (context) { + return Dialog( + child: SizedBox( + height: _height, + child: Padding(padding: MediaQuery.viewInsetsOf(context), child: ThrowExceptionWidget(msg: message, type: EnumThrowException.warning)) + ) + ); + } + ); + } + + static Future success(BuildContext context, String message) async { + return await showDialog( + context: context, + builder: (context) { + return Dialog( + child: SizedBox( + height: _height, + child: Padding(padding: MediaQuery.viewInsetsOf(context), child: ThrowExceptionWidget(msg: message, type: EnumThrowException.success)) + ) + ); + } + ); + } + +} \ No newline at end of file diff --git a/lib/shared/utils/log_util.dart b/lib/shared/utils/log_util.dart new file mode 100644 index 00000000..64a30e12 --- /dev/null +++ b/lib/shared/utils/log_util.dart @@ -0,0 +1,15 @@ +import 'dart:developer'; + +import 'package:firebase_crashlytics/firebase_crashlytics.dart'; +import 'package:hub/backend/api_requests/api_calls.dart'; + +class LogUtil { + + static void requestAPIFailed(String url, String body, String reason, dynamic error, StackTrace stack) async { + FirebaseCrashlytics.instance.setCustomKey('URL', "${PhpGroup.getBaseUrl()}/$url"); + FirebaseCrashlytics.instance.setCustomKey('Body', body); + + await FirebaseCrashlytics.instance.recordError(error, stack, reason: reason); + } + +} \ No newline at end of file diff --git a/lib/shared/utils/validator_util.dart b/lib/shared/utils/validator_util.dart new file mode 100644 index 00000000..71e83154 --- /dev/null +++ b/lib/shared/utils/validator_util.dart @@ -0,0 +1,10 @@ +class ValidatorUtil { + + static bool isValidEmail(String email) { + if (RegExp(r'^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$').hasMatch(email)) { + return true; + } else { + return false; + } + } +} \ No newline at end of file diff --git a/pubspec.lock b/pubspec.lock index a64d3263..db941ddb 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -345,6 +345,22 @@ packages: url: "https://pub.dev" source: hosted version: "2.17.2" + firebase_crashlytics: + dependency: "direct main" + description: + name: firebase_crashlytics + sha256: ad7510d9bcf1f40fc895944942f553a4c5603acb4715c0d6386dd587f82f6ae5 + url: "https://pub.dev" + source: hosted + version: "4.0.1" + firebase_crashlytics_platform_interface: + dependency: transitive + description: + name: firebase_crashlytics_platform_interface + sha256: "318589f1da3bb858872002fa20170234566f0fb080669a8256c85a81513a802a" + url: "https://pub.dev" + source: hosted + version: "3.6.37" firebase_messaging: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 276cf9cc..8efce314 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -107,6 +107,7 @@ dependencies: flutter_riverpod: ^2.5.1 qr_flutter: ^4.1.0 permission_handler: ^11.3.1 + firebase_crashlytics: ^4.0.1 dependency_overrides: http: 1.2.1