Add developer options for Rust's Trace Log Packs. (#3929)

* Add support for configuring log packs.

* Update call widget parameters.

* Update the SDK.
This commit is contained in:
Doug
2025-03-21 19:00:13 +00:00
committed by GitHub
parent 8ada12c668
commit a142ce43af
14 changed files with 122 additions and 18 deletions
@@ -37,6 +37,7 @@ enum DeveloperOptionsScreenViewAction {
protocol DeveloperOptionsProtocol: AnyObject {
var logLevel: LogLevel { get set }
var traceLogPacks: Set<TraceLogPack> { get set }
var publicSearchEnabled: Bool { get set }
var hideUnreadMessagesBadge: Bool { get set }
var fuzzyRoomListSearchEnabled: Bool { get set }
@@ -21,6 +21,14 @@ struct DeveloperOptionsScreen: View {
Form {
Section("Logging") {
LogLevelConfigurationView(logLevel: $context.logLevel)
DisclosureGroup("SDK trace packs") {
ForEach(TraceLogPack.allCases, id: \.self) { pack in
Toggle(isOn: $context.traceLogPacks[pack]) {
Text(pack.title)
}
}
}
}
Section("General") {
@@ -153,6 +161,20 @@ private struct LogLevelConfigurationView: View {
}
}
private extension Set<TraceLogPack> {
/// A custom subscript that allows binding a toggle to add/remove a pack from the array.
subscript(pack: TraceLogPack) -> Bool {
get { contains(pack) }
set {
if newValue {
insert(pack)
} else {
remove(pack)
}
}
}
}
// MARK: - Previews
struct DeveloperOptionsScreen_Previews: PreviewProvider {