More fix to Archive

This commit is contained in:
Thomas Ricouard 2024-08-12 22:38:23 +02:00
parent 57c2133673
commit caac1334d1

View file

@ -1,9 +1,10 @@
#if !os(visionOS) && !DEBUG
import DesignSystem
import GiphyUISDK
@preconcurrency import GiphyUISDK
import SwiftUI
import UIKit
@MainActor
struct GifPickerView: UIViewControllerRepresentable {
@Environment(Theme.self) private var theme
@ -33,6 +34,7 @@
GifPickerView.Coordinator(parent: self)
}
@MainActor
class Coordinator: NSObject, GiphyDelegate {
var parent: GifPickerView
@ -40,13 +42,17 @@
self.parent = parent
}
@MainActor func didDismiss(controller _: GiphyViewController?) {
parent.onShouldDismissGifPicker()
nonisolated func didDismiss(controller _: GiphyViewController?) {
Task { @MainActor in
parent.onShouldDismissGifPicker()
}
}
@MainActor func didSelectMedia(giphyViewController _: GiphyViewController, media: GPHMedia) {
let url = media.url(rendition: .fixedWidth, fileType: .gif)
parent.completion(url ?? "")
nonisolated func didSelectMedia(giphyViewController _: GiphyViewController, media: GPHMedia) {
Task { @MainActor in
let url = media.url(rendition: .fixedWidth, fileType: .gif)
parent.completion(url ?? "")
}
}
}
}