Hook up delegate
This commit is contained in:
parent
5777120f35
commit
745a420c19
|
@ -27,4 +27,12 @@ public extension AccountViewModel {
|
|||
var note: NSAttributedString { accountService.account.note.attributed }
|
||||
|
||||
var emoji: [Emoji] { accountService.account.emojis }
|
||||
|
||||
func urlSelected(_ url: URL) {
|
||||
eventsSubject.send(
|
||||
accountService.navigationService.item(url: url)
|
||||
.map { CollectionItemEvent.navigation($0) }
|
||||
.setFailureType(to: Error.self)
|
||||
.eraseToAnyPublisher())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,23 @@ extension AccountView: UIContentView {
|
|||
}
|
||||
}
|
||||
|
||||
extension AccountView: UITextViewDelegate {
|
||||
func textView(
|
||||
_ textView: UITextView,
|
||||
shouldInteractWith URL: URL,
|
||||
in characterRange: NSRange,
|
||||
interaction: UITextItemInteraction) -> Bool {
|
||||
switch interaction {
|
||||
case .invokeDefaultAction:
|
||||
accountConfiguration.viewModel.urlSelected(URL)
|
||||
return false
|
||||
case .preview: return false
|
||||
case .presentActions: return false
|
||||
@unknown default: return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private extension AccountView {
|
||||
static let spacing: CGFloat = 8
|
||||
static let stackViewSpacing: CGFloat = 4
|
||||
|
@ -67,6 +84,7 @@ private extension AccountView {
|
|||
accountLabel.textColor = .secondaryLabel
|
||||
noteTextView.isScrollEnabled = false
|
||||
noteTextView.backgroundColor = .clear
|
||||
noteTextView.delegate = self
|
||||
|
||||
NSLayoutConstraint.activate([
|
||||
avatarImageView.widthAnchor.constraint(equalToConstant: Self.avatarDimension),
|
||||
|
|
Loading…
Reference in New Issue