mirror of https://github.com/lukechilds/damus.git
Browse Source
Closes: #164 Changelog-Changed: Blur and opaque non-friend images rather than only display the link Changelog-Changed: Remove URLs in content text when image is displayed Changelog-Changed: Show non-image URLs as clickable link views Changelog-Changed: Adjusted Pay button on invoices.post-button-style
William Casarin
2 years ago
6 changed files with 103 additions and 11 deletions
@ -0,0 +1,39 @@ |
|||
// |
|||
// LinkView.swift |
|||
// damus |
|||
// |
|||
// Created by Sam DuBois on 12/27/22. |
|||
// |
|||
|
|||
import SwiftUI |
|||
import LinkPresentation |
|||
|
|||
class CustomLinkView: LPLinkView { |
|||
override var intrinsicContentSize: CGSize { CGSize(width: 0, height: super.intrinsicContentSize.height) } |
|||
} |
|||
|
|||
struct LinkViewRepresentable: UIViewRepresentable { |
|||
|
|||
typealias UIViewType = CustomLinkView |
|||
|
|||
var metadata: LPLinkMetadata? |
|||
var url: URL? |
|||
|
|||
func makeUIView(context: Context) -> CustomLinkView { |
|||
|
|||
if let metadata { |
|||
let linkView = CustomLinkView(metadata: metadata) |
|||
return linkView |
|||
} |
|||
|
|||
if let url { |
|||
let linkView = CustomLinkView(url: url) |
|||
return linkView |
|||
} |
|||
|
|||
return CustomLinkView() |
|||
} |
|||
|
|||
func updateUIView(_ uiView: CustomLinkView, context: Context) { |
|||
} |
|||
} |
Loading…
Reference in new issue