show link descr
This commit is contained in:
parent
be569b9977
commit
ddc8712b7c
@ -9,7 +9,7 @@
|
|||||||
import SwiftUI
|
import SwiftUI
|
||||||
import SimpleXChat
|
import SimpleXChat
|
||||||
|
|
||||||
private let uiLinkColor = UIColor(red: 0, green: 0.533, blue: 1, alpha: 1)
|
let uiLinkColor = UIColor(red: 0, green: 0.533, blue: 1, alpha: 1)
|
||||||
|
|
||||||
private let noTyping = Text(" ")
|
private let noTyping = Text(" ")
|
||||||
|
|
||||||
@ -144,7 +144,7 @@ private func linkText(_ s: String, _ link: String, _ preview: Bool, prefix: Stri
|
|||||||
]))).underline()
|
]))).underline()
|
||||||
}
|
}
|
||||||
|
|
||||||
private func simplexLinkText(_ linkType: SimplexLinkType, _ smpHosts: [String]) -> String {
|
func simplexLinkText(_ linkType: SimplexLinkType, _ smpHosts: [String]) -> String {
|
||||||
linkType.description + " " + "(via \(smpHosts.first ?? "?"))"
|
linkType.description + " " + "(via \(smpHosts.first ?? "?"))"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,7 +292,7 @@ struct ChatListSearchBar: View {
|
|||||||
Image(systemName: "magnifyingglass")
|
Image(systemName: "magnifyingglass")
|
||||||
TextField("Search or paste SimpleX link", text: $searchText)
|
TextField("Search or paste SimpleX link", text: $searchText)
|
||||||
.focused($searchFocussed)
|
.focused($searchFocussed)
|
||||||
.foregroundColor(.primary)
|
.foregroundColor(searchShowingSimplexLink ? Color(uiColor: uiLinkColor) : .primary)
|
||||||
.frame(maxWidth: .infinity)
|
.frame(maxWidth: .infinity)
|
||||||
if searchMode || searchShowingSimplexLink {
|
if searchMode || searchShowingSimplexLink {
|
||||||
Image(systemName: "xmark.circle.fill")
|
Image(systemName: "xmark.circle.fill")
|
||||||
@ -362,9 +362,9 @@ struct ChatListSearchBar: View {
|
|||||||
} else {
|
} else {
|
||||||
if let link = strHasSingleSimplexLink(t.trimmingCharacters(in: .whitespaces)) { // if SimpleX link is pasted, show connection dialogue
|
if let link = strHasSingleSimplexLink(t.trimmingCharacters(in: .whitespaces)) { // if SimpleX link is pasted, show connection dialogue
|
||||||
searchFocussed = false
|
searchFocussed = false
|
||||||
if link.text != t {
|
if case let .simplexLink(linkType, _, smpHosts) = link.format {
|
||||||
ignoreSearchTextChange = true
|
ignoreSearchTextChange = true
|
||||||
searchText = link.text
|
searchText = simplexLinkText(linkType, smpHosts)
|
||||||
}
|
}
|
||||||
searchShowingSimplexLink = true
|
searchShowingSimplexLink = true
|
||||||
searchChatFilteredBySimplexLink = nil
|
searchChatFilteredBySimplexLink = nil
|
||||||
|
Loading…
Reference in New Issue
Block a user