reformat
This commit is contained in:
@ -1,12 +1,12 @@
|
|||||||
mutation SetLabels($input: SetLabelsInput!) {
|
mutation SetLabels($input: SetLabelsInput!) {
|
||||||
setLabels(input: $input) {
|
setLabels(input: $input) {
|
||||||
... on SetLabelsSuccess {
|
... on SetLabelsSuccess {
|
||||||
labels {
|
labels {
|
||||||
...LabelFields
|
...LabelFields
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
... on SetLabelsError {
|
||||||
|
errorCodes
|
||||||
|
}
|
||||||
}
|
}
|
||||||
... on SetLabelsError {
|
|
||||||
errorCodes
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
mutation SetLinkArchived($input: ArchiveLinkInput!) {
|
mutation SetLinkArchived($input: ArchiveLinkInput!) {
|
||||||
setLinkArchived(input: $input) {
|
setLinkArchived(input: $input) {
|
||||||
... on ArchiveLinkSuccess {
|
... on ArchiveLinkSuccess {
|
||||||
linkId
|
linkId
|
||||||
message
|
message
|
||||||
|
}
|
||||||
|
... on ArchiveLinkError {
|
||||||
|
message
|
||||||
|
errorCodes
|
||||||
|
}
|
||||||
}
|
}
|
||||||
... on ArchiveLinkError {
|
|
||||||
message
|
|
||||||
errorCodes
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,70 +1,70 @@
|
|||||||
query GetArticle($slug: String!) {
|
query GetArticle($slug: String!) {
|
||||||
article(username: "me", slug: $slug) {
|
article(username: "me", slug: $slug) {
|
||||||
... on ArticleSuccess {
|
... on ArticleSuccess {
|
||||||
article {
|
article {
|
||||||
...ArticleFields
|
...ArticleFields
|
||||||
content
|
content
|
||||||
highlights(input: { includeFriends: false }) {
|
highlights(input: { includeFriends: false }) {
|
||||||
...HighlightFields
|
...HighlightFields
|
||||||
|
}
|
||||||
|
labels {
|
||||||
|
...LabelFields
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
labels {
|
... on ArticleError {
|
||||||
...LabelFields
|
errorCodes
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
... on ArticleError {
|
|
||||||
errorCodes
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fragment ArticleFields on Article {
|
fragment ArticleFields on Article {
|
||||||
id
|
id
|
||||||
title
|
title
|
||||||
url
|
url
|
||||||
author
|
author
|
||||||
image
|
image
|
||||||
savedAt
|
savedAt
|
||||||
createdAt
|
createdAt
|
||||||
publishedAt
|
publishedAt
|
||||||
contentReader
|
contentReader
|
||||||
originalArticleUrl
|
originalArticleUrl
|
||||||
readingProgressPercent
|
readingProgressPercent
|
||||||
readingProgressAnchorIndex
|
readingProgressAnchorIndex
|
||||||
slug
|
slug
|
||||||
isArchived
|
isArchived
|
||||||
description
|
description
|
||||||
linkId
|
linkId
|
||||||
siteName
|
siteName
|
||||||
state
|
state
|
||||||
readAt
|
readAt
|
||||||
updatedAt
|
updatedAt
|
||||||
content
|
content
|
||||||
wordsCount
|
wordsCount
|
||||||
}
|
}
|
||||||
|
|
||||||
fragment HighlightFields on Highlight {
|
fragment HighlightFields on Highlight {
|
||||||
id
|
id
|
||||||
type
|
type
|
||||||
shortId
|
shortId
|
||||||
quote
|
quote
|
||||||
prefix
|
prefix
|
||||||
suffix
|
suffix
|
||||||
patch
|
patch
|
||||||
annotation
|
annotation
|
||||||
createdByMe
|
createdByMe
|
||||||
createdAt
|
createdAt
|
||||||
updatedAt
|
updatedAt
|
||||||
sharedAt
|
sharedAt
|
||||||
color
|
color
|
||||||
highlightPositionPercent
|
highlightPositionPercent
|
||||||
highlightPositionAnchorIndex
|
highlightPositionAnchorIndex
|
||||||
}
|
}
|
||||||
|
|
||||||
fragment LabelFields on Label {
|
fragment LabelFields on Label {
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
color
|
color
|
||||||
description
|
description
|
||||||
createdAt
|
createdAt
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
mutation CreateHighlight($input: CreateHighlightInput!) {
|
mutation CreateHighlight($input: CreateHighlightInput!) {
|
||||||
createHighlight(input: $input) {
|
createHighlight(input: $input) {
|
||||||
... on CreateHighlightSuccess {
|
... on CreateHighlightSuccess {
|
||||||
highlight {
|
highlight {
|
||||||
...HighlightFields
|
...HighlightFields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
... on CreateHighlightError {
|
... on CreateHighlightError {
|
||||||
errorCodes
|
errorCodes
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,16 +1,16 @@
|
|||||||
mutation CreateLabel($input: CreateLabelInput!) {
|
mutation CreateLabel($input: CreateLabelInput!) {
|
||||||
createLabel(input: $input) {
|
createLabel(input: $input) {
|
||||||
... on CreateLabelSuccess {
|
... on CreateLabelSuccess {
|
||||||
label {
|
label {
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
color
|
color
|
||||||
description
|
description
|
||||||
createdAt
|
createdAt
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
... on CreateLabelError {
|
||||||
|
errorCodes
|
||||||
|
}
|
||||||
}
|
}
|
||||||
... on CreateLabelError {
|
|
||||||
errorCodes
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
mutation DeleteHighlight($highlightId: ID!) {
|
mutation DeleteHighlight($highlightId: ID!) {
|
||||||
deleteHighlight(highlightId: $highlightId) {
|
deleteHighlight(highlightId: $highlightId) {
|
||||||
... on DeleteHighlightSuccess {
|
... on DeleteHighlightSuccess {
|
||||||
highlight {
|
highlight {
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
... on DeleteHighlightError {
|
||||||
|
errorCodes
|
||||||
|
}
|
||||||
}
|
}
|
||||||
... on DeleteHighlightError {
|
|
||||||
errorCodes
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
mutation SetBookmarkArticle($input: SetBookmarkArticleInput!) {
|
mutation SetBookmarkArticle($input: SetBookmarkArticleInput!) {
|
||||||
setBookmarkArticle(input: $input) {
|
setBookmarkArticle(input: $input) {
|
||||||
... on SetBookmarkArticleSuccess {
|
... on SetBookmarkArticleSuccess {
|
||||||
bookmarkedArticle {
|
bookmarkedArticle {
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
... on SetBookmarkArticleError {
|
||||||
|
errorCodes
|
||||||
|
}
|
||||||
}
|
}
|
||||||
... on SetBookmarkArticleError {
|
|
||||||
errorCodes
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
query GetLabels {
|
query GetLabels {
|
||||||
labels {
|
labels {
|
||||||
... on LabelsSuccess {
|
... on LabelsSuccess {
|
||||||
labels {
|
labels {
|
||||||
...LabelFields
|
...LabelFields
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
... on LabelsError {
|
||||||
|
errorCodes
|
||||||
|
}
|
||||||
}
|
}
|
||||||
... on LabelsError {
|
|
||||||
errorCodes
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,23 +1,23 @@
|
|||||||
mutation MergeHighlight($input: MergeHighlightInput!) {
|
mutation MergeHighlight($input: MergeHighlightInput!) {
|
||||||
mergeHighlight(input: $input) {
|
mergeHighlight(input: $input) {
|
||||||
... on MergeHighlightSuccess {
|
... on MergeHighlightSuccess {
|
||||||
highlight {
|
highlight {
|
||||||
id
|
id
|
||||||
shortId
|
shortId
|
||||||
quote
|
quote
|
||||||
prefix
|
prefix
|
||||||
suffix
|
suffix
|
||||||
patch
|
patch
|
||||||
createdAt
|
createdAt
|
||||||
updatedAt
|
updatedAt
|
||||||
annotation
|
annotation
|
||||||
sharedAt
|
sharedAt
|
||||||
createdByMe
|
createdByMe
|
||||||
}
|
}
|
||||||
overlapHighlightIdList
|
overlapHighlightIdList
|
||||||
|
}
|
||||||
|
... on MergeHighlightError {
|
||||||
|
errorCodes
|
||||||
|
}
|
||||||
}
|
}
|
||||||
... on MergeHighlightError {
|
|
||||||
errorCodes
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,14 +1,14 @@
|
|||||||
mutation SaveArticleReadingProgress($input: SaveArticleReadingProgressInput!) {
|
mutation SaveArticleReadingProgress($input: SaveArticleReadingProgressInput!) {
|
||||||
saveArticleReadingProgress(input: $input) {
|
saveArticleReadingProgress(input: $input) {
|
||||||
... on SaveArticleReadingProgressSuccess {
|
... on SaveArticleReadingProgressSuccess {
|
||||||
updatedArticle {
|
updatedArticle {
|
||||||
id
|
id
|
||||||
readingProgressPercent
|
readingProgressPercent
|
||||||
readingProgressAnchorIndex
|
readingProgressAnchorIndex
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
... on SaveArticleReadingProgressError {
|
||||||
|
errorCodes
|
||||||
|
}
|
||||||
}
|
}
|
||||||
... on SaveArticleReadingProgressError {
|
|
||||||
errorCodes
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
mutation SaveUrl($input: SaveUrlInput!) {
|
mutation SaveUrl($input: SaveUrlInput!) {
|
||||||
saveUrl(input: $input) {
|
saveUrl(input: $input) {
|
||||||
... on SaveSuccess {
|
... on SaveSuccess {
|
||||||
url
|
url
|
||||||
|
}
|
||||||
|
... on SaveError {
|
||||||
|
errorCodes
|
||||||
|
}
|
||||||
}
|
}
|
||||||
... on SaveError {
|
|
||||||
errorCodes
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,55 +1,55 @@
|
|||||||
query Search($after: String, $first: Int, $query: String) {
|
query Search($after: String, $first: Int, $query: String) {
|
||||||
search(first: $first, after: $after, query: $query) {
|
search(first: $first, after: $after, query: $query) {
|
||||||
... on SearchSuccess {
|
... on SearchSuccess {
|
||||||
edges {
|
edges {
|
||||||
cursor
|
cursor
|
||||||
node {
|
node {
|
||||||
id
|
id
|
||||||
title
|
title
|
||||||
slug
|
slug
|
||||||
url
|
url
|
||||||
pageType
|
pageType
|
||||||
contentReader
|
contentReader
|
||||||
createdAt
|
createdAt
|
||||||
isArchived
|
isArchived
|
||||||
readingProgressPercent
|
readingProgressPercent
|
||||||
readingProgressAnchorIndex
|
readingProgressAnchorIndex
|
||||||
author
|
author
|
||||||
image
|
image
|
||||||
description
|
description
|
||||||
publishedAt
|
publishedAt
|
||||||
ownedByViewer
|
ownedByViewer
|
||||||
originalArticleUrl
|
originalArticleUrl
|
||||||
uploadFileId
|
uploadFileId
|
||||||
labels {
|
labels {
|
||||||
...LabelFields
|
...LabelFields
|
||||||
}
|
}
|
||||||
highlights {
|
highlights {
|
||||||
...HighlightFields
|
...HighlightFields
|
||||||
}
|
}
|
||||||
pageId
|
pageId
|
||||||
shortId
|
shortId
|
||||||
quote
|
quote
|
||||||
annotation
|
annotation
|
||||||
state
|
state
|
||||||
siteName
|
siteName
|
||||||
subscription
|
subscription
|
||||||
readAt
|
readAt
|
||||||
savedAt
|
savedAt
|
||||||
updatedAt
|
updatedAt
|
||||||
wordsCount
|
wordsCount
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pageInfo {
|
||||||
|
hasNextPage
|
||||||
|
hasPreviousPage
|
||||||
|
startCursor
|
||||||
|
endCursor
|
||||||
|
totalCount
|
||||||
|
}
|
||||||
|
}
|
||||||
|
... on SearchError {
|
||||||
|
errorCodes
|
||||||
}
|
}
|
||||||
}
|
|
||||||
pageInfo {
|
|
||||||
hasNextPage
|
|
||||||
hasPreviousPage
|
|
||||||
startCursor
|
|
||||||
endCursor
|
|
||||||
totalCount
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
... on SearchError {
|
|
||||||
errorCodes
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,15 +1,15 @@
|
|||||||
query TypeaheadSearch($query: String!) {
|
query TypeaheadSearch($query: String!) {
|
||||||
typeaheadSearch(query: $query) {
|
typeaheadSearch(query: $query) {
|
||||||
... on TypeaheadSearchSuccess {
|
... on TypeaheadSearchSuccess {
|
||||||
items {
|
items {
|
||||||
id
|
id
|
||||||
title
|
title
|
||||||
slug
|
slug
|
||||||
siteName
|
siteName
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
... on TypeaheadSearchError {
|
||||||
|
errorCodes
|
||||||
|
}
|
||||||
}
|
}
|
||||||
... on TypeaheadSearchError {
|
|
||||||
errorCodes
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
mutation UpdateHighlight($input: UpdateHighlightInput!) {
|
mutation UpdateHighlight($input: UpdateHighlightInput!) {
|
||||||
updateHighlight(input: $input) {
|
updateHighlight(input: $input) {
|
||||||
... on UpdateHighlightSuccess {
|
... on UpdateHighlightSuccess {
|
||||||
highlight {
|
highlight {
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
... on UpdateHighlightError {
|
... on UpdateHighlightError {
|
||||||
errorCodes
|
errorCodes
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,15 +1,15 @@
|
|||||||
mutation UpdatePage($input: UpdatePageInput!) {
|
mutation UpdatePage($input: UpdatePageInput!) {
|
||||||
updatePage(input: $input) {
|
updatePage(input: $input) {
|
||||||
... on UpdatePageSuccess {
|
... on UpdatePageSuccess {
|
||||||
updatedPage {
|
updatedPage {
|
||||||
title
|
title
|
||||||
author
|
author
|
||||||
description
|
description
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
... on UpdatePageError {
|
... on UpdatePageError {
|
||||||
errorCodes
|
errorCodes
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,63 +1,63 @@
|
|||||||
query UpdatesSince(
|
query UpdatesSince(
|
||||||
$folder: String
|
$folder: String
|
||||||
$after: String
|
$after: String
|
||||||
$first: Int
|
$first: Int
|
||||||
$since: Date!
|
$since: Date!
|
||||||
) {
|
) {
|
||||||
updatesSince(after: $after, first: $first, folder: $folder, since: $since) {
|
updatesSince(after: $after, first: $first, folder: $folder, since: $since) {
|
||||||
... on UpdatesSinceSuccess {
|
... on UpdatesSinceSuccess {
|
||||||
edges {
|
edges {
|
||||||
cursor
|
cursor
|
||||||
itemID
|
itemID
|
||||||
updateReason
|
updateReason
|
||||||
node {
|
node {
|
||||||
id
|
id
|
||||||
title
|
title
|
||||||
slug
|
slug
|
||||||
url
|
url
|
||||||
pageType
|
pageType
|
||||||
contentReader
|
contentReader
|
||||||
createdAt
|
createdAt
|
||||||
isArchived
|
isArchived
|
||||||
readingProgressPercent
|
readingProgressPercent
|
||||||
readingProgressAnchorIndex
|
readingProgressAnchorIndex
|
||||||
author
|
author
|
||||||
image
|
image
|
||||||
description
|
description
|
||||||
publishedAt
|
publishedAt
|
||||||
ownedByViewer
|
ownedByViewer
|
||||||
originalArticleUrl
|
originalArticleUrl
|
||||||
uploadFileId
|
uploadFileId
|
||||||
labels {
|
labels {
|
||||||
...LabelFields
|
...LabelFields
|
||||||
}
|
}
|
||||||
highlights {
|
highlights {
|
||||||
...HighlightFields
|
...HighlightFields
|
||||||
}
|
}
|
||||||
pageId
|
pageId
|
||||||
shortId
|
shortId
|
||||||
quote
|
quote
|
||||||
annotation
|
annotation
|
||||||
state
|
state
|
||||||
siteName
|
siteName
|
||||||
subscription
|
subscription
|
||||||
readAt
|
readAt
|
||||||
savedAt
|
savedAt
|
||||||
updatedAt
|
updatedAt
|
||||||
language
|
language
|
||||||
wordsCount
|
wordsCount
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pageInfo {
|
||||||
|
hasNextPage
|
||||||
|
hasPreviousPage
|
||||||
|
startCursor
|
||||||
|
endCursor
|
||||||
|
totalCount
|
||||||
|
}
|
||||||
|
}
|
||||||
|
... on UpdatesSinceError {
|
||||||
|
errorCodes
|
||||||
}
|
}
|
||||||
}
|
|
||||||
pageInfo {
|
|
||||||
hasNextPage
|
|
||||||
hasPreviousPage
|
|
||||||
startCursor
|
|
||||||
endCursor
|
|
||||||
totalCount
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
... on UpdatesSinceError {
|
|
||||||
errorCodes
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
query ValidateUsername($username: String!) {
|
query ValidateUsername($username: String!) {
|
||||||
validateUsername(username: $username)
|
validateUsername(username: $username)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,14 +1,14 @@
|
|||||||
query Viewer {
|
query Viewer {
|
||||||
me {
|
me {
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
isFullUser
|
isFullUser
|
||||||
intercomHash
|
intercomHash
|
||||||
profile {
|
profile {
|
||||||
id
|
id
|
||||||
username
|
username
|
||||||
pictureUrl
|
pictureUrl
|
||||||
bio
|
bio
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1,100 +1,90 @@
|
|||||||
package app.omnivore.omnivore.core.network
|
package app.omnivore.omnivore.core.network
|
||||||
|
|
||||||
|
import app.omnivore.omnivore.core.data.model.ServerSyncStatus
|
||||||
import app.omnivore.omnivore.core.database.entities.Highlight
|
import app.omnivore.omnivore.core.database.entities.Highlight
|
||||||
import app.omnivore.omnivore.core.database.entities.SavedItem
|
import app.omnivore.omnivore.core.database.entities.SavedItem
|
||||||
import app.omnivore.omnivore.core.database.entities.SavedItemLabel
|
import app.omnivore.omnivore.core.database.entities.SavedItemLabel
|
||||||
import app.omnivore.omnivore.graphql.generated.SearchQuery
|
import app.omnivore.omnivore.graphql.generated.SearchQuery
|
||||||
import app.omnivore.omnivore.core.data.model.ServerSyncStatus
|
|
||||||
import com.apollographql.apollo3.api.Optional
|
import com.apollographql.apollo3.api.Optional
|
||||||
|
|
||||||
data class LibrarySearchQueryResponse(
|
data class LibrarySearchQueryResponse(
|
||||||
val cursor: String?,
|
val cursor: String?, val items: List<LibrarySearchItem>
|
||||||
val items: List<LibrarySearchItem>
|
|
||||||
)
|
)
|
||||||
|
|
||||||
data class LibrarySearchItem(
|
data class LibrarySearchItem(
|
||||||
val item: SavedItem,
|
val item: SavedItem, val labels: List<SavedItemLabel>, val highlights: List<Highlight>
|
||||||
val labels: List<SavedItemLabel>,
|
|
||||||
val highlights: List<Highlight>
|
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun Networker.search(
|
suspend fun Networker.search(
|
||||||
cursor: String? = null,
|
cursor: String? = null, limit: Int = 15, query: String
|
||||||
limit: Int = 15,
|
|
||||||
query: String
|
|
||||||
): LibrarySearchQueryResponse {
|
): LibrarySearchQueryResponse {
|
||||||
try {
|
try {
|
||||||
val result = authenticatedApolloClient().query(
|
val result = authenticatedApolloClient().query(
|
||||||
SearchQuery(
|
SearchQuery(
|
||||||
after = Optional.presentIfNotNull(cursor),
|
after = Optional.presentIfNotNull(cursor),
|
||||||
first = Optional.presentIfNotNull(limit),
|
first = Optional.presentIfNotNull(limit),
|
||||||
query = Optional.presentIfNotNull(query)
|
query = Optional.presentIfNotNull(query)
|
||||||
)
|
)
|
||||||
).execute()
|
).execute()
|
||||||
|
|
||||||
val newCursor = result.data?.search?.onSearchSuccess?.pageInfo?.endCursor
|
val newCursor = result.data?.search?.onSearchSuccess?.pageInfo?.endCursor
|
||||||
val itemList = result.data?.search?.onSearchSuccess?.edges ?: listOf()
|
val itemList = result.data?.search?.onSearchSuccess?.edges ?: listOf()
|
||||||
|
|
||||||
val searchItems = itemList.map {
|
val searchItems = itemList.map {
|
||||||
LibrarySearchItem(
|
LibrarySearchItem(item = SavedItem(
|
||||||
item = SavedItem(
|
savedItemId = it.node.id,
|
||||||
savedItemId = it.node.id,
|
title = it.node.title,
|
||||||
title = it.node.title,
|
createdAt = it.node.createdAt as String,
|
||||||
createdAt = it.node.createdAt as String,
|
savedAt = it.node.savedAt as String,
|
||||||
savedAt = it.node.savedAt as String,
|
readAt = it.node.readAt as String?,
|
||||||
readAt = it.node.readAt as String?,
|
updatedAt = it.node.updatedAt as String?,
|
||||||
updatedAt = it.node.updatedAt as String?,
|
readingProgress = it.node.readingProgressPercent,
|
||||||
readingProgress = it.node.readingProgressPercent,
|
readingProgressAnchor = it.node.readingProgressAnchorIndex,
|
||||||
readingProgressAnchor = it.node.readingProgressAnchorIndex,
|
imageURLString = it.node.image,
|
||||||
imageURLString = it.node.image,
|
pageURLString = it.node.url,
|
||||||
pageURLString = it.node.url,
|
descriptionText = it.node.description,
|
||||||
descriptionText = it.node.description,
|
publisherURLString = it.node.originalArticleUrl,
|
||||||
publisherURLString = it.node.originalArticleUrl,
|
siteName = it.node.siteName,
|
||||||
siteName = it.node.siteName,
|
author = it.node.author,
|
||||||
author = it.node.author,
|
publishDate = it.node.publishedAt as String?,
|
||||||
publishDate = it.node.publishedAt as String?,
|
slug = it.node.slug,
|
||||||
slug = it.node.slug,
|
isArchived = it.node.isArchived,
|
||||||
isArchived = it.node.isArchived,
|
contentReader = it.node.contentReader.rawValue,
|
||||||
contentReader = it.node.contentReader.rawValue,
|
content = null,
|
||||||
content = null,
|
wordsCount = it.node.wordsCount,
|
||||||
wordsCount = it.node.wordsCount,
|
), labels = (it.node.labels ?: listOf()).map { label ->
|
||||||
),
|
SavedItemLabel(
|
||||||
labels = (it.node.labels ?: listOf()).map { label ->
|
savedItemLabelId = label.labelFields.id,
|
||||||
SavedItemLabel(
|
name = label.labelFields.name,
|
||||||
savedItemLabelId = label.labelFields.id,
|
color = label.labelFields.color,
|
||||||
name = label.labelFields.name,
|
createdAt = label.labelFields.createdAt as String?,
|
||||||
color = label.labelFields.color,
|
labelDescription = null
|
||||||
createdAt = label.labelFields.createdAt as String?,
|
)
|
||||||
labelDescription = null
|
}, highlights = (it.node.highlights ?: listOf()).map { highlight ->
|
||||||
)
|
Highlight(
|
||||||
},
|
highlightId = highlight.highlightFields.id,
|
||||||
highlights = (it.node.highlights ?: listOf()).map { highlight ->
|
type = highlight.highlightFields.type.toString(),
|
||||||
Highlight(
|
annotation = highlight.highlightFields.annotation,
|
||||||
highlightId = highlight.highlightFields.id,
|
createdByMe = highlight.highlightFields.createdByMe,
|
||||||
type = highlight.highlightFields.type.toString(),
|
patch = highlight.highlightFields.patch,
|
||||||
annotation = highlight.highlightFields.annotation,
|
prefix = highlight.highlightFields.prefix,
|
||||||
createdByMe = highlight.highlightFields.createdByMe,
|
quote = highlight.highlightFields.quote,
|
||||||
patch = highlight.highlightFields.patch,
|
serverSyncStatus = ServerSyncStatus.IS_SYNCED.rawValue,
|
||||||
prefix = highlight.highlightFields.prefix,
|
shortId = highlight.highlightFields.shortId,
|
||||||
quote = highlight.highlightFields.quote,
|
suffix = highlight.highlightFields.suffix,
|
||||||
serverSyncStatus = ServerSyncStatus.IS_SYNCED.rawValue,
|
updatedAt = highlight.highlightFields.updatedAt as String?,
|
||||||
shortId = highlight.highlightFields.shortId,
|
createdAt = highlight.highlightFields.createdAt as String?,
|
||||||
suffix = highlight.highlightFields.suffix,
|
color = highlight.highlightFields.color,
|
||||||
updatedAt = highlight.highlightFields.updatedAt as String?,
|
highlightPositionPercent = highlight.highlightFields.highlightPositionPercent,
|
||||||
createdAt = highlight.highlightFields.createdAt as String?,
|
highlightPositionAnchorIndex = highlight.highlightFields.highlightPositionAnchorIndex
|
||||||
color = highlight.highlightFields.color,
|
)
|
||||||
highlightPositionPercent = highlight.highlightFields.highlightPositionPercent,
|
})
|
||||||
highlightPositionAnchorIndex = highlight.highlightFields.highlightPositionAnchorIndex
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
return LibrarySearchQueryResponse(
|
return LibrarySearchQueryResponse(
|
||||||
cursor = newCursor,
|
cursor = newCursor, items = searchItems
|
||||||
items = searchItems
|
)
|
||||||
)
|
} catch (e: java.lang.Exception) {
|
||||||
} catch (e: java.lang.Exception) {
|
return LibrarySearchQueryResponse(null, listOf())
|
||||||
return LibrarySearchQueryResponse(null, listOf())
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,7 +24,7 @@ import app.omnivore.omnivore.core.network.RetrofitHelper
|
|||||||
import app.omnivore.omnivore.core.network.SignInParams
|
import app.omnivore.omnivore.core.network.SignInParams
|
||||||
import app.omnivore.omnivore.core.network.UserProfile
|
import app.omnivore.omnivore.core.network.UserProfile
|
||||||
import app.omnivore.omnivore.core.network.viewer
|
import app.omnivore.omnivore.core.network.viewer
|
||||||
import app.omnivore.omnivore.feature.ResourceProvider
|
import app.omnivore.omnivore.utils.ResourceProvider
|
||||||
import app.omnivore.omnivore.utils.Constants
|
import app.omnivore.omnivore.utils.Constants
|
||||||
import app.omnivore.omnivore.utils.DatastoreKeys
|
import app.omnivore.omnivore.utils.DatastoreKeys
|
||||||
import com.apollographql.apollo3.ApolloClient
|
import com.apollographql.apollo3.ApolloClient
|
||||||
|
|||||||
@ -13,7 +13,7 @@ import app.omnivore.omnivore.R
|
|||||||
import app.omnivore.omnivore.core.data.DataService
|
import app.omnivore.omnivore.core.data.DataService
|
||||||
import app.omnivore.omnivore.graphql.generated.UpdatePageMutation
|
import app.omnivore.omnivore.graphql.generated.UpdatePageMutation
|
||||||
import app.omnivore.omnivore.graphql.generated.type.UpdatePageInput
|
import app.omnivore.omnivore.graphql.generated.type.UpdatePageInput
|
||||||
import app.omnivore.omnivore.feature.ResourceProvider
|
import app.omnivore.omnivore.utils.ResourceProvider
|
||||||
import com.apollographql.apollo3.ApolloClient
|
import com.apollographql.apollo3.ApolloClient
|
||||||
import com.apollographql.apollo3.api.Optional
|
import com.apollographql.apollo3.api.Optional
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
|
|||||||
@ -69,7 +69,7 @@ class FollowingViewModel @Inject constructor(
|
|||||||
initialValue = FollowingUiState.Loading
|
initialValue = FollowingUiState.Loading
|
||||||
)
|
)
|
||||||
|
|
||||||
val appliedFilterLiveData = MutableLiveData<SavedItemFilter>(
|
val appliedFilterLiveData = MutableLiveData(
|
||||||
SavedItemFilter.FOLLOWING
|
SavedItemFilter.FOLLOWING
|
||||||
)
|
)
|
||||||
val appliedSortFilterLiveData = MutableLiveData(SavedItemSortFilter.NEWEST)
|
val appliedSortFilterLiveData = MutableLiveData(SavedItemSortFilter.NEWEST)
|
||||||
@ -159,7 +159,7 @@ class FollowingViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateSavedItemFilter(filter: SavedItemFilter) {
|
private fun updateSavedItemFilter(filter: SavedItemFilter) {
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
datastoreRepo.putString(DatastoreKeys.lastUsedSavedItemFilter, filter.rawValue)
|
datastoreRepo.putString(DatastoreKeys.lastUsedSavedItemFilter, filter.rawValue)
|
||||||
appliedFilterLiveData.value = filter
|
appliedFilterLiveData.value = filter
|
||||||
@ -206,10 +206,9 @@ class FollowingViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
var requiredLabels = when (appliedFilterLiveData.value) {
|
var requiredLabels = when (appliedFilterLiveData.value) {
|
||||||
SavedItemFilter.FOLLOWING -> listOf("Newsletter", "RSS")
|
|
||||||
SavedItemFilter.NEWSLETTERS -> listOf("Newsletter")
|
SavedItemFilter.NEWSLETTERS -> listOf("Newsletter")
|
||||||
SavedItemFilter.FEEDS -> listOf("RSS")
|
SavedItemFilter.FEEDS -> listOf("RSS")
|
||||||
else -> listOf("Newsletter", "RSS")//activeLabels.value.map { it.name }
|
else -> activeLabels.value.map { it.name }
|
||||||
}
|
}
|
||||||
|
|
||||||
activeLabels.value.let { it ->
|
activeLabels.value.let { it ->
|
||||||
|
|||||||
@ -51,7 +51,7 @@ class LibraryViewModel @Inject constructor(
|
|||||||
allowedArchiveStates = listOf(0),
|
allowedArchiveStates = listOf(0),
|
||||||
sortKey = "newest",
|
sortKey = "newest",
|
||||||
requiredLabels = listOf(),
|
requiredLabels = listOf(),
|
||||||
excludedLabels = listOf(),
|
excludedLabels = listOf("Newsletter", "RSS"),
|
||||||
allowedContentReaders = listOf("WEB", "PDF", "EPUB")
|
allowedContentReaders = listOf("WEB", "PDF", "EPUB")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -65,6 +65,7 @@ class LibraryViewModel @Inject constructor(
|
|||||||
)
|
)
|
||||||
|
|
||||||
val appliedFilterLiveData = MutableLiveData<SavedItemFilter>()
|
val appliedFilterLiveData = MutableLiveData<SavedItemFilter>()
|
||||||
|
|
||||||
val appliedSortFilterLiveData = MutableLiveData(SavedItemSortFilter.NEWEST)
|
val appliedSortFilterLiveData = MutableLiveData(SavedItemSortFilter.NEWEST)
|
||||||
val bottomSheetState = MutableLiveData(LibraryBottomSheetState.HIDDEN)
|
val bottomSheetState = MutableLiveData(LibraryBottomSheetState.HIDDEN)
|
||||||
val currentItem = mutableStateOf<String?>(null)
|
val currentItem = mutableStateOf<String?>(null)
|
||||||
@ -198,7 +199,6 @@ class LibraryViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
var requiredLabels = when (appliedFilterLiveData.value) {
|
var requiredLabels = when (appliedFilterLiveData.value) {
|
||||||
SavedItemFilter.FOLLOWING -> listOf("Newsletter", "RSS")
|
|
||||||
SavedItemFilter.NEWSLETTERS -> listOf("Newsletter")
|
SavedItemFilter.NEWSLETTERS -> listOf("Newsletter")
|
||||||
SavedItemFilter.FEEDS -> listOf("RSS")
|
SavedItemFilter.FEEDS -> listOf("RSS")
|
||||||
else -> activeLabels.value.map { it.name }
|
else -> activeLabels.value.map { it.name }
|
||||||
@ -211,7 +211,7 @@ class LibraryViewModel @Inject constructor(
|
|||||||
|
|
||||||
val excludeLabels = when (appliedFilterLiveData.value) {
|
val excludeLabels = when (appliedFilterLiveData.value) {
|
||||||
SavedItemFilter.READ_LATER -> listOf("Newsletter", "RSS")
|
SavedItemFilter.READ_LATER -> listOf("Newsletter", "RSS")
|
||||||
else -> listOf()
|
else -> listOf("Newsletter", "RSS")
|
||||||
}
|
}
|
||||||
|
|
||||||
_libraryQuery.value = LibraryQuery(
|
_libraryQuery.value = LibraryQuery(
|
||||||
|
|||||||
@ -8,12 +8,13 @@ import androidx.compose.ui.text.font.FontWeight
|
|||||||
|
|
||||||
enum class SavedItemFilter(val displayText: String, val rawValue: String, val queryString: String) {
|
enum class SavedItemFilter(val displayText: String, val rawValue: String, val queryString: String) {
|
||||||
FOLLOWING("Following", "following", "in:following use:folders"),
|
FOLLOWING("Following", "following", "in:following use:folders"),
|
||||||
INBOX("Inbox", rawValue = "inbox", "in:inbox"),
|
INBOX("Inbox", rawValue = "inbox", "in:inbox use:folders"),
|
||||||
READ_LATER("Non-Feed Items", "nonFeed", "no:subscription"),
|
READ_LATER("Non-Feed Items", "nonFeed", "no:subscription"),
|
||||||
FEEDS("Feeds", "feeds", "in:inbox label:RSS"),
|
FEEDS("Feeds", "feeds", "in:inbox label:RSS"),
|
||||||
NEWSLETTERS("Newsletters", "newsletters", "in:inbox label:Newsletter"),
|
NEWSLETTERS("Newsletters", "newsletters", "in:inbox label:Newsletter"),
|
||||||
ALL("All", "all", "in:all"),
|
ALL("All", "all", "in:all"),
|
||||||
ARCHIVED("Archived", "archived", "in:archive"),
|
ARCHIVED("Archived", "archived", "in:archive"),
|
||||||
|
|
||||||
// HAS_HIGHLIGHTS("Highlighted", "hasHighlights", "has:highlights"),
|
// HAS_HIGHLIGHTS("Highlighted", "hasHighlights", "has:highlights"),
|
||||||
FILES("Files", "files", "type:file"),
|
FILES("Files", "files", "type:file"),
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,7 +14,7 @@ import app.omnivore.omnivore.core.datastore.DatastoreRepository
|
|||||||
import app.omnivore.omnivore.R
|
import app.omnivore.omnivore.R
|
||||||
import app.omnivore.omnivore.graphql.generated.SaveUrlMutation
|
import app.omnivore.omnivore.graphql.generated.SaveUrlMutation
|
||||||
import app.omnivore.omnivore.graphql.generated.type.SaveUrlInput
|
import app.omnivore.omnivore.graphql.generated.type.SaveUrlInput
|
||||||
import app.omnivore.omnivore.feature.ResourceProvider
|
import app.omnivore.omnivore.utils.ResourceProvider
|
||||||
import com.apollographql.apollo3.ApolloClient
|
import com.apollographql.apollo3.ApolloClient
|
||||||
import com.apollographql.apollo3.api.Optional
|
import com.apollographql.apollo3.api.Optional
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
|
|||||||
Reference in New Issue
Block a user