//
//  SpeakPermission.swift
//  SpeakEasyLearnEnglish
//
//  Created by edy on 2025/7/24.
//

import UIKit
import UserNotifications


class SpeakPermission: NSObject {
    
   class func requestNotificationPermission() {
        let center = UNUserNotificationCenter.current()
        center.getNotificationSettings { settings in
            switch settings.authorizationStatus {
            case .authorized:
                break
            case .denied:
                break
            case .notDetermined:
                center.requestAuthorization(options: [.alert, .sound, .badge]) { granted, error in
                    if granted {
                    } else {
                    }
                }
                break
            default: break
            }
        }
    }
    
    class func checkNotificationPermission( _ complate:@escaping((Bool)->Void)) {
        UNUserNotificationCenter.current().getNotificationSettings { settings in
            switch settings.authorizationStatus {
            case .authorized:
                complate(true)
                break
            default:
                complate(false)
                break
            }
        }
    }
}
