Tapping on room link (with roomID) (#1853)

* room linking

* chagelog
This commit is contained in:
Mauro
2023-10-04 15:47:57 +02:00
committed by GitHub
parent e065f9d3a2
commit dce94e7d7d
4 changed files with 16 additions and 2 deletions
@@ -158,7 +158,7 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationCoordinatorDelegate,
} else { } else {
navigationRootCoordinator.setSheetCoordinator(GenericCallLinkCoordinator(parameters: .init(url: url))) navigationRootCoordinator.setSheetCoordinator(GenericCallLinkCoordinator(parameters: .init(url: url)))
} }
case .roomMemberDetails: case .roomMemberDetails, .room:
userSessionFlowCoordinator?.handleAppRoute(route, animated: true) userSessionFlowCoordinator?.handleAppRoute(route, animated: true)
default: default:
break break
@@ -115,7 +115,8 @@ struct MatrixPermalinkParser: URLParser {
switch PermalinkBuilder.detectPermalink(in: url, baseURL: appSettings.permalinkBaseURL) { switch PermalinkBuilder.detectPermalink(in: url, baseURL: appSettings.permalinkBaseURL) {
case .userIdentifier(let userID): case .userIdentifier(let userID):
return .roomMemberDetails(userID: userID) return .roomMemberDetails(userID: userID)
// Other cases will be handled in the future case .roomIdentifier(let roomID):
return .room(roomID: roomID)
default: default:
return nil return nil
} }
@@ -120,4 +120,16 @@ class AppRouteURLParserTests: XCTestCase {
XCTAssertEqual(route, .roomMemberDetails(userID: userID)) XCTAssertEqual(route, .roomMemberDetails(userID: userID))
} }
func testMatrixRoomIdentifierURL() {
let id = "!abcdefghijklmnopqrstuvwxyz1234567890:matrix.org"
guard let url = URL(string: "\(appSettings.permalinkBaseURL)/#/\(id)") else {
XCTFail("Invalid url")
return
}
let route = appRouteURLParser.route(from: url)
XCTAssertEqual(route, .room(roomID: id))
}
} }
+1
View File
@@ -0,0 +1 @@
Tapping on matrix room id link brings you to that room.