1
0
mirror of https://github.com/mastodon/mastodon-ios.git synced 2024-12-23 07:26:34 +01:00

fix: timeline gap not using theme color issue

This commit is contained in:
CMK 2021-07-06 19:32:11 +08:00
parent 0782c9761e
commit 7a0ceb8fc4
3 changed files with 34 additions and 5 deletions

View File

@ -12,7 +12,7 @@
<key>CoreDataStack.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>20</integer>
<integer>27</integer>
</dict>
<key>Mastodon - ASDK.xcscheme_^#shared#^_</key>
<dict>
@ -37,7 +37,7 @@
<key>NotificationService.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>21</integer>
<integer>26</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>

View File

@ -7,10 +7,13 @@
import Foundation
import UIKit
import Combine
final class SawToothView: UIView {
static let widthUint = 8
var disposeBag = Set<AnyCancellable>()
override init(frame: CGRect) {
super.init(frame: frame)
_init()
@ -22,7 +25,19 @@ final class SawToothView: UIView {
}
func _init() {
backgroundColor = Asset.Colors.Background.secondarySystemBackground.color
setupBackgroundColor(theme: ThemeService.shared.currentTheme.value)
ThemeService.shared.currentTheme
.receive(on: RunLoop.main)
.sink { [weak self] theme in
guard let self = self else { return }
self.setupBackgroundColor(theme: theme)
}
.store(in: &disposeBag)
}
private func setupBackgroundColor(theme: Theme) {
backgroundColor = theme.secondarySystemBackgroundColor
setNeedsDisplay()
}
override func draw(_ rect: CGRect) {
@ -37,7 +52,7 @@ final class SawToothView: UIView {
}
bezierPath.addLine(to: CGPoint(x: 0, y: bottomY))
bezierPath.close()
Asset.Colors.Background.systemBackground.color.setFill()
ThemeService.shared.currentTheme.value.systemBackgroundColor.setFill()
bezierPath.fill()
bezierPath.lineWidth = 0
bezierPath.stroke()

View File

@ -16,13 +16,14 @@ class TimelineLoaderTableViewCell: UITableViewCell {
static let labelFont = UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: 17, weight: .medium))
var disposeBag = Set<AnyCancellable>()
private var _disposeBag = Set<AnyCancellable>()
let stackView = UIStackView()
let loadMoreButton: UIButton = {
let button = HighlightDimmableButton()
button.titleLabel?.font = TimelineLoaderTableViewCell.labelFont
button.backgroundColor = Asset.Colors.Background.systemBackground.color
button.setTitleColor(Asset.Colors.brandBlue.color, for: .normal)
button.setTitle(L10n.Common.Controls.Timeline.Loader.loadMissingPosts, for: .normal)
button.setTitle("", for: .disabled)
@ -114,6 +115,19 @@ class TimelineLoaderTableViewCell: UITableViewCell {
loadMoreButton.isHidden = true
loadMoreLabel.isHidden = true
activityIndicatorView.isHidden = true
setupBackgroundColor(theme: ThemeService.shared.currentTheme.value)
ThemeService.shared.currentTheme
.receive(on: RunLoop.main)
.sink { [weak self] theme in
guard let self = self else { return }
self.setupBackgroundColor(theme: theme)
}
.store(in: &_disposeBag)
}
private func setupBackgroundColor(theme: Theme) {
loadMoreButton.backgroundColor = theme.systemBackgroundColor
}
}