Compare commits

...

4 Commits

6 changed files with 44 additions and 9 deletions

View File

@ -1,5 +1,13 @@
# Changelog # Changelog
## 2024.4 (134)
Features/Improvements:
- iOS 18: New floating sidebar/tab bar
Bugfixes:
- Fix crash when hashtag search results include duplicates
- Fix "no content" text not being removed from list timeline after refreshing
## 2024.3 (133) ## 2024.3 (133)
- Add additional info to Tip Jar - Add additional info to Tip Jar

View File

@ -45,7 +45,9 @@ class MainTabBarViewController: BaseMainTabBarViewController {
embedInNavigationController(Tab.myProfile.createViewController(mastodonController)), embedInNavigationController(Tab.myProfile.createViewController(mastodonController)),
] ]
#if !os(visionOS)
setupFastAccountSwitcher() setupFastAccountSwitcher()
#endif
tabBar.isSpringLoaded = true tabBar.isSpringLoaded = true

View File

@ -91,7 +91,7 @@ final class NewMainTabBarViewController: BaseMainTabBarViewController {
] ]
reloadSavedInstances() reloadSavedInstances()
if UIDevice.current.userInterfaceIdiom == .phone { if UIDevice.current.userInterfaceIdiom == .phone || UIDevice.current.userInterfaceIdiom == .vision {
self.tabs = [ self.tabs = [
homeTab, homeTab,
notificationsTab, notificationsTab,
@ -121,7 +121,9 @@ final class NewMainTabBarViewController: BaseMainTabBarViewController {
NotificationCenter.default.addObserver(self, selector: #selector(reloadSavedInstances), name: .savedInstancesChanged, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(reloadSavedInstances), name: .savedInstancesChanged, object: nil)
} }
#if !os(visionOS)
setupFastAccountSwitcher() setupFastAccountSwitcher()
#endif
} }
private func updatePadTabs() { private func updatePadTabs() {
@ -312,7 +314,9 @@ final class NewMainTabBarViewController: BaseMainTabBarViewController {
} }
@objc private func sidebarTapped() { @objc private func sidebarTapped() {
#if !os(visionOS)
fastAccountSwitcher?.hide() fastAccountSwitcher?.hide()
#endif
} }
private func showAddList() { private func showAddList() {
@ -500,6 +504,9 @@ extension NewMainTabBarViewController: UITabBarController.Sidebar.Delegate {
config.imageProperties.maximumSize = CGSize(width: MainSidebarMyProfileCollectionViewCell.avatarImageSize, height: MainSidebarMyProfileCollectionViewCell.avatarImageSize) config.imageProperties.maximumSize = CGSize(width: MainSidebarMyProfileCollectionViewCell.avatarImageSize, height: MainSidebarMyProfileCollectionViewCell.avatarImageSize)
config.imageProperties.cornerRadius = Preferences.shared.avatarStyle.cornerRadiusFraction * MainSidebarMyProfileCollectionViewCell.avatarImageSize config.imageProperties.cornerRadius = Preferences.shared.avatarStyle.cornerRadiusFraction * MainSidebarMyProfileCollectionViewCell.avatarImageSize
#if os(visionOS)
item.contentConfiguration = config
#else
if UIDevice.current.userInterfaceIdiom != .mac { if UIDevice.current.userInterfaceIdiom != .mac {
item.accessories = [ item.accessories = [
.customView(configuration: .init(customView: fastAccountSwitcherIndicator, placement: .trailing())) .customView(configuration: .init(customView: fastAccountSwitcherIndicator, placement: .trailing()))
@ -510,6 +517,7 @@ extension NewMainTabBarViewController: UITabBarController.Sidebar.Delegate {
} else { } else {
item.contentConfiguration = config item.contentConfiguration = config
} }
#endif
} }
return item return item
} }

View File

@ -7,7 +7,7 @@
// //
import UIKit import UIKit
import Combine import TuskerPreferences
@available(iOS 17.0, *) @available(iOS 17.0, *)
class AdaptableNavigationController: UIViewController { class AdaptableNavigationController: UIViewController {
@ -15,6 +15,7 @@ class AdaptableNavigationController: UIViewController {
private let viewControllersToPrependInCompact: [UIViewController] private let viewControllersToPrependInCompact: [UIViewController]
private var initialViewControllers: [UIViewController] = [] private var initialViewControllers: [UIViewController] = []
private var currentWidescreenNavigationMode: WidescreenNavigationMode?
private lazy var regular = makeRegularNavigationController() private lazy var regular = makeRegularNavigationController()
private lazy var compact = makeCompactNavigationController() private lazy var compact = makeCompactNavigationController()
private var _current: (any NavigationControllerProtocol)? private var _current: (any NavigationControllerProtocol)?
@ -39,6 +40,8 @@ class AdaptableNavigationController: UIViewController {
registerForTraitChanges([UITraitHorizontalSizeClass.self]) { (self: AdaptableNavigationController, previousTraitCollection) in registerForTraitChanges([UITraitHorizontalSizeClass.self]) { (self: AdaptableNavigationController, previousTraitCollection) in
self.updateNavigationController() self.updateNavigationController()
} }
NotificationCenter.default.addObserver(self, selector: #selector(preferencesChanged), name: .preferencesChanged, object: nil)
} }
private func updateNavigationController() { private func updateNavigationController() {
@ -47,6 +50,7 @@ class AdaptableNavigationController: UIViewController {
if let _current { if let _current {
_current.removeViewAndController() _current.removeViewAndController()
stack = _current.viewControllers stack = _current.viewControllers
_current.viewControllers = []
isTransferring = true isTransferring = true
} else { } else {
stack = initialViewControllers stack = initialViewControllers
@ -79,6 +83,7 @@ class AdaptableNavigationController: UIViewController {
private func makeRegularNavigationController() -> any NavigationControllerProtocol { private func makeRegularNavigationController() -> any NavigationControllerProtocol {
// TODO: need to figure out how to update the navigation controller if the pref changes // TODO: need to figure out how to update the navigation controller if the pref changes
self.currentWidescreenNavigationMode = Preferences.shared.widescreenNavigationMode
switch Preferences.shared.widescreenNavigationMode { switch Preferences.shared.widescreenNavigationMode {
case .stack: case .stack:
return EnhancedNavigationViewController() return EnhancedNavigationViewController()
@ -92,6 +97,18 @@ class AdaptableNavigationController: UIViewController {
private func makeCompactNavigationController() -> any NavigationControllerProtocol { private func makeCompactNavigationController() -> any NavigationControllerProtocol {
EnhancedNavigationViewController() EnhancedNavigationViewController()
} }
@objc private func preferencesChanged() {
if currentWidescreenNavigationMode != Preferences.shared.widescreenNavigationMode {
if let _current,
_current === regular {
regular = makeRegularNavigationController()
updateNavigationController()
} else {
regular = makeRegularNavigationController()
}
}
}
} }
@available(iOS 17.0, *) @available(iOS 17.0, *)

View File

@ -87,7 +87,7 @@ class SplitNavigationController: UIViewController {
NSLayoutConstraint.activate([ NSLayoutConstraint.activate([
rootNav.view.topAnchor.constraint(equalTo: view.topAnchor), rootNav.view.topAnchor.constraint(equalTo: view.topAnchor),
rootNav.view.bottomAnchor.constraint(equalTo: view.bottomAnchor), rootNav.view.bottomAnchor.constraint(equalTo: view.bottomAnchor),
rootNav.view.leadingAnchor.constraint(equalTo: view.leadingAnchor), rootNav.view.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor),
separatorView.topAnchor.constraint(equalTo: view.topAnchor), separatorView.topAnchor.constraint(equalTo: view.topAnchor),
separatorView.bottomAnchor.constraint(equalTo: view.bottomAnchor), separatorView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
@ -196,13 +196,13 @@ class SplitNavigationController: UIViewController {
NSLayoutConstraint.deactivate(constraints) NSLayoutConstraint.deactivate(constraints)
if visible { if visible {
constraints = [ constraints = [
rootNav.view.trailingAnchor.constraint(equalTo: view.centerXAnchor), rootNav.view.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.centerXAnchor),
secondaryNav.view.trailingAnchor.constraint(equalTo: view.trailingAnchor), secondaryNav.view.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor),
] ]
} else { } else {
constraints = [ constraints = [
rootNav.view.trailingAnchor.constraint(equalTo: view.trailingAnchor), rootNav.view.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor),
secondaryNav.view.widthAnchor.constraint(equalTo: view.widthAnchor, multiplier: 0.5), secondaryNav.view.widthAnchor.constraint(equalTo: rootNav.view.widthAnchor),
] ]
} }
NSLayoutConstraint.activate(constraints) NSLayoutConstraint.activate(constraints)

View File

@ -9,8 +9,8 @@
// Configuration settings file format documentation can be found at: // Configuration settings file format documentation can be found at:
// https://help.apple.com/xcode/#/dev745c5c974 // https://help.apple.com/xcode/#/dev745c5c974
MARKETING_VERSION = 2024.3 MARKETING_VERSION = 2024.4
CURRENT_PROJECT_VERSION = 133 CURRENT_PROJECT_VERSION = 134
CURRENT_PROJECT_VERSION = $(inherited)$(CURRENT_PROJECT_VERSION_BUILD_SUFFIX_$(CONFIGURATION)) CURRENT_PROJECT_VERSION = $(inherited)$(CURRENT_PROJECT_VERSION_BUILD_SUFFIX_$(CONFIGURATION))
CURRENT_PROJECT_VERSION_BUILD_SUFFIX_Debug=-dev CURRENT_PROJECT_VERSION_BUILD_SUFFIX_Debug=-dev