74808f086e
* feat: Replace Legacy Media Controls with Nitro-Powered Playback * feat: Add TTS Engine Selection * chore: Remove User-Facing Error Reporting * refactor: Combine `Tts` and `TtsSession` Imports from `nitro-tts` Module --------- Co-authored-by: Claude <noreply@anthropic.com>
18 lines
364 B
Swift
18 lines
364 B
Swift
import Foundation
|
|
import NitroModules
|
|
|
|
enum MainQueuePromise {
|
|
static func run(_ operation: @escaping () throws -> Void) -> Promise<Void> {
|
|
let promise = Promise<Void>()
|
|
DispatchQueue.main.async {
|
|
do {
|
|
try operation()
|
|
promise.resolve()
|
|
} catch {
|
|
promise.reject(withError: error)
|
|
}
|
|
}
|
|
return promise
|
|
}
|
|
}
|