Compare commits

...

4 Commits

Author SHA1 Message Date
Amine Louveau
a094d88799 Merge pull request 'Make the author field nullable' (#117) from davidoskky/ReaderForSelfoss-multiplatform:author into master
Some checks reported errors
continuous-integration/drone/push Build was killed
Reviewed-on: https://gitea.amine-louveau.fr/Louvorg/ReaderForSelfoss-multiplatform/pulls/117
2022-12-28 14:25:36 +00:00
e51915d1cd Include author field when updating the database
All checks were successful
continuous-integration/drone/pr Build is passing
2022-12-28 14:25:56 +01:00
3a654f6ede Migrate the database table 2022-12-28 14:25:34 +01:00
5227751dca Make the author field nullable
All checks were successful
continuous-integration/drone/pr Build is passing
2022-12-28 11:02:43 +01:00
5 changed files with 12 additions and 5 deletions

View File

@ -46,7 +46,7 @@ data class ParecelableItem(
val link: String, val link: String,
val sourcetitle: String, val sourcetitle: String,
val tags: String, val tags: String,
val author: String val author: String?
) : Parcelable { ) : Parcelable {
companion object { companion object {

View File

@ -73,7 +73,7 @@ class SelfossModel {
val sourcetitle: String, val sourcetitle: String,
@Serializable(with = TagsListSerializer::class) @Serializable(with = TagsListSerializer::class)
val tags: List<String>, val tags: List<String>,
val author: String val author: String?
) { ) {
// TODO: maybe find a better way to handle these kind of urls // TODO: maybe find a better way to handle these kind of urls
fun getLinkDecoded(): String { fun getLinkDecoded(): String {
@ -104,7 +104,7 @@ class SelfossModel {
fun sourceAuthorAndDate(): String { fun sourceAuthorAndDate(): String {
var txt = this.sourcetitle.getHtmlDecoded() var txt = this.sourcetitle.getHtmlDecoded()
if (this.author.isNotEmpty()) { if (!this.author.isNullOrBlank()) {
txt += " (by ${this.author}) " txt += " (by ${this.author}) "
} }
txt += DateUtils.parseRelativeDate(this.datetime) txt += DateUtils.parseRelativeDate(this.datetime)

View File

@ -511,6 +511,7 @@ class Repository(
item.link, item.link,
item.sourcetitle, item.sourcetitle,
item.tags.joinToString(","), item.tags.joinToString(","),
item.author,
item.id.toString() item.id.toString()
) )

View File

@ -0,0 +1,6 @@
CREATE TABLE ITEM_BACKUP AS SELECT `id`, `datetime`, `title`, `content`,
`unread`, `starred`, `thumbnail`, `icon`, `link`, `sourcetitle`,
`tags` FROM ITEM;
ALTER TABLE ITEM_BACKUP ADD COLUMN `author` TEXT;
DROP TABLE ITEM;
ALTER TABLE ITEM_BACKUP RENAME TO ITEM;

View File

@ -10,7 +10,7 @@ CREATE TABLE ITEM (
`link` TEXT NOT NULL, `link` TEXT NOT NULL,
`sourcetitle` TEXT NOT NULL, `sourcetitle` TEXT NOT NULL,
`tags` TEXT NOT NULL, `tags` TEXT NOT NULL,
`author` TEXT NOT NULL, `author` TEXT,
PRIMARY KEY(`id`) PRIMARY KEY(`id`)
); );
@ -31,4 +31,4 @@ deleteItemsWhereSource:
DELETE FROM ITEM WHERE `sourcetitle` = ?; DELETE FROM ITEM WHERE `sourcetitle` = ?;
updateItem: updateItem:
UPDATE ITEM SET `datetime` = ?, `title` = ?, `content` = ?, `unread` = ?, `starred` = ?, `thumbnail` = ?, `icon` = ?, `link` = ?, `sourcetitle` = ?, `tags` = ? WHERE `id` = ?; UPDATE ITEM SET `datetime` = ?, `title` = ?, `content` = ?, `unread` = ?, `starred` = ?, `thumbnail` = ?, `icon` = ?, `link` = ?, `sourcetitle` = ?, `tags` = ?, `author` = ? WHERE `id` = ?;