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

Convert internal, static colors into color assets. #1386

Merged
merged 16 commits into from
Jun 23, 2020
Merged

Conversation

kinoroy
Copy link
Member

@kinoroy kinoroy commented Jun 22, 2020

What does this implement/fix? Explain your changes.

  • As described by @austinwright in issue Convert internal, static colors into color assets. #1301, this PR replaces the static UIColor constants with Xcode Color Assets, which are edited visually in Xcode, allowing you to combine appearances for dark/light mode, and high contrast in one described 'color. These color assets are named for the use of the color rather than the color value itself.

  • Also fixes an issue where the video play button was too dark in dark mode (Issue Video message playback icon bug in dark mode #1335). Specifically, replaces the background color of the video playback button with a UIVisualEffectsView which blurs the background similar to how it looks on iMessage.

  • Also fixes an issue where the video play triangle was not properly centered in the button view (no issue #).

Does this close any currently open issues?

Yes:
Closes #1301
Closes #1335
Closes #1321

Any other comments?

  • I imagine there is a small performance impact of using a UIVisualEffectsView in the video play button as opposed to a plain color background however I quickly tested by profiling scrolling through 99 video messages on an iPhone 6 (a 6 year-old phone!) in the example app and I was able to scroll up to 60FPS.

  • The addition of the UIVisualEffectsView could also be its own PR, but I added it since I was changing the background color there anyways and its a small change.

  • For now, I added static vars in the extension of the UIColor class to make the references to the color assets type-safe, but this is something we could maybe have automated for us like with SwiftGen. That could be its own PR in the future.

Where has this been tested?

Devices/Simulators: … iPhone 11 Simulator, iPhone 6 Device

iOS Version: … iOS 12, and iOS 13

Swift Version: … Swift 5

MessageKit Version: … 3.1.0

@kinoroy
Copy link
Member Author

kinoroy commented Jun 22, 2020

Screenshots showing fixes to the video play button:
Video Message Comparison

Copy link
Member

@Kaspik Kaspik left a comment

Choose a reason for hiding this comment

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

Love this, thanks!

@codecov
Copy link

codecov bot commented Jun 23, 2020

Codecov Report

Merging #1386 into development will increase coverage by 0.24%.
The diff coverage is 81.35%.

Impacted file tree graph

@@               Coverage Diff               @@
##           development    #1386      +/-   ##
===============================================
+ Coverage        64.75%   64.99%   +0.24%     
===============================================
  Files               68       68              
  Lines             3305     3277      -28     
===============================================
- Hits              2140     2130      -10     
+ Misses            1165     1147      -18     
Impacted Files Coverage Δ
Sources/Views/Cells/ContactMessageCell.swift 0.00% <0.00%> (ø)
Sources/Views/TypingBubble.swift 0.00% <0.00%> (ø)
Sources/Views/TypingIndicator.swift 0.00% <0.00%> (ø)
Sources/Extensions/UIColor+Extensions.swift 71.42% <71.42%> (+13.24%) ⬆️
Sources/Views/PlayButtonView.swift 50.00% <84.61%> (+9.61%) ⬆️
Sources/Protocols/MessagesDisplayDelegate.swift 82.35% <85.71%> (-0.99%) ⬇️
Sources/Controllers/MessagesViewController.swift 53.76% <100.00%> (ø)
Sources/Views/AvatarView.swift 74.46% <100.00%> (ø)
Sources/Views/MessageLabel.swift 46.37% <100.00%> (ø)
Sources/Views/MessagesCollectionView.swift 41.75% <100.00%> (ø)
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update afde0b1...38eb375. Read the comment docs.

@kinoroy kinoroy merged commit 1918e55 into development Jun 23, 2020
@martinpucik martinpucik deleted the color-assets branch June 24, 2020 06:28
@Kaspik Kaspik mentioned this pull request Aug 26, 2020
Patrick-Kladek pushed a commit to medbee/MessageKit that referenced this pull request Oct 25, 2023
* Add Assets.xcassets to MessageKitAssets.bundle

* Replace incomingGray, outgoingGreen, inputBarGray

* Replace playButtonLightGray, with UIVisualEffectView to mimic iMessage (Fixes MessageKit#1321 , Fixes MessageKit#1335)

* Fixes an issue where the triangle in the play button is not centered

* remove sendButtonBlue, add incoming/outgoingAudioMessageTint

Matches audio tint more closely to iMessage by tinting white on outgoing and tinting blue on incoming

* Remove backgroundColor, add collectionViewBackground

* remove unused labelColor

* Remove unused placeholderTextColor

* Remove grayColor

* remove darkTextColor, add typingIndicatorDot

Matches dot color more closely to iMessage

* Remove unused lightGrayColor

* Adds high contrast appearances to the color assets

* Add MessageKitError string for case when color asset could not be loaded

Also removes redundant internal access level modifier on MessageKitError (internal is default), and changes MessageKitError from enum -> struct as its members were not enum cases

* Fix swiftlint issues

* Add label color asset and use in ContactMessageCell

* Fix tests
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