Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

buildscript {
ext.kotlin_version = '1.5.31'
ext.kotlin_version = '1.6.10'
ext.dokka_version = '1.5.30'

repositories {
Expand All @@ -17,7 +17,7 @@ buildscript {
maven { url "https://s3.amazonaws.com/repo.commonsware.com" }
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.3'
classpath 'com.android.tools.build:gradle:7.0.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version"
}
Expand Down
15 changes: 7 additions & 8 deletions readium/lcp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ dependencies {

api project(':readium:shared')

implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'com.google.android.material:material:1.4.0'
implementation "com.jakewharton.timber:timber:4.7.1"
implementation 'com.jakewharton.timber:timber:5.0.1'
implementation("com.mcxiaoke.koi:async:0.5.5") {
exclude module: 'support-v4'
}
Expand All @@ -71,16 +71,15 @@ dependencies {
}
implementation 'joda-time:joda-time:2.10.13'
implementation "org.zeroturnaround:zt-zip:1.14"
implementation 'androidx.browser:browser:1.3.0'
implementation 'androidx.browser:browser:1.4.0'

final room_version = '2.4.0-beta01'
final room_version = '2.4.0'
implementation "androidx.room:room-runtime:$room_version"
implementation "androidx.room:room-ktx:$room_version"
kapt "androidx.room:room-compiler:$room_version"

// Tests
testImplementation "junit:junit:4.13.2"
testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"

androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation 'androidx.test:runner:1.4.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ import org.readium.r2.shared.util.getOrElse
import org.readium.r2.shared.util.mediatype.MediaType
import timber.log.Timber
import java.util.*
import kotlin.time.Duration
import kotlin.time.Duration.Companion.seconds
import kotlin.time.ExperimentalTime
import kotlin.time.seconds

internal sealed class Either<A, B> {
class Left<A, B>(val left: A) : Either<A, B>()
Expand Down Expand Up @@ -316,9 +315,7 @@ internal class LicenseValidation(
private suspend fun fetchStatus(license: LicenseDocument) {
val url = license.url(LicenseDocument.Rel.status, preferredType = MediaType.LCP_STATUS_DOCUMENT).toString()
// Short timeout to avoid blocking the License, since the LSD is optional.
// FIXME: To remove after bumping to Kotlin 1.6
@Suppress("DEPRECATION")
val data = network.fetch(url, timeout = Duration.seconds(5))
val data = network.fetch(url, timeout = 5.seconds)
.getOrElse { throw LcpException.Network(it) }

raise(Event.retrievedStatusData(data))
Expand All @@ -332,9 +329,7 @@ internal class LicenseValidation(
private suspend fun fetchLicense(status: StatusDocument) {
val url = status.url(StatusDocument.Rel.license, preferredType = MediaType.LCP_LICENSE_DOCUMENT).toString()
// Short timeout to avoid blocking the License, since it can be updated next time.
// FIXME: To remove after bumping to Kotlin 1.6
@Suppress("DEPRECATION")
val data = network.fetch(url, timeout = Duration.seconds(5))
val data = network.fetch(url, timeout = 5.seconds)
.getOrElse { throw LcpException.Network(it) }

raise(Event.retrievedLicenseData(data))
Expand Down
37 changes: 18 additions & 19 deletions readium/navigator/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,35 +62,35 @@ dependencies {

api project(':readium:shared')

implementation 'androidx.activity:activity-ktx:1.3.1'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation "androidx.browser:browser:1.3.0"
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.fragment:fragment-ktx:1.3.6'
implementation 'androidx.activity:activity-ktx:1.4.0'
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation "androidx.browser:browser:1.4.0"
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.fragment:fragment-ktx:1.4.0'
implementation "androidx.legacy:legacy-support-core-ui:1.0.0"
implementation "androidx.legacy:legacy-support-v4:1.0.0"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.3.1"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:2.3.1"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.4.0"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.4.0"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0"
implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:2.4.0"
implementation "androidx.recyclerview:recyclerview:1.2.1"
implementation "androidx.media:media:1.4.3"
implementation "androidx.viewpager2:viewpager2:1.0.0"
implementation "androidx.webkit:webkit:1.4.0"
// Needed to avoid a crash with API 31, see https://stackoverflow.com/a/69152986/1474476
implementation 'androidx.work:work-runtime-ktx:2.7.0'
implementation 'androidx.work:work-runtime-ktx:2.7.1'
implementation "com.duolingo.open:rtl-viewpager:1.0.3"
api "com.github.barteksc:android-pdf-viewer:2.8.2"
// ChrisBane/PhotoView ( for the Zoom handling )
implementation "com.github.chrisbanes:PhotoView:2.3.0"
// ExoPlayer is used by the Audio Navigator.
api 'com.google.android.exoplayer:exoplayer-core:2.15.1'
api 'com.google.android.exoplayer:exoplayer-ui:2.15.1'
api 'com.google.android.exoplayer:extension-mediasession:2.15.1'
api 'com.google.android.exoplayer:extension-workmanager:2.15.1'
api 'com.google.android.exoplayer:exoplayer-core:2.16.1'
api 'com.google.android.exoplayer:exoplayer-ui:2.16.1'
api 'com.google.android.exoplayer:extension-mediasession:2.16.1'
api 'com.google.android.exoplayer:extension-workmanager:2.16.1'
implementation 'com.google.android.material:material:1.4.0'
implementation "com.jakewharton.timber:timber:4.7.1"
implementation 'com.jakewharton.timber:timber:5.0.1'
implementation "com.shopgun.android:utils:1.0.9"
implementation 'joda-time:joda-time:2.10.13'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2"
Expand All @@ -99,9 +99,8 @@ dependencies {
//noinspection GradleDependency
implementation 'org.jsoup:jsoup:1.14.3'

// Tests
testImplementation "junit:junit:4.13.2"
testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"

androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation 'androidx.test:runner:1.4.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ class R2FXLLayout : FrameLayout {
// only fling if no scale is needed - scale will happen on ACTION_UP
flingRunnable = FlingRunnable(context)
flingRunnable!!.fling(velocityX.toInt(), velocityY.toInt())
ViewCompat.postOnAnimation(this@R2FXLLayout, flingRunnable)
ViewCompat.postOnAnimation(this@R2FXLLayout, flingRunnable!!)
return true
}
return false
Expand Down Expand Up @@ -429,7 +429,7 @@ class R2FXLLayout : FrameLayout {
if (animate) {
animatedZoomRunnable = AnimatedZoomRunnable()
animatedZoomRunnable!!.scale(scale, newScale, this.focusX, this.focusY, true)
ViewCompat.postOnAnimation(this@R2FXLLayout, animatedZoomRunnable)
ViewCompat.postOnAnimation(this@R2FXLLayout, animatedZoomRunnable!!)
} else {
zoomDispatcher.onZoomBegin(newScale)
internalScale(newScale, this.focusX, this.focusY)
Expand Down Expand Up @@ -531,7 +531,7 @@ class R2FXLLayout : FrameLayout {
val newScale = NumberUtils.clamp(minScale, scale, maxScale)
scale(scale, newScale, focusX, focusY, true)
if (animatedZoomRunnable!!.doScale() || animatedZoomRunnable!!.doTranslate()) {
ViewCompat.postOnAnimation(this@R2FXLLayout, animatedZoomRunnable)
ViewCompat.postOnAnimation(this@R2FXLLayout, animatedZoomRunnable!!)
return true
}
return false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class ExoMediaPlayer(

private inner class PlaybackPreparer : MediaSessionConnector.PlaybackPreparer {

override fun onCommand(player: Player, controlDispatcher: ControlDispatcher, command: String, extras: Bundle?, cb: ResultReceiver?): Boolean =
override fun onCommand(player: Player, command: String, extras: Bundle?, cb: ResultReceiver?): Boolean =
listener?.onCommand(command, extras, cb) ?: false

override fun getSupportedPrepareActions(): Long =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import androidx.lifecycle.ViewModelProvider
internal inline fun <reified T : ViewModel> createViewModelFactory(crossinline factory: () -> T): ViewModelProvider.Factory =

object : ViewModelProvider.Factory {
override fun <V : ViewModel?> create(modelClass: Class<V>): V {
override fun <V : ViewModel> create(modelClass: Class<V>): V {
if (!modelClass.isAssignableFrom(T::class.java)) {
throw IllegalAccessException("Unknown ViewModel class")
}
Expand Down
22 changes: 6 additions & 16 deletions readium/opds/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,25 +53,15 @@ dependencies {

api project(':readium:shared')

implementation 'androidx.appcompat:appcompat:1.3.1'
implementation "com.jakewharton.timber:timber:4.7.1"
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'com.jakewharton.timber:timber:5.0.1'
implementation "joda-time:joda-time:2.10.13"
implementation "nl.komponents.kovenant:kovenant:3.3.0"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2"

testImplementation 'androidx.test.ext:junit-ktx:1.1.3'
testImplementation 'androidx.test:core-ktx:1.4.0'
testImplementation "junit:junit:4.13.2"
testImplementation "net.sf.kxml:kxml2:2.3.0"
testImplementation 'org.assertj:assertj-core:3.19.0'
testImplementation "org.jetbrains.kotlin:kotlin-reflect:1.5.31"
testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.5.0"
testImplementation "org.json:json:20200518"
testImplementation "org.mockito:mockito-core:3.3.3"
testImplementation 'org.robolectric:robolectric:4.5.1'
testImplementation "xmlpull:xmlpull:1.1.3.1"

// Tests
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.robolectric:robolectric:4.7.3'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation 'androidx.test:runner:1.4.0'
}
30 changes: 11 additions & 19 deletions readium/shared/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -56,37 +56,29 @@ afterEvaluate {
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')

implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.browser:browser:1.3.0'
implementation "com.github.kittinunf.fuel:fuel-android:2.2.2"
implementation "com.github.kittinunf.fuel:fuel:2.2.2"
implementation "com.jakewharton.timber:timber:4.7.1"
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'androidx.browser:browser:1.4.0'
implementation 'com.github.kittinunf.fuel:fuel-android:2.3.1'
implementation 'com.github.kittinunf.fuel:fuel:2.3.1'
implementation 'com.jakewharton.timber:timber:5.0.1'
implementation "joda-time:joda-time:2.10.13"
implementation "nl.komponents.kovenant:kovenant-android:3.3.0"
implementation "nl.komponents.kovenant:kovenant-combine:3.3.0"
implementation "nl.komponents.kovenant:kovenant-core:3.3.0"
implementation "nl.komponents.kovenant:kovenant-functional:3.3.0"
implementation "nl.komponents.kovenant:kovenant-jvm:3.3.0"
implementation "nl.komponents.kovenant:kovenant:3.3.0"
implementation "org.jetbrains.kotlin:kotlin-reflect:1.5.31"
implementation 'org.jetbrains.kotlin:kotlin-reflect:1.6.10'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2"
implementation "org.jsoup:jsoup:1.14.3"

testImplementation 'androidx.test.ext:junit-ktx:1.1.3'
testImplementation 'androidx.test:core-ktx:1.4.0'
// Tests
testImplementation "junit:junit:4.13.2"
testImplementation "net.sf.kxml:kxml2:2.3.0"
testImplementation 'org.assertj:assertj-core:3.19.0'
testImplementation "org.jetbrains.kotlin:kotlin-reflect:1.5.31"
testImplementation 'org.assertj:assertj-core:3.21.0'
testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.5.0"
// Latest version of org.json is incompatible with the one bundled in Android, breaking the tests.
//noinspection GradleDependency
testImplementation "org.json:json:20200518"
testImplementation "org.mockito:mockito-core:3.3.3"
testImplementation 'org.robolectric:robolectric:4.5.1'
testImplementation "xmlpull:xmlpull:1.1.3.1"
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.5.2"
testImplementation 'org.robolectric:robolectric:4.7.3'

androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation 'androidx.test:runner:1.4.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner

@RunWith(RobolectricTestRunner::class)
class JSONTest {

@Test fun `unpack an empty JSONObject`() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@ import org.json.JSONArray
import org.json.JSONObject
import org.junit.Assert.*
import org.junit.Test
import org.junit.runner.RunWith
import org.readium.r2.shared.assertJSONEquals
import org.readium.r2.shared.toJSON
import org.robolectric.RobolectricTestRunner

@RunWith(RobolectricTestRunner::class)
class AcquisitionTest {

@Test fun `parse minimal JSON acquisition`() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ package org.readium.r2.shared.opds
import org.json.JSONObject
import org.junit.Assert.*
import org.junit.Test
import org.junit.runner.RunWith
import org.readium.r2.shared.assertJSONEquals
import org.readium.r2.shared.extensions.iso8601ToDate
import org.robolectric.RobolectricTestRunner

@RunWith(RobolectricTestRunner::class)
class AvailabilityTest {

@Test fun `parse JSON availability state`() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ package org.readium.r2.shared.opds
import org.json.JSONObject
import org.junit.Assert.*
import org.junit.Test
import org.junit.runner.RunWith
import org.readium.r2.shared.assertJSONEquals
import org.robolectric.RobolectricTestRunner

@RunWith(RobolectricTestRunner::class)
class CopiesTest {

@Test fun `parse minimal JSON copies`() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ package org.readium.r2.shared.opds
import org.json.JSONObject
import org.junit.Assert.*
import org.junit.Test
import org.junit.runner.RunWith
import org.readium.r2.shared.assertJSONEquals
import org.robolectric.RobolectricTestRunner

@RunWith(RobolectricTestRunner::class)
class HoldsTest {

@Test fun `parse minimal JSON holds`() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@
package org.readium.r2.shared.opds

import org.json.JSONObject
import org.junit.Assert.*
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNull
import org.junit.Test
import org.junit.runner.RunWith
import org.readium.r2.shared.assertJSONEquals
import org.robolectric.RobolectricTestRunner

@RunWith(RobolectricTestRunner::class)
class PriceTest {

@Test fun `parse JSON price`() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
package org.readium.r2.shared.parser.xml

import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
import org.xmlpull.v1.XmlPullParserException
import java.io.ByteArrayInputStream
import javax.xml.XMLConstants
Expand Down Expand Up @@ -42,6 +44,7 @@ private fun parseXmlString(string: String, namespaceAware: Boolean = true): Elem
return parser.parse(stream)
}

@RunWith(RobolectricTestRunner::class)
class XmlParserTest {
@Test
fun testNotNamespaceAwareV3() {
Expand Down Expand Up @@ -199,6 +202,7 @@ class XmlParserTest {
}
}

@RunWith(RobolectricTestRunner::class)
class ElementNodeTest {
@Test
fun testCollectText() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@ import org.json.JSONArray
import org.json.JSONObject
import org.junit.Assert.*
import org.junit.Test
import org.junit.runner.RunWith
import org.readium.r2.shared.assertJSONEquals
import org.readium.r2.shared.toJSON
import org.robolectric.RobolectricTestRunner

@RunWith(RobolectricTestRunner::class)
class ContributorTest {

@Test fun `parse JSON string`() {
Expand Down Expand Up @@ -193,7 +196,7 @@ class ContributorTest {
assertJSONEquals(
JSONArray("""[
{
"name": {"und": "Thom Yorke"},
"name": {"und": "Thom Yorke"}
},
{
"name": {"en": "Jonny Greenwood", "fr": "Jean Boisvert"},
Expand Down
Loading