show limited set of library filters (all|archived|inbox)
This commit is contained in:
@ -17,8 +17,8 @@ android {
|
||||
applicationId "app.omnivore.omnivore"
|
||||
minSdk 26
|
||||
targetSdk 33
|
||||
versionCode 24
|
||||
versionName "0.0.24"
|
||||
versionCode 25
|
||||
versionName "0.0.25"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
vectorDrawables {
|
||||
|
||||
@ -82,3 +82,53 @@ private data class LibraryLiveDataQueryParams(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//switch self {
|
||||
// case .inbox:
|
||||
// // non-archived items
|
||||
// return NSCompoundPredicate(andPredicateWithSubpredicates: [undeletedPredicate, notInArchivePredicate])
|
||||
|
||||
// case .readlater:
|
||||
// // non-archived or deleted items without the Newsletter label
|
||||
// let nonNewsletterLabelPredicate = NSPredicate(
|
||||
// format: "NOT SUBQUERY(labels, $label, $label.name == \"Newsletter\") .@count > 0"
|
||||
// )
|
||||
// return NSCompoundPredicate(andPredicateWithSubpredicates: [
|
||||
// undeletedPredicate, notInArchivePredicate, nonNewsletterLabelPredicate
|
||||
// ])
|
||||
// case .newsletters:
|
||||
// // non-archived or deleted items with the Newsletter label
|
||||
// let newsletterLabelPredicate = NSPredicate(
|
||||
// format: "SUBQUERY(labels, $label, $label.name == \"Newsletter\").@count > 0"
|
||||
// )
|
||||
// return NSCompoundPredicate(andPredicateWithSubpredicates: [notInArchivePredicate, newsletterLabelPredicate])
|
||||
// case .recommended:
|
||||
// // non-archived or deleted items with the Newsletter label
|
||||
// let recommendedPredicate = NSPredicate(
|
||||
// format: "recommendations.@count > 0"
|
||||
// )
|
||||
// return NSCompoundPredicate(andPredicateWithSubpredicates: [notInArchivePredicate, recommendedPredicate])
|
||||
// case .all:
|
||||
// // include everything undeleted
|
||||
// return undeletedPredicate
|
||||
// case .archived:
|
||||
// let inArchivePredicate = NSPredicate(
|
||||
// format: "%K == %@", #keyPath(LinkedItem.isArchived), Int(truncating: true) as NSNumber
|
||||
// )
|
||||
// return NSCompoundPredicate(andPredicateWithSubpredicates: [undeletedPredicate, inArchivePredicate])
|
||||
// case .files:
|
||||
// // include pdf only
|
||||
// let isPDFPredicate = NSPredicate(
|
||||
// format: "%K == %@", #keyPath(LinkedItem.contentReader), "PDF"
|
||||
// )
|
||||
// return NSCompoundPredicate(andPredicateWithSubpredicates: [undeletedPredicate, isPDFPredicate])
|
||||
// case .hasHighlights:
|
||||
// let hasHighlightsPredicate = NSPredicate(
|
||||
// format: "highlights.@count > 0"
|
||||
// )
|
||||
// return NSCompoundPredicate(andPredicateWithSubpredicates: [
|
||||
// hasHighlightsPredicate
|
||||
// ])
|
||||
//}
|
||||
//}
|
||||
//}
|
||||
|
||||
@ -154,69 +154,3 @@ interface SavedItemDao {
|
||||
object SavedItemQueryConstants {
|
||||
const val columns = "savedItemId, slug, publisherURLString, title, author, imageURLString, isArchived, pageURLString, contentReader "
|
||||
}
|
||||
|
||||
// Archive Status:
|
||||
|
||||
//INBOX("Inbox", rawValue = "inbox", "in:inbox"),
|
||||
//READ_LATER("Read Later", "readlater", "in:inbox -label:Newsletter"),
|
||||
//NEWSLETTERS("Newsletters", "newsletters", "in:inbox label:Newsletter"),
|
||||
//RECOMMENDED("Recommended", "recommended", "recommendedBy:*"),
|
||||
//ALL("All", "all", "in:all"),
|
||||
//ARCHIVED("Archived", "archived", "in:archive"),
|
||||
//HAS_HIGHLIGHTS("Highlighted", "hasHighlights", "has:highlights"),
|
||||
//FILES("Files", "files", "type:file"),
|
||||
|
||||
|
||||
//let notInArchivePredicate = NSPredicate(
|
||||
//format: "%K == %@", #keyPath(LinkedItem.isArchived), Int(truncating: false) as NSNumber
|
||||
//)
|
||||
|
||||
//switch self {
|
||||
// case .inbox:
|
||||
// // non-archived items
|
||||
// return NSCompoundPredicate(andPredicateWithSubpredicates: [undeletedPredicate, notInArchivePredicate])
|
||||
|
||||
// case .readlater:
|
||||
// // non-archived or deleted items without the Newsletter label
|
||||
// let nonNewsletterLabelPredicate = NSPredicate(
|
||||
// format: "NOT SUBQUERY(labels, $label, $label.name == \"Newsletter\") .@count > 0"
|
||||
// )
|
||||
// return NSCompoundPredicate(andPredicateWithSubpredicates: [
|
||||
// undeletedPredicate, notInArchivePredicate, nonNewsletterLabelPredicate
|
||||
// ])
|
||||
// case .newsletters:
|
||||
// // non-archived or deleted items with the Newsletter label
|
||||
// let newsletterLabelPredicate = NSPredicate(
|
||||
// format: "SUBQUERY(labels, $label, $label.name == \"Newsletter\").@count > 0"
|
||||
// )
|
||||
// return NSCompoundPredicate(andPredicateWithSubpredicates: [notInArchivePredicate, newsletterLabelPredicate])
|
||||
// case .recommended:
|
||||
// // non-archived or deleted items with the Newsletter label
|
||||
// let recommendedPredicate = NSPredicate(
|
||||
// format: "recommendations.@count > 0"
|
||||
// )
|
||||
// return NSCompoundPredicate(andPredicateWithSubpredicates: [notInArchivePredicate, recommendedPredicate])
|
||||
// case .all:
|
||||
// // include everything undeleted
|
||||
// return undeletedPredicate
|
||||
// case .archived:
|
||||
// let inArchivePredicate = NSPredicate(
|
||||
// format: "%K == %@", #keyPath(LinkedItem.isArchived), Int(truncating: true) as NSNumber
|
||||
// )
|
||||
// return NSCompoundPredicate(andPredicateWithSubpredicates: [undeletedPredicate, inArchivePredicate])
|
||||
// case .files:
|
||||
// // include pdf only
|
||||
// let isPDFPredicate = NSPredicate(
|
||||
// format: "%K == %@", #keyPath(LinkedItem.contentReader), "PDF"
|
||||
// )
|
||||
// return NSCompoundPredicate(andPredicateWithSubpredicates: [undeletedPredicate, isPDFPredicate])
|
||||
// case .hasHighlights:
|
||||
// let hasHighlightsPredicate = NSPredicate(
|
||||
// format: "highlights.@count > 0"
|
||||
// )
|
||||
// return NSCompoundPredicate(andPredicateWithSubpredicates: [
|
||||
// hasHighlightsPredicate
|
||||
// ])
|
||||
//}
|
||||
//}
|
||||
//}
|
||||
|
||||
@ -26,7 +26,9 @@ fun SavedItemFilterContextMenu(
|
||||
expanded = isExpanded,
|
||||
onDismissRequest = onDismiss
|
||||
) {
|
||||
SavedItemFilter.values().forEach {
|
||||
// Displaying only a subset of filters until we figure out the Room DB queries (and labels)
|
||||
// SavedItemFilter.values().forEach {
|
||||
listOf(SavedItemFilter.INBOX, SavedItemFilter.ARCHIVED, SavedItemFilter.ALL).forEach {
|
||||
DropdownMenuItem(
|
||||
text = { Text(it.displayText) },
|
||||
onClick = {
|
||||
|
||||
Reference in New Issue
Block a user