yayy notifs!!

made the about app icon better
This commit is contained in:
neon443
2025-05-06 21:03:53 +01:00
parent f8f5cdde26
commit b88bc11b36
5 changed files with 66 additions and 1 deletions

View File

@@ -9,6 +9,7 @@ import Foundation
import SwiftData
import SwiftUI
import WidgetKit
import UserNotifications
//@Model
//final class Item {
@@ -423,3 +424,19 @@ func plu(_ inp: Int) -> String {
public enum importError: Error {
case invalidB64
}
func requestNotifs() async -> Bool {
let result = try? await UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .carPlay, .sound])
return result ?? false
}
func scheduleNotif() {
let content = UNMutableNotificationContent()
content.title = "hi"
content.subtitle = "sss"
content.sound = .default
let identifier = UUID().uuidString
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 1, repeats: false)
let request = UNNotificationRequest(identifier: identifier, content: content, trigger: trigger)
UNUserNotificationCenter.current().add(request)
}