Skip to content

Commit

Permalink
3.0.0 (#569)
Browse files Browse the repository at this point in the history
  • Loading branch information
mickael-menu authored Sep 19, 2024
1 parent 775f742 commit 773b01e
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 53 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
<!-- ## [Unreleased] -->

## [3.0.0]

### Fixed

Expand Down Expand Up @@ -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

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
90 changes: 41 additions & 49 deletions docs/migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,65 +4,24 @@ All migration steps necessary in reading apps to upgrade to major versions of th

<!-- ## Unreleased -->

## 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`
Expand Down Expand Up @@ -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`
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 773b01e

Please sign in to comment.