25-3/8/1
This commit is contained in:
@@ -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 }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user