41 lines
1.3 KiB
Swift
41 lines
1.3 KiB
Swift
import UIKit
|
|
import Flutter
|
|
import FirebaseCore
|
|
import GoogleMaps
|
|
|
|
@main
|
|
@objc class AppDelegate: FlutterAppDelegate {
|
|
override func application(
|
|
_ application: UIApplication,
|
|
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
|
) -> Bool {
|
|
GMSServices.provideAPIKey(Constants.googleMapsAPIKey)
|
|
FirebaseApp.configure()
|
|
GeneratedPluginRegistrant.register(with: self)
|
|
|
|
if JailbreakDetection.isJailbroken() {
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
|
|
self.showJailbreakAlert()
|
|
}
|
|
}
|
|
|
|
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
|
}
|
|
|
|
func showJailbreakAlert() {
|
|
guard let rootVC = UIApplication.shared.keyWindow?.rootViewController else { return }
|
|
|
|
let alert = UIAlertController(
|
|
title: "تحذير أمني",
|
|
message: "تم اكتشاف أن جهازك يحتوي على جيلبريك. لا يمكن تشغيل التطبيق على هذا الجهاز.",
|
|
preferredStyle: .alert
|
|
)
|
|
|
|
alert.addAction(UIAlertAction(title: "إنهاء التطبيق", style: .destructive) { _ in
|
|
exit(0)
|
|
})
|
|
|
|
rootVC.present(alert, animated: true, completion: nil)
|
|
}
|
|
}
|