From 80167378d9f3fecd81f9061105731885bdeb4fc2 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 6 Dec 2023 15:42:21 +0300 Subject: [PATCH] lat long fixes --- lib/core/service/client/base_app_client.dart | 13 ++++++++++--- lib/splashPage.dart | 9 ++++----- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 34a0a753..a397a928 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -79,8 +79,11 @@ class BaseAppClient { body['generalid'] = GENERAL_ID; // body['isVidaPlus'] = true; - body['Latitude'] = await AppSharedPreferences().getDouble(USER_LAT); - body['Longitude'] = await AppSharedPreferences().getDouble(USER_LONG); + double lat = await AppSharedPreferences().getDouble(USER_LAT); + double long = await AppSharedPreferences().getDouble(USER_LONG); + + body['Latitude'] = lat == null ? 0.0 : lat; + body['Longitude'] = long == null ? 0.0 : long; if (body.containsKey('isDentalAllowedBackend')) { body['isDentalAllowedBackend'] = body.containsKey('isDentalAllowedBackend') @@ -90,7 +93,11 @@ class BaseAppClient { : IS_DENTAL_ALLOWED_BACKEND; } - body['DeviceTypeID'] = Platform.isIOS ? 1 : await Utils.isGoogleServicesAvailable() ? 2 : 3; + body['DeviceTypeID'] = Platform.isIOS + ? 1 + : await Utils.isGoogleServicesAvailable() + ? 2 + : 3; if (!body.containsKey('IsPublicRequest')) { // if (!body.containsKey('PatientType')) { diff --git a/lib/splashPage.dart b/lib/splashPage.dart index b8293e0f..290bbac0 100644 --- a/lib/splashPage.dart +++ b/lib/splashPage.dart @@ -43,11 +43,6 @@ class _SplashScreenState extends State { }); }, ); - - // AppSharedPreferences().getAll().then((value) { - // debugPrint("ALL SHARED PREFERENCES!!!!!"); - // debugPrint(jsonEncode(value)); - // }); } /// load the Privilege from service @@ -63,6 +58,10 @@ class _SplashScreenState extends State { var themeNotifier = Provider.of(context, listen: false); themeNotifier.setTheme(defaultTheme(fontName: projectProvider.isArabic ? 'Cairo' : 'Poppins')); PushNotificationHandler(context).init(); // Asyncronously + AppSharedPreferences().getAll().then((value) { + // debugPrint("ALL SHARED PREFERENCES!!!!!"); + // debugPrint(jsonEncode(value)); + }); } @override