mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-05 11:58:32 +00:00
Add the inviter to JoinRoomScreen when it's an invite. (#3093)
* Add inviter property to RoomProxyProtocol. * Extract the room cell inviter label into it's own view. * Use the new RoomInviterLabel in the JoinRoomScreen. * Fix bug with invite to a public room.
This commit is contained in:
@@ -8273,6 +8273,23 @@ class RoomProxyMock: RoomProxyProtocol {
|
||||
set(value) { underlyingMembership = value }
|
||||
}
|
||||
var underlyingMembership: Membership!
|
||||
var inviterCallsCount = 0
|
||||
var inviterCalled: Bool {
|
||||
return inviterCallsCount > 0
|
||||
}
|
||||
|
||||
var inviter: RoomMemberProxyProtocol? {
|
||||
get async {
|
||||
inviterCallsCount += 1
|
||||
if let inviterClosure = inviterClosure {
|
||||
return await inviterClosure()
|
||||
} else {
|
||||
return underlyingInviter
|
||||
}
|
||||
}
|
||||
}
|
||||
var underlyingInviter: RoomMemberProxyProtocol?
|
||||
var inviterClosure: (() async -> RoomMemberProxyProtocol?)?
|
||||
var hasOngoingCall: Bool {
|
||||
get { return underlyingHasOngoingCall }
|
||||
set(value) { underlyingHasOngoingCall = value }
|
||||
|
||||
@@ -97,6 +97,11 @@ extension RoomMemberProxyMock {
|
||||
membership: .join))
|
||||
}
|
||||
|
||||
static var mockNoName: RoomMemberProxyMock {
|
||||
RoomMemberProxyMock(with: .init(userID: "@anonymous:matrix.org",
|
||||
membership: .join))
|
||||
}
|
||||
|
||||
static var mockInvited: RoomMemberProxyMock {
|
||||
RoomMemberProxyMock(with: .init(userID: "@invited:matrix.org",
|
||||
displayName: "Invited",
|
||||
|
||||
@@ -35,6 +35,7 @@ struct RoomProxyMockConfiguration {
|
||||
|
||||
var members: [RoomMemberProxyMock] = .allMembers
|
||||
var ownUserID = RoomMemberProxyMock.mockMe.userID
|
||||
var inviter: RoomMemberProxyProtocol?
|
||||
|
||||
var canUserInvite = true
|
||||
var canUserTriggerRoomNotification = false
|
||||
@@ -85,6 +86,7 @@ extension RoomProxyMock {
|
||||
|
||||
ownUserID = configuration.ownUserID
|
||||
membership = .joined
|
||||
inviterClosure = { configuration.inviter }
|
||||
|
||||
membersPublisher = CurrentValueSubject(configuration.members).asCurrentValuePublisher()
|
||||
typingMembersPublisher = CurrentValueSubject([]).asCurrentValuePublisher()
|
||||
|
||||
Reference in New Issue
Block a user