Leave data loading to ThreadViewModel

This commit is contained in:
jinsu kim 2023-01-02 00:26:15 -08:00
parent 5c82c04232
commit 843eeed616
1 changed files with 25 additions and 25 deletions

View File

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