mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Improve undelete
This commit is contained in:
parent
55d24ee52d
commit
52776521f3
6 changed files with 14 additions and 2 deletions
|
|
@ -17,6 +17,8 @@ extension LinkedItemFilter {
|
|||
return LocalText.allGeneric
|
||||
case .archived:
|
||||
return LocalText.archivedGeneric
|
||||
case .deleted:
|
||||
return "Deleted"
|
||||
case .hasHighlights:
|
||||
return LocalText.highlightedGeneric
|
||||
case .files:
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ import Views
|
|||
return itemObjects
|
||||
}()
|
||||
|
||||
if searchTerm.replacingOccurrences(of: " ", with: "").isEmpty {
|
||||
if searchTerm.replacingOccurrences(of: " ", with: "").isEmpty, LinkedItemFilter(rawValue: appliedFilter) != .deleted {
|
||||
updateFetchController(dataService: dataService)
|
||||
} else {
|
||||
// Don't use FRC for searching. Use server results directly.
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ public enum ArticleContentStatus: String {
|
|||
case processing = "PROCESSING"
|
||||
case succeeded = "SUCCEEDED"
|
||||
case unknown = "UNKNOWN"
|
||||
case deleted = "DELETED"
|
||||
}
|
||||
|
||||
public struct ArticleContent {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ public enum LinkedItemFilter: String, CaseIterable {
|
|||
case recommended
|
||||
case all
|
||||
case archived
|
||||
case deleted
|
||||
case hasHighlights
|
||||
case files
|
||||
}
|
||||
|
|
@ -26,6 +27,8 @@ public extension LinkedItemFilter {
|
|||
return "in:all"
|
||||
case .archived:
|
||||
return "in:archive"
|
||||
case .deleted:
|
||||
return "in:trash"
|
||||
case .hasHighlights:
|
||||
return "has:highlights"
|
||||
case .files:
|
||||
|
|
@ -73,6 +76,11 @@ public extension LinkedItemFilter {
|
|||
format: "%K == %@", #keyPath(LinkedItem.isArchived), Int(truncating: true) as NSNumber
|
||||
)
|
||||
return NSCompoundPredicate(andPredicateWithSubpredicates: [undeletedPredicate, inArchivePredicate])
|
||||
case .deleted:
|
||||
let deletedPredicate = NSPredicate(
|
||||
format: "%K == %i", #keyPath(LinkedItem.serverSyncStatus), Int64(ServerSyncStatus.needsDeletion.rawValue)
|
||||
)
|
||||
return NSCompoundPredicate(andPredicateWithSubpredicates: [deletedPredicate])
|
||||
case .files:
|
||||
// include pdf only
|
||||
let isPDFPredicate = NSPredicate(
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public extension DataService {
|
|||
username: username,
|
||||
requestCount: requestCount + 1
|
||||
)
|
||||
case .succeeded, .unknown:
|
||||
case .succeeded, .unknown, .deleted:
|
||||
return fetchedContent
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@ extension Sequence where Element == InternalLinkedItem {
|
|||
print("LinkedItems saved succesfully")
|
||||
} catch {
|
||||
context.rollback()
|
||||
print(error)
|
||||
print("Failed to save LinkedItems: \(error.localizedDescription)")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue