fix: fade out empty view when it needs hidden

This commit is contained in:
CMK 2021-06-16 13:54:25 +08:00
parent be976c2795
commit 59dda3c469
1 changed files with 5 additions and 3 deletions

View File

@ -242,16 +242,18 @@ extension MastodonPickServerViewController {
guard let self = self else { return }
switch state {
case .none:
self.emptyStateView.isHidden = true
UIView.animate(withDuration: 0.3) {
self.emptyStateView.alpha = 0
}
case .loading:
self.emptyStateView.isHidden = false
self.emptyStateView.alpha = 1
self.emptyStateView.networkIndicatorImageView.isHidden = true
self.emptyStateView.activityIndicatorView.startAnimating()
self.emptyStateView.infoLabel.isHidden = false
self.emptyStateView.infoLabel.text = L10n.Scene.ServerPicker.EmptyState.findingServers
self.emptyStateView.infoLabel.textAlignment = self.traitCollection.layoutDirection == .rightToLeft ? .right : .left
case .badNetwork:
self.emptyStateView.isHidden = false
self.emptyStateView.alpha = 1
self.emptyStateView.networkIndicatorImageView.isHidden = false
self.emptyStateView.activityIndicatorView.stopAnimating()
self.emptyStateView.infoLabel.isHidden = false