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 let trendHeaderRegister = UICollectionView.SupplementaryRegistration<SearchHistorySectionHeaderCollectionReusableView>(elementKind: UICollectionView.elementKindSectionHeader) { [weak dataSource] supplementaryView, elementKind, indexPath in
supplementaryView.delegate = configuration.searchHistorySectionHeaderCollectionReusableViewDelegate supplementaryView.delegate = configuration.searchHistorySectionHeaderCollectionReusableViewDelegate
guard let dataSource = dataSource else { return } guard let _ = dataSource else { return }
let sections = dataSource.snapshot().sectionIdentifiers // let sections = dataSource.snapshot().sectionIdentifiers
guard indexPath.section < sections.count else { return } // guard indexPath.section < sections.count else { return }
let section = sections[indexPath.section] // let section = sections[indexPath.section]
} }
dataSource.supplementaryViewProvider = { (collectionView: UICollectionView, elementKind: String, indexPath: IndexPath) in dataSource.supplementaryViewProvider = { (collectionView: UICollectionView, elementKind: String, indexPath: IndexPath) in

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -141,11 +141,11 @@ public final class StatusView: UIView {
return style return style
}() }()
metaText.textAttributes = [ 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, .foregroundColor: Asset.Colors.Label.primary.color,
] ]
metaText.linkAttributes = [ 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, .foregroundColor: Asset.Colors.brandBlue.color,
] ]
return metaText return metaText
@ -757,7 +757,7 @@ extension StatusView: UITextViewDelegate {
// MARK: - MetaTextViewDelegate // MARK: - MetaTextViewDelegate
extension StatusView: MetaTextViewDelegate { extension StatusView: MetaTextViewDelegate {
public func metaTextView(_ metaTextView: MetaTextView, didSelectMeta meta: Meta) { 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 { switch metaTextView {
case contentMetaText.textView: case contentMetaText.textView:
delegate?.statusView(self, metaText: contentMetaText, didSelectMeta: meta) delegate?.statusView(self, metaText: contentMetaText, didSelectMeta: meta)