diff --git a/apps/ios/Shared/Views/Helpers/ChatItemClipShape.swift b/apps/ios/Shared/Views/Helpers/ChatItemClipShape.swift index 0bde81e228..a4e20c5954 100644 --- a/apps/ios/Shared/Views/Helpers/ChatItemClipShape.swift +++ b/apps/ios/Shared/Views/Helpers/ChatItemClipShape.swift @@ -9,44 +9,44 @@ import SwiftUI import SimpleXChat -/// Modifier, which provides clipping mask for ``ChatItemWithMenu`` view +/// Modifier, which provides clipping mask for ``ChatItemWithMenu`` view /// and it's previews: (drag interaction, context menu, etc.) /// Supports [Dynamic Type](https://developer.apple.com/documentation/uikit/uifont/scaling_fonts_automatically) /// by retaining pill shape, even when ``ChatItem``'s height is less that twice its corner radius struct ChatItemClipped: ViewModifier { struct ClipShape: Shape { let maxCornerRadius: Double - + func path(in rect: CGRect) -> Path { Path( roundedRect: rect, - cornerRadius: min((rect.height / 2), maxCornerRadius), + cornerRadius: min((rect.height / 2), maxCornerRadius), style: .circular ) } } - + init() { clipShape = ClipShape( maxCornerRadius: 18 ) } - + init(_ chatItem: ChatItem) { clipShape = ClipShape( maxCornerRadius: { switch chatItem.content { - case - .sndMsgContent, + case + .sndMsgContent, .rcvMsgContent, .rcvDecryptionError, .rcvGroupInvitation, .sndGroupInvitation, - .sndDeleted, + .sndDeleted, .rcvDeleted, .rcvIntegrityError, - .sndModerated, - .rcvModerated, + .sndModerated, + .rcvModerated, .rcvBlocked, .invalidJSON: 18 default: 8 @@ -54,9 +54,9 @@ struct ChatItemClipped: ViewModifier { }() ) } - + private let clipShape: ClipShape - + func body(content: Content) -> some View { content .contentShape(.dragPreview, clipShape) @@ -64,3 +64,4 @@ struct ChatItemClipped: ViewModifier { .clipShape(clipShape) } } +