mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:31:27 +00:00
Fixes #2414 - Move member loading to the room member detail screen, avoid blocking the whole application
This commit is contained in:
@@ -25,7 +25,7 @@ enum RoomScreenInteractionHandlerAction {
|
||||
case displayMessageForwarding(itemID: TimelineItemIdentifier)
|
||||
case displayMediaUploadPreviewScreen(url: URL)
|
||||
case displayPollForm(mode: PollFormMode)
|
||||
case displayRoomMemberDetails(member: RoomMemberProxyProtocol)
|
||||
case displayRoomMemberDetails(userID: String)
|
||||
case showActionMenu(TimelineItemActionMenuInfo)
|
||||
case showDebugInfo(TimelineItemDebugInfo)
|
||||
case showConfirmationAlert(AlertInfo<UUID>)
|
||||
@@ -579,19 +579,7 @@ class RoomScreenInteractionHandler {
|
||||
}
|
||||
|
||||
func handleTappedUser(userID: String) async {
|
||||
// This is generally fast but it could take some time for rooms with thousands of users on first load
|
||||
// Show a loader only if it takes more than 0.1 seconds
|
||||
showLoadingIndicator(with: .milliseconds(100))
|
||||
let result = await roomProxy.getMember(userID: userID)
|
||||
hideLoadingIndicator()
|
||||
|
||||
switch result {
|
||||
case .success(let member):
|
||||
actionsSubject.send(.displayRoomMemberDetails(member: member))
|
||||
case .failure(let error):
|
||||
actionsSubject.send(.displayError(.alert(L10n.screenRoomErrorFailedRetrievingUserDetails)))
|
||||
MXLog.error("Failed retrieving the user given the following id \(userID) with error: \(error)")
|
||||
}
|
||||
actionsSubject.send(.displayRoomMemberDetails(userID: userID))
|
||||
}
|
||||
|
||||
func processItemTap(_ itemID: TimelineItemIdentifier) async -> RoomTimelineControllerAction {
|
||||
@@ -660,22 +648,6 @@ class RoomScreenInteractionHandler {
|
||||
return .none
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: User indicators
|
||||
|
||||
private static let loadingIndicatorIdentifier = "RoomScreenLoadingIndicator"
|
||||
|
||||
private func showLoadingIndicator(with delay: Duration) {
|
||||
userIndicatorController.submitIndicator(UserIndicator(id: Self.loadingIndicatorIdentifier,
|
||||
type: .modal(progress: .indeterminate, interactiveDismissDisabled: true, allowsInteraction: false),
|
||||
title: L10n.commonLoading,
|
||||
persistent: true),
|
||||
delay: delay)
|
||||
}
|
||||
|
||||
private func hideLoadingIndicator() {
|
||||
userIndicatorController.retractIndicatorWithId(Self.loadingIndicatorIdentifier)
|
||||
}
|
||||
}
|
||||
|
||||
private struct ReplyInfo {
|
||||
|
||||
Reference in New Issue
Block a user