1
0
mirror of https://github.com/mastodon/mastodon-ios.git synced 2024-12-16 10:48:49 +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(
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 {