mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-05 11:58:32 +00:00
Room screen: timeline message bubbles (#91)
* #34 Create `TimelineItemStylerView` * #34 Add styler view into different type of cells * #34 Use placeholder avatar image on room list * #34 Add `isOutgoing` param to event based timeline item * #34 Compute `isOutgoing` for timeline items * #34 Update sender info view in timeline * #34 Update mock timeline items * #34 Rename `EventBasedTimelineView` to `EventBasedTimelineSenderView` * #34 Change padding on timeline cells * #34 Create `TimelineItemStylerView` to move content into a bubble if needed * #34 Use styler view in all of the timeline item views * #34 Make timestamp more readable on images * #34 Little layout tweaks * #34 Add changelog * #34 Fix code smells * #34 Set text colors on timeline items * #34 Fix background color of the timeline * #34 Fix PR remarks * #34 Set background colors explicitly on remaining screens * #34 Reduce min bubble width and make it a scaled metric * #34 Refactor `PlaceholderAvatarImage` to accept a text only * #34 Fix code smell * #34 Fix further comments
This commit is contained in:
@@ -13,12 +13,15 @@ struct TextRoomTimelineView: View {
|
||||
let timelineItem: TextRoomTimelineItem
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading) {
|
||||
EventBasedTimelineView(timelineItem: timelineItem)
|
||||
TimelineItemStylerView(timelineItem: timelineItem) {
|
||||
EventBasedTimelineSenderView(timelineItem: timelineItem)
|
||||
} content: {
|
||||
if let attributedComponents = timelineItem.attributedComponents {
|
||||
FormattedBodyText(attributedComponents: attributedComponents)
|
||||
} else {
|
||||
Text(timelineItem.text)
|
||||
.font(.body)
|
||||
.multilineTextAlignment(.leading)
|
||||
}
|
||||
}
|
||||
.id(timelineItem.id)
|
||||
@@ -36,19 +39,25 @@ struct TextRoomTimelineView_Previews: PreviewProvider {
|
||||
VStack(alignment: .leading, spacing: 20.0) {
|
||||
TextRoomTimelineView(timelineItem: itemWith(text: "Short loin ground round tongue hamburger, fatback salami shoulder. Beef turkey sausage kielbasa strip steak. Alcatra capicola pig tail pancetta chislic.",
|
||||
timestamp: "Now",
|
||||
shouldShowSenderDetails: true,
|
||||
isOutgoing: false,
|
||||
senderId: "Bob"))
|
||||
|
||||
TextRoomTimelineView(timelineItem: itemWith(text: "Some other text",
|
||||
timestamp: "Later",
|
||||
shouldShowSenderDetails: true,
|
||||
isOutgoing: true,
|
||||
senderId: "Anne"))
|
||||
}
|
||||
.padding(.horizontal, 8)
|
||||
}
|
||||
|
||||
private static func itemWith(text: String, timestamp: String, senderId: String) -> TextRoomTimelineItem {
|
||||
private static func itemWith(text: String, timestamp: String, shouldShowSenderDetails: Bool, isOutgoing: Bool, senderId: String) -> TextRoomTimelineItem {
|
||||
return TextRoomTimelineItem(id: UUID().uuidString,
|
||||
text: text,
|
||||
timestamp: timestamp,
|
||||
shouldShowSenderDetails: true,
|
||||
senderId: senderId)
|
||||
text: text,
|
||||
timestamp: timestamp,
|
||||
shouldShowSenderDetails: shouldShowSenderDetails,
|
||||
isOutgoing: isOutgoing,
|
||||
senderId: senderId)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user