Skip to content
This repository was archived by the owner on Feb 5, 2025. It is now read-only.

Commit 68a8748

Browse files
committed
Disable submit button and show a spinner in the magic link button when requesting a magic link.
1 parent 2f8395f commit 68a8748

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

WordPressAuthenticator/Unified Auth/View Related/Password/PasswordViewController.swift

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ private extension PasswordViewController {
276276
tracker.track(click: .requestMagicLink)
277277
loginFields.meta.emailMagicLinkSource = .login
278278

279-
configureViewLoading(true)
279+
updateLoadingUI(isRequestingMagicLink: true)
280280
let result = await MagicLinkRequester().requestMagicLink(email: loginFields.username, jetpackLogin: loginFields.meta.jetpackLogin)
281281
switch result {
282282
case .success:
@@ -292,7 +292,25 @@ private extension PasswordViewController {
292292
displayError(error as NSError, sourceTag: sourceTag)
293293
}
294294
}
295-
configureViewLoading(false)
295+
updateLoadingUI(isRequestingMagicLink: false)
296+
}
297+
298+
func updateLoadingUI(isRequestingMagicLink: Bool) {
299+
if isRequestingMagicLink {
300+
if isMagicLinkShownAsSecondaryAction {
301+
submitButton?.isEnabled = false
302+
secondaryButton.showActivityIndicator(true)
303+
} else {
304+
configureViewLoading(true)
305+
}
306+
} else {
307+
if isMagicLinkShownAsSecondaryAction {
308+
submitButton?.isEnabled = true
309+
secondaryButton.showActivityIndicator(false)
310+
} else {
311+
configureViewLoading(false)
312+
}
313+
}
296314
}
297315
}
298316

0 commit comments

Comments
 (0)