Skip to content

Commit aac14c9

Browse files
authored
Fix building with Kotlin 1.6 (#58)
1 parent 1521e33 commit aac14c9

File tree

6 files changed

+35
-2
lines changed

6 files changed

+35
-2
lines changed

.idea/codeStyles/Project.xml

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/codeStyles/codeStyleConfig.xml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ All notable changes to this project will be documented in this file. Take a look
2727

2828
### Fixed
2929

30+
* Fix building with Kotlin 1.6.
31+
3032
#### Navigator
3133

3234
* Fixed turning pages of an EPUB reflowable resource with an odd number of columns. A virtual blank trailing column is appended to the resource when displayed as two columns.

readium/lcp/src/main/java/org/readium/r2/lcp/license/LicenseValidation.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ internal class LicenseValidation(
280280
is State.registerDevice -> registerDevice(state.documents.license, state.link)
281281
is State.valid -> notifyObservers(state.documents, null)
282282
is State.failure -> notifyObservers(null, state.error)
283+
State.cancelled -> notifyObservers(null, null)
283284
}
284285
}
285286
} catch (error: Exception) {
@@ -315,6 +316,8 @@ internal class LicenseValidation(
315316
private suspend fun fetchStatus(license: LicenseDocument) {
316317
val url = license.url(LicenseDocument.Rel.status, preferredType = MediaType.LCP_STATUS_DOCUMENT).toString()
317318
// Short timeout to avoid blocking the License, since the LSD is optional.
319+
// FIXME: To remove after bumping to Kotlin 1.6
320+
@Suppress("DEPRECATION")
318321
val data = network.fetch(url, timeout = Duration.seconds(5))
319322
.getOrElse { throw LcpException.Network(it) }
320323

@@ -329,6 +332,8 @@ internal class LicenseValidation(
329332
private suspend fun fetchLicense(status: StatusDocument) {
330333
val url = status.url(StatusDocument.Rel.license, preferredType = MediaType.LCP_LICENSE_DOCUMENT).toString()
331334
// Short timeout to avoid blocking the License, since it can be updated next time.
335+
// FIXME: To remove after bumping to Kotlin 1.6
336+
@Suppress("DEPRECATION")
332337
val data = network.fetch(url, timeout = Duration.seconds(5))
333338
.getOrElse { throw LcpException.Network(it) }
334339

readium/shared/src/test/java/org/readium/r2/shared/fetcher/ArchiveFetcherTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class ArchiveFetcherTest {
9292
@Test
9393
fun `Reading a missing entry returns NotFound`() {
9494
val resource = fetcher.get(Link(href = "/unknown"))
95-
assertFailsWith<Resource.Exception.NotFound> { resource.lengthBlocking().getOrThrow() }
95+
assertFailsWith<Resource.Exception.NotFound> { resource.readBlocking().getOrThrow() }
9696
}
9797

9898
@Test

test-app/src/main/java/org/readium/r2/testapp/reader/BaseReaderFragment.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ abstract class BaseReaderFragment : Fragment() {
155155
private var mode: ActionMode? = null
156156

157157
// Available tint colors for highlight and underline annotations.
158-
private val highlightTints = mapOf<@IdRes Int, @ColorInt Int>(
158+
private val highlightTints = mapOf</*@IdRes*/ Int, /*@ColorInt*/ Int>(
159159
R.id.red to Color.rgb(247, 124, 124),
160160
R.id.green to Color.rgb(173, 247, 123),
161161
R.id.blue to Color.rgb(124, 198, 247),

0 commit comments

Comments
 (0)