Skip to content

Commit

Permalink
Fixes #2792 - Use the right room context in the plain composer
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanceriu committed May 7, 2024
1 parent 4d0d150 commit 3017100
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,6 @@ struct ComposerToolbar: View {
RoomAttachmentPicker(context: context)
}
messageComposer
.environmentObject(context)
.onTapGesture {
guard !composerFocused else { return }
composerFocused = true
}
.padding(.leading, context.composerActionsEnabled ? 7 : 0)
.padding(.trailing, context.composerActionsEnabled ? 4 : 0)
}
.opacity(context.viewState.isVoiceMessageModeActivated ? 0 : 1)

Expand Down Expand Up @@ -177,7 +170,14 @@ struct ComposerToolbar: View {
} onAppearAction: {
context.send(viewAction: .composerAppeared)
}
.environmentObject(context)
.focused($composerFocused)
.padding(.leading, context.composerActionsEnabled ? 7 : 0)
.padding(.trailing, context.composerActionsEnabled ? 4 : 0)
.onTapGesture {
guard !composerFocused else { return }
composerFocused = true
}
.onChange(of: context.composerFocused) { newValue in
guard composerFocused != newValue else { return }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ extension EnvironmentValues {
get { self[RoomContextKey.self] }
set { self[RoomContextKey.self] = newValue }
}

/// An event ID which will be non-nil when a timeline item should show as focussed.
var focussedEventID: String? {
get { self[FocussedEventID.self] }
Expand Down
2 changes: 1 addition & 1 deletion ElementX/Sources/Screens/RoomScreen/View/RoomScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ struct RoomScreen: View {
}
.padding(.top, 8)
.background(Color.compound.bgCanvasDefault.ignoresSafeArea())
.environmentObject(context)
.environment(\.roomContext, context)
}
.navigationTitle(L10n.screenRoomTitle) // Hidden but used for back button text.
.navigationBarTitleDisplayMode(.inline)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class RoomPollsHistoryScreenViewModelTests: XCTestCase {
override func setUpWithError() throws {
interactionHandler = PollInteractionHandlerMock()
timelineController = MockRoomTimelineController()
let roomProxyMockConfiguration = RoomProxyMockConfiguration(name: "Polls")
viewModel = RoomPollsHistoryScreenViewModel(pollInteractionHandler: interactionHandler,
roomTimelineController: timelineController,
userIndicatorController: UserIndicatorControllerMock())
Expand Down

0 comments on commit 3017100

Please sign in to comment.