Skip to content

Fix the me icon tint color in dark mode - #21932

Merged
adalpari merged 4 commits into
trunkfrom
fix/CMM-449-Fix-the-Me-icon-tint-color-in-dark-mode
Jun 3, 2025
Merged

Fix the me icon tint color in dark mode#21932
adalpari merged 4 commits into
trunkfrom
fix/CMM-449-Fix-the-Me-icon-tint-color-in-dark-mode

Conversation

@adalpari

@adalpari adalpari commented Jun 3, 2025

Copy link
Copy Markdown
Contributor

Description

This PR is fixing a UI glitch where the "Me" icon in the nav bar was drawn with the wrong tint.

The bug was introduced here, where we were swapping the avatar from colored to black and white. So, when the avatar is not ready yet, it was causing the default icon to be shown using the wrong color.

This fix has surfaced other side "bugs" that I'll ticket separately:

  1. The Gravatar is not directly shown in the first login
  2. Changing the gravatar, both in the app and in an external platform, is not taking effect in the "Me" icon

Testing instructions

  1. Set your device to dark mode
  2. Log into the app
  • Verify the right color is used for the "Me" bottom nav icon
  1. Select the "Me" bottom nav icon
  • Verify the "selected state color" is used
  1. Close and open the app
  • If you have a Gravatar image, verify it looks B&W when unselected and coloured when selected
  • If you don't have a Gravatar image, verify it looks selected/unselected correctly
  1. Select light mode, and repeat all the steps
  • Verify all looks as expected

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a UI glitch where the "Me" icon in the navigation bar was displayed with the wrong tint in dark mode.

  • Updated ImageManager.load() to accept an optional requestListener parameter for additional Glide handling.
  • Introduced a gravatarLoaded flag and adjusted the color filter logic in WPMainNavigationView to conditionally update the icon tint only when a gravatar image is loaded.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
WordPress/src/main/java/org/wordpress/android/util/image/ImageManager.kt Added a new parameter to the load() function and chained .attachRequestListener(requestListener) in the Glide configuration.
WordPress/src/main/java/org/wordpress/android/ui/main/WPMainNavigationView.kt Introduced a gravatarLoaded flag and updated the setImageViewSelected method to only change the saturation when the gravatar image is loaded.
Comments suppressed due to low confidence (1)

WordPress/src/main/java/org/wordpress/android/util/image/ImageManager.kt:457

  • Ensure that attachRequestListener handles a null requestListener appropriately or add a null check if necessary to prevent potential runtime issues.
.attachRequestListener(requestListener)

getImageViewForPosition(position)?.let {
if(position == getPosition(ME)) {
if(!isSelected){
// Only change the saturation if we have loaded a Gravatar image

Copilot AI Jun 3, 2025

Copy link

Choose a reason for hiding this comment

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

[nitpick] Consider adding inline documentation or clarifying the logic behind applying color filters only when gravatarLoaded is true to improve code maintainability.

Suggested change
// Only change the saturation if we have loaded a Gravatar image
// Only change the saturation if we have loaded a Gravatar image
// Apply color filters only for the "ME" position and only if the Gravatar image has been loaded.
// This ensures that the color filters are applied to the user's profile image (Gravatar) and not to other icons.

Copilot uses AI. Check for mistakes.
@dangermattic

Copy link
Copy Markdown
Collaborator
1 Warning
⚠️ PR is not assigned to a milestone.

Generated by 🚫 Danger

@wpmobilebot

wpmobilebot commented Jun 3, 2025

Copy link
Copy Markdown
Contributor
WordPress📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress WordPress
FlavorJalapeno
Build TypeDebug
Versionpr21932-9fb12e8
Commit9fb12e8
Direct Downloadwordpress-prototype-build-pr21932-9fb12e8.apk
Note: Google Login is not supported on these builds.

@wpmobilebot

wpmobilebot commented Jun 3, 2025

Copy link
Copy Markdown
Contributor
Jetpack📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack Jetpack
FlavorJalapeno
Build TypeDebug
Versionpr21932-9fb12e8
Commit9fb12e8
Direct Downloadjetpack-prototype-build-pr21932-9fb12e8.apk
Note: Google Login is not supported on these builds.

@codecov

codecov Bot commented Jun 3, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.

Project coverage is 39.31%. Comparing base (9d01155) to head (9fb12e8).
Report is 1 commits behind head on trunk.

Files with missing lines Patch % Lines
...a/org/wordpress/android/util/image/ImageManager.kt 0.00% 6 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            trunk   #21932   +/-   ##
=======================================
  Coverage   39.31%   39.31%           
=======================================
  Files        2139     2139           
  Lines      100443   100443           
  Branches    15417    15417           
=======================================
  Hits        39491    39491           
  Misses      57468    57468           
  Partials     3484     3484           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@adalpari
adalpari enabled auto-merge (squash) June 3, 2025 19:13
@sonarqubecloud

sonarqubecloud Bot commented Jun 3, 2025

Copy link
Copy Markdown

@nbradbury nbradbury self-assigned this Jun 3, 2025

@nbradbury nbradbury left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good! :shipit:

@adalpari
adalpari merged commit 0567f79 into trunk Jun 3, 2025
@adalpari
adalpari deleted the fix/CMM-449-Fix-the-Me-icon-tint-color-in-dark-mode branch June 3, 2025 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants