Compare commits
No commits in common. "b45dc198111ddbb7d9a77bded1f94e5b91a5ffc1" and "0303c9af9d4e7f3653df0d5f3a7986c4128a3135" have entirely different histories.
b45dc19811
...
0303c9af9d
|
@ -236,7 +236,6 @@
|
||||||
D6B053AC23BD2F1400A066FA /* AssetCollectionViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = D6B053AA23BD2F1400A066FA /* AssetCollectionViewCell.xib */; };
|
D6B053AC23BD2F1400A066FA /* AssetCollectionViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = D6B053AA23BD2F1400A066FA /* AssetCollectionViewCell.xib */; };
|
||||||
D6B053AE23BD322B00A066FA /* AssetPickerSheetContainerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6B053AD23BD322B00A066FA /* AssetPickerSheetContainerViewController.swift */; };
|
D6B053AE23BD322B00A066FA /* AssetPickerSheetContainerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6B053AD23BD322B00A066FA /* AssetPickerSheetContainerViewController.swift */; };
|
||||||
D6B17255254F88B800128392 /* OppositeCollapseKeywordsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6B17254254F88B800128392 /* OppositeCollapseKeywordsView.swift */; };
|
D6B17255254F88B800128392 /* OppositeCollapseKeywordsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6B17254254F88B800128392 /* OppositeCollapseKeywordsView.swift */; };
|
||||||
D6B22A0F2560D52D004D82EF /* TabbedPageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6B22A0E2560D52D004D82EF /* TabbedPageViewController.swift */; };
|
|
||||||
D6B30E09254BAF63009CAEE5 /* ImageGrayscalifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6B30E08254BAF63009CAEE5 /* ImageGrayscalifier.swift */; };
|
D6B30E09254BAF63009CAEE5 /* ImageGrayscalifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6B30E08254BAF63009CAEE5 /* ImageGrayscalifier.swift */; };
|
||||||
D6B4A4FF2506B81A000C81C1 /* AccountDisplayNameLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6B4A4FE2506B81A000C81C1 /* AccountDisplayNameLabel.swift */; };
|
D6B4A4FF2506B81A000C81C1 /* AccountDisplayNameLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6B4A4FE2506B81A000C81C1 /* AccountDisplayNameLabel.swift */; };
|
||||||
D6B81F3C2560365300F6E31D /* RefreshableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6B81F3B2560365300F6E31D /* RefreshableViewController.swift */; };
|
D6B81F3C2560365300F6E31D /* RefreshableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6B81F3B2560365300F6E31D /* RefreshableViewController.swift */; };
|
||||||
|
@ -586,7 +585,6 @@
|
||||||
D6B053AA23BD2F1400A066FA /* AssetCollectionViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AssetCollectionViewCell.xib; sourceTree = "<group>"; };
|
D6B053AA23BD2F1400A066FA /* AssetCollectionViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AssetCollectionViewCell.xib; sourceTree = "<group>"; };
|
||||||
D6B053AD23BD322B00A066FA /* AssetPickerSheetContainerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AssetPickerSheetContainerViewController.swift; sourceTree = "<group>"; };
|
D6B053AD23BD322B00A066FA /* AssetPickerSheetContainerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AssetPickerSheetContainerViewController.swift; sourceTree = "<group>"; };
|
||||||
D6B17254254F88B800128392 /* OppositeCollapseKeywordsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OppositeCollapseKeywordsView.swift; sourceTree = "<group>"; };
|
D6B17254254F88B800128392 /* OppositeCollapseKeywordsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OppositeCollapseKeywordsView.swift; sourceTree = "<group>"; };
|
||||||
D6B22A0E2560D52D004D82EF /* TabbedPageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabbedPageViewController.swift; sourceTree = "<group>"; };
|
|
||||||
D6B30E08254BAF63009CAEE5 /* ImageGrayscalifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageGrayscalifier.swift; sourceTree = "<group>"; };
|
D6B30E08254BAF63009CAEE5 /* ImageGrayscalifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageGrayscalifier.swift; sourceTree = "<group>"; };
|
||||||
D6B4A4FE2506B81A000C81C1 /* AccountDisplayNameLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountDisplayNameLabel.swift; sourceTree = "<group>"; };
|
D6B4A4FE2506B81A000C81C1 /* AccountDisplayNameLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountDisplayNameLabel.swift; sourceTree = "<group>"; };
|
||||||
D6B81F3B2560365300F6E31D /* RefreshableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RefreshableViewController.swift; sourceTree = "<group>"; };
|
D6B81F3B2560365300F6E31D /* RefreshableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RefreshableViewController.swift; sourceTree = "<group>"; };
|
||||||
|
@ -1364,7 +1362,6 @@
|
||||||
D6538944214D6D7500E3CEFC /* TableViewSwipeActionProvider.swift */,
|
D6538944214D6D7500E3CEFC /* TableViewSwipeActionProvider.swift */,
|
||||||
D6B8DB332182A59300424AF7 /* UIAlertController+Visibility.swift */,
|
D6B8DB332182A59300424AF7 /* UIAlertController+Visibility.swift */,
|
||||||
D6BC8747219738E1006163F1 /* EnhancedTableViewController.swift */,
|
D6BC8747219738E1006163F1 /* EnhancedTableViewController.swift */,
|
||||||
D6B22A0E2560D52D004D82EF /* TabbedPageViewController.swift */,
|
|
||||||
D68FEC4E232C5BC300C84F23 /* SegmentedPageViewController.swift */,
|
D68FEC4E232C5BC300C84F23 /* SegmentedPageViewController.swift */,
|
||||||
D693DE5623FE1A6A0061E07D /* EnhancedNavigationViewController.swift */,
|
D693DE5623FE1A6A0061E07D /* EnhancedNavigationViewController.swift */,
|
||||||
D693DE5823FE24300061E07D /* InteractivePushTransition.swift */,
|
D693DE5823FE24300061E07D /* InteractivePushTransition.swift */,
|
||||||
|
@ -1861,7 +1858,6 @@
|
||||||
D620483823D38190008A63EF /* StatusContentTextView.swift in Sources */,
|
D620483823D38190008A63EF /* StatusContentTextView.swift in Sources */,
|
||||||
D6D3FDE224F46A8D00FF50A5 /* ComposeUIState.swift in Sources */,
|
D6D3FDE224F46A8D00FF50A5 /* ComposeUIState.swift in Sources */,
|
||||||
D6C99FC724FACFAB005C74D3 /* ActivityIndicatorView.swift in Sources */,
|
D6C99FC724FACFAB005C74D3 /* ActivityIndicatorView.swift in Sources */,
|
||||||
D6B22A0F2560D52D004D82EF /* TabbedPageViewController.swift in Sources */,
|
|
||||||
D6F953F021251A2900CF0F2B /* MastodonController.swift in Sources */,
|
D6F953F021251A2900CF0F2B /* MastodonController.swift in Sources */,
|
||||||
0411610022B442870030A9B7 /* LoadingLargeImageViewController.swift in Sources */,
|
0411610022B442870030A9B7 /* LoadingLargeImageViewController.swift in Sources */,
|
||||||
D6A4DCE525537C7A00D9DE31 /* FastSwitchingAccountView.swift in Sources */,
|
D6A4DCE525537C7A00D9DE31 /* FastSwitchingAccountView.swift in Sources */,
|
||||||
|
|
|
@ -10,7 +10,7 @@ import UIKit
|
||||||
|
|
||||||
struct MenuController {
|
struct MenuController {
|
||||||
|
|
||||||
static let composeCommand: UIKeyCommand = {
|
static func composeCommand() -> UIKeyCommand {
|
||||||
let selector: Selector
|
let selector: Selector
|
||||||
if #available(iOS 14.0, *) {
|
if #available(iOS 14.0, *) {
|
||||||
selector = #selector(MainSplitViewController.presentCompose)
|
selector = #selector(MainSplitViewController.presentCompose)
|
||||||
|
@ -18,7 +18,7 @@ struct MenuController {
|
||||||
selector = #selector(MainTabBarViewController.presentCompose)
|
selector = #selector(MainTabBarViewController.presentCompose)
|
||||||
}
|
}
|
||||||
return UIKeyCommand(title: "Compose", action: selector, input: "n", modifierFlags: .command)
|
return UIKeyCommand(title: "Compose", action: selector, input: "n", modifierFlags: .command)
|
||||||
}()
|
}
|
||||||
|
|
||||||
static func refreshCommand(discoverabilityTitle: String?) -> UIKeyCommand {
|
static func refreshCommand(discoverabilityTitle: String?) -> UIKeyCommand {
|
||||||
return UIKeyCommand(title: "Refresh", action: #selector(RefreshableViewController.refresh), input: "r", modifierFlags: .command, discoverabilityTitle: discoverabilityTitle)
|
return UIKeyCommand(title: "Refresh", action: #selector(RefreshableViewController.refresh), input: "r", modifierFlags: .command, discoverabilityTitle: discoverabilityTitle)
|
||||||
|
@ -47,22 +47,19 @@ struct MenuController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@available(iOS 14.0, *)
|
@available(iOS 14.0, *)
|
||||||
static let sidebarItemKeyCommands: [UIKeyCommand] = [
|
static func sidebarItemKeyCommands() -> [UIKeyCommand] {
|
||||||
|
return [
|
||||||
sidebarCommand(item: .tab(.timelines), command: "1"),
|
sidebarCommand(item: .tab(.timelines), command: "1"),
|
||||||
sidebarCommand(item: .tab(.notifications), command: "2"),
|
sidebarCommand(item: .tab(.notifications), command: "2"),
|
||||||
sidebarCommand(item: .search, command: "3"),
|
sidebarCommand(item: .search, command: "3"),
|
||||||
sidebarCommand(item: .bookmarks, command: "4"),
|
sidebarCommand(item: .bookmarks, command: "4"),
|
||||||
sidebarCommand(item: .tab(.myProfile), command: "5"),
|
sidebarCommand(item: .tab(.myProfile), command: "5"),
|
||||||
]
|
]
|
||||||
|
}
|
||||||
static let nextSubTabCommand = UIKeyCommand(title: "Next Sub Tab", action: #selector(TabbedPageViewController.selectNextPage), input: "]", modifierFlags: [.command, .shift])
|
|
||||||
|
|
||||||
static let prevSubTabCommand = UIKeyCommand(title: "Previous Sub Tab", action: #selector(TabbedPageViewController.selectPrevPage), input: "[", modifierFlags: [.command, .shift])
|
|
||||||
|
|
||||||
static func buildMainMenu(builder: UIMenuBuilder) {
|
static func buildMainMenu(builder: UIMenuBuilder) {
|
||||||
builder.insertChild(buildFileMenu(), atStartOfMenu: .file)
|
builder.insertChild(buildFileMenu(), atStartOfMenu: .file)
|
||||||
builder.insertChild(buildSubTabMenu(), atStartOfMenu: .view)
|
builder.insertChild(buildViewMenu(), atStartOfMenu: .view)
|
||||||
builder.insertChild(buildSidebarShortcuts(), atStartOfMenu: .view)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static func buildFileMenu() -> UIMenu {
|
private static func buildFileMenu() -> UIMenu {
|
||||||
|
@ -72,29 +69,16 @@ struct MenuController {
|
||||||
identifier: nil,
|
identifier: nil,
|
||||||
options: .displayInline,
|
options: .displayInline,
|
||||||
children: [
|
children: [
|
||||||
composeCommand,
|
composeCommand(),
|
||||||
refreshCommand(discoverabilityTitle: nil),
|
refreshCommand(discoverabilityTitle: nil),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private static func buildSubTabMenu() -> UIMenu {
|
private static func buildViewMenu() -> UIMenu {
|
||||||
return UIMenu(
|
|
||||||
title: "",
|
|
||||||
image: nil,
|
|
||||||
identifier: nil,
|
|
||||||
options: .displayInline,
|
|
||||||
children: [
|
|
||||||
prevSubTabCommand,
|
|
||||||
nextSubTabCommand,
|
|
||||||
]
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
private static func buildSidebarShortcuts() -> UIMenu {
|
|
||||||
let children: [UIMenuElement]
|
let children: [UIMenuElement]
|
||||||
if #available(iOS 14.0, *) {
|
if #available(iOS 14.0, *) {
|
||||||
children = sidebarItemKeyCommands
|
children = sidebarItemKeyCommands()
|
||||||
} else {
|
} else {
|
||||||
children = []
|
children = []
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,7 +176,8 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
||||||
mastodonController.getOwnAccount()
|
mastodonController.getOwnAccount()
|
||||||
mastodonController.getOwnInstance()
|
mastodonController.getOwnInstance()
|
||||||
|
|
||||||
if #available(iOS 14.0, *) {
|
if #available(iOS 14.0, *),
|
||||||
|
UIDevice.current.userInterfaceIdiom != .phone {
|
||||||
return MainSplitViewController(mastodonController: mastodonController)
|
return MainSplitViewController(mastodonController: mastodonController)
|
||||||
} else {
|
} else {
|
||||||
return MainTabBarViewController(mastodonController: mastodonController)
|
return MainTabBarViewController(mastodonController: mastodonController)
|
||||||
|
|
|
@ -58,9 +58,9 @@ class MainSplitViewController: UISplitViewController {
|
||||||
tabBarViewController = MainTabBarViewController(mastodonController: mastodonController)
|
tabBarViewController = MainTabBarViewController(mastodonController: mastodonController)
|
||||||
setViewController(tabBarViewController, for: .compact)
|
setViewController(tabBarViewController, for: .compact)
|
||||||
|
|
||||||
addKeyCommand(MenuController.composeCommand)
|
addKeyCommand(MenuController.composeCommand())
|
||||||
|
|
||||||
MenuController.sidebarItemKeyCommands.forEach(addKeyCommand(_:))
|
MenuController.sidebarItemKeyCommands().forEach(addKeyCommand(_:))
|
||||||
}
|
}
|
||||||
|
|
||||||
func select(item: MainSidebarViewController.Item) {
|
func select(item: MainSidebarViewController.Item) {
|
||||||
|
|
|
@ -89,9 +89,6 @@ class ProfileViewController: UIPageViewController {
|
||||||
headerView.widthAnchor.constraint(equalTo: view.widthAnchor),
|
headerView.widthAnchor.constraint(equalTo: view.widthAnchor),
|
||||||
])
|
])
|
||||||
|
|
||||||
addKeyCommand(MenuController.prevSubTabCommand)
|
|
||||||
addKeyCommand(MenuController.nextSubTabCommand)
|
|
||||||
|
|
||||||
accountUpdater = mastodonController.persistentContainer.accountSubject
|
accountUpdater = mastodonController.persistentContainer.accountSubject
|
||||||
.filter { [weak self] in $0 == self?.accountID }
|
.filter { [weak self] in $0 == self?.accountID }
|
||||||
.receive(on: DispatchQueue.main)
|
.receive(on: DispatchQueue.main)
|
||||||
|
@ -148,8 +145,6 @@ class ProfileViewController: UIPageViewController {
|
||||||
let direction: UIPageViewController.NavigationDirection = currentIndex == nil || index - currentIndex > 0 ? .forward : .reverse
|
let direction: UIPageViewController.NavigationDirection = currentIndex == nil || index - currentIndex > 0 ? .forward : .reverse
|
||||||
currentIndex = index
|
currentIndex = index
|
||||||
|
|
||||||
headerView.pagesSegmentedControl.selectedSegmentIndex = index
|
|
||||||
|
|
||||||
guard let old = viewControllers?.first as? ProfileStatusesViewController else {
|
guard let old = viewControllers?.first as? ProfileStatusesViewController else {
|
||||||
// if old doesn't exist, we're selecting the initial view controller, so moving the header around isn't necessary
|
// if old doesn't exist, we're selecting the initial view controller, so moving the header around isn't necessary
|
||||||
// since it will be added in viewDidLoad
|
// since it will be added in viewDidLoad
|
||||||
|
@ -278,15 +273,3 @@ extension ProfileViewController: TabBarScrollableViewController {
|
||||||
pageControllers[currentIndex].tabBarScrollToTop()
|
pageControllers[currentIndex].tabBarScrollToTop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ProfileViewController: TabbedPageViewController {
|
|
||||||
func selectNextPage() {
|
|
||||||
guard currentIndex < pageControllers.count - 1 else { return }
|
|
||||||
selectPage(at: currentIndex + 1, animated: true)
|
|
||||||
}
|
|
||||||
|
|
||||||
func selectPrevPage() {
|
|
||||||
guard currentIndex > 0 else { return }
|
|
||||||
selectPage(at: currentIndex - 1, animated: true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -41,9 +41,6 @@ class SegmentedPageViewController: UIPageViewController, UIPageViewControllerDel
|
||||||
|
|
||||||
segmentedControl.selectedSegmentIndex = 0
|
segmentedControl.selectedSegmentIndex = 0
|
||||||
selectPage(at: 0, animated: false)
|
selectPage(at: 0, animated: false)
|
||||||
|
|
||||||
addKeyCommand(MenuController.prevSubTabCommand)
|
|
||||||
addKeyCommand(MenuController.nextSubTabCommand)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func selectPage(at index: Int, animated: Bool) {
|
func selectPage(at index: Int, animated: Bool) {
|
||||||
|
@ -51,7 +48,6 @@ class SegmentedPageViewController: UIPageViewController, UIPageViewControllerDel
|
||||||
setViewControllers([pageControllers[index]], direction: direction, animated: animated)
|
setViewControllers([pageControllers[index]], direction: direction, animated: animated)
|
||||||
navigationItem.title = pageControllers[index].title
|
navigationItem.title = pageControllers[index].title
|
||||||
currentIndex = index
|
currentIndex = index
|
||||||
segmentedControl.selectedSegmentIndex = index
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc func segmentedControlChanged() {
|
@objc func segmentedControlChanged() {
|
||||||
|
@ -76,18 +72,6 @@ extension SegmentedPageViewController: TabBarScrollableViewController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension SegmentedPageViewController: TabbedPageViewController {
|
|
||||||
func selectNextPage() {
|
|
||||||
guard currentIndex < pageControllers.count - 1 else { return }
|
|
||||||
selectPage(at: currentIndex + 1, animated: true)
|
|
||||||
}
|
|
||||||
|
|
||||||
func selectPrevPage() {
|
|
||||||
guard currentIndex > 0 else { return }
|
|
||||||
selectPage(at: currentIndex - 1, animated: true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extension SegmentedPageViewController: BackgroundableViewController {
|
extension SegmentedPageViewController: BackgroundableViewController {
|
||||||
func sceneDidEnterBackground() {
|
func sceneDidEnterBackground() {
|
||||||
if let current = pageControllers[currentIndex] as? BackgroundableViewController {
|
if let current = pageControllers[currentIndex] as? BackgroundableViewController {
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
//
|
|
||||||
// TabbedPageViewController.swift
|
|
||||||
// Tusker
|
|
||||||
//
|
|
||||||
// Created by Shadowfacts on 11/14/20.
|
|
||||||
// Copyright © 2020 Shadowfacts. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
import UIKit
|
|
||||||
|
|
||||||
@objc protocol TabbedPageViewController {
|
|
||||||
func selectNextPage()
|
|
||||||
func selectPrevPage()
|
|
||||||
}
|
|
Loading…
Reference in New Issue