Remove redundant toastableViewController property

This commit is contained in:
Shadowfacts 2024-04-17 17:12:35 -04:00
parent 043a708515
commit 8960873ff3
6 changed files with 7 additions and 17 deletions

View File

@ -34,7 +34,6 @@ extension StatusSwipeAction {
protocol StatusSwipeActionContainer: UIView { protocol StatusSwipeActionContainer: UIView {
var mastodonController: MastodonController! { get } var mastodonController: MastodonController! { get }
var navigationDelegate: any TuskerNavigationDelegate { get } var navigationDelegate: any TuskerNavigationDelegate { get }
var toastableViewController: ToastableViewController? { get }
var canReblog: Bool { get } var canReblog: Bool { get }

View File

@ -108,7 +108,12 @@ struct PreferencesView: View {
PreferenceSectionLabel(title: "Composing", systemImageName: "pencil", backgroundColor: .blue) PreferenceSectionLabel(title: "Composing", systemImageName: "pencil", backgroundColor: .blue)
} }
NavigationLink(destination: WellnessPrefsView()) { NavigationLink(destination: WellnessPrefsView()) {
PreferenceSectionLabel(title: "Digital Wellness", systemImageName: "brain.fill", backgroundColor: .purple) let brainImageName = if #available(iOS 17.0, *) {
"brain.fill"
} else {
"brain"
}
PreferenceSectionLabel(title: "Digital Wellness", systemImageName: brainImageName, backgroundColor: .purple)
} }
NavigationLink(destination: AdvancedPrefsView()) { NavigationLink(destination: AdvancedPrefsView()) {
PreferenceSectionLabel(title: "Advanced", systemImageName: "gearshape.2.fill", backgroundColor: .gray) PreferenceSectionLabel(title: "Advanced", systemImageName: "gearshape.2.fill", backgroundColor: .gray)

View File

@ -15,7 +15,6 @@ import SwiftUI
@MainActor @MainActor
protocol MenuActionProvider: AnyObject { protocol MenuActionProvider: AnyObject {
var navigationDelegate: TuskerNavigationDelegate? { get } var navigationDelegate: TuskerNavigationDelegate? { get }
var toastableViewController: ToastableViewController? { get }
} }
@MainActor @MainActor
@ -34,10 +33,6 @@ extension MenuActionProvider where Self: TuskerNavigationDelegate {
var navigationDelegate: TuskerNavigationDelegate? { self } var navigationDelegate: TuskerNavigationDelegate? { self }
} }
extension MenuActionProvider where Self: ToastableViewController {
var toastableViewController: ToastableViewController? { self }
}
extension MenuActionProvider { extension MenuActionProvider {
private var mastodonController: MastodonController? { navigationDelegate?.apiController } private var mastodonController: MastodonController? { navigationDelegate?.apiController }
@ -459,7 +454,7 @@ extension MenuActionProvider {
} }
private func handleSuccess(title: String) { private func handleSuccess(title: String) {
if let toastable = self.toastableViewController { if let toastable = self.navigationDelegate {
var config = ToastConfiguration(title: title) var config = ToastConfiguration(title: title)
config.systemImageName = "checkmark" config.systemImageName = "checkmark"
config.dismissAutomaticallyAfter = 2 config.dismissAutomaticallyAfter = 2

View File

@ -267,10 +267,6 @@ extension ContentTextView: UITextViewDelegate {
} }
extension ContentTextView: MenuActionProvider { extension ContentTextView: MenuActionProvider {
var toastableViewController: ToastableViewController? {
// todo: pass this down through the text view
nil
}
} }
extension ContentTextView: UIContextMenuInteractionDelegate { extension ContentTextView: UIContextMenuInteractionDelegate {

View File

@ -170,10 +170,6 @@ class ProfileFieldValueView: UIView {
} }
extension ProfileFieldValueView: UIContextMenuInteractionDelegate, MenuActionProvider { extension ProfileFieldValueView: UIContextMenuInteractionDelegate, MenuActionProvider {
var toastableViewController: ToastableViewController? {
navigationDelegate
}
func contextMenuInteraction(_ interaction: UIContextMenuInteraction, configurationForMenuAtLocation location: CGPoint) -> UIContextMenuConfiguration? { func contextMenuInteraction(_ interaction: UIContextMenuInteraction, configurationForMenuAtLocation location: CGPoint) -> UIContextMenuConfiguration? {
guard let (hashtag, url) = getHashtagOrURL(), guard let (hashtag, url) = getHashtagOrURL(),
let navigationDelegate else { let navigationDelegate else {

View File

@ -945,7 +945,6 @@ extension TimelineStatusCollectionViewCell: UIPointerInteractionDelegate {
extension TimelineStatusCollectionViewCell: StatusSwipeActionContainer { extension TimelineStatusCollectionViewCell: StatusSwipeActionContainer {
var navigationDelegate: TuskerNavigationDelegate { delegate! } var navigationDelegate: TuskerNavigationDelegate { delegate! }
var toastableViewController: ToastableViewController? { delegate }
var canReblog: Bool { var canReblog: Bool {
reblogButton.isEnabled reblogButton.isEnabled