mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-05 11:58:32 +00:00
Add support for quick room search through the Cmd+K shortcut (#2363)
This commit is contained in:
@@ -35,6 +35,7 @@ enum HomeScreenCoordinatorAction {
|
||||
case presentSecureBackupSettings
|
||||
case presentStartChatScreen
|
||||
case presentInvitesScreen
|
||||
case presentGlobalSearch
|
||||
case logout
|
||||
}
|
||||
|
||||
@@ -82,6 +83,8 @@ final class HomeScreenCoordinator: CoordinatorProtocol {
|
||||
actionsSubject.send(.presentStartChatScreen)
|
||||
case .presentInvitesScreen:
|
||||
actionsSubject.send(.presentInvitesScreen)
|
||||
case .presentGlobalSearch:
|
||||
actionsSubject.send(.presentGlobalSearch)
|
||||
}
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
|
||||
@@ -28,6 +28,7 @@ enum HomeScreenViewModelAction {
|
||||
case presentFeedbackScreen
|
||||
case presentStartChatScreen
|
||||
case presentInvitesScreen
|
||||
case presentGlobalSearch
|
||||
case logout
|
||||
}
|
||||
|
||||
@@ -49,6 +50,7 @@ enum HomeScreenViewAction {
|
||||
case skipRecoveryKeyConfirmation
|
||||
case updateVisibleItemRange(range: Range<Int>, isScrolling: Bool)
|
||||
case selectInvites
|
||||
case globalSearch
|
||||
}
|
||||
|
||||
enum HomeScreenRoomListMode: CustomStringConvertible {
|
||||
|
||||
@@ -141,6 +141,8 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
|
||||
actionsSubject.send(.presentStartChatScreen)
|
||||
case .selectInvites:
|
||||
actionsSubject.send(.presentInvitesScreen)
|
||||
case .globalSearch:
|
||||
actionsSubject.send(.presentGlobalSearch)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -94,6 +94,12 @@ struct HomeScreenContent: View {
|
||||
.onChange(of: context.viewState.visibleRooms) { _ in
|
||||
updateVisibleRange()
|
||||
}
|
||||
.background(
|
||||
Button("", action: {
|
||||
context.send(viewAction: .globalSearch)
|
||||
})
|
||||
.keyboardShortcut(KeyEquivalent("k"), modifiers: [.command])
|
||||
)
|
||||
.scrollDismissesKeyboard(.immediately)
|
||||
.scrollDisabled(context.viewState.roomListMode == .skeletons)
|
||||
.scrollBounceBehavior(context.viewState.roomListMode == .empty ? .basedOnSize : .automatic)
|
||||
|
||||
Reference in New Issue
Block a user