This commit is contained in:
Thomas Ricouard 2023-12-21 21:00:44 +01:00
parent 3eb373550e
commit f04f5c701c

View file

@ -137,16 +137,24 @@ struct StatusEditorAccessoryView: View {
})
.sheet(isPresented: $isGIFPickerPresented, content: {
#if !os(visionOS)
GifPickerView { url in
GPHCache.shared.downloadAssetData(url) { data, _ in
guard let data else { return }
viewModel.processGIFData(data: data)
#if targetEnvironment(macCatalyst)
NavigationStack {
giphyView
.toolbar {
ToolbarItem(placement: .topBarLeading) {
Button {
isGIFPickerPresented = false
} label: {
Image(systemName: "xmark.circle")
}
}
}
}
isGIFPickerPresented = false
} onShouldDismissGifPicker: {
isGIFPickerPresented = false
}
.presentationDetents([.medium, .large])
.presentationDetents([.medium, .large])
#else
giphyView
.presentationDetents([.medium, .large])
#endif
#else
EmptyView()
#endif
@ -258,6 +266,20 @@ struct StatusEditorAccessoryView: View {
return false
}
@ViewBuilder
private var giphyView: some View {
@Bindable var viewModel = focusedSEVM
GifPickerView { url in
GPHCache.shared.downloadAssetData(url) { data, _ in
guard let data else { return }
viewModel.processGIFData(data: data)
}
isGIFPickerPresented = false
} onShouldDismissGifPicker: {
isGIFPickerPresented = false
}
}
private var draftsListView: some View {
DraftsListView(selectedDraft: .init(get: {