Skip to content

2.3.0

Compare
Choose a tag to compare
@mickael-menu mickael-menu released this 28 Dec 12:01
· 162 commits to main since this release
bfc536f

Resources

Changelog

Added

Shared

  • Extract the raw content (text, images, etc.) of a publication. Take a look at the user guide.
  • Add support for unsafe HTTP redirections with DefaultHttpClient.
    • You will need to opt-in explicitly by implementing DefaultHttpClient.Callback.onFollowUnsafeRedirect.

Navigator

  • Improved Javascript support in the EPUB navigator:
    • Register custom JavascriptInterface objects to inject native Kotlin code in the EPUB web views.
      EpubNavigatorFragment.createFactory(
          publication = publication,
          …,
          config = EpubNavigatorFragment.Configuration().apply {
              registerJavascriptInterface("customInterface") { link ->
                  MyCustomApi(link)
              }
          }
      )
      
      class MyCustomApi(val link: Link) {
          @JavascriptInterface
          fun api(arg: String): String {
              return "API called from the resource ${link.href} with argument $arg")
          }
      }
    • Evaluate JavaScript on the currently visible HTML resource with EpubNavigatorFragment.evaluateJavascript().
      val result = navigator.evaluateJavascript("customInterface.api('argument')")
  • New PSPDFKit adapter for rendering PDF documents. Take a look at the user guide.
  • A brand new text-to-speech implementation.
  • Support for custom fonts with the EPUB navigator.
  • New EPUB user preferences, as part of the revamped Settings API:
    • backgroundColor - Default page background color.
    • fontWeight - Base text font weight.
    • textColor - Default page text color.
    • textNormalization - Normalize font style, weight and variants, which improves accessibility.
    • imageFilter - Filter applied to images in dark theme (darken, invert colors)
    • language - Language of the publication content.
    • readingProgression - Direction of the reading progression across resources, e.g. RTL.
    • typeScale - Scale applied to all element font sizes.
    • paragraphIndent - Text indentation for paragraphs.
    • paragraphSpacing - Vertical margins for paragraphs.
    • hyphens - Enable hyphenation.
    • ligatures - Enable ligatures in Arabic.
  • Fixed scroll inertia when scrolling an EPUB.
  • EPUB decorations can now be attached to Locator objects containing only an HTML ID (locations.fragments) or a CSS selector (locations.cssSelector).

Changed

Shared

  • TransformingResource now caches its content by default, as it is the correct behavior in most cases. Set cacheBytes = false explicitly to revert to the previous behavior.
  • The previous PDF navigator was extracted in its own package to support third-party PDF engines. This is a breaking change if your app supported PDF, take a look at the migration guide.

Navigator

  • The EPUB and PDF user preferences API got revamped. Take a look at the user guide and the migration guide to learn how to use it.
  • Decoration.extras is now a Map<String, Any> instead of Bundle. You will need to update your app if you were storing custom data in extras, for example:
    val decoration = Decoration(...,
        extras = mapOf("id" to id)
    )
    
    val id = decoration.extras["id"] as? Long

Deprecated

Streamer

Fixed

Streamer

  • Fixed parsing the table of contents of an EPUB 3 using NCX instead of a Navigation Document.

Navigator

  • swift-toolkit#61 Fixed serving EPUB resources when the HREF contains an anchor or query parameters.
  • Fixed emitting currentLocator with fixed layout EPUBs.
  • Prevent refreshing an already loaded EPUB resource when jumping to a Locator in it.
  • #86 Fixed page swipes while selecting text in an EPUB resource.
  • The onTap event is not sent when an EPUB text selection is active anymore, to prevent showing the app bar while dismissing a selection.
  • #76 Fixed EPUB fixed layout font size affected by device settings.
  • Decoration objects are now properly comparable with equals().
  • #292 Fix broken pagination when an EPUB uses overflow-x: hidden.