Add hooks for the RoomDetails, RoomMemberDetails and UserProfile screens. (#5980)

Also adds an @AppHook macro.
This commit is contained in:
Doug
2026-08-05 12:41:18 +01:00
committed by GitHub
parent 68f7f2b301
commit 80530f0006
31 changed files with 328 additions and 126 deletions
@@ -0,0 +1,18 @@
//
// Copyright 2026 Element Creations Ltd.
//
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
// Please see LICENSE files in the repository root for full details.
//
import Foundation
nonisolated protocol RoomDetailsScreenHookProtocol: Sendable {
@MainActor func update(_ viewState: RoomDetailsScreenViewState) -> RoomDetailsScreenViewState
}
struct DefaultRoomDetailsScreenHook: RoomDetailsScreenHookProtocol {
func update(_ viewState: RoomDetailsScreenViewState) -> RoomDetailsScreenViewState {
viewState
}
}
@@ -0,0 +1,18 @@
//
// Copyright 2026 Element Creations Ltd.
//
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
// Please see LICENSE files in the repository root for full details.
//
import Foundation
nonisolated protocol RoomMemberDetailsScreenHookProtocol: Sendable {
@MainActor func update(_ viewState: RoomMemberDetailsScreenViewState) -> RoomMemberDetailsScreenViewState
}
struct DefaultRoomMemberDetailsScreenHook: RoomMemberDetailsScreenHookProtocol {
func update(_ viewState: RoomMemberDetailsScreenViewState) -> RoomMemberDetailsScreenViewState {
viewState
}
}
@@ -9,12 +9,10 @@
import Foundation
nonisolated protocol RoomScreenHookProtocol: Sendable {
@MainActor func configure(with userSession: UserSessionProtocol?) async
@MainActor func update(_ viewState: RoomScreenViewState) -> RoomScreenViewState
}
struct DefaultRoomScreenHook: RoomScreenHookProtocol {
func configure(with userSession: UserSessionProtocol?) async { }
func update(_ viewState: RoomScreenViewState) -> RoomScreenViewState {
viewState
}
@@ -0,0 +1,18 @@
//
// Copyright 2026 Element Creations Ltd.
//
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
// Please see LICENSE files in the repository root for full details.
//
import Foundation
nonisolated protocol UserProfileScreenHookProtocol: Sendable {
@MainActor func update(_ viewState: UserProfileScreenViewState) -> UserProfileScreenViewState
}
struct DefaultUserProfileScreenHook: UserProfileScreenHookProtocol {
func update(_ viewState: UserProfileScreenViewState) -> UserProfileScreenViewState {
viewState
}
}
@@ -0,0 +1,16 @@
//
// Copyright 2026 Element Creations Ltd.
//
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
// Please see LICENSE files in the repository root for full details.
//
import MatrixRustSDK
nonisolated protocol UserSessionHookProtocol: Sendable {
func configure(with userSession: UserSessionProtocol?) async
}
nonisolated struct DefaultUserSessionHook: UserSessionHookProtocol {
func configure(with userSession: UserSessionProtocol?) async { }
}