Repository navigation
fix: compatibilidad de UserNotifications con el SDK de CI - #1
Merged
Merged
Conversation
Las variantes async devuelven tipos no-Sendable (UNNotificationSettings) que no cruzan la frontera de actor en el SDK de Xcode 16, aunque sí compilen con el SDK más nuevo local. Se extrae solo el estado de autorización dentro del callback @sendable, y el delegado se mueve a una clase nonisolated Sendable que entrega únicamente el UUID de la tarea y qué acción fue.
Un 'static let' dentro de una clase @mainactor queda aislado al actor y el delegado nonisolated no puede leerlo.
There was a problem hiding this comment.
Pull request overview
Actualiza la integración con UserNotifications para que compile con el SDK de Xcode 16 usado en CI, evitando los problemas de Sendable de las variantes async y aislando el delegado en un tipo separado.
Changes:
- Sustituye
UNUserNotificationCenterasyncpor APIs con completion handler@Sendabley wrappers conwithCheckedContinuation. - Extrae el delegado a
NotificationDelegate(nonisolated) que reentra al@MainActorcon valoresSendable. - Ajusta el acceso a IDs de categoría/acción para que el delegado pueda consultarlos dentro del mismo archivo.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+93
to
97
| center.add(request) { @Sendable error in | ||
| if let error { | ||
| log.error("no se pudo programar la alarma: \(error, privacy: .public)") | ||
| } | ||
| } |
Comment on lines
+125
to
129
| private func requestAuthorization() async -> Bool { | ||
| await withCheckedContinuation { continuation in | ||
| center.requestAuthorization(options: [.alert, .sound]) { @Sendable granted, _ in | ||
| continuation.resume(returning: granted) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Las variantes async de UserNotifications devuelven tipos no-Sendable que el SDK de Xcode 16 (el de los runners) rechaza, aunque compilen con el SDK local más nuevo. Este PR usa las variantes con completion handler y aísla el delegado.
Se valida en CI antes de tocar main.