Fix selected segment not updating on profiles when switching tabs with keyboard shortcuts

This commit is contained in:
Shadowfacts 2022-10-29 15:08:03 -04:00
parent 2344275ff9
commit 10239d14c9
2 changed files with 10 additions and 0 deletions

View File

@ -12,6 +12,14 @@ class ProfileHeaderCollectionViewCell: UICollectionViewCell {
private var state: State = .unloaded
var view: ProfileHeaderView? {
if case .view(let view) = state {
return view
} else {
return nil
}
}
override init(frame: CGRect) {
super.init(frame: frame)

View File

@ -297,11 +297,13 @@ extension ProfileViewController: ProfileHeaderViewDelegate {
extension ProfileViewController: TabbedPageViewController {
func selectNextPage() {
guard currentIndex < pageControllers.count - 1 else { return }
currentViewController.headerCell?.view?.pagesSegmentedControl.selectedSegmentIndex = currentIndex + 1
selectPage(at: currentIndex + 1, animated: true)
}
func selectPrevPage() {
guard currentIndex > 0 else { return }
currentViewController.headerCell?.view?.pagesSegmentedControl.selectedSegmentIndex = currentIndex - 1
selectPage(at: currentIndex - 1, animated: true)
}
}