-
-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added display of article image inside reader
- Loading branch information
1 parent
694ad69
commit 4efc9d7
Showing
23 changed files
with
1,297 additions
and
250 deletions.
There are no files selected for viewing
755 changes: 755 additions & 0 deletions
755
app/schemas/com.nononsenseapps.feeder.db.room.AppDatabase/32.json
Large diffs are not rendered by default.
Oops, something went wrong.
75 changes: 75 additions & 0 deletions
75
app/src/androidTest/java/com/nononsenseapps/feeder/db/room/TestMigrationFrom31To32.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,75 @@ | ||
package com.nononsenseapps.feeder.db.room | ||
|
||
import androidx.room.testing.MigrationTestHelper | ||
import androidx.sqlite.db.framework.FrameworkSQLiteOpenHelperFactory | ||
import androidx.test.core.app.ApplicationProvider | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
import androidx.test.filters.LargeTest | ||
import androidx.test.platform.app.InstrumentationRegistry | ||
import com.nononsenseapps.feeder.FeederApplication | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import org.kodein.di.DI | ||
import org.kodein.di.DIAware | ||
import org.kodein.di.android.closestDI | ||
import kotlin.test.assertEquals | ||
|
||
@RunWith(AndroidJUnit4::class) | ||
@LargeTest | ||
class TestMigrationFrom31To32 : DIAware { | ||
private val dbName = "testDb" | ||
private val feederApplication: FeederApplication = ApplicationProvider.getApplicationContext() | ||
override val di: DI by closestDI(feederApplication) | ||
|
||
@Rule | ||
@JvmField | ||
val testHelper: MigrationTestHelper = | ||
MigrationTestHelper( | ||
InstrumentationRegistry.getInstrumentation(), | ||
AppDatabase::class.java, | ||
emptyList(), | ||
FrameworkSQLiteOpenHelperFactory(), | ||
) | ||
|
||
@Test | ||
fun migrate() { | ||
@Suppress("SimpleRedundantLet") | ||
testHelper.createDatabase(dbName, FROM_VERSION).let { oldDB -> | ||
oldDB.execSQL( | ||
""" | ||
INSERT INTO feeds(id, title, url, custom_title, tag, notify, last_sync, response_hash, fulltext_by_default, open_articles_with, alternate_id, currently_syncing, when_modified, site_fetched) | ||
VALUES(1, 'feed', 'http://url', '', '', 0, 0, 666, 0, '', 0, 0, 0, 0) | ||
""".trimIndent(), | ||
) | ||
oldDB.execSQL( | ||
""" | ||
INSERT INTO feed_items(id, guid, title, plain_title, plain_snippet, notified, feed_id, first_synced_time, primary_sort_time, pinned, bookmarked, fulltext_downloaded, read_time, unread, word_count, word_count_full) | ||
VALUES(8, 'http://item1', 'title', 'ptitle', 'psnippet', 0, 1, 0, 0, 1, 0, 0, 0, 1, 5, 900) | ||
""".trimIndent(), | ||
) | ||
} | ||
val db = | ||
testHelper.runMigrationsAndValidate( | ||
dbName, | ||
TO_VERSION, | ||
true, | ||
MigrationFrom31To32(di), | ||
) | ||
|
||
db.query( | ||
""" | ||
select image_from_body from feed_items | ||
""".trimIndent(), | ||
).use { | ||
assert(it.count == 1) | ||
assert(it.moveToFirst()) | ||
assertEquals(0, it.getInt(0)) | ||
} | ||
} | ||
|
||
companion object { | ||
private const val FROM_VERSION = 31 | ||
private const val TO_VERSION = 32 | ||
} | ||
} |
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
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
17 changes: 17 additions & 0 deletions
17
app/src/main/java/com/nononsenseapps/feeder/model/ParsedArticle.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,17 @@ | ||
package com.nononsenseapps.feeder.model | ||
|
||
data class ParsedArticle( | ||
val id: String?, | ||
val url: String? = null, | ||
val external_url: String? = null, | ||
val title: String? = null, | ||
val content_html: String? = null, | ||
val content_text: String? = null, | ||
val summary: String? = null, | ||
val image: ThumbnailImage? = null, | ||
val date_published: String? = null, | ||
val date_modified: String? = null, | ||
val author: ParsedAuthor? = null, | ||
val tags: List<String>? = null, | ||
val attachments: List<ParsedEnclosure>? = null, | ||
) |
7 changes: 7 additions & 0 deletions
7
app/src/main/java/com/nononsenseapps/feeder/model/ParsedAuthor.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,7 @@ | ||
package com.nononsenseapps.feeder.model | ||
|
||
data class ParsedAuthor( | ||
val name: String? = null, | ||
val url: String? = null, | ||
val avatar: String? = null, | ||
) |
9 changes: 9 additions & 0 deletions
9
app/src/main/java/com/nononsenseapps/feeder/model/ParsedEnclosure.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,9 @@ | ||
package com.nononsenseapps.feeder.model | ||
|
||
data class ParsedEnclosure( | ||
val url: String?, | ||
val mime_type: String? = null, | ||
val title: String? = null, | ||
val size_in_bytes: Long? = null, | ||
val duration_in_seconds: Long? = null, | ||
) |
Oops, something went wrong.