25-3/18/1
This commit is contained in:
@@ -1,49 +1,10 @@
|
||||
//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)
|
||||
// }
|
||||
//}
|
||||
|
||||
import UIKit
|
||||
import Flutter
|
||||
import FirebaseCore
|
||||
import GoogleMaps
|
||||
|
||||
@UIApplicationMain
|
||||
@main
|
||||
@objc class AppDelegate: FlutterAppDelegate {
|
||||
|
||||
override func application(
|
||||
@@ -51,9 +12,14 @@ import GoogleMaps
|
||||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
||||
) -> Bool {
|
||||
|
||||
// Load API keys from a secure location (NOT in plain text!)
|
||||
// See the "Secure API Key Storage" section below.
|
||||
GMSServices.provideAPIKey(Constants.googleMapsAPIKey)
|
||||
if let config = loadConfig() {
|
||||
if let apiKey = config["APIKey"] as? String {
|
||||
print("googleMapsAPIKey: \(Constants.googleMapsAPIKey)")
|
||||
GMSServices.provideAPIKey(apiKey)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FirebaseApp.configure()
|
||||
GeneratedPluginRegistrant.register(with: self)
|
||||
|
||||
@@ -92,7 +58,7 @@ import GoogleMaps
|
||||
guard let rootVC = UIApplication.shared.keyWindow?.rootViewController else {
|
||||
// Handle the case where rootVC is nil (extremely unlikely, but good practice)
|
||||
exit(0)
|
||||
return
|
||||
// return
|
||||
}
|
||||
|
||||
let alert = UIAlertController(
|
||||
@@ -154,7 +120,15 @@ import GoogleMaps
|
||||
|
||||
return apiKey
|
||||
}
|
||||
func loadConfig() -> [String: Any]? {
|
||||
guard let path = Bundle.main.path(forResource: "Config", ofType: "plist"),
|
||||
let config = NSDictionary(contentsOfFile: path) as? [String: Any] else {
|
||||
return nil // Or handle the error appropriately
|
||||
}
|
||||
return config
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// Add for prevent dismissing
|
||||
extension AppDelegate: UIAdaptivePresentationControllerDelegate {
|
||||
|
||||
Reference in New Issue
Block a user