Integrate高德 SDK with simulator-safe build flags, add map views for operating area and punch points, refactor main tabs and key feature screens to UIKit with Diffable lists, and document Swift concurrency defaults in AGENTS.md. Co-authored-by: Cursor <cursoragent@cursor.com>
64 lines
2.0 KiB
Swift
64 lines
2.0 KiB
Swift
//
|
||
// AppDelegate.swift
|
||
// suixinkan_ios
|
||
//
|
||
|
||
import UIKit
|
||
|
||
/// 应用入口,承接 APNs 回调并在启动时初始化高德 SDK。
|
||
@main
|
||
class AppDelegate: UIResponder, UIApplicationDelegate {
|
||
|
||
/// 应用启动:重置 UI 测试状态并配置高德 Key。
|
||
func application(
|
||
_ application: UIApplication,
|
||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
||
) -> Bool {
|
||
AppUITestLaunchState.resetIfNeeded()
|
||
if let key = Bundle.main.object(forInfoDictionaryKey: "AMapAPIKey") as? String {
|
||
AMapBootstrap.configure(apiKey: key)
|
||
}
|
||
return true
|
||
}
|
||
|
||
func application(
|
||
_ application: UIApplication,
|
||
configurationForConnecting connectingSceneSession: UISceneSession,
|
||
options: UIScene.ConnectionOptions
|
||
) -> UISceneConfiguration {
|
||
UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
|
||
}
|
||
|
||
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {}
|
||
|
||
func application(
|
||
_ application: UIApplication,
|
||
didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data
|
||
) {
|
||
Task { @MainActor in
|
||
PushNotificationManager.shared.handleDeviceToken(deviceToken)
|
||
}
|
||
}
|
||
|
||
func application(
|
||
_ application: UIApplication,
|
||
didFailToRegisterForRemoteNotificationsWithError error: Error
|
||
) {
|
||
Task { @MainActor in
|
||
PushNotificationManager.shared.handleRegistrationError(error)
|
||
}
|
||
}
|
||
|
||
func application(
|
||
_ application: UIApplication,
|
||
didReceiveRemoteNotification userInfo: [AnyHashable: Any],
|
||
fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void
|
||
) {
|
||
let payload = PushPayload(userInfo: userInfo)
|
||
Task { @MainActor in
|
||
PushNotificationManager.shared.handleRemoteNotification(payload)
|
||
completionHandler(.newData)
|
||
}
|
||
}
|
||
}
|