From 4b9792c34abe20f00058b93c3b40558a2556c722 Mon Sep 17 00:00:00 2001 From: Kingkor Roy Tirtho Date: Wed, 14 Sep 2022 22:54:00 +0600 Subject: [PATCH] fix(auth): Android login local server not starting --- lib/components/Login/LoginForm.dart | 10 ++++++++++ lib/utils/service_utils.dart | 8 ++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/components/Login/LoginForm.dart b/lib/components/Login/LoginForm.dart index c315b410..e2078b12 100644 --- a/lib/components/Login/LoginForm.dart +++ b/lib/components/Login/LoginForm.dart @@ -62,6 +62,16 @@ class LoginForm extends HookConsumerWidget { const SizedBox(height: 20), ElevatedButton( onPressed: () async { + if (clientSecretController.text.isEmpty || + clientIdController.text.isEmpty) { + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar( + content: Text("Please fill in all fields"), + behavior: SnackBarBehavior.floating, + ), + ); + return; + } await handleLogin(authState); }, child: const Text("Submit"), diff --git a/lib/utils/service_utils.dart b/lib/utils/service_utils.dart index 315c24ee..574899c8 100644 --- a/lib/utils/service_utils.dart +++ b/lib/utils/service_utils.dart @@ -184,8 +184,12 @@ abstract class ServiceUtils { mode: LaunchMode.externalApplication, ); - HttpServer server = - await HttpServer.bind(InternetAddress.loopbackIPv4, 4304); + HttpServer server = await HttpServer.bind( + InternetAddress.loopbackIPv4, + 4304, + shared: true, + ); + logger.i("[connectIpc] Server started"); await for (HttpRequest request in server) {