"View only" polls in the timeline (#1399)

* Add stub methods in RoomTimelineItemFactory

* Add PollRoomTimelineView and PollEndRoomTimelineView

* Add timeline skeleton

* Start poll mapping

* Add comment

* Refine poll UI

* Add feature flags for polls

* Cleanup

* Delete poll end event

* Refine poll mapping

* Refine poll layout

* Reuse FormRowAccessory

* Refine poll bubble layout

* Localise strings

* Update project

* Refine poll preview

* Map poll properties
This commit is contained in:
Alfonso Grillo
2023-07-27 15:34:27 +02:00
committed by GitHub
parent 8f2904701b
commit 0e7a48d961
19 changed files with 483 additions and 43 deletions
@@ -0,0 +1,50 @@
//
// Copyright 2023 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
struct PollRoomTimelineItem: Equatable, EventBasedTimelineItemProtocol {
let id: TimelineItemIdentifier
let poll: Poll
let body: String
let timestamp: String
let isOutgoing: Bool
let isEditable: Bool
let sender: TimelineItemSender
var properties: RoomTimelineItemProperties
}
struct Poll: Equatable {
let question: String
let pollKind: Kind
let maxSelections: Int
let options: [Option]
let votes: [String: [String]]
let endDate: Date?
enum Kind: Equatable {
case disclosed
case undisclosed
}
struct Option: Equatable {
let id: String
let text: String
let votes: Int
let allVotes: Int
let isSelected: Bool
}
}