Files
tripz/ios/Runner/AppDelegate.swift
Hamza-Ayed 3162b1bec6 25-2/24/1
2025-02-24 23:38:42 +03:00

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)
}
}