56 lines
2.1 KiB
Swift
56 lines
2.1 KiB
Swift
////
|
||
//// PushAppDelegate.swift
|
||
//// yobble
|
||
////
|
||
//// Created by cheykrym on 02.12.2025.
|
||
//// 72acf38bfbf0e990f745a612527911f8df1d63d60de70d41391c54b52498f7ab
|
||
//
|
||
//import UIKit
|
||
//import UserNotifications
|
||
//
|
||
//class PushAppDelegate: NSObject, UIApplicationDelegate, UNUserNotificationCenterDelegate {
|
||
//
|
||
// // Запрос разрешения на уведомления
|
||
// func application(_ application: UIApplication,
|
||
// didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
|
||
//
|
||
// UNUserNotificationCenter.current().delegate = self
|
||
//
|
||
// UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) { granted, error in
|
||
// guard granted else {
|
||
// print("⛔️ User denied push notifications")
|
||
// return
|
||
// }
|
||
//
|
||
// DispatchQueue.main.async {
|
||
// UIApplication.shared.registerForRemoteNotifications()
|
||
// }
|
||
// }
|
||
//
|
||
// return true
|
||
// }
|
||
//
|
||
// // Получаем пуш-токен устройства
|
||
// func application(_ application: UIApplication,
|
||
// didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
|
||
//
|
||
// let token = deviceToken.map { String(format: "%02x", $0) }.joined()
|
||
// print("📨 Device Token:", token)
|
||
// }
|
||
//
|
||
// // Ошибка регистрации
|
||
// func application(_ application: UIApplication,
|
||
// didFailToRegisterForRemoteNotificationsWithError error: Error) {
|
||
// print("❌ Failed to register for remote notifications:", error)
|
||
// }
|
||
//
|
||
// // Пуш пришёл в форграунде
|
||
// func userNotificationCenter(_ center: UNUserNotificationCenter,
|
||
// willPresent notification: UNNotification,
|
||
// withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
|
||
//
|
||
// // показываем алерт даже если приложение открыто
|
||
// completionHandler([.banner, .sound, .badge])
|
||
// }
|
||
//}
|