Merge pull request #367 from mastodon/fix-ui

Fix various UI issues
This commit is contained in:
CMK 2022-04-12 11:29:29 +08:00 committed by GitHub
commit 8a051c2177
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 40 additions and 43 deletions

View File

@ -69,10 +69,10 @@ extension SearchHistorySection {
let trendHeaderRegister = UICollectionView.SupplementaryRegistration<SearchHistorySectionHeaderCollectionReusableView>(elementKind: UICollectionView.elementKindSectionHeader) { [weak dataSource] supplementaryView, elementKind, indexPath in
supplementaryView.delegate = configuration.searchHistorySectionHeaderCollectionReusableViewDelegate
guard let dataSource = dataSource else { return }
let sections = dataSource.snapshot().sectionIdentifiers
guard indexPath.section < sections.count else { return }
let section = sections[indexPath.section]
guard let _ = dataSource else { return }
// let sections = dataSource.snapshot().sectionIdentifiers
// guard indexPath.section < sections.count else { return }
// let section = sections[indexPath.section]
}
dataSource.supplementaryViewProvider = { (collectionView: UICollectionView, elementKind: String, indexPath: IndexPath) in

View File

@ -38,11 +38,15 @@ extension DataSourceFacade {
meta: Meta
) async {
switch meta {
// note:
// some server mark the normal url as "u-url" class. highlighted content is a URL
case .url(_, _, let url, _),
.mention(_, let url, _) where url.lowercased().hasPrefix("http"):
// note:
// some server mark the normal url as "u-url" class. highlighted content is a URL
guard let url = URL(string: url) else { return }
// fix non-ascii character URL link can not open issue
guard let url = URL(string: url) ?? URL(string: url.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) ?? url) else {
assertionFailure()
return
}
if let domain = provider.context.authenticationService.activeMastodonAuthenticationBox.value?.domain, url.host == domain,
url.pathComponents.count >= 4,
url.pathComponents[0] == "/",

View File

@ -85,6 +85,9 @@ class SettingsAppearanceTableViewCell: UITableViewCell {
subview.removeFromSuperview()
}
}
// remove grouped style table corner radius
layer.cornerRadius = 0
}
}

View File

@ -5,9 +5,9 @@
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.216",
"green" : "0.173",
"red" : "0.157"
"blue" : "55",
"green" : "44",
"red" : "40"
}
},
"idiom" : "universal"

View File

@ -4,10 +4,10 @@
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "0.600",
"blue" : "67",
"green" : "60",
"red" : "60"
"alpha" : "1.000",
"blue" : "133",
"green" : "112",
"red" : "102"
}
},
"idiom" : "universal"

View File

@ -321,9 +321,6 @@ extension StatusView.ViewModel {
statusView.setSpoilerOverlayViewHidden(isHidden: isContentReveal)
let image = isContentReveal ? UIImage(systemName: "eye.slash.fill") : UIImage(systemName: "eye.fill")
statusView.contentSensitiveeToggleButton.setImage(image, for: .normal)
self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): isContentReveal: \(isContentReveal)")
}
.store(in: &disposeBag)
@ -335,29 +332,22 @@ extension StatusView.ViewModel {
}
.store(in: &disposeBag)
// // visibility
// Publishers.CombineLatest(
// $visibility,
// $isMyself
// )
// .sink { visibility, isMyself in
// switch visibility {
// case .public:
// break
// case .unlisted:
// statusView.statusVisibilityView.label.text = "Everyone can see this post but not display in the public timeline."
// statusView.setVisibilityDisplay()
// case .private:
// statusView.statusVisibilityView.label.text = isMyself ? "Only my followers can see this post." : "Only their followers can see this post."
// statusView.setVisibilityDisplay()
// case .direct:
// statusView.statusVisibilityView.label.text = "Only mentioned user can see this post."
// statusView.setVisibilityDisplay()
// case ._other:
// break
// }
// }
// .store(in: &disposeBag)
// There are 2 conditions:
// 1. The content may non-sensitive with sensitive media
// 2. The content and media both senstivie
Publishers.CombineLatest(
$isContentSensitiveToggled,
$isMediaSensitiveToggled
)
.map { $0 || $1 }
.sink { isSensitiveToggled in
// The button indicator go-to state for button action direction
// eye: when media is hidden
// eye-slash: when media display
let image = isSensitiveToggled ? UIImage(systemName: "eye.slash.fill") : UIImage(systemName: "eye.fill")
statusView.contentSensitiveeToggleButton.setImage(image, for: .normal)
}
.store(in: &disposeBag)
}
private func bindMedia(statusView: StatusView) {

View File

@ -141,11 +141,11 @@ public final class StatusView: UIView {
return style
}()
metaText.textAttributes = [
.font: UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: 15, weight: .regular)),
.font: UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: 17, weight: .regular)),
.foregroundColor: Asset.Colors.Label.primary.color,
]
metaText.linkAttributes = [
.font: UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: 15, weight: .semibold)),
.font: UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: 17, weight: .semibold)),
.foregroundColor: Asset.Colors.brandBlue.color,
]
return metaText
@ -757,7 +757,7 @@ extension StatusView: UITextViewDelegate {
// MARK: - MetaTextViewDelegate
extension StatusView: MetaTextViewDelegate {
public func metaTextView(_ metaTextView: MetaTextView, didSelectMeta meta: Meta) {
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)")
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): meta: \(String(describing: meta))")
switch metaTextView {
case contentMetaText.textView:
delegate?.statusView(self, metaText: contentMetaText, didSelectMeta: meta)