mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Add max selections support for polls (#5726)
This commit is contained in:
committed by
GitHub
parent
173a927bf8
commit
30e4e6339d
@@ -42,7 +42,7 @@ enum RoomPollsHistoryScreenViewAction {
|
||||
case filter(RoomPollsHistoryFilter)
|
||||
case end(pollStartID: String)
|
||||
case edit(pollStartID: String, poll: Poll)
|
||||
case sendPollResponse(pollStartID: String, optionID: String)
|
||||
case sendPollResponse(pollStartID: String, answerIDs: [String])
|
||||
case loadMore
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -58,8 +58,8 @@ class RoomPollsHistoryScreenViewModel: RoomPollsHistoryScreenViewModelType, Room
|
||||
updatePollsList(filter: filter)
|
||||
case .loadMore:
|
||||
paginateBackwards()
|
||||
case .sendPollResponse(let pollStartID, let optionID):
|
||||
sendPollResponse(pollStartID: pollStartID, optionID: optionID)
|
||||
case .sendPollResponse(let pollStartID, let answerIDs):
|
||||
sendPollResponse(pollStartID: pollStartID, answerIDs: answerIDs)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,10 +117,10 @@ class RoomPollsHistoryScreenViewModel: RoomPollsHistoryScreenViewModelType, Room
|
||||
}
|
||||
}
|
||||
|
||||
private func sendPollResponse(pollStartID: String, optionID: String) {
|
||||
private func sendPollResponse(pollStartID: String, answerIDs: [String]) {
|
||||
Task {
|
||||
do {
|
||||
try await pollInteractionHandler.sendPollResponse(pollStartID: pollStartID, optionID: optionID).get()
|
||||
try await pollInteractionHandler.sendPollResponse(pollStartID: pollStartID, answerIDs: answerIDs).get()
|
||||
} catch {
|
||||
MXLog.error("Failed to send poll response. \(error)")
|
||||
displayError(message: L10n.errorUnknown)
|
||||
|
||||
@@ -62,9 +62,9 @@ struct RoomPollsHistoryScreen: View {
|
||||
PollView(poll: pollTimelineItem.item.poll,
|
||||
state: .full(isEditable: pollTimelineItem.item.isEditable), sender: pollTimelineItem.item.sender) { action in
|
||||
switch action {
|
||||
case .selectOption(let optionID):
|
||||
case .sendResponse(let answerIDs):
|
||||
guard let pollStartID = pollTimelineItem.item.id.eventID else { return }
|
||||
context.send(viewAction: .sendPollResponse(pollStartID: pollStartID, optionID: optionID))
|
||||
context.send(viewAction: .sendPollResponse(pollStartID: pollStartID, answerIDs: answerIDs))
|
||||
case .edit:
|
||||
guard let pollStartID = pollTimelineItem.item.id.eventID else { return }
|
||||
context.send(viewAction: .edit(pollStartID: pollStartID, poll: pollTimelineItem.item.poll))
|
||||
|
||||
Reference in New Issue
Block a user