mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Interact with polls through the TimelineController as well (creation still disabled on threaded timeline as it's not yet supported by the SDK)
This commit is contained in:
committed by
Stefan Ceriu
parent
324a203086
commit
ffe2f726e7
@@ -9,22 +9,22 @@ import Foundation
|
||||
|
||||
class PollInteractionHandler: PollInteractionHandlerProtocol {
|
||||
let analyticsService: AnalyticsService
|
||||
let roomProxy: JoinedRoomProxyProtocol
|
||||
let timelineController: TimelineControllerProtocol
|
||||
|
||||
init(analyticsService: AnalyticsService, roomProxy: JoinedRoomProxyProtocol) {
|
||||
init(analyticsService: AnalyticsService, timelineController: TimelineControllerProtocol) {
|
||||
self.analyticsService = analyticsService
|
||||
self.roomProxy = roomProxy
|
||||
self.timelineController = timelineController
|
||||
}
|
||||
|
||||
func sendPollResponse(pollStartID: String, optionID: String) async -> Result<Void, Error> {
|
||||
let sendPollResponseResult = await roomProxy.timeline.sendPollResponse(pollStartID: pollStartID, answers: [optionID])
|
||||
let sendPollResponseResult = await timelineController.sendPollResponse(pollStartID: pollStartID, answers: [optionID])
|
||||
analyticsService.trackPollVote()
|
||||
|
||||
|
||||
return sendPollResponseResult.mapError { $0 }
|
||||
}
|
||||
|
||||
func endPoll(pollStartID: String) async -> Result<Void, Error> {
|
||||
let endPollResult = await roomProxy.timeline.endPoll(pollStartID: pollStartID,
|
||||
let endPollResult = await timelineController.endPoll(pollStartID: pollStartID,
|
||||
text: "The poll with event id: \(pollStartID) has ended")
|
||||
analyticsService.trackPollEnd()
|
||||
return endPollResult.mapError { $0 }
|
||||
|
||||
Reference in New Issue
Block a user