mirror of
https://github.com/mastodon/mastodon-ios
synced 2025-04-11 22:58:02 +02:00
fix: AccountList scene not display items issue
This commit is contained in:
parent
3100c59a3b
commit
668a1d28e2
@ -216,7 +216,7 @@ extension SceneCoordinator {
|
||||
let rootViewController: UIViewController
|
||||
|
||||
do {
|
||||
let request = MastodonAuthentication.sortedFetchRequest
|
||||
let request = MastodonAuthentication.activeSortedFetchRequest // use active order
|
||||
let _authentication = try appContext.managedObjectContext.fetch(request).first
|
||||
let _authContext = _authentication.flatMap { AuthContext(authentication: $0) }
|
||||
self.authContext = _authContext
|
||||
|
@ -50,6 +50,12 @@ final class AccountListViewModel: NSObject {
|
||||
// end init
|
||||
|
||||
mastodonAuthenticationFetchedResultsController.delegate = self
|
||||
do {
|
||||
try mastodonAuthenticationFetchedResultsController.performFetch()
|
||||
authentications = mastodonAuthenticationFetchedResultsController.fetchedObjects?.compactMap { $0.asRecrod } ?? []
|
||||
} catch {
|
||||
assertionFailure(error.localizedDescription)
|
||||
}
|
||||
|
||||
$authentications
|
||||
.receive(on: DispatchQueue.main)
|
||||
|
@ -148,6 +148,18 @@ extension MastodonAuthentication: Managed {
|
||||
public static var defaultSortDescriptors: [NSSortDescriptor] {
|
||||
return [NSSortDescriptor(keyPath: \MastodonAuthentication.createdAt, ascending: false)]
|
||||
}
|
||||
|
||||
public static var activeSortDescriptors: [NSSortDescriptor] {
|
||||
return [NSSortDescriptor(keyPath: \MastodonAuthentication.activedAt, ascending: false)]
|
||||
}
|
||||
}
|
||||
|
||||
extension MastodonAuthentication {
|
||||
public static var activeSortedFetchRequest: NSFetchRequest<MastodonAuthentication> {
|
||||
let request = NSFetchRequest<MastodonAuthentication>(entityName: entityName)
|
||||
request.sortDescriptors = activeSortDescriptors
|
||||
return request
|
||||
}
|
||||
}
|
||||
|
||||
extension MastodonAuthentication {
|
||||
|
Loading…
x
Reference in New Issue
Block a user