diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 62b3c51..4de366e 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,4 +1,5 @@ + userRegister({ required Map data, }) async { - try { final uri = ApiHelper.getUri(urlEndpoint: ApiEndpoints.createUserApiEndpoint); - var res = await http.post(uri, body: data); + var res = await http.post(uri, body: data) + .timeout(const Duration(seconds: 7)); return res; - } catch (e) { - throw Exception(e); - } + } } diff --git a/lib/features/auth/screens/signup_screen_2.dart b/lib/features/auth/screens/signup_screen_2.dart index 122d56f..febbe65 100644 --- a/lib/features/auth/screens/signup_screen_2.dart +++ b/lib/features/auth/screens/signup_screen_2.dart @@ -28,10 +28,10 @@ class _SignupScreenTwoState extends State { final _pwdController = TextEditingController(text: authStore.password); void login() { - navigateToNextScreen(nextScreen: const LoginScreen(), context: context); + navigateToNextScreen(nextScreen: const LoginScreen(), context: context); } - void signupNow() async { + void signupNow() { if (!isValidate(_phoneNumberController.text)) { showMessage(message: 'Please Enter Valid Phone Number', context: context); return; @@ -46,7 +46,7 @@ class _SignupScreenTwoState extends State { context: context); return; } - await authStore.userSignUp(); + authStore.userSignUp(); } void showValidateDialog(BuildContext context, Builder builder) { @@ -54,16 +54,17 @@ class _SignupScreenTwoState extends State { context: context, builder: (BuildContext context) { return Dialog( - backgroundColor: Colors.transparent, child: BackdropFilter( - filter: - ImageFilter.blur(sigmaX: 10, sigmaY: 10), child: Container( + backgroundColor: Colors.transparent, + child: BackdropFilter( + filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), + child: Container( padding: const EdgeInsets.all(16), decoration: BoxDecoration( - color: Colors.white - .withOpacity(0.2), borderRadius: BorderRadius.circular(20), + color: Colors.white.withOpacity(0.2), + borderRadius: BorderRadius.circular(20), border: Border.all( - color: Colors.white - .withOpacity(0.3), width: 1.5, + color: Colors.white.withOpacity(0.3), + width: 1.5, ), ), child: const Text("Account created"), @@ -118,7 +119,6 @@ class _SignupScreenTwoState extends State { return Scaffold( appBar: AppBar( centerTitle: true, - title: const Text('One more step'), leading: IconButton( onPressed: () { diff --git a/lib/features/auth/stores/auth_store.dart b/lib/features/auth/stores/auth_store.dart index d609992..f66105c 100644 --- a/lib/features/auth/stores/auth_store.dart +++ b/lib/features/auth/stores/auth_store.dart @@ -23,7 +23,6 @@ abstract class Auth with Store { @observable bool isLoading = false; - @observable bool isSuccessfullyLoggedin = false; @@ -63,7 +62,7 @@ abstract class Auth with Store { final userJson = data['user']; appState.currentUser = User.fromJson(userJson); final userJsonString = jsonEncode(userJson); - sp.setString('userJsonString', userJsonString); + sp.setString('userJsonString', userJsonString); final expire = data['authentication']['payload']['exp'] as int; isSuccessfullyLoggedin = true; await sp.setInt('exp', expire); @@ -88,6 +87,7 @@ abstract class Auth with Store { appState.authError = const AuthErrorUnknownIssue(); } finally { isLoading = false; + isSuccessfullyLoggedin = false; } } @@ -103,7 +103,7 @@ abstract class Auth with Store { "mobileNumber": mobileNumber, }); if (res != null && res.statusCode == 201) { - currentAuthScreen = AuthScreens.loginScreen; + currentAuthScreen = AuthScreens.loginScreen; } else if (res != null && res.statusCode == 409) { appState.currentUser = null; } diff --git a/lib/main.dart b/lib/main.dart index d77614c..b225e1f 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -41,7 +41,7 @@ class MyApp extends StatelessWidget { final isSuccess = authStore.isSuccessfullyLoggedin; if (!isLoading && authError != null) { showError(context, authError.errorDescription, - authError.errorString); + authError.errorString,); appState.authError = null; } if (isSuccess) { diff --git a/pubspec.lock b/pubspec.lock index 3b9a2d1..d9740b2 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,18 +5,23 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: "0b2f2bd91ba804e53a61d757b986f89f1f9eaed5b11e4b2f5a2468d86d6c9fc7" + sha256: f256b0c0ba6c7577c15e2e4e114755640a875e885099367bf6e012b19314c834 url: "https://pub.dev" source: hosted - version: "67.0.0" + version: "72.0.0" + _macros: + dependency: transitive + description: dart + source: sdk + version: "0.3.2" analyzer: dependency: transitive description: name: analyzer - sha256: "37577842a27e4338429a1cbc32679d508836510b056f1eedf0c8d20e39c1383d" + sha256: b652861553cd3990d8ed361f7979dc6d7053a9ac8843fa73820ab68ce5410139 url: "https://pub.dev" source: hosted - version: "6.4.1" + version: "6.7.0" archive: dependency: transitive description: @@ -85,18 +90,18 @@ packages: dependency: "direct dev" description: name: build_runner - sha256: "644dc98a0f179b872f612d3eb627924b578897c629788e858157fa5e704ca0c7" + sha256: dd09dd4e2b078992f42aac7f1a622f01882a8492fef08486b27ddde929c19f04 url: "https://pub.dev" source: hosted - version: "2.4.11" + version: "2.4.12" build_runner_core: dependency: transitive description: name: build_runner_core - sha256: e3c79f69a64bdfcd8a776a3c28db4eb6e3fb5356d013ae5eb2e52007706d5dbe + sha256: f8126682b87a7282a339b871298cc12009cb67109cfa1614d6436fb0289193e0 url: "https://pub.dev" source: hosted - version: "7.3.1" + version: "7.3.2" built_collection: dependency: transitive description: @@ -165,10 +170,10 @@ packages: dependency: transitive description: name: crypto - sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + sha256: ec30d999af904f33454ba22ed9a86162b35e52b44ac4807d1d93c288041d7d27 url: "https://pub.dev" source: hosted - version: "3.0.3" + version: "3.0.5" cupertino_icons: dependency: "direct main" description: @@ -197,10 +202,10 @@ packages: dependency: transitive description: name: ffi - sha256: "493f37e7df1804778ff3a53bd691d8692ddf69702cf4c1c1096a2e41b4779e21" + sha256: "16ed7b077ef01ad6170a3d0c57caa4a112a38d7a2ed5602e0aca9ca6f3d98da6" url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.3" file: dependency: transitive description: @@ -384,6 +389,14 @@ packages: url: "https://pub.dev" source: hosted version: "3.1.2" + macros: + dependency: transitive + description: + name: macros + sha256: "0acaed5d6b7eab89f63350bccd82119e6c602df0f391260d0e32b5e23db79536" + url: "https://pub.dev" + source: hosted + version: "0.1.2-main.4" matcher: dependency: transitive description: @@ -540,10 +553,10 @@ packages: dependency: "direct main" description: name: shared_preferences - sha256: c272f9cabca5a81adc9b0894381e9c1def363e980f960fa903c604c471b22f68 + sha256: "746e5369a43170c25816cc472ee016d3a66bc13fcf430c0bc41ad7b4b2922051" url: "https://pub.dev" source: hosted - version: "2.3.1" + version: "2.3.2" shared_preferences_android: dependency: transitive description: @@ -556,10 +569,10 @@ packages: dependency: transitive description: name: shared_preferences_foundation - sha256: "776786cff96324851b656777648f36ac772d88bc4c669acff97b7fce5de3c849" + sha256: c4b35f6cb8f63c147312c054ce7c2254c8066745125264f0c88739c417fc9d9f url: "https://pub.dev" source: hosted - version: "2.5.1" + version: "2.5.2" shared_preferences_linux: dependency: transitive description: @@ -729,10 +742,10 @@ packages: dependency: transitive description: name: url_launcher_android - sha256: "94d8ad05f44c6d4e2ffe5567ab4d741b82d62e3c8e288cc1fcea45965edf47c9" + sha256: e35a698ac302dd68e41f73250bd9517fe3ab5fa4f18fe4647a0872db61bacbab url: "https://pub.dev" source: hosted - version: "6.3.8" + version: "6.3.10" url_launcher_ios: dependency: transitive description: @@ -846,5 +859,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.4.0 <4.0.0" - flutter: ">=3.22.0" + dart: ">=3.5.0 <4.0.0" + flutter: ">=3.24.0"