mirror of
https://github.com/metabolist/metatext.git
synced 2024-11-25 09:41:00 +00:00
Hook up delegate
This commit is contained in:
parent
5777120f35
commit
745a420c19
2 changed files with 26 additions and 0 deletions
|
@ -27,4 +27,12 @@ public extension AccountViewModel {
|
||||||
var note: NSAttributedString { accountService.account.note.attributed }
|
var note: NSAttributedString { accountService.account.note.attributed }
|
||||||
|
|
||||||
var emoji: [Emoji] { accountService.account.emojis }
|
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 {
|
private extension AccountView {
|
||||||
static let spacing: CGFloat = 8
|
static let spacing: CGFloat = 8
|
||||||
static let stackViewSpacing: CGFloat = 4
|
static let stackViewSpacing: CGFloat = 4
|
||||||
|
@ -67,6 +84,7 @@ private extension AccountView {
|
||||||
accountLabel.textColor = .secondaryLabel
|
accountLabel.textColor = .secondaryLabel
|
||||||
noteTextView.isScrollEnabled = false
|
noteTextView.isScrollEnabled = false
|
||||||
noteTextView.backgroundColor = .clear
|
noteTextView.backgroundColor = .clear
|
||||||
|
noteTextView.delegate = self
|
||||||
|
|
||||||
NSLayoutConstraint.activate([
|
NSLayoutConstraint.activate([
|
||||||
avatarImageView.widthAnchor.constraint(equalToConstant: Self.avatarDimension),
|
avatarImageView.widthAnchor.constraint(equalToConstant: Self.avatarDimension),
|
||||||
|
|
Loading…
Reference in a new issue