This commit is contained in:
Hamza-Ayed
2024-09-08 18:25:13 +03:00
parent a40c6851ee
commit 3135187408
5 changed files with 62 additions and 77 deletions

View File

@@ -55,8 +55,8 @@ android {
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion 23 minSdkVersion 23
targetSdkVersion 34 targetSdkVersion 34
versionCode 61 versionCode 62
versionName '1.5.61' versionName '1.5.62'
// manifestPlaceholders = [mapsApiKey: 'android/app/src/main/AndroidManifest.xml'] // manifestPlaceholders = [mapsApiKey: 'android/app/src/main/AndroidManifest.xml']
} }

View File

@@ -37,11 +37,11 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>49</string> <string>50</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>4.3.49</string> <string>4.3.50</string>
<key>FirebaseAppDelegateProxyEnabled</key> <key>FirebaseAppDelegateProxyEnabled</key>
<string>NO</string> <string>NO</string>
<key>GMSApiKey</key> <key>GMSApiKey</key>

View File

@@ -203,12 +203,6 @@ class LoginController extends GetxController {
} }
} }
goToMapPage() {
if (box.read(BoxName.email) != null) {
Get.offAll(() => const MapPagePassenger());
}
}
final location = Location(); final location = Location();
// late PermissionStatus permissionGranted = PermissionStatus.denied; // late PermissionStatus permissionGranted = PermissionStatus.denied;
@@ -246,10 +240,10 @@ class LoginController extends GetxController {
void onInit() async { void onInit() async {
// permissionLocation = await Permission.locationWhenInUse.isGranted; // permissionLocation = await Permission.locationWhenInUse.isGranted;
await getAppTester(AppInformation.appName); await getAppTester(AppInformation.appName);
if (isTest == 0 && box.read(BoxName.passengerID) != null) { // if (isTest == 0 && box.read(BoxName.passengerID) != null) {
await loginUsingCredentials( // // await loginUsingCredentials(
box.read(BoxName.passengerID), box.read(BoxName.email)); // // box.read(BoxName.passengerID), box.read(BoxName.email));
} // }
super.onInit(); super.onInit();
} }
} }

View File

@@ -2603,58 +2603,44 @@ class MapPassengerController extends GetxController {
Future<void> getLocation() async { Future<void> getLocation() async {
isLoading = true; isLoading = true;
update(); update();
bool serviceEnabled;
try { PermissionStatus permissionGranted;
// Perform permission and service checks in parallel // dialoge();
final results = await Future.wait([
location.serviceEnabled(),
location.hasPermission(),
]);
bool serviceEnabled = results[0] as bool; // Cast to bool
PermissionStatus permissionGranted =
results[1] as PermissionStatus; // Cast to PermissionStatus
// Check if location services are enabled // Check if location services are enabled
serviceEnabled = await location.serviceEnabled();
if (!serviceEnabled) { if (!serviceEnabled) {
serviceEnabled = await location.requestService(); serviceEnabled = await location.requestService();
if (!serviceEnabled) { if (!serviceEnabled) {
// Location services are still not enabled, handle the error // Location services are still not enabled, handle the error
isLoading = false;
update();
return; return;
} }
} }
// Check if the app has permission to access location // Check if the app has permission to access location
permissionGranted = await location.hasPermission();
if (permissionGranted == PermissionStatus.denied) { if (permissionGranted == PermissionStatus.denied) {
permissionGranted = await location.requestPermission(); permissionGranted = await location.requestPermission();
if (permissionGranted != PermissionStatus.granted) { if (permissionGranted != PermissionStatus.granted) {
// Location permission is still not granted, handle the error // Location permission is still not granted, handle the error
isLoading = false;
update();
return; return;
} }
} }
// Request updated location with medium accuracy (faster) // Configure location accuracy
// LocationAccuracy desiredAccuracy = LocationAccuracy.high;
// Get the current location
LocationData _locationData = await location.getLocation(); LocationData _locationData = await location.getLocation();
passengerLocation = passengerLocation =
LatLng(_locationData.latitude!, _locationData.longitude!); (_locationData.latitude != null && _locationData.longitude != null
? LatLng(_locationData.latitude!, _locationData.longitude!)
// Process location data : null)!;
getLocationArea(passengerLocation.latitude, passengerLocation.longitude); getLocationArea(passengerLocation.latitude, passengerLocation.longitude);
newStartPointLocation = passengerLocation; newStartPointLocation = passengerLocation;
speed = _locationData.speed!; speed = _locationData.speed!;
// //print location details
// Update loading state
isLoading = false; isLoading = false;
update(); update();
} catch (e) {
// Handle exceptions (optional logging)
isLoading = false;
update();
}
} }
LatLngBounds calculateBounds( LatLngBounds calculateBounds(

View File

@@ -1,12 +1,17 @@
import 'package:SEFER/constant/api_key.dart';
import 'package:SEFER/constant/box_name.dart'; import 'package:SEFER/constant/box_name.dart';
import 'package:SEFER/main.dart'; import 'package:SEFER/main.dart';
import 'package:SEFER/views/auth/sms_verfy_page.dart'; import 'package:SEFER/views/auth/sms_verfy_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart';
import '../../../constant/char_map.dart';
import '../../../constant/colors.dart'; import '../../../constant/colors.dart';
import '../../../constant/credential.dart';
import '../../../constant/links.dart';
import '../../../controller/firebase/firbase_messge.dart'; import '../../../controller/firebase/firbase_messge.dart';
import '../../../controller/functions/audio_record1.dart'; import '../../../controller/functions/audio_record1.dart';
import '../../../controller/functions/crud.dart';
import '../../../controller/functions/tts.dart'; import '../../../controller/functions/tts.dart';
import '../../../controller/home/map_passenger_controller.dart'; import '../../../controller/home/map_passenger_controller.dart';
@@ -142,12 +147,13 @@ GetBuilder<MapPassengerController> leftMainMenuIcons() {
// 'name,fullName,address,idNumber,cardId,dob', // 'name,fullName,address,idNumber,cardId,dob',
// AppLink.uploadEgypt, // AppLink.uploadEgypt,
// 'idFront'); // 'idFront');
//
// // await ImageController().choosImage( // await ImageController().choosImage(
// // 'https://api.sefer.live/sefer/uploadEgypt.php', // 'https://api.sefer.live/sefer/uploadEgypt.php',
// // 'FrontId'); // 'FrontId');
// AC credentials = AC(); // AC credentials = AC();
// String apiKey = 'zjujl_qvo_fwjfgjlXrXlBl'; // String apiKey =
// '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';
// String convertedStringN = credentials.c( // String convertedStringN = credentials.c(
// credentials.c(credentials.c(apiKey, cs), cC), cn); // credentials.c(credentials.c(apiKey, cs), cC), cn);
@@ -160,11 +166,10 @@ GetBuilder<MapPassengerController> leftMainMenuIcons() {
// print('retrievedStringS ---$retrievedStringS'); // print('retrievedStringS ---$retrievedStringS');
// print('same'); // print('same');
// } // }
//
// // await Get.find<PaymentController>() // await Get.find<PaymentController>()
// // .payWithPayMob(context, '1100', 'EGP'); // .payWithPayMob(context, '1100', 'EGP');
// // Initiates a payment with a card using the FlutterPaymob instance // Initiates a payment with a card using the FlutterPaymob instance
//
// }, // },
// icon: const Icon( // icon: const Icon(
// // Get.put(AudioRecorderController()).isRecording // // Get.put(AudioRecorderController()).isRecording