This commit is contained in:
Eric85710 2026-05-27 06:16:01 +08:00
parent 19c74da15f
commit a61707afc5

View file

@ -268,4 +268,25 @@ class ChatRoomsRepository @Inject constructor(
Result.failure(e) Result.failure(e)
} }
} }
// 移除訊息的 Emoji 反應
suspend fun deleteMessageReaction(
roomId: String,
messageId: String,
emoji: String
): Result<Unit> {
return try {
val response = api.deleteMessageReaction(roomId, messageId, emoji)
if (response.isSuccessful) {
// 204 成功時沒有 body,直接回傳 Unit
Result.success(Unit)
} else {
val errorMsg = response.errorBody()?.string() ?: "未知錯誤"
Result.failure(Exception("移除反應失敗,錯誤碼: ${response.code()}, 訊息: $errorMsg"))
}
} catch (e: Exception) {
Result.failure(e)
}
}
} }