Permalink Tweaks 2 (#2766)

* Missing changelog.

* Parse bare room aliases as permalinks.

Update the SDK.

* Fix tapping the same permalink twice.

Add a test.

Don't clear the focussed item when reaching the bottom of the timeline.

* Make sure sending a message returns to live.
This commit is contained in:
Doug
2024-04-29 17:32:16 +01:00
committed by GitHub
parent aaa8af2996
commit 7c94ed98a5
18 changed files with 111 additions and 52 deletions
@@ -188,13 +188,24 @@ class AttributedStringBuilderTests: XCTestCase {
checkLinkIn(attributedString: attributedStringBuilder.fromPlain(string), expectedLink: string, expectedRuns: 1)
}
func testUserIdLink() {
let userId = "@user:matrix.org"
let string = "The user is \(userId)."
let expectedLink = "https://matrix.to/#/\(userId)"
func testUserIDLink() {
let userID = "@user:matrix.org"
let string = "The user is \(userID)."
let expectedLink = "https://matrix.to/#/\(userID)"
checkLinkIn(attributedString: attributedStringBuilder.fromHTML(string), expectedLink: expectedLink, expectedRuns: 3)
checkLinkIn(attributedString: attributedStringBuilder.fromPlain(string), expectedLink: expectedLink, expectedRuns: 3)
}
func testRoomAliasLink() {
let roomAlias = "#room:matrix.org"
let string = "The room is \(roomAlias)."
guard let expectedLink = URL(string: "https://matrix.to/#/\(roomAlias)") else {
XCTFail("The expected link should be valid.")
return
}
checkLinkIn(attributedString: attributedStringBuilder.fromHTML(string), expectedLink: expectedLink.absoluteString, expectedRuns: 3)
checkLinkIn(attributedString: attributedStringBuilder.fromPlain(string), expectedLink: expectedLink.absoluteString, expectedRuns: 3)
}
func testDefaultFont() {
let htmlString = "<b>Test</b> <i>string</i>."