Fixes #322 - Developer options menu (#581)

This commit is contained in:
Stefan Ceriu
2023-02-15 13:07:06 +02:00
committed by GitHub
parent 6211f121a0
commit 4fd24a6c16
21 changed files with 390 additions and 7 deletions
@@ -88,7 +88,7 @@ struct RoomScreenViewStateBindings {
/// Information describing the currently displayed alert.
var alertInfo: AlertInfo<RoomScreenErrorType>?
var debugInfo: DebugScreen.DebugInfo?
var debugInfo: TimelineItemDebugView.DebugInfo?
}
enum RoomScreenErrorType: Hashable {
@@ -229,7 +229,7 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
actions.append(.redact)
}
var debugActions: [TimelineItemContextMenuAction] = [.viewSource]
var debugActions: [TimelineItemContextMenuAction] = ServiceLocator.shared.settings.canShowDeveloperOptions ? [.viewSource] : []
if let item = timelineItem as? EncryptedRoomTimelineItem,
case let .megolmV1AesSha2(sessionID) = item.encryptionType {
@@ -30,7 +30,7 @@ struct RoomScreen: View {
.toolbarBackground(.visible, for: .navigationBar) // Fix the toolbar's background.
.overlay { loadingIndicator }
.alert(item: $context.alertInfo) { $0.alert }
.sheet(item: $context.debugInfo) { DebugScreen(info: $0) }
.sheet(item: $context.debugInfo) { TimelineItemDebugView(info: $0) }
.task(id: context.viewState.roomId) {
// Give a couple of seconds for items to load and to see them.
try? await Task.sleep(for: .seconds(2))
@@ -16,7 +16,7 @@
import SwiftUI
struct DebugScreen: View {
struct TimelineItemDebugView: View {
struct DebugInfo: Identifiable {
let id = UUID()
let title: String