Skip to content

Commit 184bd2b

Browse files
thirumani-vihaanthirumani-vihaanadalpari
authored
Fix Me tab Gravatar icon not updating on first launch (#23103)
* Fix Me tab Gravatar icon not updating on first launch * Only refresh Gravatar on FETCH_ACCOUNT to prevent unnecessary UI updates * Fix missing AccountAction import --------- Co-authored-by: thirumani-vihaan <your-github-email@example.com> Co-authored-by: Adalberto Plaza <adalpari@gmail.com>
1 parent 5c00911 commit 184bd2b

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

WordPress/src/main/java/org/wordpress/android/ui/main/WPMainActivity.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import org.wordpress.android.analytics.AnalyticsTracker;
4040
import org.wordpress.android.analytics.AnalyticsTracker.Stat;
4141
import org.wordpress.android.fluxc.Dispatcher;
42+
import org.wordpress.android.fluxc.action.AccountAction;
4243
import org.wordpress.android.fluxc.generated.AccountActionBuilder;
4344
import org.wordpress.android.fluxc.generated.SiteActionBuilder;
4445
import org.wordpress.android.fluxc.model.PostModel;
@@ -1466,7 +1467,12 @@ public void onAuthenticationChanged(OnAuthenticationChanged event) {
14661467
public void onAccountChanged(OnAccountChanged event) {
14671468
// Sign-out is handled in `handleSiteRemoved`, no need to show the signup flow here
14681469
if (mAccountStore.hasAccessToken()) {
1469-
if (mBottomNav != null) mBottomNav.showNoteBadge(mAccountStore.getAccount().getHasUnseenNotes());
1470+
if (mBottomNav != null) {
1471+
mBottomNav.showNoteBadge(mAccountStore.getAccount().getHasUnseenNotes());
1472+
if (event.causeOfChange == AccountAction.FETCH_ACCOUNT) {
1473+
mBottomNav.refreshGravatar();
1474+
}
1475+
}
14701476
}
14711477
}
14721478

WordPress/src/main/java/org/wordpress/android/ui/main/WPMainNavigationView.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,13 @@ class WPMainNavigationView @JvmOverloads constructor(
452452
showBadge(getPosition(NOTIFS), showBadge)
453453
}
454454

455+
fun refreshGravatar() {
456+
val imgIcon = getImageViewForPosition(getPosition(ME))
457+
if (imgIcon != null) {
458+
loadGravatar(imgIcon, accountStore.account?.avatarUrl.orEmpty())
459+
}
460+
}
461+
455462
/*
456463
* show or hide the badge on the 'pageId' icon in the bottom bar
457464
*/

0 commit comments

Comments
 (0)