fix: the data source update queue , change activityIndicatorView color
This commit is contained in:
parent
61a26fbe66
commit
d6d91180cb
@ -162,7 +162,6 @@ final class SearchViewModel: NSObject {
|
|||||||
.store(in: &disposeBag)
|
.store(in: &disposeBag)
|
||||||
|
|
||||||
requestRecommendAccountsV2()
|
requestRecommendAccountsV2()
|
||||||
.receive(on: DispatchQueue.main)
|
|
||||||
.sink { [weak self] _ in
|
.sink { [weak self] _ in
|
||||||
guard let self = self else { return }
|
guard let self = self else { return }
|
||||||
if !self.recommendAccounts.isEmpty {
|
if !self.recommendAccounts.isEmpty {
|
||||||
@ -176,7 +175,6 @@ final class SearchViewModel: NSObject {
|
|||||||
.sink { [weak self] _ in
|
.sink { [weak self] _ in
|
||||||
guard let self = self else { return }
|
guard let self = self else { return }
|
||||||
self.requestRecommendAccounts()
|
self.requestRecommendAccounts()
|
||||||
.receive(on: DispatchQueue.main)
|
|
||||||
.sink { [weak self] _ in
|
.sink { [weak self] _ in
|
||||||
guard let self = self else { return }
|
guard let self = self else { return }
|
||||||
if !self.recommendAccounts.isEmpty {
|
if !self.recommendAccounts.isEmpty {
|
||||||
@ -295,12 +293,14 @@ final class SearchViewModel: NSObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func applyDataSource() {
|
func applyDataSource() {
|
||||||
guard let dataSource = accountDiffableDataSource else { return }
|
DispatchQueue.main.async {
|
||||||
|
guard let dataSource = self.accountDiffableDataSource else { return }
|
||||||
var snapshot = NSDiffableDataSourceSnapshot<RecommendAccountSection, NSManagedObjectID>()
|
var snapshot = NSDiffableDataSourceSnapshot<RecommendAccountSection, NSManagedObjectID>()
|
||||||
snapshot.appendSections([.main])
|
snapshot.appendSections([.main])
|
||||||
snapshot.appendItems(recommendAccounts, toSection: .main)
|
snapshot.appendItems(self.recommendAccounts, toSection: .main)
|
||||||
dataSource.apply(snapshot, animatingDifferences: false, completion: nil)
|
dataSource.apply(snapshot, animatingDifferences: false, completion: nil)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func receiveAccounts(ids: [String]) {
|
func receiveAccounts(ids: [String]) {
|
||||||
guard let activeMastodonAuthenticationBox = context.authenticationService.activeMastodonAuthenticationBox.value else {
|
guard let activeMastodonAuthenticationBox = context.authenticationService.activeMastodonAuthenticationBox.value else {
|
||||||
|
@ -62,7 +62,6 @@ final class SuggestionAccountTableViewCell: UITableViewCell {
|
|||||||
|
|
||||||
let activityIndicatorView: UIActivityIndicatorView = {
|
let activityIndicatorView: UIActivityIndicatorView = {
|
||||||
let activityIndicatorView = UIActivityIndicatorView(style: .medium)
|
let activityIndicatorView = UIActivityIndicatorView(style: .medium)
|
||||||
activityIndicatorView.color = .white
|
|
||||||
activityIndicatorView.hidesWhenStopped = true
|
activityIndicatorView.hidesWhenStopped = true
|
||||||
return activityIndicatorView
|
return activityIndicatorView
|
||||||
}()
|
}()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user