chore: update navigation bar button item assets

This commit is contained in:
CMK 2022-05-06 15:17:26 +08:00
parent c8e8013901
commit ca0a697cd0
8 changed files with 149 additions and 39 deletions

View File

@ -28,7 +28,7 @@ final class HashtagTimelineViewController: UIViewController, NeedsDependency, Me
let composeBarButtonItem: UIBarButtonItem = {
let barButtonItem = UIBarButtonItem()
barButtonItem.image = UIImage(systemName: "square.and.pencil")?.withRenderingMode(.alwaysTemplate)
barButtonItem.image = Asset.ObjectsAndTools.squareAndPencil.image.withRenderingMode(.alwaysTemplate)
return barButtonItem
}()

View File

@ -51,19 +51,11 @@ final class HomeTimelineViewController: UIViewController, NeedsDependency, Media
let settingBarButtonItem: UIBarButtonItem = {
let barButtonItem = UIBarButtonItem()
barButtonItem.tintColor = ThemeService.tintColor
barButtonItem.image = UIImage(systemName: "gear")?.withRenderingMode(.alwaysTemplate)
barButtonItem.image = Asset.ObjectsAndTools.gear.image.withRenderingMode(.alwaysTemplate)
barButtonItem.accessibilityLabel = L10n.Common.Controls.Actions.settings
return barButtonItem
}()
let composeBarButtonItem: UIBarButtonItem = {
let barButtonItem = UIBarButtonItem()
barButtonItem.tintColor = ThemeService.tintColor
barButtonItem.image = UIImage(systemName: "square.and.pencil")?.withRenderingMode(.alwaysTemplate)
barButtonItem.accessibilityLabel = L10n.Common.Controls.Actions.compose
return barButtonItem
}()
let tableView: UITableView = {
let tableView = ControlContainableTableView()
tableView.register(StatusTableViewCell.self, forCellReuseIdentifier: String(describing: StatusTableViewCell.self))
@ -109,14 +101,14 @@ extension HomeTimelineViewController {
guard let self = self else { return }
#if DEBUG
// display debug menu
self.navigationItem.leftBarButtonItem = {
self.navigationItem.rightBarButtonItem = {
let barButtonItem = UIBarButtonItem()
barButtonItem.image = UIImage(systemName: "ellipsis.circle")
barButtonItem.menu = self.debugMenu
return barButtonItem
}()
#else
self.navigationItem.leftBarButtonItem = displaySettingBarButtonItem ? self.settingBarButtonItem : nil
self.navigationItem.rightBarButtonItem = displaySettingBarButtonItem ? self.settingBarButtonItem : nil
#endif
}
.store(in: &disposeBag)
@ -133,16 +125,6 @@ extension HomeTimelineViewController {
titleView.button.menu = self.debugMenu
#endif
viewModel.$displayComposeBarButtonItem
.receive(on: DispatchQueue.main)
.sink { [weak self] displayComposeBarButtonItem in
guard let self = self else { return }
self.navigationItem.rightBarButtonItem = displayComposeBarButtonItem ? self.composeBarButtonItem : nil
}
.store(in: &disposeBag)
composeBarButtonItem.target = self
composeBarButtonItem.action = #selector(HomeTimelineViewController.composeBarButtonItemPressed(_:))
navigationItem.titleView = titleView
titleView.delegate = self
@ -411,18 +393,7 @@ extension HomeTimelineViewController {
let settingsViewModel = SettingsViewModel(context: context, setting: setting)
coordinator.present(scene: .settings(viewModel: settingsViewModel), from: self, transition: .modal(animated: true, completion: nil))
}
@objc private func composeBarButtonItemPressed(_ sender: UIBarButtonItem) {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
guard let authenticationBox = context.authenticationService.activeMastodonAuthenticationBox.value else { return }
let composeViewModel = ComposeViewModel(
context: context,
composeKind: .post,
authenticationBox: authenticationBox
)
coordinator.present(scene: .compose(viewModel: composeViewModel), from: self, transition: .modal(animated: true, completion: nil))
}
@objc private func refreshControlValueChanged(_ sender: UIRefreshControl) {
guard viewModel.loadLatestStateMachine.enter(HomeTimelineViewModel.LoadLatestState.Loading.self) else {
sender.endRefreshing()

View File

@ -33,7 +33,6 @@ final class HomeTimelineViewModel: NSObject {
@Published var lastAutomaticFetchTimestamp: Date? = nil
@Published var scrollPositionRecord: ScrollPositionRecord? = nil
@Published var displaySettingBarButtonItem = true
@Published var displayComposeBarButtonItem = true
weak var tableView: UITableView?
weak var timelineMiddleLoaderTableViewCellDelegate: TimelineMiddleLoaderTableViewCellDelegate?

View File

@ -42,19 +42,34 @@ final class ProfileViewController: UIViewController, NeedsDependency, MediaPrevi
}()
private(set) lazy var settingBarButtonItem: UIBarButtonItem = {
let barButtonItem = UIBarButtonItem(image: UIImage(systemName: "gear"), style: .plain, target: self, action: #selector(ProfileViewController.settingBarButtonItemPressed(_:)))
let barButtonItem = UIBarButtonItem(
image: Asset.ObjectsAndTools.gear.image.withRenderingMode(.alwaysTemplate),
style: .plain,
target: self,
action: #selector(ProfileViewController.settingBarButtonItemPressed(_:))
)
barButtonItem.tintColor = .white
return barButtonItem
}()
private(set) lazy var shareBarButtonItem: UIBarButtonItem = {
let barButtonItem = UIBarButtonItem(image: UIImage(systemName: "square.and.arrow.up"), style: .plain, target: self, action: #selector(ProfileViewController.shareBarButtonItemPressed(_:)))
let barButtonItem = UIBarButtonItem(
image: Asset.Arrow.squareAndArrowUp.image.withRenderingMode(.alwaysTemplate),
style: .plain,
target: self,
action: #selector(ProfileViewController.shareBarButtonItemPressed(_:))
)
barButtonItem.tintColor = .white
return barButtonItem
}()
private(set) lazy var favoriteBarButtonItem: UIBarButtonItem = {
let barButtonItem = UIBarButtonItem(image: UIImage(systemName: "star"), style: .plain, target: self, action: #selector(ProfileViewController.favoriteBarButtonItemPressed(_:)))
let barButtonItem = UIBarButtonItem(
image: Asset.ObjectsAndTools.star.image.withRenderingMode(.alwaysTemplate),
style: .plain,
target: self,
action: #selector(ProfileViewController.favoriteBarButtonItemPressed(_:))
)
barButtonItem.tintColor = .white
return barButtonItem
}()

View File

@ -38,7 +38,6 @@ final class ContentSplitViewController: UIViewController, NeedsDependency {
private(set) lazy var mainTabBarController: MainTabBarController = {
let mainTabBarController = MainTabBarController(context: context, coordinator: coordinator)
if let homeTimelineViewController = mainTabBarController.viewController(of: HomeTimelineViewController.self) {
homeTimelineViewController.viewModel.displayComposeBarButtonItem = false
homeTimelineViewController.viewModel.displaySettingBarButtonItem = false
}
return mainTabBarController

View File

@ -0,0 +1,15 @@
{
"images" : [
{
"filename" : "Share iOS.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true
}
}

View File

@ -0,0 +1,110 @@
%PDF-1.7
1 0 obj
<< >>
endobj
2 0 obj
<< /Length 3 0 R >>
stream
/DeviceRGB CS
/DeviceRGB cs
q
1.000000 0.000000 -0.000000 1.000000 5.004150 3.928345 cm
0.000000 0.000000 0.000000 scn
16.750000 11.071655 m
17.129696 11.071655 17.443491 10.789501 17.493153 10.423426 c
17.500000 10.321655 l
17.500000 3.320786 l
17.500000 1.587753 16.143545 0.171539 14.434423 0.075930 c
14.250000 0.070786 l
3.250000 0.070786 l
1.516969 0.070786 0.100754 1.427240 0.005145 3.136362 c
0.000000 3.320786 l
0.000000 10.321655 l
0.000000 10.735868 0.335786 11.071655 0.750000 11.071655 c
1.129696 11.071655 1.443491 10.789501 1.493153 10.423426 c
1.500000 10.321655 l
1.500000 3.320786 l
1.500000 2.402613 2.207110 1.649591 3.106473 1.576586 c
3.250000 1.570786 l
14.250000 1.570786 l
15.168174 1.570786 15.921191 2.277895 15.994198 3.177258 c
16.000000 3.320786 l
16.000000 10.321655 l
16.000000 10.735868 16.335787 11.071655 16.750000 11.071655 c
h
3.215397 14.855352 m
8.211636 19.851965 l
8.477744 20.118093 8.894129 20.142456 9.187749 19.924934 c
9.271878 19.852423 l
14.276731 14.855809 l
14.569866 14.563158 14.570257 14.088284 14.277605 13.795150 c
14.011558 13.528664 13.594913 13.504115 13.301123 13.721727 c
13.216944 13.794276 l
9.493999 17.510654 l
9.494885 5.816710 l
9.494885 5.437014 9.212732 5.123218 8.846657 5.073555 c
8.744885 5.066710 l
8.365190 5.066710 8.051395 5.348864 8.001733 5.714939 c
7.994885 5.816710 l
7.993999 17.513655 l
4.276096 13.794732 l
4.009840 13.528456 3.593178 13.504234 3.299558 13.722077 c
3.215437 13.794693 l
2.949160 14.060949 2.924938 14.477612 3.142782 14.771232 c
3.215397 14.855352 l
8.211636 19.851965 l
3.215397 14.855352 l
h
f
n
Q
endstream
endobj
3 0 obj
1600
endobj
4 0 obj
<< /Annots []
/Type /Page
/MediaBox [ 0.000000 0.000000 28.000000 28.000000 ]
/Resources 1 0 R
/Contents 2 0 R
/Parent 5 0 R
>>
endobj
5 0 obj
<< /Kids [ 4 0 R ]
/Count 1
/Type /Pages
>>
endobj
6 0 obj
<< /Pages 5 0 R
/Type /Catalog
>>
endobj
xref
0 7
0000000000 65535 f
0000000010 00000 n
0000000034 00000 n
0000001690 00000 n
0000001713 00000 n
0000001886 00000 n
0000001960 00000 n
trailer
<< /ID [ (some) (id) ]
/Root 6 0 R
/Size 7
>>
startxref
2019
%%EOF

View File

@ -24,6 +24,7 @@ public enum Asset {
public enum Arrow {
public static let `repeat` = ImageAsset(name: "Arrow/repeat")
public static let repeatSmall = ImageAsset(name: "Arrow/repeat.small")
public static let squareAndArrowUp = ImageAsset(name: "Arrow/square.and.arrow.up")
}
public enum Asset {
public static let email = ImageAsset(name: "Asset/email")