Leverage spinner error UI

This commit is contained in:
Michelle Linington 2022-03-23 16:51:15 -07:00
parent 29dc1eefcd
commit f2bb180d65

View File

@ -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)
}
}
}
}