Fix timestamp label layout when not in fullscreen by CocoaBob · Pull Request #1854 · MessageKit/MessageKit

What does this implement/fix? Explain your changes.

MessageKit shows timestamps when showMessageTimestampOnSwipeLeft = true, but I notice a bug that timestamp label layout is wrong when app isn't in fullscreen or is using UISplitViewController. So actually if we run the built-in Example project in iPad simulator, since it uses UISplitViewController, we can easily find this issue (screenshots below).

The fix is easy, just replace UIScreen.main.bounds.width + paddingLeft with self.frame.maxX + paddingLeft. Because the timestamp labels are relatively positioned to the MessageContentCell, not the screen.

Does this close any currently open issues?

No, I didn't find any related discussion.

Any relevant logs, error output, etc?

No, only UI layout

Any other comments?

No

Where has this been tested?

Devices/Simulators: Both simulator and real devices (iPad Pro 11-inch 2018)

iOS Version: iOS 17.5

Swift Version: Swift 5

MessageKit Version: v4.2.0

Screenshots before & after

Simulator Screenshot - iPad (10th generation) - 2024-07-30 at 18 55 26

Simulator Screenshot - iPad (10th generation) - 2024-07-30 at 18 49 53