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

Use attributed string whitespace for URL previews. #4924

Merged
merged 11 commits into from
Sep 29, 2021

Conversation

pixlwave
Copy link
Member

Fixes #4896, depends on matrix-org/matrix-ios-kit#916. This PR does the following:

  • Moves the urlPreviewData and showURLPreview properties from RoomBubbleCellData to MXKRoomBubbleComponent so that previews can be managed per event rather than per cell.
  • Uses addVerticalWhitespaceToString to include the preview height instead of overriding heightForCellData:withMaximumWidth:.
  • Stops breaking up the bubble cell data as it is no longer necessary with the changes above.
  • Uses invalidateTextLayout instead of clearing the cell data's attributed string when the layout changes.
  • Renames refreshAttributedTextMessage to makeAttributedString as it only creates the string but doesn't assign it.

…emove heightForCellData:withMaximumWidth: from the various TextMsgBubbleCell subclasses.

Use the bubble cell data's available width when sizing URL previews and update the defaultAvailableWidth and reducedWidthThreshold accordingly.
…te that it doesn't affect the attributedTextMessage.
…omponent.

Stop breaking up the bubble data for links now that vertical whitespace is added.
Reset all cell data when this setting is changed to force a refresh.
Rename `hasClosedPreview(from:)` to `shouldShowPreview(for:)` for clarity and potentially adding more rules at a later date.
@github-actions
Copy link

📱 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/5BbqiM

@pixlwave pixlwave merged commit 03f813c into develop Sep 29, 2021
@pixlwave pixlwave deleted the doug/4896_url_previews_string_whitespace branch September 29, 2021 15:18
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.

Use addVerticalWhitespaceToString: for URL Previews
2 participants