Full size attachment previews on Compose screen (iOS 16)

Closes #110
This commit is contained in:
Shadowfacts 2022-06-07 09:51:06 -04:00
parent f5ac2616ad
commit 02e3417c27
1 changed files with 13 additions and 0 deletions

View File

@ -46,6 +46,8 @@ struct ComposeAttachmentRow: View {
Label("Delete", systemImage: "trash") Label("Delete", systemImage: "trash")
} }
} }
} previewIfAvailable: {
ComposeAttachmentImage(attachment: attachment, fullSize: true)
} }
switch mode { switch mode {
@ -151,6 +153,17 @@ extension ComposeAttachmentRow {
} }
} }
private extension View {
@ViewBuilder
func contextMenu<M: View, P: View>(@ViewBuilder menuItems: () -> M, @ViewBuilder previewIfAvailable preview: () -> P) -> some View {
if #available(iOS 16.0, *) {
self.contextMenu(menuItems: menuItems, preview: preview)
} else {
self.contextMenu(menuItems: menuItems)
}
}
}
//struct ComposeAttachmentRow_Previews: PreviewProvider { //struct ComposeAttachmentRow_Previews: PreviewProvider {
// static var previews: some View { // static var previews: some View {
// ComposeAttachmentRow() // ComposeAttachmentRow()