Post cell cleanup (IOS-232) and other fixes (#1272)
* Replace icons with SF Symbols (IOS-232) * Remove visibility-icon from Status (IOS-232) * Use relative time formatter and switch position of timestamp/user (IOS-232) * Set TimelineSelector-Button-Position (IOS-232) Shouldn't switch now any longer. Also: Refactoring. * Fix position of the Home-icon in TabBar (IOS-232) TIL: Don't set an empty string, otherwise the position of the TabBarItem-icon breaks
This commit is contained in:
parent
6b32e5e4aa
commit
b120d32efa
|
@ -46,8 +46,9 @@ final class HomeTimelineViewController: UIViewController, NeedsDependency, Media
|
|||
|
||||
lazy var timelineSelectorButton = {
|
||||
let button = UIButton(type: .custom)
|
||||
|
||||
button.setAttributedTitle(
|
||||
.init(string: "Following", attributes: [
|
||||
.init(string: L10n.Scene.HomeTimeline.TimelineMenu.following, attributes: [
|
||||
.font: UIFontMetrics(forTextStyle: .headline).scaledFont(for: .systemFont(ofSize: 20, weight: .semibold))
|
||||
]),
|
||||
for: .normal)
|
||||
|
@ -61,15 +62,12 @@ final class HomeTimelineViewController: UIViewController, NeedsDependency, Media
|
|||
config.contentInsets = .init(top: 0, leading: 0, bottom: 0, trailing: 0)
|
||||
config.imagePadding = 8
|
||||
config.image = UIImage(systemName: "chevron.down.circle.fill", withConfiguration: imageConfiguration)
|
||||
config.imagePlacement = .trailing
|
||||
return config
|
||||
}()
|
||||
|
||||
button.semanticContentAttribute =
|
||||
UIApplication.shared.userInterfaceLayoutDirection == .rightToLeft ?
|
||||
.forceLeftToRight :
|
||||
.forceRightToLeft
|
||||
button.showsMenuAsPrimaryAction = true
|
||||
button.menu = generateTimeSelectorMenu()
|
||||
button.menu = generateTimelineSelectorMenu()
|
||||
return button
|
||||
}()
|
||||
|
||||
|
@ -105,7 +103,7 @@ final class HomeTimelineViewController: UIViewController, NeedsDependency, Media
|
|||
var timelinePillHiddenTopAnchor: NSLayoutConstraint?
|
||||
|
||||
|
||||
private func generateTimeSelectorMenu() -> UIMenu {
|
||||
private func generateTimelineSelectorMenu() -> UIMenu {
|
||||
let showFollowingAction = UIAction(title: L10n.Scene.HomeTimeline.TimelineMenu.following, image: .init(systemName: "house")) { [weak self] _ in
|
||||
guard let self, let viewModel = self.viewModel else { return }
|
||||
|
||||
|
@ -120,7 +118,7 @@ final class HomeTimelineViewController: UIViewController, NeedsDependency, Media
|
|||
for: .normal)
|
||||
|
||||
timelineSelectorButton.sizeToFit()
|
||||
timelineSelectorButton.menu = generateTimeSelectorMenu()
|
||||
timelineSelectorButton.menu = generateTimelineSelectorMenu()
|
||||
}
|
||||
|
||||
let showLocalTimelineAction = UIAction(title: L10n.Scene.HomeTimeline.TimelineMenu.localCommunity, image: .init(systemName: "building.2")) { [weak self] action in
|
||||
|
@ -134,7 +132,7 @@ final class HomeTimelineViewController: UIViewController, NeedsDependency, Media
|
|||
]),
|
||||
for: .normal)
|
||||
timelineSelectorButton.sizeToFit()
|
||||
timelineSelectorButton.menu = generateTimeSelectorMenu()
|
||||
timelineSelectorButton.menu = generateTimelineSelectorMenu()
|
||||
}
|
||||
|
||||
if let viewModel {
|
||||
|
@ -157,7 +155,7 @@ extension HomeTimelineViewController {
|
|||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
title = ""
|
||||
title = nil
|
||||
view.backgroundColor = .secondarySystemBackground
|
||||
|
||||
viewModel?.$displaySettingBarButtonItem
|
||||
|
|
|
@ -82,9 +82,6 @@ extension NotificationView {
|
|||
let metaUsername = PlaintextMetaContent(string: "@\(author.acct)")
|
||||
authorUsernameLabel.configure(content: metaUsername)
|
||||
|
||||
let visibility = notification.entity.status?.mastodonVisibility ?? ._other("")
|
||||
visibilityIconImageView.image = visibility.image
|
||||
|
||||
// notification type indicator
|
||||
let notificationIndicatorText: MetaContent?
|
||||
if let type = MastodonNotificationType(rawValue: notification.entity.type.rawValue) {
|
||||
|
@ -218,7 +215,7 @@ extension NotificationView {
|
|||
.sink { [weak self] now in
|
||||
guard let self, let type = MastodonNotificationType(rawValue: notification.entity.type.rawValue) else { return }
|
||||
|
||||
let formattedTimestamp = now.localizedTimeAgo(since: notification.entity.createdAt)
|
||||
let formattedTimestamp = notification.entity.createdAt.localizedAbbreviatedSlowedTimeAgoSinceNow
|
||||
dateLabel.configure(content: PlaintextMetaContent(string: formattedTimestamp))
|
||||
|
||||
self.accessibilityLabel = [
|
||||
|
|
|
@ -84,20 +84,6 @@ public final class NotificationView: UIView {
|
|||
// timestamp
|
||||
public let dateLabel = MetaLabel(style: .statusUsername)
|
||||
|
||||
public let dateTrailingDotLabel: MetaLabel = {
|
||||
let label = MetaLabel(style: .statusUsername)
|
||||
label.configure(content: PlaintextMetaContent(string: "·"))
|
||||
return label
|
||||
}()
|
||||
|
||||
let visibilityIconImageView: UIImageView = {
|
||||
let imageView = UIImageView()
|
||||
imageView.tintColor = Asset.Colors.Label.secondary.color
|
||||
imageView.contentMode = .scaleAspectFit
|
||||
imageView.image = Mastodon.Entity.Status.Visibility.public.image.withRenderingMode(.alwaysTemplate)
|
||||
return imageView
|
||||
}()
|
||||
|
||||
public let menuButton: UIButton = {
|
||||
let button = HitTestExpandedButton(type: .system)
|
||||
button.tintColor = Asset.Colors.Label.secondary.color
|
||||
|
@ -280,29 +266,18 @@ extension NotificationView {
|
|||
authrMetaContainer.addArrangedSubview(authorSecondaryMetaContainer)
|
||||
authrMetaContainer.setCustomSpacing(4, after: authorSecondaryMetaContainer)
|
||||
|
||||
authorSecondaryMetaContainer.addArrangedSubview(authorUsernameLabel)
|
||||
authorUsernameLabel.setContentHuggingPriority(.required - 1, for: .vertical)
|
||||
authorUsernameLabel.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
|
||||
|
||||
authorSecondaryMetaContainer.addArrangedSubview(usernameTrialingDotLabel)
|
||||
usernameTrialingDotLabel.setContentCompressionResistancePriority(.required, for: .horizontal)
|
||||
|
||||
authorSecondaryMetaContainer.addArrangedSubview(dateLabel)
|
||||
dateLabel.setContentHuggingPriority(.required - 1, for: .horizontal)
|
||||
dateLabel.setContentCompressionResistancePriority(.required - 1, for: .horizontal)
|
||||
|
||||
authorSecondaryMetaContainer.addArrangedSubview(dateTrailingDotLabel)
|
||||
dateTrailingDotLabel.setContentCompressionResistancePriority(.required, for: .horizontal)
|
||||
authorSecondaryMetaContainer.addArrangedSubview(usernameTrialingDotLabel)
|
||||
usernameTrialingDotLabel.setContentCompressionResistancePriority(.required, for: .horizontal)
|
||||
|
||||
authorSecondaryMetaContainer.addArrangedSubview(authorUsernameLabel)
|
||||
authorUsernameLabel.setContentHuggingPriority(.required - 1, for: .vertical)
|
||||
authorUsernameLabel.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
|
||||
|
||||
authorSecondaryMetaContainer.addArrangedSubview(visibilityIconImageView)
|
||||
NSLayoutConstraint.activate([
|
||||
visibilityIconImageView.heightAnchor.constraint(equalTo: authorUsernameLabel.heightAnchor),
|
||||
visibilityIconImageView.widthAnchor.constraint(equalTo: visibilityIconImageView.heightAnchor),
|
||||
])
|
||||
|
||||
authorSecondaryMetaContainer.addArrangedSubview(UIView())
|
||||
|
||||
authorSecondaryMetaContainer.setCustomSpacing(0, after: visibilityIconImageView)
|
||||
|
||||
// authorContainerViewBottomPaddingView
|
||||
authorContainerViewBottomPaddingView.translatesAutoresizingMaskIntoConstraints = false
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "repeat.pdf",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
},
|
||||
"properties" : {
|
||||
"preserves-vector-representation" : true
|
||||
}
|
||||
}
|
|
@ -1,122 +0,0 @@
|
|||
%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 2.000000 2.107513 cm
|
||||
0.000000 0.000000 0.000000 scn
|
||||
12.610181 19.422018 m
|
||||
12.533377 19.489384 l
|
||||
12.239406 19.713934 11.818006 19.691479 11.549520 19.422018 c
|
||||
11.482400 19.344936 l
|
||||
11.258662 19.049896 11.281035 18.626966 11.549520 18.357506 c
|
||||
13.521000 16.380682 l
|
||||
6.500000 16.380682 l
|
||||
6.266866 16.376564 l
|
||||
2.784996 16.253372 0.000000 13.381639 0.000000 9.857073 c
|
||||
0.000000 8.166546 0.640704 6.626207 1.691700 5.467305 c
|
||||
1.764071 5.397793 l
|
||||
1.894961 5.285951 2.064627 5.218454 2.250000 5.218454 c
|
||||
2.664214 5.218454 3.000000 5.555460 3.000000 5.971178 c
|
||||
3.000000 6.144394 2.941704 6.303945 2.843728 6.431146 c
|
||||
2.644393 6.661853 l
|
||||
1.929533 7.529752 1.500000 8.643068 1.500000 9.857073 c
|
||||
1.500000 12.628527 3.738576 14.875234 6.500000 14.875234 c
|
||||
13.381000 14.875234 l
|
||||
11.549520 13.034943 l
|
||||
11.482400 12.957859 l
|
||||
11.258662 12.662821 11.281035 12.239891 11.549520 11.970430 c
|
||||
11.842414 11.676473 12.317287 11.676473 12.610181 11.970430 c
|
||||
15.792162 15.163968 l
|
||||
15.859283 15.241051 l
|
||||
16.083021 15.536089 16.060648 15.959020 15.792162 16.228481 c
|
||||
12.610181 19.422018 l
|
||||
h
|
||||
18.229979 14.321409 m
|
||||
18.099916 14.430242 17.932577 14.495717 17.750000 14.495717 c
|
||||
17.335787 14.495717 17.000000 14.158710 17.000000 13.742992 c
|
||||
17.000000 13.556305 17.067719 13.385490 17.179129 13.255264 c
|
||||
17.999193 12.361402 18.500000 11.167934 18.500000 9.857073 c
|
||||
18.500000 7.085619 16.261425 4.838912 13.500000 4.838912 c
|
||||
6.558000 4.838912 l
|
||||
8.463367 6.750031 l
|
||||
8.536530 6.835192 l
|
||||
8.733867 7.102798 8.731853 7.471925 8.530489 7.737460 c
|
||||
8.463367 7.814543 l
|
||||
8.378515 7.887972 l
|
||||
8.111876 8.086025 7.744085 8.084003 7.479511 7.881908 c
|
||||
7.402708 7.814543 l
|
||||
4.220727 4.621005 l
|
||||
4.147565 4.535844 l
|
||||
3.950228 4.268237 3.952242 3.899111 4.153605 3.633575 c
|
||||
4.220727 3.556492 l
|
||||
7.402708 0.362953 l
|
||||
7.486826 0.290073 l
|
||||
7.780437 0.071426 8.197102 0.095720 8.463367 0.362953 c
|
||||
8.731853 0.632414 8.754227 1.055346 8.530489 1.350384 c
|
||||
8.463367 1.427467 l
|
||||
6.564000 3.333464 l
|
||||
13.500000 3.333464 l
|
||||
13.733133 3.337582 l
|
||||
17.215004 3.460773 20.000000 6.332506 20.000000 9.857073 c
|
||||
20.000000 11.550518 19.357080 13.093257 18.302853 14.252840 c
|
||||
18.229979 14.321409 l
|
||||
h
|
||||
f
|
||||
n
|
||||
Q
|
||||
|
||||
endstream
|
||||
endobj
|
||||
|
||||
3 0 obj
|
||||
2191
|
||||
endobj
|
||||
|
||||
4 0 obj
|
||||
<< /Annots []
|
||||
/Type /Page
|
||||
/MediaBox [ 0.000000 0.000000 24.000000 24.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
|
||||
0000002281 00000 n
|
||||
0000002304 00000 n
|
||||
0000002477 00000 n
|
||||
0000002551 00000 n
|
||||
trailer
|
||||
<< /ID [ (some) (id) ]
|
||||
/Root 6 0 R
|
||||
/Size 7
|
||||
>>
|
||||
startxref
|
||||
2610
|
||||
%%EOF
|
|
@ -1,15 +0,0 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "repeat.small.pdf",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
},
|
||||
"properties" : {
|
||||
"preserves-vector-representation" : true
|
||||
}
|
||||
}
|
|
@ -1,121 +0,0 @@
|
|||
%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 1.997589 2.358398 cm
|
||||
0.000000 0.000000 0.000000 scn
|
||||
13.752419 11.631601 m
|
||||
13.931720 11.631601 14.096325 11.568684 14.225361 11.463720 c
|
||||
15.313271 10.549767 16.004837 9.176446 16.004837 7.641602 c
|
||||
16.004837 4.952847 13.882531 2.759784 11.221727 2.646221 c
|
||||
11.004837 2.641602 l
|
||||
6.563000 2.641602 l
|
||||
7.782749 1.421932 l
|
||||
8.049015 1.155665 8.073221 0.739002 7.855367 0.445391 c
|
||||
7.782749 0.361271 l
|
||||
7.516482 0.095004 7.099819 0.070798 6.806207 0.288652 c
|
||||
6.722089 0.361271 l
|
||||
4.222089 2.861272 l
|
||||
3.955822 3.127539 3.931616 3.544202 4.149471 3.837813 c
|
||||
4.222089 3.921931 l
|
||||
6.722089 6.421931 l
|
||||
7.014983 6.714825 7.489855 6.714825 7.782749 6.421931 c
|
||||
8.049015 6.155664 8.073221 5.739001 7.855367 5.445390 c
|
||||
7.782749 5.361272 l
|
||||
6.563000 4.141602 l
|
||||
11.004837 4.141602 l
|
||||
12.873401 4.141602 14.399964 5.605879 14.499659 7.449566 c
|
||||
14.504837 7.641602 l
|
||||
14.504837 8.722754 14.014629 9.689410 13.244354 10.331430 c
|
||||
13.095952 10.466222 13.002419 10.662989 13.002419 10.881601 c
|
||||
13.002419 11.295815 13.338205 11.631601 13.752419 11.631601 c
|
||||
h
|
||||
8.222090 14.921932 m
|
||||
8.488357 15.188198 8.905020 15.212404 9.198631 14.994550 c
|
||||
9.282749 14.921932 l
|
||||
11.782749 12.421932 l
|
||||
11.855368 12.337813 l
|
||||
12.049016 12.076825 12.051406 11.718611 11.862539 11.455222 c
|
||||
11.782749 11.361271 l
|
||||
9.282749 8.861272 l
|
||||
9.198631 8.788653 l
|
||||
8.937643 8.595005 8.579429 8.592613 8.316040 8.781481 c
|
||||
8.222090 8.861272 l
|
||||
8.149471 8.945390 l
|
||||
7.955823 9.206378 7.953431 9.564592 8.142298 9.827981 c
|
||||
8.222090 9.921932 l
|
||||
9.441000 11.141602 l
|
||||
5.000000 11.141602 l
|
||||
3.131437 11.141602 1.604874 9.677324 1.505179 7.833637 c
|
||||
1.500000 7.641602 l
|
||||
1.500000 6.558465 1.992010 5.590244 2.764729 4.948239 c
|
||||
2.910926 4.812664 3.002419 4.617817 3.002419 4.401602 c
|
||||
3.002419 3.987389 2.666633 3.651602 2.252419 3.651602 c
|
||||
2.061133 3.651602 1.886572 3.723213 1.754084 3.841089 c
|
||||
0.681080 4.754352 0.000000 6.118439 0.000000 7.641602 c
|
||||
0.000000 10.330357 2.122307 12.523419 4.783111 12.636982 c
|
||||
5.000000 12.641602 l
|
||||
9.441000 12.641602 l
|
||||
8.222090 13.861271 l
|
||||
8.149471 13.945390 l
|
||||
7.931617 14.239001 7.955823 14.655665 8.222090 14.921932 c
|
||||
h
|
||||
f
|
||||
n
|
||||
Q
|
||||
|
||||
endstream
|
||||
endobj
|
||||
|
||||
3 0 obj
|
||||
2140
|
||||
endobj
|
||||
|
||||
4 0 obj
|
||||
<< /Annots []
|
||||
/Type /Page
|
||||
/MediaBox [ 0.000000 0.000000 20.000000 20.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
|
||||
0000002230 00000 n
|
||||
0000002253 00000 n
|
||||
0000002426 00000 n
|
||||
0000002500 00000 n
|
||||
trailer
|
||||
<< /ID [ (some) (id) ]
|
||||
/Root 6 0 R
|
||||
/Size 7
|
||||
>>
|
||||
startxref
|
||||
2559
|
||||
%%EOF
|
|
@ -1,15 +0,0 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "bubble.left.and.bubble.right.pdf",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
},
|
||||
"properties" : {
|
||||
"preserves-vector-representation" : true
|
||||
}
|
||||
}
|
|
@ -1,110 +0,0 @@
|
|||
%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 2.000000 2.836700 cm
|
||||
0.000000 0.000000 0.000000 scn
|
||||
7.561576 18.163300 m
|
||||
3.419440 18.163300 0.061576 14.805435 0.061576 10.663300 c
|
||||
0.061576 9.530416 0.313246 8.454476 0.764230 7.489944 c
|
||||
0.510198 6.491944 0.226379 5.379101 0.039990 4.648594 c
|
||||
-0.193033 3.735312 0.629398 2.904506 1.543737 3.124281 c
|
||||
2.293964 3.304609 3.446986 3.581353 4.474467 3.826294 c
|
||||
5.416776 3.400215 6.462413 3.163300 7.561576 3.163300 c
|
||||
11.703712 3.163300 15.061575 6.521164 15.061575 10.663300 c
|
||||
15.061575 14.805435 11.703712 18.163300 7.561576 18.163300 c
|
||||
h
|
||||
1.561576 10.663300 m
|
||||
1.561576 13.977008 4.247868 16.663300 7.561576 16.663300 c
|
||||
10.875283 16.663300 13.561575 13.977008 13.561575 10.663300 c
|
||||
13.561575 7.349591 10.875283 4.663300 7.561576 4.663300 c
|
||||
6.600843 4.663300 5.694872 4.888549 4.891613 5.288434 c
|
||||
4.648198 5.409614 l
|
||||
4.383680 5.346642 l
|
||||
3.460951 5.126980 2.394888 4.871399 1.595922 4.679508 c
|
||||
1.794670 5.458641 2.057843 6.490885 2.286006 7.387637 c
|
||||
2.356194 7.663498 l
|
||||
2.225676 7.916461 l
|
||||
1.801452 8.738670 1.561576 9.671877 1.561576 10.663300 c
|
||||
h
|
||||
12.561601 0.163244 m
|
||||
10.592215 0.163244 8.800118 0.922304 7.461914 2.163819 c
|
||||
7.495111 2.163436 7.528352 2.163244 7.561634 2.163244 c
|
||||
8.279597 2.163244 8.976770 2.252259 9.642719 2.419854 c
|
||||
10.506666 1.937881 11.502057 1.663244 12.561601 1.663244 c
|
||||
13.522333 1.663244 14.428305 1.888493 15.231564 2.288379 c
|
||||
15.474978 2.409558 l
|
||||
15.739497 2.346587 l
|
||||
16.661055 2.127203 17.704596 1.900763 18.478659 1.737051 c
|
||||
18.303703 2.487577 18.064995 3.492156 17.837170 4.387582 c
|
||||
17.766983 4.663443 l
|
||||
17.897501 4.916406 l
|
||||
18.321724 5.738615 18.561600 6.671822 18.561600 7.663244 c
|
||||
18.561600 9.777950 17.467583 11.637134 15.814650 12.705694 c
|
||||
15.636257 13.428946 15.365275 14.115738 15.014999 14.752777 c
|
||||
17.952297 13.736459 20.061600 10.946178 20.061600 7.663244 c
|
||||
20.061600 6.530099 19.809814 5.453921 19.358633 4.489217 c
|
||||
19.611656 3.481242 19.867884 2.389293 20.030380 1.685955 c
|
||||
20.234837 0.801001 19.455448 -0.000011 18.562967 0.186527 c
|
||||
17.835819 0.338509 16.693346 0.582319 15.649543 0.826614 c
|
||||
14.707017 0.400299 13.661087 0.163244 12.561601 0.163244 c
|
||||
h
|
||||
f
|
||||
n
|
||||
Q
|
||||
|
||||
endstream
|
||||
endobj
|
||||
|
||||
3 0 obj
|
||||
2167
|
||||
endobj
|
||||
|
||||
4 0 obj
|
||||
<< /Annots []
|
||||
/Type /Page
|
||||
/MediaBox [ 0.000000 0.000000 24.000000 24.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
|
||||
0000002257 00000 n
|
||||
0000002280 00000 n
|
||||
0000002453 00000 n
|
||||
0000002527 00000 n
|
||||
trailer
|
||||
<< /ID [ (some) (id) ]
|
||||
/Root 6 0 R
|
||||
/Size 7
|
||||
>>
|
||||
startxref
|
||||
2586
|
||||
%%EOF
|
|
@ -25,8 +25,6 @@ public typealias AssetImageTypeAlias = ImageAsset.Image
|
|||
// swiftlint:disable identifier_name line_length nesting type_body_length type_name
|
||||
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 {
|
||||
|
@ -111,7 +109,6 @@ public enum Asset {
|
|||
public static let systemOrange = ColorAsset(name: "Colors/system.orange")
|
||||
}
|
||||
public enum Communication {
|
||||
public static let bubbleLeftAndBubbleRight = ImageAsset(name: "Communication/bubble.left.and.bubble.right")
|
||||
public static let share = ImageAsset(name: "Communication/share")
|
||||
}
|
||||
public enum Connectivity {
|
||||
|
|
|
@ -15,11 +15,12 @@ extension Date {
|
|||
|
||||
public static let relativeTimestampFormatter: RelativeDateTimeFormatter = {
|
||||
let formatter = RelativeDateTimeFormatter()
|
||||
formatter.locale = Locale.autoupdatingCurrent
|
||||
formatter.dateTimeStyle = .numeric
|
||||
formatter.unitsStyle = .full
|
||||
formatter.unitsStyle = .abbreviated
|
||||
return formatter
|
||||
}()
|
||||
|
||||
|
||||
public static let abbreviatedDateFormatter: DateFormatter = {
|
||||
let formatter = DateFormatter()
|
||||
formatter.dateStyle = .medium // e.g. Nov 23, 1937
|
||||
|
@ -27,39 +28,9 @@ extension Date {
|
|||
return formatter
|
||||
}()
|
||||
|
||||
public var localizedSlowedTimeAgoSinceNow: String {
|
||||
return self.localizedTimeAgo(since: Date(), isSlowed: true, isAbbreviated: false)
|
||||
public var localizedAbbreviatedSlowedTimeAgoSinceNow: String {
|
||||
return Date.relativeTimestampFormatter.localizedString(for: self, relativeTo: Date())
|
||||
}
|
||||
|
||||
public var localizedTimeAgoSinceNow: String {
|
||||
return self.localizedTimeAgo(since: Date())
|
||||
}
|
||||
|
||||
public func localizedTimeAgo(since date: Date, isSlowed: Bool = false, isAbbreviated: Bool = false) -> String {
|
||||
let earlierDate = date < self ? date : self
|
||||
let latestDate = earlierDate == date ? self : date
|
||||
|
||||
if isSlowed, earlierDate.timeIntervalSince(latestDate) >= -60 {
|
||||
return L10n.Common.Controls.Timeline.Timestamp.now
|
||||
} else {
|
||||
if isAbbreviated {
|
||||
return latestDate.localizedShortTimeAgo(since: earlierDate)
|
||||
} else {
|
||||
if earlierDate.timeIntervalSince(latestDate) < -(7 * 24 * 60 * 60) {
|
||||
let currentYear = Date.calendar.dateComponents([.year], from: Date())
|
||||
let earlierDateYear = Date.calendar.dateComponents([.year], from: earlierDate)
|
||||
if currentYear.year! > earlierDateYear.year! {
|
||||
return earlierDate.formatted(.dateTime.year().month(.abbreviated).day())
|
||||
} else {
|
||||
return earlierDate.formatted(.dateTime.month(.abbreviated).day())
|
||||
}
|
||||
} else {
|
||||
return Date.relativeTimestampFormatter.localizedString(for: earlierDate, relativeTo: latestDate)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension Date {
|
||||
|
|
|
@ -40,20 +40,6 @@ public class StatusAuthorView: UIStackView {
|
|||
// timestamp
|
||||
public let dateLabel = MetaLabel(style: .statusUsername)
|
||||
|
||||
public let dateTrailingDotLabel: MetaLabel = {
|
||||
let label = MetaLabel(style: .statusUsername)
|
||||
label.configure(content: PlaintextMetaContent(string: "·"))
|
||||
return label
|
||||
}()
|
||||
|
||||
let visibilityIconImageView: UIImageView = {
|
||||
let imageView = UIImageView()
|
||||
imageView.tintColor = Asset.Colors.Label.secondary.color
|
||||
imageView.contentMode = .scaleAspectFit
|
||||
imageView.image = Mastodon.Entity.Status.Visibility.public.image
|
||||
return imageView
|
||||
}()
|
||||
|
||||
public let menuButton: UIButton = {
|
||||
let button = HitTestExpandedButton(type: .system)
|
||||
button.expandEdgeInsets = UIEdgeInsets(top: -20, left: -10, bottom: -10, right: -10)
|
||||
|
@ -150,8 +136,6 @@ extension StatusAuthorView {
|
|||
|
||||
// dateLabel
|
||||
dateLabel.isUserInteractionEnabled = false
|
||||
|
||||
visibilityIconImageView.isUserInteractionEnabled = false
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -306,27 +290,16 @@ extension StatusAuthorView {
|
|||
authorSecondaryMetaContainer.spacing = 4
|
||||
authorMetaContainer.addArrangedSubview(authorSecondaryMetaContainer)
|
||||
|
||||
authorSecondaryMetaContainer.addArrangedSubview(authorUsernameLabel)
|
||||
authorUsernameLabel.setContentHuggingPriority(.required - 1, for: .vertical)
|
||||
authorUsernameLabel.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
|
||||
|
||||
authorSecondaryMetaContainer.addArrangedSubview(usernameTrialingDotLabel)
|
||||
usernameTrialingDotLabel.setContentCompressionResistancePriority(.required, for: .horizontal)
|
||||
|
||||
authorSecondaryMetaContainer.addArrangedSubview(dateLabel)
|
||||
dateLabel.setContentHuggingPriority(.required - 1, for: .horizontal)
|
||||
dateLabel.setContentCompressionResistancePriority(.required - 1, for: .horizontal)
|
||||
|
||||
authorSecondaryMetaContainer.addArrangedSubview(dateTrailingDotLabel)
|
||||
dateTrailingDotLabel.setContentCompressionResistancePriority(.required, for: .horizontal)
|
||||
authorSecondaryMetaContainer.addArrangedSubview(usernameTrialingDotLabel)
|
||||
usernameTrialingDotLabel.setContentCompressionResistancePriority(.required, for: .horizontal)
|
||||
|
||||
authorSecondaryMetaContainer.addArrangedSubview(visibilityIconImageView)
|
||||
NSLayoutConstraint.activate([
|
||||
visibilityIconImageView.heightAnchor.constraint(equalTo: authorUsernameLabel.heightAnchor),
|
||||
visibilityIconImageView.widthAnchor.constraint(equalTo: visibilityIconImageView.heightAnchor),
|
||||
])
|
||||
|
||||
authorSecondaryMetaContainer.setCustomSpacing(0, after: visibilityIconImageView)
|
||||
authorSecondaryMetaContainer.addArrangedSubview(authorUsernameLabel)
|
||||
authorUsernameLabel.setContentHuggingPriority(.required - 1, for: .vertical)
|
||||
authorUsernameLabel.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
|
||||
|
||||
authorSecondaryMetaContainer.addArrangedSubview(UIView())
|
||||
}
|
||||
|
|
|
@ -63,21 +63,9 @@ public final class StatusMetricView: UIView {
|
|||
return stackView
|
||||
}()
|
||||
|
||||
public let reblogButton: StatusMetricRowView = {
|
||||
let button = StatusMetricRowView(iconImage: Asset.Arrow.repeat.image, text: L10n.Common.Controls.Status.Buttons.reblogsTitle, detailText: "")
|
||||
return button
|
||||
}()
|
||||
|
||||
// favorite meter
|
||||
public let favoriteButton: StatusMetricRowView = {
|
||||
let button = StatusMetricRowView(iconImage: UIImage(systemName: "star"), text: L10n.Common.Controls.Status.Buttons.favoritesTitle, detailText: "")
|
||||
return button
|
||||
}()
|
||||
|
||||
public let editHistoryButton: StatusMetricRowView = {
|
||||
let button = StatusMetricRowView(iconImage: Asset.Scene.EditHistory.edit.image, text: L10n.Common.Controls.Status.Buttons.editHistoryTitle)
|
||||
return button
|
||||
}()
|
||||
public let reblogButton = StatusMetricRowView(iconImage: UIImage(systemName: "arrow.2.squarepath")!, text: L10n.Common.Controls.Status.Buttons.reblogsTitle, detailText: "")
|
||||
public let favoriteButton = StatusMetricRowView(iconImage: UIImage(systemName: "star"), text: L10n.Common.Controls.Status.Buttons.favoritesTitle, detailText: "")
|
||||
public let editHistoryButton = StatusMetricRowView(iconImage: Asset.Scene.EditHistory.edit.image, text: L10n.Common.Controls.Status.Buttons.editHistoryTitle)
|
||||
|
||||
public override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
|
|
|
@ -248,9 +248,10 @@ extension StatusView {
|
|||
// timestamp
|
||||
viewModel.timestampFormatter = { (date: Date, isEdited: Bool) in
|
||||
if isEdited {
|
||||
return L10n.Common.Controls.Status.editedAtTimestampPrefix(date.localizedSlowedTimeAgoSinceNow)
|
||||
return L10n.Common.Controls.Status.editedAtTimestampPrefix(date.localizedAbbreviatedSlowedTimeAgoSinceNow)
|
||||
} else {
|
||||
return date.localizedAbbreviatedSlowedTimeAgoSinceNow
|
||||
}
|
||||
return date.localizedSlowedTimeAgoSinceNow
|
||||
}
|
||||
viewModel.timestamp = timestamp
|
||||
}
|
||||
|
|
|
@ -225,7 +225,7 @@ extension StatusView.ViewModel {
|
|||
case .none:
|
||||
return
|
||||
case .repost(let info):
|
||||
statusView.headerIconImageView.image = Asset.Arrow.repeatSmall.image.withRenderingMode(.alwaysTemplate)
|
||||
statusView.headerIconImageView.image = UIImage(systemName: "repeat")!.withRenderingMode(.alwaysTemplate)
|
||||
statusView.headerInfoLabel.configure(content: info.header)
|
||||
statusView.setHeaderDisplay()
|
||||
case .reply(let info):
|
||||
|
@ -293,17 +293,10 @@ extension StatusView.ViewModel {
|
|||
.store(in: &disposeBag)
|
||||
|
||||
$timestampText
|
||||
.sink { [weak self] text in
|
||||
guard let _ = self else { return }
|
||||
.sink { text in
|
||||
authorView.dateLabel.configure(content: PlaintextMetaContent(string: text))
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
|
||||
$visibility
|
||||
.sink { visibility in
|
||||
authorView.visibilityIconImageView.image = visibility.image
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
}
|
||||
|
||||
private func bindContent(statusView: StatusView) {
|
||||
|
|
|
@ -17,13 +17,13 @@ public protocol ActionToolbarContainerDelegate: AnyObject {
|
|||
}
|
||||
|
||||
public final class ActionToolbarContainer: UIView {
|
||||
|
||||
static let replyImage = Asset.Communication.bubbleLeftAndBubbleRight.image.withRenderingMode(.alwaysTemplate)
|
||||
static let reblogImage = Asset.Arrow.repeat.image.withRenderingMode(.alwaysTemplate)
|
||||
static let starImage = Asset.ObjectsAndTools.star.image.withRenderingMode(.alwaysTemplate)
|
||||
static let starFillImage = Asset.ObjectsAndTools.starFill.image.withRenderingMode(.alwaysTemplate)
|
||||
static let shareImage = Asset.Arrow.squareAndArrowUp.image.withRenderingMode(.alwaysTemplate)
|
||||
|
||||
|
||||
static let replyImage = UIImage(systemName: "arrowshape.turn.up.left")!.withRenderingMode(.alwaysTemplate)
|
||||
static let reblogImage = UIImage(systemName: "arrow.2.squarepath")!.withRenderingMode(.alwaysTemplate)
|
||||
static let starImage = UIImage(systemName: "star")!.withRenderingMode(.alwaysTemplate)
|
||||
static let starFillImage = UIImage(systemName: "star.fill")!.withRenderingMode(.alwaysTemplate)
|
||||
static let shareImage = UIImage(systemName: "square.and.arrow.up")!.withRenderingMode(.alwaysTemplate)
|
||||
|
||||
public let replyButton = HighlightDimmableButton()
|
||||
public let reblogButton = HighlightDimmableButton()
|
||||
public let favoriteButton = HighlightDimmableButton()
|
||||
|
|
Loading…
Reference in New Issue