From 0e65ddee42d119c910387968f637e62ca7bf69cf Mon Sep 17 00:00:00 2001 From: Pinar Olguc Date: Mon, 23 Dec 2024 13:24:37 +0300 Subject: [PATCH] Add email verification check for the QE --- .../Gravatar/GravatarQuickEditorPresenter.swift | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/WordPress/Classes/ViewRelated/Me/My Profile/Gravatar/GravatarQuickEditorPresenter.swift b/WordPress/Classes/ViewRelated/Me/My Profile/Gravatar/GravatarQuickEditorPresenter.swift index a1ad28d733d6..cb0ec4456d2e 100644 --- a/WordPress/Classes/ViewRelated/Me/My Profile/Gravatar/GravatarQuickEditorPresenter.swift +++ b/WordPress/Classes/ViewRelated/Me/My Profile/Gravatar/GravatarQuickEditorPresenter.swift @@ -8,6 +8,7 @@ import WordPressMedia struct GravatarQuickEditorPresenter { let email: String let authToken: String + let emailVerificationStatus: WPAccount.VerificationStatus init?(email: String) { let context = ContextManager.sharedInstance().mainContext @@ -16,9 +17,24 @@ struct GravatarQuickEditorPresenter { } self.email = email self.authToken = account.authToken + self.emailVerificationStatus = account.verificationStatus } func presentQuickEditor(on presentingViewController: UIViewController) { + guard emailVerificationStatus == .verified else { + let alert = UIAlertController( + title: nil, + message: NSLocalizedString( + "avatar.update.email.verification.required", + value: "To update your avatar, you need to verify your email address first.", + comment: "An error message displayed when attempting to update an avatar while the user's email address is not verified." + ), + preferredStyle: .alert + ) + alert.addAction(UIAlertAction(title: SharedStrings.Button.ok, style: .default)) + presentingViewController.present(alert, animated: true) + return + } let presenter = QuickEditorPresenter( email: Email(email), scope: .avatarPicker(AvatarPickerConfiguration(contentLayout: .horizontal())),