From 773b01ea01c934a876088e19bfba3b4bd2c9451e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Menu?= Date: Thu, 19 Sep 2024 10:00:42 +0200 Subject: [PATCH] 3.0.0 (#569) --- CHANGELOG.md | 5 ++- README.md | 2 +- docs/migration-guide.md | 90 ++++++++++++++++++--------------------- gradle.properties | 2 +- test-app/build.gradle.kts | 2 +- 5 files changed, 48 insertions(+), 53 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 881dd321ac..c89e8b73c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,9 @@ All notable changes to this project will be documented in this file. Take a look **Warning:** Features marked as *experimental* may change or be removed in a future release without notice. Use with caution. -## [Unreleased] + + +## [3.0.0] ### Fixed @@ -885,4 +887,5 @@ progression. Now if no reading progression is set, the `effectiveReadingProgress [3.0.0-alpha.2]: https://github.com/readium/kotlin-toolkit/compare/3.0.0-alpha.1...3.0.0-alpha.2 [3.0.0-beta.1]: https://github.com/readium/kotlin-toolkit/compare/3.0.0-alpha.2...3.0.0-beta.1 [3.0.0-beta.2]: https://github.com/readium/kotlin-toolkit/compare/3.0.0-beta.1...3.0.0-beta.2 +[3.0.0]: https://github.com/readium/kotlin-toolkit/compare/3.0.0-beta.2...3.0.0 diff --git a/README.md b/README.md index 20103cd5f2..10663ca82d 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Readium modules are distributed with [Maven Central](https://search.maven.org/se ```groovy buildscript { - ext.readium_version = '3.0.0-beta.2' + ext.readium_version = '3.0.0' } allprojects { diff --git a/docs/migration-guide.md b/docs/migration-guide.md index 8fdea8a318..21cd47fed0 100644 --- a/docs/migration-guide.md +++ b/docs/migration-guide.md @@ -4,65 +4,24 @@ All migration steps necessary in reading apps to upgrade to major versions of th -## 3.0.0-beta.1 +## 3.0.0 -### Core library desugaring - -If you target Android devices running below API 26, you now must enable [core library desugaring](https://developer.android.com/studio/write/java8-support#library-desugaring) in your application module. - -### Removing JVM dependencies - -To reduce our depency to the JVM, we no longer use `Date` objects in the toolkit. Instead, we added a custom `Instant` type. - -You can still translate from and to a `Date` object with `Instant.fromJavaDate()` and `instant.toJavaDate()`. - - -## 3.0.0-alpha.2 - -### Deprecation of `DownloadManager` - -The `DownloadManager` introduced in version 3.0.0-alpha.1 has been removed due to the Android Download Manager introducing unnecessary complexities in the toolkit. Instead, we chose to enable apps to manually handle an LCP download with `LcpService.injectLicenseDocument()`. - -### EPUB footnote pop-ups - -The EPUB navigator no longer displays a pop-up when the user activates a footnote link. This change was made to give reading apps control over the entire user interface. - -The navigator now moves to the footnote content by default. To show your own pop-up instead, implement the new callback `HyperlinkNavigator.Listener.shouldFollowInternalLink(Link, LinkContext?)`. - -```kotlin -override fun shouldFollowInternalLink( - link: Link, - context: HyperlinkNavigator.LinkContext? -): Boolean = - when (context) { - is HyperlinkNavigator.FootnoteContext -> { - val text = - if (link.mediaType?.isHtml == true) { - Html.fromHtml(context.noteContent, Html.FROM_HTML_MODE_COMPACT) - } else { - context.noteContent - } - - showPopup(text) - false - } - else -> true - } -``` +:warning: If you synchronize `Locator` objects between iOS and Android, you should wait for the 3.0 release of the Swift toolkit to upgrade your HREFs at the same time. - -## 3.0.0-alpha.1 - -First of all, upgrade to version 2.4.0 and resolve any deprecation notices. This will help you avoid troubles, as the APIs that were deprecated in version 2.x have been removed in version 3.0. +First of all, upgrade to version 2.4.3 and resolve any deprecation notices. This will help you avoid troubles, as the APIs that were deprecated in version 2.x have been removed in version 3.0. ### Minimum requirements -If you integrate Readium 3.0 as a submodule, it requires Kotlin 1.9.22 and Gradle 8.2.2. You should start by updating these dependencies in your application. +If you integrate Readium 3.0 as a submodule, it requires Kotlin 1.9.24 and Gradle 8.6.0. You should start by updating these dependencies in your application. #### Targeting Android SDK 34 The modules now target Android SDK 34. If your app also targets it, you will need the `FOREGROUND_SERVICE_MEDIA_PLAYBACK` permission in your `AndroidManifest.xml` file to use TTS and audiobook playback. +#### Core library desugaring + +If you target Android devices running below API 26, you now must enable [core library desugaring](https://developer.android.com/studio/write/java8-support#library-desugaring) in your application module. + ### `Publication` #### Opening a `Publication` @@ -219,6 +178,33 @@ navigator.addInputListener(object : InputListener { }) ``` +#### EPUB footnote pop-ups + +The EPUB navigator no longer displays a pop-up when the user activates a footnote link. This change was made to give reading apps control over the entire user interface. + +The navigator now moves to the footnote content by default. To show your own pop-up instead, implement the new callback `HyperlinkNavigator.Listener.shouldFollowInternalLink(Link, LinkContext?)`. + +```kotlin +override fun shouldFollowInternalLink( + link: Link, + context: HyperlinkNavigator.LinkContext? +): Boolean = + when (context) { + is HyperlinkNavigator.FootnoteContext -> { + val text = + if (link.mediaType?.isHtml == true) { + Html.fromHtml(context.noteContent, Html.FROM_HTML_MODE_COMPACT) + } else { + context.noteContent + } + + showPopup(text) + false + } + else -> true + } +``` + ### LCP #### Creating an `LcpService` @@ -242,6 +228,12 @@ Instead, call on your instance of `LcpDialogAuthentication`: You can monitor these events by setting a `View.OnAttachStateChangeListener` on your view. [See the Test App for an example](https://github.com/readium/kotlin-toolkit/blob/01d6c7936accea2d6b953d435e669260676e8c99/test-app/src/main/java/org/readium/r2/testapp/bookshelf/BookshelfFragment.kt#L68). +### Removing JVM dependencies + +To reduce our depency to the JVM, we no longer use `Date` objects in the toolkit. Instead, we added a custom `Instant` type. + +You can still translate from and to a `Date` object with `Instant.fromJavaDate()` and `instant.toJavaDate()`. + ### Removal of Fuel and Kovenant Both the Fuel and Kovenant libraries have been completely removed from the toolkit. With that, several deprecated functions have also been removed. diff --git a/gradle.properties b/gradle.properties index 0be95289c0..87d64aadb5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ # http://www.gradle.org/docs/current/userguide/build_environment.html pom.groupId=org.readium.kotlin-toolkit -pom.version=3.0.0-beta.2 +pom.version=3.0.0 android.minSdk=21 android.compileSdk=34 diff --git a/test-app/build.gradle.kts b/test-app/build.gradle.kts index dc3d867436..4e4186121b 100644 --- a/test-app/build.gradle.kts +++ b/test-app/build.gradle.kts @@ -19,7 +19,7 @@ android { applicationId = "org.readium.r2reader" - versionName = "3.0.0-beta.2" + versionName = "3.0.0" versionCode = 300000 testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"