Show a modal indicator while inviting users to a room.

This commit is contained in:
Stefan Ceriu
2025-09-12 15:39:10 +03:00
committed by Stefan Ceriu
parent 409fbe1ea4
commit 5fe1c7b733
3 changed files with 37 additions and 3 deletions

View File

@@ -97,6 +97,7 @@
"action_leave" = "Leave";
"action_leave_conversation" = "Leave conversation";
"action_leave_room" = "Leave room";
"action_leave_space" = "Leave space";
"action_load_more" = "Load more";
"action_manage_account" = "Manage account";
"action_manage_devices" = "Manage devices";
@@ -482,6 +483,9 @@
"screen_bottom_sheet_create_dm_confirmation_button_title" = "Send invite";
"screen_bottom_sheet_create_dm_message" = "Would you like to start a chat with %1$@?";
"screen_bottom_sheet_create_dm_title" = "Send invite?";
"screen_bottom_sheet_leave_space_subtitle" = "This will also remove you from all rooms in this space.";
"screen_bottom_sheet_leave_space_subtitle_admin" = "This will also remove you from all rooms in this space, including those youre the only administrator for:";
"screen_bottom_sheet_leave_space_title" = "Leave %1$@?";
"screen_bottom_sheet_manage_room_member_ban" = "Ban from room";
"screen_bottom_sheet_manage_room_member_ban_member_confirmation_action" = "Ban";
"screen_bottom_sheet_manage_room_member_ban_member_confirmation_description" = "They wont be able to join this room again if invited.";
@@ -1000,6 +1004,8 @@
"screen_room_details_error_loading_notification_settings" = "An error occurred when loading notification settings.";
"screen_room_details_error_muting" = "Failed muting this room, please try again.";
"screen_room_details_error_unmuting" = "Failed unmuting this room, please try again.";
"screen_room_details_invite_people_dont_close" = "Don't close the app until finished.";
"screen_room_details_invite_people_preparing" = "Preparing invitations...";
"screen_room_details_notification_mode_custom" = "Custom";
"screen_room_details_notification_mode_default" = "Default";
"screen_room_details_share_room_title" = "Share room";

View File

@@ -1279,9 +1279,19 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
}
private func inviteUsers(_ users: [String], in room: JoinedRoomProxyProtocol) {
navigationStackCoordinator.setSheetCoordinator(nil)
if flowParameters.appSettings.enableKeyShareOnInvite {
showLoadingIndicator(title: L10n.screenRoomDetailsInvitePeoplePreparing,
message: L10n.screenRoomDetailsInvitePeopleDontClose)
} else {
showLoadingIndicator()
}
Task {
defer {
navigationStackCoordinator.setSheetCoordinator(nil)
hideLoadingIndicator()
}
let result: Result<Void, RoomProxyError> = await withTaskGroup(of: Result<Void, RoomProxyError>.self) { group in
for user in users {
group.addTask {
@@ -1530,12 +1540,16 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
private static let loadingIndicatorID = "\(RoomFlowCoordinator.self)-Loading"
private func showLoadingIndicator(delay: Duration? = nil) {
private func showLoadingIndicator(delay: Duration? = nil,
title: String = L10n.commonLoading,
message: String? = nil) {
flowParameters.userIndicatorController.submitIndicator(.init(id: Self.loadingIndicatorID,
type: .modal(progress: .indeterminate,
interactiveDismissDisabled: false,
allowsInteraction: false),
title: L10n.commonLoading, persistent: true),
title: title,
message: message,
persistent: true),
delay: delay)
}

View File

@@ -232,6 +232,8 @@ internal enum L10n {
internal static var actionLeaveConversation: String { return L10n.tr("Localizable", "action_leave_conversation") }
/// Leave room
internal static var actionLeaveRoom: String { return L10n.tr("Localizable", "action_leave_room") }
/// Leave space
internal static var actionLeaveSpace: String { return L10n.tr("Localizable", "action_leave_space") }
/// Load more
internal static var actionLoadMore: String { return L10n.tr("Localizable", "action_load_more") }
/// Manage account
@@ -1278,6 +1280,14 @@ internal enum L10n {
}
/// Send invite?
internal static var screenBottomSheetCreateDmTitle: String { return L10n.tr("Localizable", "screen_bottom_sheet_create_dm_title") }
/// This will also remove you from all rooms in this space.
internal static var screenBottomSheetLeaveSpaceSubtitle: String { return L10n.tr("Localizable", "screen_bottom_sheet_leave_space_subtitle") }
/// This will also remove you from all rooms in this space, including those youre the only administrator for:
internal static var screenBottomSheetLeaveSpaceSubtitleAdmin: String { return L10n.tr("Localizable", "screen_bottom_sheet_leave_space_subtitle_admin") }
/// Leave %1$@?
internal static func screenBottomSheetLeaveSpaceTitle(_ p1: Any) -> String {
return L10n.tr("Localizable", "screen_bottom_sheet_leave_space_title", String(describing: p1))
}
/// Ban from room
internal static var screenBottomSheetManageRoomMemberBan: String { return L10n.tr("Localizable", "screen_bottom_sheet_manage_room_member_ban") }
/// Ban
@@ -2302,6 +2312,10 @@ internal enum L10n {
internal static var screenRoomDetailsErrorMuting: String { return L10n.tr("Localizable", "screen_room_details_error_muting") }
/// Failed unmuting this room, please try again.
internal static var screenRoomDetailsErrorUnmuting: String { return L10n.tr("Localizable", "screen_room_details_error_unmuting") }
/// Don't close the app until finished.
internal static var screenRoomDetailsInvitePeopleDontClose: String { return L10n.tr("Localizable", "screen_room_details_invite_people_dont_close") }
/// Preparing invitations...
internal static var screenRoomDetailsInvitePeoplePreparing: String { return L10n.tr("Localizable", "screen_room_details_invite_people_preparing") }
/// Invite people
internal static var screenRoomDetailsInvitePeopleTitle: String { return L10n.tr("Localizable", "screen_room_details_invite_people_title") }
/// Leave conversation