From 5fe1c7b733f4c1b0b05e248d633145c0fbcc0b8e Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Fri, 12 Sep 2025 15:39:10 +0300 Subject: [PATCH] Show a modal indicator while inviting users to a room. --- .../en.lproj/Localizable.strings | 6 ++++++ .../RoomFlowCoordinator.swift | 20 ++++++++++++++++--- ElementX/Sources/Generated/Strings.swift | 14 +++++++++++++ 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/ElementX/Resources/Localizations/en.lproj/Localizable.strings b/ElementX/Resources/Localizations/en.lproj/Localizable.strings index d1c135e27..24f817fa6 100644 --- a/ElementX/Resources/Localizations/en.lproj/Localizable.strings +++ b/ElementX/Resources/Localizations/en.lproj/Localizable.strings @@ -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 you’re 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 won’t 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"; diff --git a/ElementX/Sources/FlowCoordinators/RoomFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/RoomFlowCoordinator.swift index dc074dece..473b6d204 100644 --- a/ElementX/Sources/FlowCoordinators/RoomFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/RoomFlowCoordinator.swift @@ -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 = await withTaskGroup(of: Result.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) } diff --git a/ElementX/Sources/Generated/Strings.swift b/ElementX/Sources/Generated/Strings.swift index 64aa43ade..afc4e401f 100644 --- a/ElementX/Sources/Generated/Strings.swift +++ b/ElementX/Sources/Generated/Strings.swift @@ -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 you’re 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