From f2bb180d659cfdb96f0ff62f6f624871d9923108 Mon Sep 17 00:00:00 2001 From: Michelle Linington Date: Wed, 23 Mar 2022 16:51:15 -0700 Subject: [PATCH] Leverage spinner error UI --- ...oardingProfileCreationViewController.swift | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/Signal/src/ViewControllers/Registration/Onboarding/OnboardingProfileCreationViewController.swift b/Signal/src/ViewControllers/Registration/Onboarding/OnboardingProfileCreationViewController.swift index 12454b1d51..433500d93c 100644 --- a/Signal/src/ViewControllers/Registration/Onboarding/OnboardingProfileCreationViewController.swift +++ b/Signal/src/ViewControllers/Registration/Onboarding/OnboardingProfileCreationViewController.swift @@ -352,15 +352,19 @@ public class OnboardingProfileCreationViewController: OnboardingBaseViewControll } completion: { _ in spinner.removeFromSuperview() } - }.recover { error in - if error.isNetworkConnectivityFailure { - OWSActionSheets.showErrorAlert( - message: NSLocalizedString( - "PROFILE_VIEW_NO_CONNECTION", - comment: "Error shown when the user tries to update their profile when the app is not connected to the internet.") - ) - } else { - OWSActionSheets.showErrorAlert(message: error.userErrorDescription) + }.catch { error in + spinner.stopAnimating(success: false) { + spinner.removeFromSuperview() + + if error.isNetworkConnectivityFailure { + OWSActionSheets.showErrorAlert( + message: NSLocalizedString( + "PROFILE_VIEW_NO_CONNECTION", + comment: "Error shown when the user tries to update their profile when the app is not connected to the internet.") + ) + } else { + OWSActionSheets.showErrorAlert(message: error.userErrorDescription) + } } } }