Add a Compound hook. (#3979)

* Rename AppHooksProtocol.configure() to .setUp().

* Add a CompoundHook.
This commit is contained in:
Doug
2025-04-04 17:46:31 +01:00
committed by GitHub
parent a318c3918d
commit 806816be8a
5 changed files with 32 additions and 4 deletions
+7 -2
View File
@@ -14,6 +14,11 @@ class AppHooks: AppHooksProtocol {
appSettingsHook = hook
}
private(set) var compoundHook: CompoundHookProtocol = DefaultCompoundHook()
func registerCompoundHook(_ hook: CompoundHookProtocol) {
compoundHook = hook
}
private(set) var bugReportHook: BugReportHookProtocol = DefaultBugReportHook()
func registerBugReportHook(_ hook: BugReportHookProtocol) {
bugReportHook = hook
@@ -32,9 +37,9 @@ class AppHooks: AppHooksProtocol {
}
protocol AppHooksProtocol {
func configure()
func setUp()
}
extension AppHooksProtocol {
func configure() { }
func setUp() { }
}
@@ -0,0 +1,16 @@
//
// Copyright 2025 New Vector Ltd.
//
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
// Please see LICENSE files in the repository root for full details.
//
import Compound
protocol CompoundHookProtocol {
func override(colors: CompoundColors, uiColors: CompoundUIColors)
}
struct DefaultCompoundHook: CompoundHookProtocol {
func override(colors: CompoundColors, uiColors: CompoundUIColors) { }
}