-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
177 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.jocmp.basil | ||
|
||
import java.net.URL | ||
|
||
data class Article( | ||
val id: String, | ||
val externalID: String, | ||
val feedID: String, | ||
val title: String, | ||
val contentHTML: String, | ||
val url: URL?, | ||
val summary: String, | ||
val imageURL: URL? | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.jocmp.basil | ||
|
||
import androidx.paging.Pager | ||
import androidx.paging.PagingConfig | ||
import app.cash.sqldelight.paging3.QueryPagingSource | ||
import com.jocmp.basil.articles.articleMapper | ||
import kotlinx.coroutines.Dispatchers | ||
|
||
fun Account.feedPagingSource(feedID: String?): Pager<Int, Article> { | ||
return Pager( | ||
config = PagingConfig(pageSize = 10), | ||
pagingSourceFactory = { | ||
QueryPagingSource( | ||
countQuery = database.articlesQueries.countByFeed(feedID?.toLongOrNull()), | ||
transacter = database.articlesQueries, | ||
context = Dispatchers.IO, | ||
queryProvider = { limit, offset -> | ||
database.articlesQueries.allByFeed( | ||
feedID = feedID?.toLongOrNull(), | ||
limit = limit, | ||
offset = offset, | ||
mapper = ::articleMapper | ||
) | ||
} | ||
) | ||
} | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
basil/src/main/java/com/jocmp/basil/accounts/AccountDelegate.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
basil/src/main/java/com/jocmp/basil/articles/ArticleMapper.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.jocmp.basil.articles | ||
|
||
import com.jocmp.basil.Article | ||
import com.jocmp.basil.shared.optionalURL | ||
|
||
internal fun articleMapper( | ||
id: Long, | ||
externalID: String, | ||
mapperFeedID: Long?, | ||
title: String?, | ||
contentHtml: String?, | ||
url: String?, | ||
summary: String?, | ||
imageURL: String?, | ||
datePublished: Long? | ||
): Article { | ||
return Article( | ||
id = id.toString(), | ||
externalID = externalID, | ||
feedID = mapperFeedID.toString(), | ||
title = title ?: "", | ||
contentHTML = contentHtml ?: "", | ||
url = optionalURL(url), | ||
imageURL = optionalURL(imageURL), | ||
summary = summary ?: "" | ||
) | ||
} |
28 changes: 0 additions & 28 deletions
28
basil/src/main/java/com/jocmp/basil/extensions/ArticlesPagerExt.kt
This file was deleted.
Oops, something went wrong.
23 changes: 0 additions & 23 deletions
23
basil/src/main/java/com/jocmp/basil/extensions/FeedsQueriesExt.kt
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
basil/src/main/java/com/jocmp/basil/extensions/StringPrependingExt.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.jocmp.basil.feeds | ||
|
||
internal data class ExternalFeed( | ||
val externalID: String, | ||
val feedURL: String | ||
) |
Oops, something went wrong.