fix: color in Light Mode, fix search result disappear when push new page

This commit is contained in:
sunxiaojian 2021-04-09 20:38:02 +08:00
parent ae20a29013
commit a007b7a980
4 changed files with 54 additions and 15 deletions

View File

@ -44,6 +44,7 @@ internal enum Asset {
internal static let mediaTypeIndicotor = ColorAsset(name: "Colors/Background/media.type.indicotor")
internal static let navigationBar = ColorAsset(name: "Colors/Background/navigationBar")
internal static let onboardingBackground = ColorAsset(name: "Colors/Background/onboarding.background")
internal static let searchResult = ColorAsset(name: "Colors/Background/searchResult")
internal static let secondaryGroupedSystemBackground = ColorAsset(name: "Colors/Background/secondary.grouped.system.background")
internal static let secondarySystemBackground = ColorAsset(name: "Colors/Background/secondary.system.background")
internal static let systemBackground = ColorAsset(name: "Colors/Background/system.background")

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xFE",
"green" : "0xFF",
"red" : "0xFE"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x00",
"green" : "0x00",
"red" : "0x00"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -77,7 +77,7 @@ final class SearchViewController: UIViewController, NeedsDependency {
// searching
let searchingTableView: UITableView = {
let tableView = UITableView()
tableView.backgroundColor = Asset.Colors.Background.systemGroupedBackground.color
tableView.backgroundColor = Asset.Colors.Background.searchResult.color
tableView.rowHeight = UITableView.automaticDimension
tableView.separatorStyle = .singleLine
tableView.separatorInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)

View File

@ -106,11 +106,11 @@ final class SearchViewModel: NSObject {
isSearching
}
.sink { [weak self] _, text, scope in
guard text.isEmpty else { return }
guard let self = self else { return }
guard let searchHistories = self.fetchSearchHistory() else { return }
guard let dataSource = self.searchResultDiffableDataSource else { return }
var snapshot = NSDiffableDataSourceSnapshot<SearchResultSection, SearchResultItem>()
if text.isEmpty {
snapshot.appendSections([.mixed])
searchHistories.forEach { searchHistory in
@ -125,8 +125,8 @@ final class SearchViewModel: NSObject {
snapshot.appendItems([item], toSection: .mixed)
}
}
}
dataSource.apply(snapshot, animatingDifferences: false, completion: nil)
}
.store(in: &disposeBag)