2022-11-09 03:14:40 +00:00
|
|
|
//
|
|
|
|
// Duckable+Root.swift
|
|
|
|
// Tusker
|
|
|
|
//
|
|
|
|
// Created by Shadowfacts on 11/7/22.
|
|
|
|
// Copyright © 2022 Shadowfacts. All rights reserved.
|
|
|
|
//
|
|
|
|
|
2023-10-20 02:50:20 +00:00
|
|
|
#if canImport(Duckable)
|
|
|
|
|
2022-11-09 03:14:40 +00:00
|
|
|
import UIKit
|
|
|
|
import Duckable
|
2023-04-16 17:23:13 +00:00
|
|
|
import ComposeUI
|
2022-11-09 03:14:40 +00:00
|
|
|
|
|
|
|
@available(iOS 16.0, *)
|
2023-05-10 15:41:59 +00:00
|
|
|
extension DuckableContainerViewController: AccountSwitchableViewController {
|
2022-11-23 16:35:25 +00:00
|
|
|
func stateRestorationActivity() -> NSUserActivity? {
|
2022-11-28 20:21:05 +00:00
|
|
|
var activity = (child as? TuskerRootViewController)?.stateRestorationActivity()
|
2023-04-16 17:47:48 +00:00
|
|
|
if let compose = duckedViewController as? ComposeHostingController,
|
2023-04-16 17:23:13 +00:00
|
|
|
compose.controller.draft.hasContent {
|
|
|
|
activity = UserActivityManager.addDuckedDraft(to: activity, draft: compose.controller.draft)
|
2022-11-28 20:21:05 +00:00
|
|
|
}
|
|
|
|
return activity
|
2022-11-23 16:35:25 +00:00
|
|
|
}
|
|
|
|
|
2023-02-25 18:55:46 +00:00
|
|
|
func compose(editing draft: Draft?, animated: Bool, isDucked: Bool) {
|
|
|
|
(child as? TuskerRootViewController)?.compose(editing: draft, animated: animated, isDucked: isDucked)
|
|
|
|
}
|
|
|
|
|
|
|
|
func getNavigationDelegate() -> TuskerNavigationDelegate? {
|
|
|
|
(child as? TuskerRootViewController)?.getNavigationDelegate()
|
2022-11-23 16:35:25 +00:00
|
|
|
}
|
|
|
|
|
2023-02-25 18:55:46 +00:00
|
|
|
func getNavigationController() -> NavigationControllerProtocol {
|
|
|
|
(child as! TuskerRootViewController).getNavigationController()
|
2022-11-09 03:14:40 +00:00
|
|
|
}
|
|
|
|
|
2023-02-25 18:55:46 +00:00
|
|
|
func select(route: TuskerRoute, animated: Bool) {
|
|
|
|
(child as? TuskerRootViewController)?.select(route: route, animated: animated)
|
2022-11-09 03:14:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func getTabController(tab: MainTabBarViewController.Tab) -> UIViewController? {
|
|
|
|
return (child as? TuskerRootViewController)?.getTabController(tab: tab)
|
|
|
|
}
|
|
|
|
|
|
|
|
func performSearch(query: String) {
|
|
|
|
(child as? TuskerRootViewController)?.performSearch(query: query)
|
|
|
|
}
|
|
|
|
|
|
|
|
func presentPreferences(completion: (() -> Void)?) {
|
|
|
|
(child as? TuskerRootViewController)?.presentPreferences(completion: completion)
|
|
|
|
}
|
|
|
|
|
|
|
|
func handleStatusBarTapped(xPosition: CGFloat) -> StatusBarTapActionResult {
|
|
|
|
(child as? TuskerRootViewController)?.handleStatusBarTapped(xPosition: xPosition) ?? .continue
|
|
|
|
}
|
2023-05-10 15:41:59 +00:00
|
|
|
|
|
|
|
var isFastAccountSwitcherActive: Bool {
|
|
|
|
(child as? AccountSwitchableViewController)?.isFastAccountSwitcherActive ?? false
|
|
|
|
}
|
2022-11-09 03:14:40 +00:00
|
|
|
}
|
2023-10-20 02:50:20 +00:00
|
|
|
|
|
|
|
#endif
|