Update: 2026-07-10 22:31:26
This commit is contained in:
@@ -159,11 +159,9 @@ class CountryLogic {
|
||||
if (!serviceEnabled) return null;
|
||||
|
||||
LocationPermission permission = await Geolocator.checkPermission();
|
||||
if (permission == LocationPermission.denied) {
|
||||
permission = await Geolocator.requestPermission();
|
||||
if (permission == LocationPermission.denied) return null;
|
||||
if (permission == LocationPermission.denied || permission == LocationPermission.deniedForever) {
|
||||
return null;
|
||||
}
|
||||
if (permission == LocationPermission.deniedForever) return null;
|
||||
|
||||
final pos = await Geolocator.getCurrentPosition(
|
||||
desiredAccuracy: LocationAccuracy.low,
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:siro_rider/services/geofencing_service.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class GeoLocation {
|
||||
Future<Position> getCurrentLocation() async {
|
||||
@@ -15,6 +17,23 @@ class GeoLocation {
|
||||
|
||||
permission = await Geolocator.checkPermission();
|
||||
if (permission == LocationPermission.denied) {
|
||||
// Prominent Disclosure for Background Location
|
||||
bool? userAgreed = await Get.defaultDialog<bool>(
|
||||
title: 'صلاحية الموقع'.tr,
|
||||
middleText: 'يجمع تطبيق سيرو بيانات الموقع لتفعيل ميزة التتبع الجغرافي (Geofence) ولتمكين السائق من الوصول إليك بدقة وتتبع رحلتك حتى عندما يكون التطبيق في الخلفية أو مغلقاً.'.tr,
|
||||
titleStyle: const TextStyle(fontWeight: FontWeight.bold),
|
||||
textConfirm: 'موافق'.tr,
|
||||
textCancel: 'إلغاء'.tr,
|
||||
confirmTextColor: Colors.white,
|
||||
onConfirm: () => Get.back(result: true),
|
||||
onCancel: () => Get.back(result: false),
|
||||
barrierDismissible: false,
|
||||
);
|
||||
|
||||
if (userAgreed != true) {
|
||||
return Future.error('Location permissions are denied');
|
||||
}
|
||||
|
||||
permission = await Geolocator.requestPermission();
|
||||
if (permission == LocationPermission.denied) {
|
||||
// Permissions are denied, we cannot fetch the location.
|
||||
|
||||
Reference in New Issue
Block a user