Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Message bubbles: Layout for media (part 2) #5461

Merged
merged 61 commits into from
Feb 1, 2022

Conversation

SBiOSoftWhare
Copy link
Contributor

@SBiOSoftWhare SBiOSoftWhare commented Jan 31, 2022

Part of #5209, handle #5388, #5420

Included:

  • Voice message cells
  • Location sharing cells
  • File without thumbnail cells
  • Selected sticker cell
  • Remove bubble for emotes
  • Timestamp inside file thumbnail

Screenshots:

Simulator Screen Shot - iPhone 13 - 2022-01-31 at 17 49 53 Simulator Screen Shot - iPhone 13 - 2022-01-31 at 17 50 22
Simulator Screen Shot - iPhone 13 - 2022-01-31 at 17 09 10 Simulator Screen Shot - iPhone 13 - 2022-01-31 at 17 52 06
Simulator Screen Shot - iPhone 13 - 2022-01-31 at 17 55 35 Simulator Screen Shot - iPhone 13 - 2022-01-31 at 17 55 20 

…nvenient message type property from MXEvent.
@github-actions
Copy link

github-actions bot commented Jan 31, 2022

📱 Scan the QR code below to install the build for this PR.
🔒 This build is for internal testing purpose. Only devices listed in the ad-hoc provisioning profile can install Element Alpha.

QR code

If you can't scan the QR code you can install the build via this link: https://i.diawi.com/jMuQ3D

Copy link
Member

@pixlwave pixlwave left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More bubbles! Comments inline :)

@@ -87,6 +87,7 @@ abstract_target 'RiotPods' do
import_SwiftUI_pods

pod 'DGCollectionViewLeftAlignFlowLayout', '~> 1.0.4'
pod 'UICollectionViewRightAlignedLayout', '~> 0.0.3'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to add the license to third_party_licenses.html?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. In fact UICollectionViewRightAlignedLayout does not work with one item (#5469). I'll maybe remove it but I can add the license in between.

return nil
}
return MXMessageType(identifier: messageTypeString)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙌

@@ -41,7 +41,7 @@ class BubbleRoomCellLayoutUpdater: RoomCellLayoutUpdating {

func updateLayoutIfNeeded(for cell: MXKRoomBubbleTableViewCell, andCellData cellData: MXKRoomBubbleCellData) {

if cellData.isSenderCurrentUser {
if cellData.isIncoming == false {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super unimportant, but changing to if cellData.isIncoming { and flipping the 2 blocks around would be simpler to read.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes true I didn't flip when I refactor this.

Comment on lines +364 to +367
private func setupIncomingFileAttachViewMargins(for cell: MXKRoomBubbleTableViewCell) {

guard let attachmentView = cell.attachmentView,
cell.attachViewLeadingConstraint == nil || cell.attachViewLeadingConstraint.isActive == false else {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A general comment here, switching between attachment… and the attach… shorthand terminology might lead to some confusion to anyone coming to this new. Would be good if we could use attachment… everywhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally agree. I admit that I didn't changed prefixes and use existing ones. But I can refactor and use attachment prefix for readability.


let contentView = cell.contentView

// TODO: Use constants
Copy link
Member

@pixlwave pixlwave Feb 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this for a future update?

Edit: Having finished the review, I'm pretty sure this is for later 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes using proper constraints should be done in a specific PR at the end: #5409

Comment on lines 233 to 236
guard let bubbleComponents = cellData.bubbleComponents,
componentIndex < bubbleComponents.count else {
return nil
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indentation of the return and closing brace seems off to me, but I would normally put else { on a new line, so not sure if this is what Xcode does anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it depends on people but we can use the same rules. On my side I prefer line return for else of the guard, to see quickly the return without reading all the conditions of the guard.

Comment on lines 51 to 53
override func update(theme: Theme) {
super.update(theme: theme)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can probably be removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes for sure

Comment on lines +27 to +28
let messageViewMarginRight: CGFloat = 80
let messageLeftMargin: CGFloat = 48
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unimportant, but it would be nice if these names had the same format. I'm also wondering if we should be saying leading and trailing when defining such variables or adding IBOutlets for constraints?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I'll remove local constant and use proper global constants in a future PR (#5409)

Comment on lines +25 to +26
let messageViewMarginRight: CGFloat = 80
let messageLeftMargin: CGFloat = 48
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment on the name format.

Comment on lines +25 to +27
let messageViewMarginRight: CGFloat = 80
let messageLeftMargin: CGFloat = 48
let playbackViewRightMargin: CGFloat = 40
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And again :)

Copy link
Member

@pixlwave pixlwave left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! 1 small comment with a typo I just noticed.

@SBiOSoftWhare SBiOSoftWhare merged commit 5ff5a70 into develop Feb 1, 2022
@SBiOSoftWhare SBiOSoftWhare deleted the steve/5209_media_bubbles_2 branch February 1, 2022 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants