mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Accept and decline invites (#806)
* Add accept/decline invite api * Fix isDirect logic * Add logic for accepting/decling invites * Add error handling structure * Add decline alert * Add navigation to joined room * Add generic error * Add changelog.d file * Cleanup * Fix failing UTs * Add UTs * Add UI tests * Cleanup * Update ref screenshots * Refactor invitesScreen state * Improve switch handling in UserSessionFlowCoordinator * Fix build error
This commit is contained in:
@@ -348,6 +348,26 @@ class RoomProxy: RoomProxyProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
func rejectInvitation() async -> Result<Void, RoomProxyError> {
|
||||
await Task.dispatch(on: .global()) {
|
||||
do {
|
||||
return try .success(self.room.rejectInvitation())
|
||||
} catch {
|
||||
return .failure(.failedRejectingInvite)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func acceptInvitation() async -> Result<Void, RoomProxyError> {
|
||||
await Task.dispatch(on: .global()) {
|
||||
do {
|
||||
return try .success(self.room.acceptInvitation())
|
||||
} catch {
|
||||
return .failure(.failedAcceptingInvite)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
/// Force the timeline to load member details so it can populate sender profiles whenever we add a timeline listener
|
||||
|
||||
@@ -33,6 +33,8 @@ enum RoomProxyError: Error {
|
||||
case failedAddingTimelineListener
|
||||
case failedRetrievingMembers
|
||||
case failedLeavingRoom
|
||||
case failedAcceptingInvite
|
||||
case failedRejectingInvite
|
||||
}
|
||||
|
||||
@MainActor
|
||||
@@ -90,6 +92,10 @@ protocol RoomProxyProtocol {
|
||||
func updateMembers() async
|
||||
|
||||
func inviter() async -> RoomMemberProxyProtocol?
|
||||
|
||||
func rejectInvitation() async -> Result<Void, RoomProxyError>
|
||||
|
||||
func acceptInvitation() async -> Result<Void, RoomProxyError>
|
||||
}
|
||||
|
||||
extension RoomProxyProtocol {
|
||||
|
||||
@@ -129,7 +129,7 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
||||
|
||||
let details = RoomSummaryDetails(id: room.roomId(),
|
||||
name: room.name() ?? room.roomId(),
|
||||
isDirect: room.isDm() ?? false,
|
||||
isDirect: fullRoom?.isDirect() ?? room.isDm() ?? false,
|
||||
avatarURL: avatarURL,
|
||||
lastMessage: attributedLastMessage,
|
||||
lastMessageFormattedTimestamp: lastMessageFormattedTimestamp,
|
||||
|
||||
Reference in New Issue
Block a user