Fixes #296 - Improved bubble timeline item corner radii

This commit is contained in:
Stefan Ceriu
2022-11-14 10:28:13 +02:00
committed by Stefan Ceriu
parent 2bce779206
commit ce6b0041d2
3 changed files with 26 additions and 26 deletions
@@ -23,19 +23,6 @@ enum TimelineItemInGroupState {
case middle
case end
var roundedCorners: UIRectCorner {
switch self {
case .single:
return .allCorners
case .beginning:
return [.topLeft, .topRight]
case .middle:
return []
case .end:
return [.bottomLeft, .bottomRight]
}
}
var shouldShowSenderDetails: Bool {
switch self {
case .single, .beginning:
@@ -65,4 +52,25 @@ extension EventBasedTimelineItemProtocol {
var shouldShowSenderDetails: Bool {
inGroupState.shouldShowSenderDetails
}
var roundedCorners: UIRectCorner {
switch inGroupState {
case .single:
return .allCorners
case .beginning:
if isOutgoing {
return [.topLeft, .topRight, .bottomLeft]
} else {
return [.topLeft, .topRight, .bottomRight]
}
case .middle:
return isOutgoing ? [.topLeft, .bottomLeft] : [.topRight, .bottomRight]
case .end:
if isOutgoing {
return [.topLeft, .bottomLeft, .bottomRight]
} else {
return [.topRight, .bottomLeft, .bottomRight]
}
}
}
}