forked from zelo72/mastodon-ios
fix: timeline gap not using theme color issue
This commit is contained in:
parent
0782c9761e
commit
7a0ceb8fc4
|
@ -12,7 +12,7 @@
|
||||||
<key>CoreDataStack.xcscheme_^#shared#^_</key>
|
<key>CoreDataStack.xcscheme_^#shared#^_</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>orderHint</key>
|
<key>orderHint</key>
|
||||||
<integer>20</integer>
|
<integer>27</integer>
|
||||||
</dict>
|
</dict>
|
||||||
<key>Mastodon - ASDK.xcscheme_^#shared#^_</key>
|
<key>Mastodon - ASDK.xcscheme_^#shared#^_</key>
|
||||||
<dict>
|
<dict>
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
<key>NotificationService.xcscheme_^#shared#^_</key>
|
<key>NotificationService.xcscheme_^#shared#^_</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>orderHint</key>
|
<key>orderHint</key>
|
||||||
<integer>21</integer>
|
<integer>26</integer>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<key>SuppressBuildableAutocreation</key>
|
<key>SuppressBuildableAutocreation</key>
|
||||||
|
|
|
@ -7,10 +7,13 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
import UIKit
|
import UIKit
|
||||||
|
import Combine
|
||||||
|
|
||||||
final class SawToothView: UIView {
|
final class SawToothView: UIView {
|
||||||
static let widthUint = 8
|
static let widthUint = 8
|
||||||
|
|
||||||
|
var disposeBag = Set<AnyCancellable>()
|
||||||
|
|
||||||
override init(frame: CGRect) {
|
override init(frame: CGRect) {
|
||||||
super.init(frame: frame)
|
super.init(frame: frame)
|
||||||
_init()
|
_init()
|
||||||
|
@ -22,7 +25,19 @@ final class SawToothView: UIView {
|
||||||
}
|
}
|
||||||
|
|
||||||
func _init() {
|
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) {
|
override func draw(_ rect: CGRect) {
|
||||||
|
@ -37,7 +52,7 @@ final class SawToothView: UIView {
|
||||||
}
|
}
|
||||||
bezierPath.addLine(to: CGPoint(x: 0, y: bottomY))
|
bezierPath.addLine(to: CGPoint(x: 0, y: bottomY))
|
||||||
bezierPath.close()
|
bezierPath.close()
|
||||||
Asset.Colors.Background.systemBackground.color.setFill()
|
ThemeService.shared.currentTheme.value.systemBackgroundColor.setFill()
|
||||||
bezierPath.fill()
|
bezierPath.fill()
|
||||||
bezierPath.lineWidth = 0
|
bezierPath.lineWidth = 0
|
||||||
bezierPath.stroke()
|
bezierPath.stroke()
|
||||||
|
|
|
@ -17,12 +17,13 @@ class TimelineLoaderTableViewCell: UITableViewCell {
|
||||||
|
|
||||||
var disposeBag = Set<AnyCancellable>()
|
var disposeBag = Set<AnyCancellable>()
|
||||||
|
|
||||||
|
private var _disposeBag = Set<AnyCancellable>()
|
||||||
|
|
||||||
let stackView = UIStackView()
|
let stackView = UIStackView()
|
||||||
|
|
||||||
let loadMoreButton: UIButton = {
|
let loadMoreButton: UIButton = {
|
||||||
let button = HighlightDimmableButton()
|
let button = HighlightDimmableButton()
|
||||||
button.titleLabel?.font = TimelineLoaderTableViewCell.labelFont
|
button.titleLabel?.font = TimelineLoaderTableViewCell.labelFont
|
||||||
button.backgroundColor = Asset.Colors.Background.systemBackground.color
|
|
||||||
button.setTitleColor(Asset.Colors.brandBlue.color, for: .normal)
|
button.setTitleColor(Asset.Colors.brandBlue.color, for: .normal)
|
||||||
button.setTitle(L10n.Common.Controls.Timeline.Loader.loadMissingPosts, for: .normal)
|
button.setTitle(L10n.Common.Controls.Timeline.Loader.loadMissingPosts, for: .normal)
|
||||||
button.setTitle("", for: .disabled)
|
button.setTitle("", for: .disabled)
|
||||||
|
@ -114,6 +115,19 @@ class TimelineLoaderTableViewCell: UITableViewCell {
|
||||||
loadMoreButton.isHidden = true
|
loadMoreButton.isHidden = true
|
||||||
loadMoreLabel.isHidden = true
|
loadMoreLabel.isHidden = true
|
||||||
activityIndicatorView.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
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue