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

Commit 332534e

Browse files
authored
Move dropdown control to own lib (#2335)
* Move dropdown control to own lib * update to add missing assets * fix interaction, set appearances
1 parent b9027f2 commit 332534e

40 files changed

+6770
-6118
lines changed

Classes/History/PathHistoryViewController.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import UIKit
1010
import IGListKit
1111
import Squawk
12+
import DropdownTitleView
1213

1314
final class PathHistoryViewController: BaseListViewController2<String>,
1415
BaseListViewController2DataSource {
@@ -29,10 +30,11 @@ BaseListViewController2DataSource {
2930
override func viewDidLoad() {
3031
super.viewDidLoad()
3132

32-
let titleView = NavigationTitleDropdownView(chevronVisible: false)
33+
let titleView = DropdownTitleView()
3334
titleView.configure(
3435
title: NSLocalizedString("History", comment: ""),
35-
subtitle: viewModel.path?.path
36+
subtitle: viewModel.path?.path,
37+
chevronEnabled: false
3638
)
3739
navigationItem.titleView = titleView
3840
}

Classes/Issues/IssuesViewController.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import Squawk
1616
import ContextMenu
1717
import GitHubAPI
1818
import ImageAlertAction
19+
import DropdownTitleView
1920

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

151-
let navigationTitle = NavigationTitleDropdownView()
152+
let navigationTitle = DropdownTitleView()
152153
navigationTitle.addTarget(self, action: #selector(onNavigationTitle(sender:)), for: .touchUpInside)
153154
navigationTitle.configure(
154155
title: "#\(model.number)",

Classes/Repository/RepositoryViewController.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import Pageboy
1212
import TUSafariActivity
1313
import Squawk
1414
import ContextMenu
15+
import DropdownTitleView
1516

1617
class RepositoryViewController: TabmanViewController,
1718
PageboyViewControllerDataSource,
@@ -84,7 +85,7 @@ ContextMenuDelegate {
8485
}
8586
navigationItem.rightBarButtonItems = items
8687

87-
let navigationTitle = NavigationTitleDropdownView()
88+
let navigationTitle = DropdownTitleView()
8889
navigationItem.titleView = navigationTitle
8990
navigationTitle.addTarget(self, action: #selector(onNavigationTitle(sender:)), for: .touchUpInside)
9091
let labelFormat = NSLocalizedString(

Classes/View Controllers/UIViewController+FilePathTitle.swift

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//
88

99
import UIKit
10+
import DropdownTitleView
1011

1112
extension UIViewController {
1213

@@ -31,10 +32,16 @@ extension UIViewController {
3132
accessibilityLabel = nil
3233
}
3334

34-
let navigationTitle = NavigationTitleDropdownView()
35-
navigationTitle.configure(title: filePath.current, subtitle: filePath.basePath, accessibilityLabel: accessibilityLabel)
36-
navigationTitle.addTarget(target, action: action, for: .touchUpInside)
37-
navigationItem.titleView = navigationTitle
35+
if let title = filePath.current {
36+
let navigationTitle = DropdownTitleView()
37+
navigationTitle.configure(
38+
title: title,
39+
subtitle: filePath.basePath,
40+
accessibilityLabel: accessibilityLabel
41+
)
42+
navigationTitle.addTarget(target, action: action, for: .touchUpInside)
43+
navigationItem.titleView = navigationTitle
44+
}
3845
}
3946

4047
private func popFileViewControllers(count: Int) {

Classes/Views/NavigationTitleDropdownView.swift

Lines changed: 0 additions & 133 deletions
This file was deleted.

Classes/Views/Styles.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import UIKit
1010
import StyledTextKit
11+
import DropdownTitleView
1112

1213
enum Styles {
1314

@@ -125,6 +126,11 @@ enum Styles {
125126
[NSAttributedStringKey.foregroundColor: Styles.Colors.Gray.dark.color]
126127
UISwitch.appearance().onTintColor = Styles.Colors.Green.medium.color
127128
UISearchBar.appearance().tintColor = Styles.Colors.Blue.medium.color
129+
DropdownTitleView.appearance().chevronTintColor = Styles.Colors.Gray.medium.color
130+
DropdownTitleView.appearance().titleColor = Styles.Colors.Gray.dark.color
131+
DropdownTitleView.appearance().subtitleColor = Styles.Colors.Gray.light.color
132+
DropdownTitleView.appearance().titleFont = Styles.Text.bodyBold.preferredFont
133+
DropdownTitleView.appearance().subtitleFont = Styles.Text.secondaryBold.preferredFont
128134
}
129135

130136
}

Freetime.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
29136BDB200A626D007317BE /* FixedRefreshControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29136BDA200A626D007317BE /* FixedRefreshControl.swift */; };
4040
29136BDD200A6C40007317BE /* IssueTitleModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29136BDC200A6C40007317BE /* IssueTitleModel.swift */; };
4141
29136BDF200A7A75007317BE /* UIScrollView+LeftRightSafeInset.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29136BDE200A7A75007317BE /* UIScrollView+LeftRightSafeInset.swift */; };
42-
29136BE1200A7D3D007317BE /* NavigationTitleDropdownView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29136BE0200A7D3D007317BE /* NavigationTitleDropdownView.swift */; };
4342
29136BE3200AAA5A007317BE /* UIViewController+FilePathTitle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29136BE2200AAA5A007317BE /* UIViewController+FilePathTitle.swift */; };
4443
291929421F3EA8CD0012067B /* File.swift in Sources */ = {isa = PBXBuildFile; fileRef = 291929411F3EA8CD0012067B /* File.swift */; };
4544
291929471F3EAB250012067B /* IssueDetailsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 291929461F3EAB250012067B /* IssueDetailsModel.swift */; };
@@ -580,7 +579,6 @@
580579
29136BDA200A626D007317BE /* FixedRefreshControl.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FixedRefreshControl.swift; sourceTree = "<group>"; };
581580
29136BDC200A6C40007317BE /* IssueTitleModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IssueTitleModel.swift; sourceTree = "<group>"; };
582581
29136BDE200A7A75007317BE /* UIScrollView+LeftRightSafeInset.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIScrollView+LeftRightSafeInset.swift"; sourceTree = "<group>"; };
583-
29136BE0200A7D3D007317BE /* NavigationTitleDropdownView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationTitleDropdownView.swift; sourceTree = "<group>"; };
584582
29136BE2200AAA5A007317BE /* UIViewController+FilePathTitle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+FilePathTitle.swift"; sourceTree = "<group>"; };
585583
291929411F3EA8CD0012067B /* File.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = File.swift; sourceTree = "<group>"; };
586584
291929461F3EAB250012067B /* IssueDetailsModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IssueDetailsModel.swift; sourceTree = "<group>"; };
@@ -1798,7 +1796,6 @@
17981796
299F63D3205DA24A0015D901 /* MarkdownAttributeHandling.swift */,
17991797
299F63E920603FB80015D901 /* MarkdownStyledTextView.swift */,
18001798
297A6CE52027880C0027E03B /* MessageView+Styles.swift */,
1801-
29136BE0200A7D3D007317BE /* NavigationTitleDropdownView.swift */,
18021799
2963A9331EE2118E0066509C /* ResponderButton.swift */,
18031800
29C33FDE1F128D4400EC8D40 /* SelectableCell.swift */,
18041801
29EE44491F19D85800B05ED3 /* ShowErrorStatusBar.swift */,
@@ -2562,6 +2559,7 @@
25622559
"${BUILT_PRODUCTS_DIR}/AutoInsetter/AutoInsetter.framework",
25632560
"${BUILT_PRODUCTS_DIR}/ContextMenu/ContextMenu.framework",
25642561
"${BUILT_PRODUCTS_DIR}/DateAgo-iOS/DateAgo.framework",
2562+
"${BUILT_PRODUCTS_DIR}/DropdownTitleView/DropdownTitleView.framework",
25652563
"${BUILT_PRODUCTS_DIR}/FLAnimatedImage/FLAnimatedImage.framework",
25662564
"${BUILT_PRODUCTS_DIR}/FLEX/FLEX.framework",
25672565
"${BUILT_PRODUCTS_DIR}/FMDB/FMDB.framework",
@@ -2594,6 +2592,7 @@
25942592
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AutoInsetter.framework",
25952593
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ContextMenu.framework",
25962594
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DateAgo.framework",
2595+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DropdownTitleView.framework",
25972596
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FLAnimatedImage.framework",
25982597
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FLEX.framework",
25992598
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FMDB.framework",
@@ -2696,6 +2695,7 @@
26962695
"${BUILT_PRODUCTS_DIR}/AutoInsetter/AutoInsetter.framework",
26972696
"${BUILT_PRODUCTS_DIR}/ContextMenu/ContextMenu.framework",
26982697
"${BUILT_PRODUCTS_DIR}/DateAgo-iOS/DateAgo.framework",
2698+
"${BUILT_PRODUCTS_DIR}/DropdownTitleView/DropdownTitleView.framework",
26992699
"${BUILT_PRODUCTS_DIR}/FLAnimatedImage/FLAnimatedImage.framework",
27002700
"${BUILT_PRODUCTS_DIR}/FLEX/FLEX.framework",
27012701
"${BUILT_PRODUCTS_DIR}/FMDB/FMDB.framework",
@@ -2729,6 +2729,7 @@
27292729
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AutoInsetter.framework",
27302730
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ContextMenu.framework",
27312731
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DateAgo.framework",
2732+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DropdownTitleView.framework",
27322733
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FLAnimatedImage.framework",
27332734
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FLEX.framework",
27342735
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FMDB.framework",
@@ -2981,7 +2982,6 @@
29812982
29F7F05C1F2A751B00F6075D /* IssueResult.swift in Sources */,
29822983
292CD3C81F0DB32700D3D57B /* IssueReviewDetailsCell.swift in Sources */,
29832984
292CD3CA1F0DB36600D3D57B /* IssueReviewDetailsModel.swift in Sources */,
2984-
29136BE1200A7D3D007317BE /* NavigationTitleDropdownView.swift in Sources */,
29852985
299C06D81F0DD17B00C2828E /* IssueReviewEmptyTailCell.swift in Sources */,
29862986
292CD3CE1F0DB8E700D3D57B /* IssueReviewModel.swift in Sources */,
29872987
29F3A18A20CC017700645CB7 /* Repository.swift in Sources */,

Podfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def testing_pods
3535
pod 'cmark-gfm-swift', :git => 'https://github.com/GitHawkApp/cmark-gfm-swift.git', :branch => 'master'
3636
pod 'Squawk', :git => 'https://github.com/GitHawkApp/Squawk.git', :branch => 'master'
3737
pod 'GitHawkRoutes', :git => 'https://github.com/GitHawkApp/GitHawkRoutes.git', :branch => 'master'
38+
pod 'DropdownTitleView', :git => 'https://github.com/GitHawkApp/DropdownTitleView.git', :branch => 'master'
3839

3940
# debugging pods
4041
pod 'FLEX', '~> 2.0', :configurations => ['Debug', 'TestFlight']

Podfile.lock

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ PODS:
1111
- Crashlytics (3.9.3):
1212
- Fabric (~> 1.7.2)
1313
- DateAgo (0.1.0)
14+
- DropdownTitleView (0.1.0)
1415
- Fabric (1.7.2)
1516
- FBSnapshotTestCase (2.1.4):
1617
- FBSnapshotTestCase/SwiftSupport (= 2.1.4)
@@ -66,6 +67,7 @@ DEPENDENCIES:
6667
- ContextMenu (from `https://github.com/GitHawkApp/ContextMenu.git`, branch `master`)
6768
- Crashlytics
6869
- DateAgo (from `Local Pods/DateAgo`)
70+
- DropdownTitleView (from `https://github.com/GitHawkApp/DropdownTitleView.git`, branch `master`)
6971
- Fabric
7072
- FBSnapshotTestCase
7173
- FlatCache (from `https://github.com/GitHawkApp/FlatCache.git`, branch `master`)
@@ -121,6 +123,9 @@ EXTERNAL SOURCES:
121123
:git: https://github.com/GitHawkApp/ContextMenu.git
122124
DateAgo:
123125
:path: Local Pods/DateAgo
126+
DropdownTitleView:
127+
:branch: master
128+
:git: https://github.com/GitHawkApp/DropdownTitleView.git
124129
FlatCache:
125130
:branch: master
126131
:git: https://github.com/GitHawkApp/FlatCache.git
@@ -158,6 +163,9 @@ CHECKOUT OPTIONS:
158163
ContextMenu:
159164
:commit: a6956a50277f2382b920058ea90f78a82caeaaa9
160165
:git: https://github.com/GitHawkApp/ContextMenu.git
166+
DropdownTitleView:
167+
:commit: c50b85680df92e7efc985f530c971ff7bb0e9ef7
168+
:git: https://github.com/GitHawkApp/DropdownTitleView.git
161169
FlatCache:
162170
:commit: beb697643eea11f40bb66683d1576a2772080d9d
163171
:git: https://github.com/GitHawkApp/FlatCache.git
@@ -189,6 +197,7 @@ SPEC CHECKSUMS:
189197
ContextMenu: 7c2853a894e09325dba222dbc87ba594ab775321
190198
Crashlytics: dbb07d01876c171c5ccbdf7826410380189e452c
191199
DateAgo: c678b6435627f2b267980bc6f0a9969389686691
200+
DropdownTitleView: 063054a1200a16b9c15596e597e2f1c310caeff4
192201
Fabric: 9cd6a848efcf1b8b07497e0b6a2e7d336353ba15
193202
FBSnapshotTestCase: 094f9f314decbabe373b87cc339bea235a63e07a
194203
FLAnimatedImage: 4a0b56255d9b05f18b6dd7ee06871be5d3b89e31
@@ -215,6 +224,6 @@ SPEC CHECKSUMS:
215224
Tabman: 69ce69b44cec1ad693b82c24cdbdf0c45915668c
216225
TUSafariActivity: afc55a00965377939107ce4fdc7f951f62454546
217226

218-
PODFILE CHECKSUM: ad1a1bfa60ab2cc8e941a4bddf5239063f1bdeee
227+
PODFILE CHECKSUM: f20afa6a8f2119dd4614c7abb36f0ccc71ad9f48
219228

220229
COCOAPODS: 1.5.3

Pods/DropdownTitleView/LICENSE

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)