Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Move dropdown control to own lib #2335

Merged
merged 3 commits into from
Oct 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Classes/History/PathHistoryViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import UIKit
import IGListKit
import Squawk
import DropdownTitleView

final class PathHistoryViewController: BaseListViewController2<String>,
BaseListViewController2DataSource {
Expand All @@ -29,10 +30,11 @@ BaseListViewController2DataSource {
override func viewDidLoad() {
super.viewDidLoad()

let titleView = NavigationTitleDropdownView(chevronVisible: false)
let titleView = DropdownTitleView()
titleView.configure(
title: NSLocalizedString("History", comment: ""),
subtitle: viewModel.path?.path
subtitle: viewModel.path?.path,
chevronEnabled: false
)
navigationItem.titleView = titleView
}
Expand Down
3 changes: 2 additions & 1 deletion Classes/Issues/IssuesViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import Squawk
import ContextMenu
import GitHubAPI
import ImageAlertAction
import DropdownTitleView

extension ListDiffable {
var needsSpacer: Bool {
Expand Down Expand Up @@ -147,7 +148,7 @@ final class IssuesViewController: MessageViewController,
let labelFormat = NSLocalizedString("#%d in repository %@ by %@", comment: "Accessibility label for an issue/pull request navigation item")
let labelString = String(format: labelFormat, arguments: [model.number, model.repo, model.owner])

let navigationTitle = NavigationTitleDropdownView()
let navigationTitle = DropdownTitleView()
navigationTitle.addTarget(self, action: #selector(onNavigationTitle(sender:)), for: .touchUpInside)
navigationTitle.configure(
title: "#\(model.number)",
Expand Down
3 changes: 2 additions & 1 deletion Classes/Repository/RepositoryViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import Pageboy
import TUSafariActivity
import Squawk
import ContextMenu
import DropdownTitleView

class RepositoryViewController: TabmanViewController,
PageboyViewControllerDataSource,
Expand Down Expand Up @@ -84,7 +85,7 @@ ContextMenuDelegate {
}
navigationItem.rightBarButtonItems = items

let navigationTitle = NavigationTitleDropdownView()
let navigationTitle = DropdownTitleView()
navigationItem.titleView = navigationTitle
navigationTitle.addTarget(self, action: #selector(onNavigationTitle(sender:)), for: .touchUpInside)
let labelFormat = NSLocalizedString(
Expand Down
15 changes: 11 additions & 4 deletions Classes/View Controllers/UIViewController+FilePathTitle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

import UIKit
import DropdownTitleView

extension UIViewController {

Expand All @@ -31,10 +32,16 @@ extension UIViewController {
accessibilityLabel = nil
}

let navigationTitle = NavigationTitleDropdownView()
navigationTitle.configure(title: filePath.current, subtitle: filePath.basePath, accessibilityLabel: accessibilityLabel)
navigationTitle.addTarget(target, action: action, for: .touchUpInside)
navigationItem.titleView = navigationTitle
if let title = filePath.current {
let navigationTitle = DropdownTitleView()
navigationTitle.configure(
title: title,
subtitle: filePath.basePath,
accessibilityLabel: accessibilityLabel
)
navigationTitle.addTarget(target, action: action, for: .touchUpInside)
navigationItem.titleView = navigationTitle
}
}

private func popFileViewControllers(count: Int) {
Expand Down
133 changes: 0 additions & 133 deletions Classes/Views/NavigationTitleDropdownView.swift

This file was deleted.

6 changes: 6 additions & 0 deletions Classes/Views/Styles.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import UIKit
import StyledTextKit
import DropdownTitleView

enum Styles {

Expand Down Expand Up @@ -125,6 +126,11 @@ enum Styles {
[NSAttributedStringKey.foregroundColor: Styles.Colors.Gray.dark.color]
UISwitch.appearance().onTintColor = Styles.Colors.Green.medium.color
UISearchBar.appearance().tintColor = Styles.Colors.Blue.medium.color
DropdownTitleView.appearance().chevronTintColor = Styles.Colors.Gray.medium.color
DropdownTitleView.appearance().titleColor = Styles.Colors.Gray.dark.color
DropdownTitleView.appearance().subtitleColor = Styles.Colors.Gray.light.color
DropdownTitleView.appearance().titleFont = Styles.Text.bodyBold.preferredFont
DropdownTitleView.appearance().subtitleFont = Styles.Text.secondaryBold.preferredFont
}

}
Expand Down
8 changes: 4 additions & 4 deletions Freetime.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
29136BDB200A626D007317BE /* FixedRefreshControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29136BDA200A626D007317BE /* FixedRefreshControl.swift */; };
29136BDD200A6C40007317BE /* IssueTitleModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29136BDC200A6C40007317BE /* IssueTitleModel.swift */; };
29136BDF200A7A75007317BE /* UIScrollView+LeftRightSafeInset.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29136BDE200A7A75007317BE /* UIScrollView+LeftRightSafeInset.swift */; };
29136BE1200A7D3D007317BE /* NavigationTitleDropdownView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29136BE0200A7D3D007317BE /* NavigationTitleDropdownView.swift */; };
29136BE3200AAA5A007317BE /* UIViewController+FilePathTitle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29136BE2200AAA5A007317BE /* UIViewController+FilePathTitle.swift */; };
291929421F3EA8CD0012067B /* File.swift in Sources */ = {isa = PBXBuildFile; fileRef = 291929411F3EA8CD0012067B /* File.swift */; };
291929471F3EAB250012067B /* IssueDetailsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 291929461F3EAB250012067B /* IssueDetailsModel.swift */; };
Expand Down Expand Up @@ -580,7 +579,6 @@
29136BDA200A626D007317BE /* FixedRefreshControl.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FixedRefreshControl.swift; sourceTree = "<group>"; };
29136BDC200A6C40007317BE /* IssueTitleModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IssueTitleModel.swift; sourceTree = "<group>"; };
29136BDE200A7A75007317BE /* UIScrollView+LeftRightSafeInset.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIScrollView+LeftRightSafeInset.swift"; sourceTree = "<group>"; };
29136BE0200A7D3D007317BE /* NavigationTitleDropdownView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationTitleDropdownView.swift; sourceTree = "<group>"; };
29136BE2200AAA5A007317BE /* UIViewController+FilePathTitle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+FilePathTitle.swift"; sourceTree = "<group>"; };
291929411F3EA8CD0012067B /* File.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = File.swift; sourceTree = "<group>"; };
291929461F3EAB250012067B /* IssueDetailsModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IssueDetailsModel.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1798,7 +1796,6 @@
299F63D3205DA24A0015D901 /* MarkdownAttributeHandling.swift */,
299F63E920603FB80015D901 /* MarkdownStyledTextView.swift */,
297A6CE52027880C0027E03B /* MessageView+Styles.swift */,
29136BE0200A7D3D007317BE /* NavigationTitleDropdownView.swift */,
2963A9331EE2118E0066509C /* ResponderButton.swift */,
29C33FDE1F128D4400EC8D40 /* SelectableCell.swift */,
29EE44491F19D85800B05ED3 /* ShowErrorStatusBar.swift */,
Expand Down Expand Up @@ -2562,6 +2559,7 @@
"${BUILT_PRODUCTS_DIR}/AutoInsetter/AutoInsetter.framework",
"${BUILT_PRODUCTS_DIR}/ContextMenu/ContextMenu.framework",
"${BUILT_PRODUCTS_DIR}/DateAgo-iOS/DateAgo.framework",
"${BUILT_PRODUCTS_DIR}/DropdownTitleView/DropdownTitleView.framework",
"${BUILT_PRODUCTS_DIR}/FLAnimatedImage/FLAnimatedImage.framework",
"${BUILT_PRODUCTS_DIR}/FLEX/FLEX.framework",
"${BUILT_PRODUCTS_DIR}/FMDB/FMDB.framework",
Expand Down Expand Up @@ -2594,6 +2592,7 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AutoInsetter.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ContextMenu.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DateAgo.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DropdownTitleView.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FLAnimatedImage.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FLEX.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FMDB.framework",
Expand Down Expand Up @@ -2696,6 +2695,7 @@
"${BUILT_PRODUCTS_DIR}/AutoInsetter/AutoInsetter.framework",
"${BUILT_PRODUCTS_DIR}/ContextMenu/ContextMenu.framework",
"${BUILT_PRODUCTS_DIR}/DateAgo-iOS/DateAgo.framework",
"${BUILT_PRODUCTS_DIR}/DropdownTitleView/DropdownTitleView.framework",
"${BUILT_PRODUCTS_DIR}/FLAnimatedImage/FLAnimatedImage.framework",
"${BUILT_PRODUCTS_DIR}/FLEX/FLEX.framework",
"${BUILT_PRODUCTS_DIR}/FMDB/FMDB.framework",
Expand Down Expand Up @@ -2729,6 +2729,7 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AutoInsetter.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ContextMenu.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DateAgo.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DropdownTitleView.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FLAnimatedImage.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FLEX.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FMDB.framework",
Expand Down Expand Up @@ -2981,7 +2982,6 @@
29F7F05C1F2A751B00F6075D /* IssueResult.swift in Sources */,
292CD3C81F0DB32700D3D57B /* IssueReviewDetailsCell.swift in Sources */,
292CD3CA1F0DB36600D3D57B /* IssueReviewDetailsModel.swift in Sources */,
29136BE1200A7D3D007317BE /* NavigationTitleDropdownView.swift in Sources */,
299C06D81F0DD17B00C2828E /* IssueReviewEmptyTailCell.swift in Sources */,
292CD3CE1F0DB8E700D3D57B /* IssueReviewModel.swift in Sources */,
29F3A18A20CC017700645CB7 /* Repository.swift in Sources */,
Expand Down
1 change: 1 addition & 0 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def testing_pods
pod 'cmark-gfm-swift', :git => 'https://github.com/GitHawkApp/cmark-gfm-swift.git', :branch => 'master'
pod 'Squawk', :git => 'https://github.com/GitHawkApp/Squawk.git', :branch => 'master'
pod 'GitHawkRoutes', :git => 'https://github.com/GitHawkApp/GitHawkRoutes.git', :branch => 'master'
pod 'DropdownTitleView', :git => 'https://github.com/GitHawkApp/DropdownTitleView.git', :branch => 'master'

# debugging pods
pod 'FLEX', '~> 2.0', :configurations => ['Debug', 'TestFlight']
Expand Down
11 changes: 10 additions & 1 deletion Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ PODS:
- Crashlytics (3.9.3):
- Fabric (~> 1.7.2)
- DateAgo (0.1.0)
- DropdownTitleView (0.1.0)
- Fabric (1.7.2)
- FBSnapshotTestCase (2.1.4):
- FBSnapshotTestCase/SwiftSupport (= 2.1.4)
Expand Down Expand Up @@ -66,6 +67,7 @@ DEPENDENCIES:
- ContextMenu (from `https://github.com/GitHawkApp/ContextMenu.git`, branch `master`)
- Crashlytics
- DateAgo (from `Local Pods/DateAgo`)
- DropdownTitleView (from `https://github.com/GitHawkApp/DropdownTitleView.git`, branch `master`)
- Fabric
- FBSnapshotTestCase
- FlatCache (from `https://github.com/GitHawkApp/FlatCache.git`, branch `master`)
Expand Down Expand Up @@ -121,6 +123,9 @@ EXTERNAL SOURCES:
:git: https://github.com/GitHawkApp/ContextMenu.git
DateAgo:
:path: Local Pods/DateAgo
DropdownTitleView:
:branch: master
:git: https://github.com/GitHawkApp/DropdownTitleView.git
FlatCache:
:branch: master
:git: https://github.com/GitHawkApp/FlatCache.git
Expand Down Expand Up @@ -158,6 +163,9 @@ CHECKOUT OPTIONS:
ContextMenu:
:commit: a6956a50277f2382b920058ea90f78a82caeaaa9
:git: https://github.com/GitHawkApp/ContextMenu.git
DropdownTitleView:
:commit: c50b85680df92e7efc985f530c971ff7bb0e9ef7
:git: https://github.com/GitHawkApp/DropdownTitleView.git
FlatCache:
:commit: beb697643eea11f40bb66683d1576a2772080d9d
:git: https://github.com/GitHawkApp/FlatCache.git
Expand Down Expand Up @@ -189,6 +197,7 @@ SPEC CHECKSUMS:
ContextMenu: 7c2853a894e09325dba222dbc87ba594ab775321
Crashlytics: dbb07d01876c171c5ccbdf7826410380189e452c
DateAgo: c678b6435627f2b267980bc6f0a9969389686691
DropdownTitleView: 063054a1200a16b9c15596e597e2f1c310caeff4
Fabric: 9cd6a848efcf1b8b07497e0b6a2e7d336353ba15
FBSnapshotTestCase: 094f9f314decbabe373b87cc339bea235a63e07a
FLAnimatedImage: 4a0b56255d9b05f18b6dd7ee06871be5d3b89e31
Expand All @@ -215,6 +224,6 @@ SPEC CHECKSUMS:
Tabman: 69ce69b44cec1ad693b82c24cdbdf0c45915668c
TUSafariActivity: afc55a00965377939107ce4fdc7f951f62454546

PODFILE CHECKSUM: ad1a1bfa60ab2cc8e941a4bddf5239063f1bdeee
PODFILE CHECKSUM: f20afa6a8f2119dd4614c7abb36f0ccc71ad9f48

COCOAPODS: 1.5.3
21 changes: 21 additions & 0 deletions Pods/DropdownTitleView/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Pods/DropdownTitleView/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Pods/DropdownTitleView/Source/Assets.xcassets/Contents.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading