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:
Stefan Ceriu
2025-07-22 17:00:09 +03:00
committed by Stefan Ceriu
parent 324a203086
commit ffe2f726e7
8 changed files with 162 additions and 100 deletions
@@ -17752,76 +17752,6 @@ class TimelineProxyMock: TimelineProxyProtocol, @unchecked Sendable {
return editPollOriginalQuestionAnswersPollKindReturnValue
}
}
//MARK: - endPoll
var endPollPollStartIDTextUnderlyingCallsCount = 0
var endPollPollStartIDTextCallsCount: Int {
get {
if Thread.isMainThread {
return endPollPollStartIDTextUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = endPollPollStartIDTextUnderlyingCallsCount
}
return returnValue!
}
}
set {
if Thread.isMainThread {
endPollPollStartIDTextUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
endPollPollStartIDTextUnderlyingCallsCount = newValue
}
}
}
}
var endPollPollStartIDTextCalled: Bool {
return endPollPollStartIDTextCallsCount > 0
}
var endPollPollStartIDTextReceivedArguments: (pollStartID: String, text: String)?
var endPollPollStartIDTextReceivedInvocations: [(pollStartID: String, text: String)] = []
var endPollPollStartIDTextUnderlyingReturnValue: Result<Void, TimelineProxyError>!
var endPollPollStartIDTextReturnValue: Result<Void, TimelineProxyError>! {
get {
if Thread.isMainThread {
return endPollPollStartIDTextUnderlyingReturnValue
} else {
var returnValue: Result<Void, TimelineProxyError>? = nil
DispatchQueue.main.sync {
returnValue = endPollPollStartIDTextUnderlyingReturnValue
}
return returnValue!
}
}
set {
if Thread.isMainThread {
endPollPollStartIDTextUnderlyingReturnValue = newValue
} else {
DispatchQueue.main.sync {
endPollPollStartIDTextUnderlyingReturnValue = newValue
}
}
}
}
var endPollPollStartIDTextClosure: ((String, String) async -> Result<Void, TimelineProxyError>)?
func endPoll(pollStartID: String, text: String) async -> Result<Void, TimelineProxyError> {
endPollPollStartIDTextCallsCount += 1
endPollPollStartIDTextReceivedArguments = (pollStartID: pollStartID, text: text)
DispatchQueue.main.async {
self.endPollPollStartIDTextReceivedInvocations.append((pollStartID: pollStartID, text: text))
}
if let endPollPollStartIDTextClosure = endPollPollStartIDTextClosure {
return await endPollPollStartIDTextClosure(pollStartID, text)
} else {
return endPollPollStartIDTextReturnValue
}
}
//MARK: - sendPollResponse
var sendPollResponsePollStartIDAnswersUnderlyingCallsCount = 0
@@ -17892,6 +17822,76 @@ class TimelineProxyMock: TimelineProxyProtocol, @unchecked Sendable {
return sendPollResponsePollStartIDAnswersReturnValue
}
}
//MARK: - endPoll
var endPollPollStartIDTextUnderlyingCallsCount = 0
var endPollPollStartIDTextCallsCount: Int {
get {
if Thread.isMainThread {
return endPollPollStartIDTextUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = endPollPollStartIDTextUnderlyingCallsCount
}
return returnValue!
}
}
set {
if Thread.isMainThread {
endPollPollStartIDTextUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
endPollPollStartIDTextUnderlyingCallsCount = newValue
}
}
}
}
var endPollPollStartIDTextCalled: Bool {
return endPollPollStartIDTextCallsCount > 0
}
var endPollPollStartIDTextReceivedArguments: (pollStartID: String, text: String)?
var endPollPollStartIDTextReceivedInvocations: [(pollStartID: String, text: String)] = []
var endPollPollStartIDTextUnderlyingReturnValue: Result<Void, TimelineProxyError>!
var endPollPollStartIDTextReturnValue: Result<Void, TimelineProxyError>! {
get {
if Thread.isMainThread {
return endPollPollStartIDTextUnderlyingReturnValue
} else {
var returnValue: Result<Void, TimelineProxyError>? = nil
DispatchQueue.main.sync {
returnValue = endPollPollStartIDTextUnderlyingReturnValue
}
return returnValue!
}
}
set {
if Thread.isMainThread {
endPollPollStartIDTextUnderlyingReturnValue = newValue
} else {
DispatchQueue.main.sync {
endPollPollStartIDTextUnderlyingReturnValue = newValue
}
}
}
}
var endPollPollStartIDTextClosure: ((String, String) async -> Result<Void, TimelineProxyError>)?
func endPoll(pollStartID: String, text: String) async -> Result<Void, TimelineProxyError> {
endPollPollStartIDTextCallsCount += 1
endPollPollStartIDTextReceivedArguments = (pollStartID: pollStartID, text: text)
DispatchQueue.main.async {
self.endPollPollStartIDTextReceivedInvocations.append((pollStartID: pollStartID, text: text))
}
if let endPollPollStartIDTextClosure = endPollPollStartIDTextClosure {
return await endPollPollStartIDTextClosure(pollStartID, text)
} else {
return endPollPollStartIDTextReturnValue
}
}
//MARK: - getLoadedReplyDetails
var getLoadedReplyDetailsEventIDUnderlyingCallsCount = 0