This commit is contained in:
Hamza-Ayed
2025-03-08 19:35:09 +03:00
parent d41314cfed
commit 5a4664ed67
30 changed files with 433 additions and 306 deletions

View File

@@ -2,9 +2,12 @@ import UIKit
import Flutter
import FirebaseCore
import GoogleMaps
import CoreLocation // استيراد CoreLocation لتحديث الموقع
@main
@objc class AppDelegate: FlutterAppDelegate {
@objc class AppDelegate: FlutterAppDelegate, CLLocationManagerDelegate {
var locationManager: CLLocationManager?
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
@@ -19,9 +22,28 @@ import GoogleMaps
}
}
// تفعيل تحديث الموقع فور تشغيل التطبيق
// startLocationUpdates()
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
func startLocationUpdates() {
locationManager = CLLocationManager()
locationManager?.delegate = self
locationManager?.desiredAccuracy = kCLLocationAccuracyBest
locationManager?.allowsBackgroundLocationUpdates = true
locationManager?.pausesLocationUpdatesAutomatically = false
locationManager?.requestAlwaysAuthorization() // طلب إذن الموقع
locationManager?.startUpdatingLocation() // بدء التحديث
}
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
guard let location = locations.last else { return }
print("📍 Location updated: \(location.coordinate.latitude), \(location.coordinate.longitude)")
}
func showJailbreakAlert() {
guard let rootVC = UIApplication.shared.keyWindow?.rootViewController else { return }