added an alert before creating a new DM

This commit is contained in:
Element CI
2025-02-03 15:51:12 +01:00
committed by Mauro
parent d195e603c9
commit 7f04c8841f
10 changed files with 71 additions and 98 deletions
@@ -341,23 +341,6 @@ class ClientProxy: ClientProxyProtocol {
try? await client.accountUrl(action: action).flatMap(URL.init(string:))
}
func createDirectRoomIfNeeded(with userID: String, expectedRoomName: String?) async -> Result<(roomID: String, isNewRoom: Bool), ClientProxyError> {
let currentDirectRoom = await directRoomForUserID(userID)
switch currentDirectRoom {
case .success(.some(let roomID)):
return .success((roomID: roomID, isNewRoom: false))
case .success(.none):
switch await createDirectRoom(with: userID, expectedRoomName: expectedRoomName) {
case .success(let roomID):
return .success((roomID: roomID, isNewRoom: true))
case .failure(let error):
return .failure(.sdkError(error))
}
case .failure(let error):
return .failure(.sdkError(error))
}
}
func directRoomForUserID(_ userID: String) async -> Result<String?, ClientProxyError> {
await Task.dispatch(on: clientQueue) {
do {