mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +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:
@@ -331,6 +331,11 @@ class RoomMemberProxyMock: RoomMemberProxyProtocol {
|
||||
set(value) { underlyingIsIgnored = value }
|
||||
}
|
||||
var underlyingIsIgnored: Bool!
|
||||
var canInviteUsers: Bool {
|
||||
get { return underlyingCanInviteUsers }
|
||||
set(value) { underlyingCanInviteUsers = value }
|
||||
}
|
||||
var underlyingCanInviteUsers: Bool!
|
||||
|
||||
//MARK: - ignoreUser
|
||||
|
||||
@@ -869,6 +874,27 @@ class RoomProxyMock: RoomProxyProtocol {
|
||||
fetchDetailsForReceivedInvocations.append(eventID)
|
||||
fetchDetailsForClosure?(eventID)
|
||||
}
|
||||
//MARK: - invite
|
||||
|
||||
var inviteUserIDCallsCount = 0
|
||||
var inviteUserIDCalled: Bool {
|
||||
return inviteUserIDCallsCount > 0
|
||||
}
|
||||
var inviteUserIDReceivedUserID: String?
|
||||
var inviteUserIDReceivedInvocations: [String] = []
|
||||
var inviteUserIDReturnValue: Result<Void, RoomProxyError>!
|
||||
var inviteUserIDClosure: ((String) async -> Result<Void, RoomProxyError>)?
|
||||
|
||||
func invite(userID: String) async -> Result<Void, RoomProxyError> {
|
||||
inviteUserIDCallsCount += 1
|
||||
inviteUserIDReceivedUserID = userID
|
||||
inviteUserIDReceivedInvocations.append(userID)
|
||||
if let inviteUserIDClosure = inviteUserIDClosure {
|
||||
return await inviteUserIDClosure(userID)
|
||||
} else {
|
||||
return inviteUserIDReturnValue
|
||||
}
|
||||
}
|
||||
}
|
||||
class SessionVerificationControllerProxyMock: SessionVerificationControllerProxyProtocol {
|
||||
var callbacks: PassthroughSubject<SessionVerificationControllerProxyCallback, Never> {
|
||||
|
||||
@@ -22,11 +22,12 @@ struct RoomMemberProxyMockConfiguration {
|
||||
var displayName: String
|
||||
var avatarURL: URL?
|
||||
var membership: MembershipState
|
||||
var isNameAmbiguous: Bool
|
||||
var isNameAmbiguous = false
|
||||
var powerLevel: Int
|
||||
var normalizedPowerLevel: Int
|
||||
var isAccountOwner: Bool
|
||||
var isIgnored: Bool
|
||||
var isAccountOwner = false
|
||||
var isIgnored = false
|
||||
var canInviteUsers = false
|
||||
}
|
||||
|
||||
extension RoomMemberProxyMock {
|
||||
@@ -41,6 +42,7 @@ extension RoomMemberProxyMock {
|
||||
normalizedPowerLevel = configuration.normalizedPowerLevel
|
||||
isAccountOwner = configuration.isAccountOwner
|
||||
isIgnored = configuration.isIgnored
|
||||
canInviteUsers = configuration.canInviteUsers
|
||||
}
|
||||
|
||||
// Mocks
|
||||
@@ -49,11 +51,8 @@ extension RoomMemberProxyMock {
|
||||
displayName: "Alice",
|
||||
avatarURL: nil,
|
||||
membership: .join,
|
||||
isNameAmbiguous: false,
|
||||
powerLevel: 50,
|
||||
normalizedPowerLevel: 50,
|
||||
isAccountOwner: false,
|
||||
isIgnored: false))
|
||||
normalizedPowerLevel: 50))
|
||||
}
|
||||
|
||||
static var mockInvitedAlice: RoomMemberProxyMock {
|
||||
@@ -61,11 +60,8 @@ extension RoomMemberProxyMock {
|
||||
displayName: "Alice",
|
||||
avatarURL: nil,
|
||||
membership: .invite,
|
||||
isNameAmbiguous: false,
|
||||
powerLevel: 50,
|
||||
normalizedPowerLevel: 50,
|
||||
isAccountOwner: false,
|
||||
isIgnored: false))
|
||||
normalizedPowerLevel: 50))
|
||||
}
|
||||
|
||||
static var mockBob: RoomMemberProxyMock {
|
||||
@@ -73,11 +69,8 @@ extension RoomMemberProxyMock {
|
||||
displayName: "Bob",
|
||||
avatarURL: nil,
|
||||
membership: .join,
|
||||
isNameAmbiguous: false,
|
||||
powerLevel: 50,
|
||||
normalizedPowerLevel: 50,
|
||||
isAccountOwner: false,
|
||||
isIgnored: false))
|
||||
normalizedPowerLevel: 50))
|
||||
}
|
||||
|
||||
static var mockCharlie: RoomMemberProxyMock {
|
||||
@@ -85,11 +78,8 @@ extension RoomMemberProxyMock {
|
||||
displayName: "Charlie",
|
||||
avatarURL: nil,
|
||||
membership: .join,
|
||||
isNameAmbiguous: false,
|
||||
powerLevel: 50,
|
||||
normalizedPowerLevel: 50,
|
||||
isAccountOwner: false,
|
||||
isIgnored: false))
|
||||
normalizedPowerLevel: 50))
|
||||
}
|
||||
|
||||
static var mockDan: RoomMemberProxyMock {
|
||||
@@ -97,11 +87,8 @@ extension RoomMemberProxyMock {
|
||||
displayName: "Dan",
|
||||
avatarURL: URL.picturesDirectory,
|
||||
membership: .join,
|
||||
isNameAmbiguous: false,
|
||||
powerLevel: 50,
|
||||
normalizedPowerLevel: 50,
|
||||
isAccountOwner: false,
|
||||
isIgnored: false))
|
||||
normalizedPowerLevel: 50))
|
||||
}
|
||||
|
||||
static var mockMe: RoomMemberProxyMock {
|
||||
@@ -109,11 +96,10 @@ extension RoomMemberProxyMock {
|
||||
displayName: "Me",
|
||||
avatarURL: URL.picturesDirectory,
|
||||
membership: .join,
|
||||
isNameAmbiguous: false,
|
||||
powerLevel: 50,
|
||||
normalizedPowerLevel: 50,
|
||||
isAccountOwner: true,
|
||||
isIgnored: false))
|
||||
canInviteUsers: true))
|
||||
}
|
||||
|
||||
static var mockIgnored: RoomMemberProxyMock {
|
||||
@@ -121,10 +107,8 @@ extension RoomMemberProxyMock {
|
||||
displayName: "Ignored",
|
||||
avatarURL: nil,
|
||||
membership: .join,
|
||||
isNameAmbiguous: false,
|
||||
powerLevel: 50,
|
||||
normalizedPowerLevel: 50,
|
||||
isAccountOwner: false,
|
||||
isIgnored: true))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user