Customize TimePollView for poll.end events

This commit is contained in:
Alfonso Grillo
2022-12-28 16:35:49 +01:00
parent 39bb927fd5
commit 6b477c764c
7 changed files with 28 additions and 0 deletions
@@ -32,6 +32,11 @@ enum TimelinePollType {
case undisclosed
}
enum TimelinePollEventType {
case started
case ended
}
struct TimelinePollAnswerOption: Identifiable {
var id: String
var text: String
@@ -62,6 +67,7 @@ struct TimelinePollDetails {
var closed: Bool
var totalAnswerCount: UInt
var type: TimelinePollType
var eventType: TimelinePollEventType
var maxAllowedSelections: UInt
var hasBeenEdited = true
var hasDecryptionError: Bool
@@ -70,6 +76,7 @@ struct TimelinePollDetails {
closed: Bool,
totalAnswerCount: UInt,
type: TimelinePollType,
eventType: TimelinePollEventType,
maxAllowedSelections: UInt,
hasBeenEdited: Bool,
hasDecryptionError: Bool) {
@@ -78,6 +85,7 @@ struct TimelinePollDetails {
self.closed = closed
self.totalAnswerCount = totalAnswerCount
self.type = type
self.eventType = eventType
self.maxAllowedSelections = maxAllowedSelections
self.hasBeenEdited = hasBeenEdited
self.hasDecryptionError = hasDecryptionError
@@ -94,6 +102,10 @@ struct TimelinePollDetails {
return type == .disclosed && totalAnswerCount > 0 && hasCurrentUserVoted
}
}
var representsPollEndedEvent: Bool {
eventType == .ended
}
}
struct TimelinePollViewState: BindableState {