mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-05 11:58:32 +00:00
Invite people in an existing room (#915)
* Handle power levels * Add “invite” button in RoomMembersListScreen * Refactor DI in RoomDetailsScreenCoordinator * Add navigation to “select people” coordinator * Add InviteUsersScreenRoomContext * Add invite user by id api * Updare InviteUsersScreenRoomContext * Support disabled state on FormButtonStyles * Handle membership in UserProfileCell * Fix conflicts * Refactor RoomContext -> RoomType * Refactor UserProfileCell * Add invite action * Setup navigation to user flow coordinator * Add invite logic * Fix test build errors * Address comments * Fix localisations * Update required state * Handle error * Move invite logic in RoomDetailsScreenCoordinator * Add navigation from room’s members list * Fix UTs * Fix missing display name in RoomMemberDetails * Add user indicator * Add feature flag * Add RoomDetailsViewModel UTs * Add room details ui tests * Add InviteUsersViewModelTests UTs * Add UI tests * Update UI tests * Empty commit
This commit is contained in:
@@ -66,6 +66,10 @@ final class RoomMemberProxy: RoomMemberProxyProtocol {
|
||||
var isIgnored: Bool {
|
||||
member.isIgnored()
|
||||
}
|
||||
|
||||
var canInviteUsers: Bool {
|
||||
member.canInvite()
|
||||
}
|
||||
|
||||
func ignoreUser() async -> Result<Void, RoomMemberProxyError> {
|
||||
sendAccountDataEventBackgroundTask = await backgroundTaskService.startBackgroundTask(withName: backgroundAccountDataTaskName, isReusable: true)
|
||||
|
||||
@@ -33,6 +33,7 @@ protocol RoomMemberProxyProtocol {
|
||||
var normalizedPowerLevel: Int { get }
|
||||
var isAccountOwner: Bool { get }
|
||||
var isIgnored: Bool { get }
|
||||
var canInviteUsers: Bool { get }
|
||||
|
||||
func ignoreUser() async -> Result<Void, RoomMemberProxyError>
|
||||
func unignoreUser() async -> Result<Void, RoomMemberProxyError>
|
||||
|
||||
@@ -449,6 +449,18 @@ class RoomProxy: RoomProxyProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
func invite(userID: String) async -> Result<Void, RoomProxyError> {
|
||||
await Task.dispatch(on: .global()) {
|
||||
do {
|
||||
MXLog.info("Inviting user \(userID)")
|
||||
return try .success(self.room.inviteUserById(userId: userID))
|
||||
} catch {
|
||||
MXLog.error("Failed inviting user \(userID) with error: \(error)")
|
||||
return .failure(.failedInvitingUser)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var invitedMembersCount: UInt {
|
||||
UInt(room.invitedMembersCount())
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ enum RoomProxyError: Error {
|
||||
case failedLeavingRoom
|
||||
case failedAcceptingInvite
|
||||
case failedRejectingInvite
|
||||
case failedInvitingUser
|
||||
}
|
||||
|
||||
@MainActor
|
||||
@@ -105,6 +106,8 @@ protocol RoomProxyProtocol {
|
||||
|
||||
func fetchDetails(for eventID: String)
|
||||
|
||||
func invite(userID: String) async -> Result<Void, RoomProxyError>
|
||||
|
||||
var invitedMembersCount: UInt { get }
|
||||
|
||||
var joinedMembersCount: UInt { get }
|
||||
|
||||
Reference in New Issue
Block a user