1
0
mirror of https://github.com/mastodon/mastodon-ios.git synced 2024-12-16 18:58:45 +01:00

Leave data loading to ThreadViewModel

This commit is contained in:
jinsu kim 2023-01-02 00:26:15 -08:00
parent 5c82c04232
commit 843eeed616

View File

@ -81,31 +81,31 @@ extension APIService {
) )
} }
let responseTwo = try await Mastodon.API.Statuses.statusContext( // let responseTwo = try await Mastodon.API.Statuses.statusContext(
session: session, // session: session,
domain: domain, // domain: domain,
statusID: statusID, // statusID: statusID,
authorization: authorization // authorization: authorization
).singleOutput() // ).singleOutput()
//
try await managedObjectContext.performChanges { // try await managedObjectContext.performChanges {
let me = authenticationBox.authenticationRecord.object(in: managedObjectContext)?.user // let me = authenticationBox.authenticationRecord.object(in: managedObjectContext)?.user
let value = responseTwo.value.ancestors + responseTwo.value.descendants // let value = responseTwo.value.ancestors + responseTwo.value.descendants
//
for entity in value { // for entity in value {
_ = Persistence.Status.createOrMerge( // _ = Persistence.Status.createOrMerge(
in: managedObjectContext, // in: managedObjectContext,
context: Persistence.Status.PersistContext( // context: Persistence.Status.PersistContext(
domain: domain, // domain: domain,
entity: entity, // entity: entity,
me: me, // me: me,
statusCache: nil, // statusCache: nil,
userCache: nil, // userCache: nil,
networkDate: responseTwo.networkDate // networkDate: responseTwo.networkDate
) // )
) // )
} // }
} // }
var result: Status? var result: Status?
try await managedObjectContext.perform { try await managedObjectContext.perform {