diff --git a/WordPress/src/main/java/org/wordpress/android/ui/main/MeFragment.kt b/WordPress/src/main/java/org/wordpress/android/ui/main/MeFragment.kt
index 9f5e19d0c04e..0b8ad6687560 100644
--- a/WordPress/src/main/java/org/wordpress/android/ui/main/MeFragment.kt
+++ b/WordPress/src/main/java/org/wordpress/android/ui/main/MeFragment.kt
@@ -71,6 +71,7 @@ import org.wordpress.android.ui.photopicker.MediaPickerLauncher
import org.wordpress.android.ui.photopicker.PhotoPickerActivity
import org.wordpress.android.ui.prefs.AppPrefsWrapper
import org.wordpress.android.ui.utils.UiHelpers
+import org.wordpress.android.ui.utils.UiString
import org.wordpress.android.ui.utils.UiString.UiStringText
import org.wordpress.android.util.AppLog
import org.wordpress.android.util.AppLog.T.MAIN
@@ -201,20 +202,36 @@ class MeFragment : Fragment(R.layout.me_fragment), OnScrollToTopListener {
val showPickerListener = OnClickListener {
AnalyticsTracker.track(ME_GRAVATAR_TAPPED)
- if (gravatarQuickEditorFeatureConfig.isEnabled()) {
- GravatarQuickEditor.show(
- fragment = this@MeFragment,
- gravatarQuickEditorParams = GravatarQuickEditorParams {
- email = Email(accountStore.account.email)
- avatarPickerContentLayout = AvatarPickerContentLayout.Horizontal
- },
- authenticationMethod = AuthenticationMethod.Bearer(accountStore.accessToken.orEmpty()),
- onAvatarSelected = {
- loadAvatar(null, true)
- },
- )
+ if (accountStore.account.emailVerified) {
+ if (gravatarQuickEditorFeatureConfig.isEnabled()) {
+ GravatarQuickEditor.show(
+ fragment = this@MeFragment,
+ gravatarQuickEditorParams = GravatarQuickEditorParams {
+ email = Email(accountStore.account.email)
+ avatarPickerContentLayout = AvatarPickerContentLayout.Horizontal
+ },
+ authenticationMethod = AuthenticationMethod.Bearer(accountStore.accessToken.orEmpty()),
+ onAvatarSelected = {
+ loadAvatar(null, true)
+ },
+ )
+ } else {
+ showPhotoPickerForGravatar()
+ }
} else {
- showPhotoPickerForGravatar()
+ view?.let { view ->
+ sequencer.enqueue(
+ SnackbarItem(
+ Info(
+ view,
+ UiString.UiStringRes(R.string.avatar_update_email_unverified),
+ Snackbar.LENGTH_LONG
+ ),
+ null,
+ null
+ )
+ )
+ }
}
}
avatarContainer.setOnClickListener(showPickerListener)
diff --git a/WordPress/src/main/res/values/strings.xml b/WordPress/src/main/res/values/strings.xml
index 76db2f186275..c796329e15e2 100644
--- a/WordPress/src/main/res/values/strings.xml
+++ b/WordPress/src/main/res/values/strings.xml
@@ -3054,6 +3054,7 @@
Error locating the cropped image
Error reloading your Gravatar
Error updating your Gravatar
+ To update your avatar, you need to verify your email address first.
Discard