UI/UX improvements and fixes (IOS-5)

- Blur images and hide bio/timeline
- Show correct texts (localization is about to come)
This commit is contained in:
Nathan Mattes 2023-12-19 12:14:58 +01:00
parent bc915e2ef9
commit 8b02ba29dd
5 changed files with 12 additions and 9 deletions

View File

@ -119,7 +119,7 @@ extension ProfileHeaderView.ViewModel {
.store(in: &disposeBag)
// blur for blocking & blockingBy
$relationshipActionOptionSet
.map { $0.contains(.blocking) || $0.contains(.blockingBy) }
.map { $0.contains(.blocking) || $0.contains(.blockingBy) || $0.contains(.domainBlocking) }
.sink { needsImageOverlayBlurred in
UIView.animate(withDuration: 0.33) {
let bannerEffect: UIVisualEffect? = needsImageOverlayBlurred ? ProfileHeaderView.bannerImageViewOverlayBlurEffect : nil
@ -185,7 +185,7 @@ extension ProfileHeaderView.ViewModel {
$relationshipActionOptionSet
.receive(on: DispatchQueue.main)
.sink { optionSet in
let isBlocking = optionSet.contains(.blocking)
let isBlocking = optionSet.contains(.blocking) || optionSet.contains(.domainBlocking)
let isBlockedBy = optionSet.contains(.blockingBy)
let isSuspended = optionSet.contains(.suspended)
let isNeedsHidden = isBlocking || isBlockedBy || isSuspended

View File

@ -325,6 +325,7 @@ extension ProfileViewController {
viewModel.relationshipViewModel.$isBlocking.assign(to: \.isBlocking, on: userTimelineViewModel).store(in: &disposeBag)
viewModel.relationshipViewModel.$isBlockingBy.assign(to: \.isBlockedBy, on: userTimelineViewModel).store(in: &disposeBag)
viewModel.relationshipViewModel.$isSuspended.assign(to: \.isSuspended, on: userTimelineViewModel).store(in: &disposeBag)
viewModel.relationshipViewModel.$isDomainBlocking.assign(to: \.isDomainBlocking, on: userTimelineViewModel).store(in: &disposeBag)
}
// about
@ -831,11 +832,11 @@ extension ProfileViewController: ProfileHeaderViewControllerDelegate {
present(alertController, animated: true, completion: nil)
case .domainBlocking:
guard let user = viewModel.user else { return }
let name = user.displayNameWithFallback
let domain = user.domainFromAcct
let alertController = UIAlertController(
title: L10n.Scene.Profile.RelationshipActionAlert.ConfirmUnblockUser.title,
message: L10n.Scene.Profile.RelationshipActionAlert.ConfirmUnblockUser.message(name),
title: "Unblock domain \(domain)",
message: "Really unblock domain \(domain)?!",
preferredStyle: .alert
)
let record = ManagedObjectRecord<MastodonUser>(objectID: user.objectID)

View File

@ -41,11 +41,12 @@ extension UserTimelineViewModel {
}
.store(in: &disposeBag)
let needsTimelineHidden = Publishers.CombineLatest3(
let needsTimelineHidden = Publishers.CombineLatest4(
$isBlocking,
$isBlockedBy,
$isSuspended
).map { $0 || $1 || $2 }
$isSuspended,
$isDomainBlocking
).map { $0 || $1 || $2 || $3 }
Publishers.CombineLatest(
statusFetchedResultsController.$records,

View File

@ -27,6 +27,7 @@ final class UserTimelineViewModel {
@Published var queryFilter: QueryFilter
@Published var isBlocking = false
@Published var isDomainBlocking = false
@Published var isBlockedBy = false
@Published var isSuspended = false

View File

@ -94,7 +94,7 @@ public struct RelationshipActionOptionSet: OptionSet {
case .editing: return L10n.Common.Controls.Actions.done
case .updating: return " "
case .showReblogs: return " "
case .domainBlocking: return " "
case .domainBlocking: return "Unblock domain"
}
}
}