fix: Toot.emojis wrong keyPath issue

This commit is contained in:
CMK 2021-02-02 16:04:39 +08:00
parent 9c54095f40
commit b749d0a7bc
2 changed files with 19 additions and 6 deletions

View File

@ -93,7 +93,7 @@ public extension Toot {
}
if let emojis = property.emojis {
toot.mutableSetValue(forKey: #keyPath(Toot.mentions)).addObjects(from: emojis)
toot.mutableSetValue(forKey: #keyPath(Toot.emojis)).addObjects(from: emojis)
}
if let tags = property.tags {
@ -123,10 +123,11 @@ public extension Toot {
if let bookmarkedBy = property.bookmarkedBy {
toot.mutableSetValue(forKey: #keyPath(Toot.bookmarkedBy)).add(bookmarkedBy)
}
if let pinnedBy = property.pinnedBy {
toot.mutableSetValue(forKey: #keyPath(Toot.pinnedBy))
}
// TODO: not implement yet
// if let pinnedBy = property.pinnedBy {
// toot.mutableSetValue(forKey: #keyPath(Toot.pinnedBy))
// }
toot.updatedAt = property.updatedAt
toot.deletedAt = property.deletedAt

View File

@ -72,6 +72,18 @@ extension APIService.Persist {
homeTimelineIndexes: nil)
Toot.insert(into: managedObjectContext, property: tootProperty, author: author)
}
}.eraseToAnyPublisher()
}
.handleEvents(receiveOutput: { result in
switch result {
case .success:
break
case .failure(let error):
#if DEBUG
debugPrint(error)
#endif
assertionFailure(error.localizedDescription)
}
})
.eraseToAnyPublisher()
}
}