Update: 2026-07-14 19:10:36
This commit is contained in:
@@ -558,39 +558,47 @@ class LoginController extends GetxController {
|
||||
// Check if location services are enabled
|
||||
serviceEnabled = await location.serviceEnabled();
|
||||
if (!serviceEnabled) {
|
||||
serviceEnabled = await location.requestService();
|
||||
if (Platform.isAndroid) {
|
||||
serviceEnabled = await location.requestService();
|
||||
}
|
||||
if (!serviceEnabled) {
|
||||
// Location services are still not enabled, handle the error
|
||||
// Location services are still not enabled, show a message
|
||||
mySnackbarError('Please enable location services in your device settings to continue.'.tr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the app has permission to access location
|
||||
permissionGranted = await location.hasPermission();
|
||||
|
||||
if (permissionGranted == loc.PermissionStatus.deniedForever) {
|
||||
mySnackbarError('Please go to app settings and grant location permission.'.tr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (permissionGranted == loc.PermissionStatus.denied) {
|
||||
|
||||
|
||||
permissionGranted = await location.requestPermission();
|
||||
if (permissionGranted != loc.PermissionStatus.granted) {
|
||||
if (permissionGranted != loc.PermissionStatus.granted && permissionGranted != loc.PermissionStatus.grantedLimited) {
|
||||
// Location permission is still not granted, handle the error
|
||||
permissionGranted = await location.requestPermission();
|
||||
if (permissionGranted != loc.PermissionStatus.granted) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize geofencing now that we have permission
|
||||
if (Platform.isAndroid || Platform.isIOS) {
|
||||
await SiroGeofencingService.initAndStart();
|
||||
mySnackbarError('Location permission is required to use the app. Please grant permission.'.tr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize geofencing now that we have permission
|
||||
if (Platform.isAndroid || Platform.isIOS) {
|
||||
await SiroGeofencingService.initAndStart();
|
||||
}
|
||||
|
||||
if (permissionGranted.toString() == 'PermissionStatus.granted' ||
|
||||
permissionGranted == loc.PermissionStatus.granted) {
|
||||
permissionGranted == loc.PermissionStatus.granted ||
|
||||
permissionGranted == loc.PermissionStatus.grantedLimited) {
|
||||
box.write(BoxName.locationPermission, 'true');
|
||||
}
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
// ─────────────────────────────────────────────────────────────
|
||||
// sendPassengerLocation: تسجيل موقع فتح التطبيق للراكب
|
||||
// ─────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -2,7 +2,7 @@ name: siro_rider
|
||||
description: "A new Flutter project."
|
||||
publish_to: "none" # Remove this line if you wish to publish to pub.dev
|
||||
|
||||
version: 1.0.5+5
|
||||
version: 1.0.6+6
|
||||
|
||||
environment:
|
||||
sdk: ">=3.0.5 <4.0.0"
|
||||
|
||||
Reference in New Issue
Block a user