Prefetch content and update share extension info after saving items
This commit is contained in:
committed by
Hongbo Wu
parent
60a663e9bb
commit
c523010427
@ -172,6 +172,15 @@ public class ShareExtensionViewModel: ObservableObject {
|
||||
}
|
||||
|
||||
updateStatusOnMain(requestId: newRequestID, newStatus: .synced)
|
||||
|
||||
// Prefetch the newly saved content
|
||||
if let itemID = newRequestID,
|
||||
let currentViewer = services.dataService.currentViewer?.username,
|
||||
(try? await services.dataService.loadArticleContentWithRetries(itemID: itemID, username: currentViewer)) != nil
|
||||
{
|
||||
updateStatusOnMain(requestId: requestId, newStatus: .saved, objectID: linkedItemObjectID)
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@ -184,6 +193,10 @@ public class ShareExtensionViewModel: ObservableObject {
|
||||
|
||||
if let objectID = objectID {
|
||||
self.linkedItem = self.services.dataService.viewContext.object(with: objectID) as? LinkedItem
|
||||
if let title = self.linkedItem?.title {
|
||||
self.title = title
|
||||
}
|
||||
self.url = self.linkedItem?.pageURLString
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,10 +77,6 @@ struct LabelsMasonaryView: View {
|
||||
}
|
||||
|
||||
private func item(for item: (label: LinkedItemLabel, selected: Bool)) -> some View {
|
||||
if item.selected {
|
||||
print(" -- SELECTED LABEL", item.label.name)
|
||||
}
|
||||
print("GETTING ITERATION", iteration)
|
||||
let chip = TextChip(feedItemLabel: item.label, negated: false, checked: item.selected) { chip in
|
||||
onLabelTap(item.label, chip)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user