forked from shadowfacts/Tusker
parent
f25031afd4
commit
fccd4e427c
|
@ -14,7 +14,8 @@ class ProfileHeaderMovedOverlayView: UIView {
|
|||
weak var delegate: TuskerNavigationDelegate?
|
||||
|
||||
var collapse: (() -> Void)?
|
||||
|
||||
var hide: (() -> Void)?
|
||||
|
||||
private var avatarImageView: CachedImageView!
|
||||
private var displayNameLabel: EmojiLabel!
|
||||
private var usernameLabel: UILabel!
|
||||
|
@ -144,7 +145,46 @@ class ProfileHeaderMovedOverlayView: UIView {
|
|||
@objc private func accountTapped() {
|
||||
delegate?.selected(account: movedToID)
|
||||
}
|
||||
|
||||
|
||||
// MARK: Accessibility
|
||||
|
||||
override var isAccessibilityElement: Bool {
|
||||
get { true }
|
||||
set {}
|
||||
}
|
||||
|
||||
override var accessibilityLabel: String? {
|
||||
get {
|
||||
guard let movedToID,
|
||||
let account = delegate?.apiController?.persistentContainer.account(for: movedToID) else {
|
||||
return "This account has moved"
|
||||
}
|
||||
return "This account has moved to @\(account.acct)"
|
||||
}
|
||||
set {}
|
||||
}
|
||||
|
||||
override func accessibilityActivate() -> Bool {
|
||||
guard let movedToID,
|
||||
let delegate else {
|
||||
return false
|
||||
}
|
||||
delegate.selected(account: movedToID)
|
||||
return true
|
||||
}
|
||||
|
||||
override var accessibilityCustomActions: [UIAccessibilityCustomAction]? {
|
||||
get {
|
||||
[
|
||||
UIAccessibilityCustomAction(name: "Hide banner", actionHandler: { [unowned self] _ in
|
||||
self.hide?()
|
||||
return true
|
||||
})
|
||||
]
|
||||
}
|
||||
set {}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension ProfileHeaderMovedOverlayView: UIPointerInteractionDelegate {
|
||||
|
|
|
@ -41,6 +41,7 @@ class ProfileHeaderView: UIView {
|
|||
@IBOutlet weak var followersCountButton: UIButton!
|
||||
private(set) var pagesSegmentedControl: ScrollingSegmentedControl<ProfileViewController.Page>!
|
||||
private var movedOverlayView: ProfileHeaderMovedOverlayView?
|
||||
private var hideMovedOverlayView = false
|
||||
|
||||
var accountID: String!
|
||||
|
||||
|
@ -178,7 +179,8 @@ class ProfileHeaderView: UIView {
|
|||
followersCountButton.setAttributedTitle(followersCountTitle, for: .normal)
|
||||
followersCountButton.accessibilityLabel = "\(followersSpelledOut) followers"
|
||||
|
||||
if let movedTo = account.movedTo {
|
||||
if let movedTo = account.movedTo,
|
||||
!hideMovedOverlayView {
|
||||
if let movedOverlayView {
|
||||
movedOverlayView.updateUI(movedTo: movedTo)
|
||||
} else {
|
||||
|
@ -235,6 +237,12 @@ class ProfileHeaderView: UIView {
|
|||
}
|
||||
animator.startAnimation()
|
||||
}
|
||||
overlay.hide = { [weak self] in
|
||||
guard let self else { return }
|
||||
self.hideMovedOverlayView = true
|
||||
self.updateUI(for: self.accountID)
|
||||
UIAccessibility.post(notification: .layoutChanged, argument: self)
|
||||
}
|
||||
|
||||
return overlay
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue