From a0baaac3141b4aabc95892b5de29bfdb9bd08251 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Sat, 19 Dec 2020 13:18:23 +0300 Subject: [PATCH] bug fixes --- lib/core/service/weather_service.dart | 1 + lib/pages/landing/landing_page.dart | 39 +++++++++++++------ lib/pages/login/confirm-login.dart | 3 ++ .../authentication/auth_provider.dart | 2 +- lib/widgets/drawer/app_drawer_widget.dart | 2 +- lib/widgets/otp/sms-popup.dart | 11 +++--- 6 files changed, 40 insertions(+), 18 deletions(-) diff --git a/lib/core/service/weather_service.dart b/lib/core/service/weather_service.dart index 679a4c9d..10ab1adf 100644 --- a/lib/core/service/weather_service.dart +++ b/lib/core/service/weather_service.dart @@ -21,6 +21,7 @@ class WeatherService extends BaseService { await baseAppClient.post(WEATHER_INDICATOR, onSuccess: (dynamic response, int statusCode) { + weatherIndicatorData = []; response['GetCityInfo_List'].forEach((data) { weatherIndicatorData.add(GetCityInfoList.fromJson(data)); }); diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index bb629f6b..fe4e82ca 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -516,14 +516,15 @@ class _LandingPageState extends State with WidgetsBindingObserver { // ); // themeNotifier.setTheme(defaultTheme); } - void checkUserStatus(token) async { - //GifLoaderDialogUtils.showMyDialog(context); - authService - .selectDeviceImei(token) - .then((SelectDeviceIMEIRES value) => setUserValues(value)) - .catchError((err) { - //GifLoaderDialogUtils.hideDialog(context); - }); + void checkUserStatus(token, {isLoader}) async { + if (isLoader) + //GifLoaderDialogUtils.showMyDialog(context); + authService + .selectDeviceImei(token) + .then((SelectDeviceIMEIRES value) => setUserValues(value)) + .catchError((err) { + //GifLoaderDialogUtils.hideDialog(context); + }); } static Future myBackgroundMessageHandler( @@ -560,9 +561,25 @@ class _LandingPageState extends State with WidgetsBindingObserver { if (data != null) { Navigator.of(context).pushNamed(CONFIRM_LOGIN); } else { - Navigator.of(context).pushNamed( - WELCOME_LOGIN, - ); + GifLoaderDialogUtils.showMyDialog(context); + authService + .selectDeviceImei(DEVICE_TOKEN) + .then((SelectDeviceIMEIRES value) { + GifLoaderDialogUtils.hideDialog(context); + if (value != null) { + setUserValues(value); + Navigator.of(context).pushNamed(CONFIRM_LOGIN); + } else { + Navigator.of(context).pushNamed( + WELCOME_LOGIN, + ); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + Navigator.of(context).pushNamed( + WELCOME_LOGIN, + ); + }); } } diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index a3537e54..37ce9bc2 100644 --- a/lib/pages/login/confirm-login.dart +++ b/lib/pages/login/confirm-login.dart @@ -540,6 +540,9 @@ class _ConfirmLogin extends State { .catchError((err) { print(err); GifLoaderDialogUtils.hideDialog(context); + Future.delayed(Duration(seconds: 1), () { + AppToast.showErrorToast(message: err); + }); }); } diff --git a/lib/services/authentication/auth_provider.dart b/lib/services/authentication/auth_provider.dart index d4e6dd22..8f0ea470 100644 --- a/lib/services/authentication/auth_provider.dart +++ b/lib/services/authentication/auth_provider.dart @@ -258,7 +258,7 @@ class AuthProvider with ChangeNotifier { sharedPref.setString(BLOOD_TYPE, localRes['PatientBloodType']); return Future.value(localRes); } catch (error) { - throw error; + throw localRes; //return Future.value(error); } } diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index 3a80c598..0f6f60db 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -370,7 +370,7 @@ class _AppDrawerState extends State { "https://apps.apple.com/sa/app/dr-suliaman-alhabib/id733503978"); } else { launch( - "https://play.google.com/store/apps/details?id=com.ejada.hmg&hl=en"); + "https://play.google.com/store/apps/details?id=com.cloud.diplomaticquarterapp&hl=en"); } }, ), diff --git a/lib/widgets/otp/sms-popup.dart b/lib/widgets/otp/sms-popup.dart index 1694f675..703886d0 100644 --- a/lib/widgets/otp/sms-popup.dart +++ b/lib/widgets/otp/sms-popup.dart @@ -114,7 +114,7 @@ class SMSOTP { textInputAction: TextInputAction.next, style: buildTextStyle(), autofocus: true, - // maxLength: 1, + maxLength: 1, controller: digit1, textAlign: TextAlign.center, keyboardType: TextInputType.number, @@ -141,7 +141,7 @@ class SMSOTP { child: TextFormField( focusNode: focusD2, textInputAction: TextInputAction.next, - // maxLength: 1, + maxLength: 1, controller: digit2, textAlign: TextAlign.center, style: buildTextStyle(), @@ -168,7 +168,7 @@ class SMSOTP { child: TextFormField( focusNode: focusD3, textInputAction: TextInputAction.next, - // maxLength: 1, + maxLength: 1, controller: digit3, textAlign: TextAlign.center, style: buildTextStyle(), @@ -194,7 +194,7 @@ class SMSOTP { width: SizeConfig.realScreenWidth * 0.15, child: TextFormField( focusNode: focusD4, - // maxLength: 1, + maxLength: 1, textAlign: TextAlign.center, style: buildTextStyle(), controller: digit4, @@ -242,8 +242,9 @@ class SMSOTP { InputDecoration buildInputDecoration(BuildContext context) { return InputDecoration( + counterText: " ", // ts/images/password_icon.png - contentPadding: EdgeInsets.only(top: 20, bottom: 20), + // contentPadding: EdgeInsets.only(top: 20, bottom: 20), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.black),