Skip to content

[Accessoryview] fix#893

Merged
nathantannar4 merged 1 commit intoMessageKit:accessoryview-updatesfrom
JulienKode:accessoryview-updates-fix
Oct 12, 2018
Merged

[Accessoryview] fix#893
nathantannar4 merged 1 commit intoMessageKit:accessoryview-updatesfrom
JulienKode:accessoryview-updates-fix

Conversation

@JulienKode
Copy link
Contributor

@JulienKode JulienKode commented Oct 4, 2018

With an Accessoryview of 100 x 300

img_5915

#834

@nathantannar4
Copy link
Member

@JulienKode Nice! So if the width is set to large your just shrinking it? I think that makes sense so that it fits the overall message cell padding. @SD10 what do you think?

Sent with GitHawk

@JulienKode
Copy link
Contributor Author

@JulienKode Nice! So if the width is set to large your just shrinking it? I think that makes sense so that it fits the overall message cell padding. @SD10 what do you think? ...

@nathantannar4 it’s supposed to do that as we take care of the size of the accessoryView return messagesLayout.itemWidth - avatarWidth - messagePadding.horizontal - accessoryWidth - accessoryPadding.horizontal

Sent with GitHawk

}
default:
origin.y = attributes.cellTopLabelSize.height + attributes.messageTopLabelSize.height + attributes.messageContainerPadding.top
if attributes.accessoryViewSize.height > attributes.messageContainerSize.height {
Copy link
Member

Choose a reason for hiding this comment

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

Can you explain this to me a little bit more? I don't know why it's necessary

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are doing that here because usually the origin.y of the view is just under the others items

But If the accessoryView is bigger than the messageContentCell,
It will cause the accessory view to render outisde the cell

As the accessory view is at the center of the messageContentCell if the accessoryView is bigger, he will go outside of the cell

So if the accessoryView is bigger, we render the messageContentCell, at the middle of the cell then the accessoryView fit perfectly the cell

Copy link
Contributor Author

Choose a reason for hiding this comment

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

GitHawk Upload by JulienKode here is what happened if we do not manage this case

Copy link
Member

@SD10 SD10 Oct 5, 2018

Choose a reason for hiding this comment

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

Hey @JulienKode, thanks for explaining this to me 👍 I think the real issue is in the height calculation for the cell? I'm sure if this PR solves the issue the correct way but I totally understand what you're saying is the problem

Copy link
Member

Choose a reason for hiding this comment

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

There may actually not be a great way to solve this as I think more about it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree that’s not a good way to handle this new case, what did you suggest ?

May be add an enum somewhere

Copy link
Member

Choose a reason for hiding this comment

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

@SD10 @JulienKode I think the current state is good, it doesnt break the cell layout as all subviews are rendered within the bounds. I think if we want to develop the reliability for rendering options in this case it could be tabled for a future release.

I think we really need to release 1.1, particularly because of the content inset bug people keep facing and the Swift 4.2 update

@nathantannar4
Copy link
Member

@SD10 Do you think anything still needs to be changed here? This change along with my other changes will ensure the accessory size is centered to the message content view and that large accessory views don't mess up the layout.

Sent with GitHawk

@nathantannar4
Copy link
Member

@JulienKode This does a good job aligning the accessoryView to the center, but we still need to make some changes. Im gonna merge this to my branch and then work on it.

TODO:

  1. Remove vertical padding
  2. Always layout the accessoryView to the size specified, even if its bigger than the cell

If that occurs it is a developer error and we should not auto resize it

@nathantannar4 nathantannar4 merged commit 83b483f into MessageKit:accessoryview-updates Oct 12, 2018
@JulienKode
Copy link
Contributor Author

@nathantannar4

Thanks, I'll take a look at this

@JulienKode JulienKode changed the title Accessoryview updates try to fix [Accessoryview] fix Nov 3, 2018
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.

3 participants