Skip to content
This repository has been archived by the owner on Jul 29, 2022. It is now read-only.

Commit

Permalink
Merge pull request #120 from readium/2.0.0-alpha.1
Browse files Browse the repository at this point in the history
2.0.0-alpha.1
  • Loading branch information
mickael-menu authored Aug 11, 2020
2 parents 24a9ccf + 93b42ba commit 754f174
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 18 deletions.
1 change: 0 additions & 1 deletion .github/CODEOWNERS

This file was deleted.

9 changes: 5 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@ All notable changes to this project will be documented in this file.

**Warning:** Features marked as *experimental* may change or be removed in a future release without notice. Use with caution.

[unreleased]: https://github.com/readium/r2-streamer-kotlin/compare/master...HEAD
[1.2.0]: https://github.com/readium/r2-streamer-kotlin/compare/1.1.5...1.2.0

## [Unreleased]

## [1.2.0]
## [2.0.0-alpha.1]

### Added

Expand Down Expand Up @@ -40,3 +37,7 @@ server.loadCustomResource(assets.open("scripts/highlight.js"), "highlight.js", I
* [`Server` was broken](https://github.com/readium/r2-testapp-kotlin/pull/306) when provided with publication filenames containing invalid characters.
* [EPUB publishers' default styles are not overriden by Readium CSS anymore](https://github.com/readium/r2-navigator-kotlin/issues/132).
* The `AndroidManifest.xml` is not forcing anymore `allowBackup` and `supportsRtl`, to let reading apps manage these features themselves (contributed by [@twaddington](https://github.com/readium/r2-streamer-kotlin/pull/93)).


[unreleased]: https://github.com/readium/r2-streamer-kotlin/compare/master...HEAD
[2.0.0-alpha.1]: https://github.com/readium/r2-streamer-kotlin/compare/1.1.5...2.0.0-alpha.1
2 changes: 1 addition & 1 deletion r2-streamer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ dependencies {
if (findProject(':r2-shared')) {
implementation project(':r2-shared')
} else {
implementation "com.github.readium:r2-shared-kotlin:1.1.6"
implementation "com.github.readium:r2-shared-kotlin:2.0.0-alpha.1"
}

//AM NOTE: conflicting support libraries, excluding these
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
package org.readium.r2.streamer.parser.epub

import org.readium.r2.shared.extensions.toMap
import org.readium.r2.shared.publication.*
import org.readium.r2.shared.publication.encryption.Encryption
import org.readium.r2.shared.normalize
import org.readium.r2.shared.publication.Link
import org.readium.r2.shared.publication.Properties
import org.readium.r2.shared.publication.Publication
import org.readium.r2.shared.publication.PublicationCollection
import org.readium.r2.shared.publication.encryption.Encryption

/**
* Creates a [Publication] model from an EPUB package's document.
Expand Down Expand Up @@ -65,8 +68,17 @@ internal class PublicationFactory(

// Compute toc and otherCollections
val toc = navigationData["toc"].orEmpty()
val otherCollections =
navigationData.minus("toc").map { PublicationCollection(links = it.value, role = it.key) }
val otherCollections = navigationData
.minus("toc")
.mapKeys {
when (it.key) {
// RWPM uses camel case for the roles
// https://github.com/readium/webpub-manifest/issues/53
"page-list" -> "pageList"
else -> it.key
}
}
.map { PublicationCollection(links = it.value, role = it.key) }

// Build Publication object
return Publication(
Expand Down
21 changes: 13 additions & 8 deletions r2-streamer/src/main/java/org/readium/r2/streamer/server/Server.kt
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,20 @@ abstract class AbstractServer(private var port: Int, private val context: Contex
catch (e: Exception) { baseUrl.path }

if (containsMediaOverlay) {
addRoute(basePath + MEDIA_OVERLAY_HANDLE, MediaOverlayHandler::class.java, fetcher)
setRoute(basePath + MEDIA_OVERLAY_HANDLE, MediaOverlayHandler::class.java, fetcher)
}
addRoute(basePath + JSON_MANIFEST_HANDLE, ManifestHandler::class.java, fetcher)
addRoute(basePath + MANIFEST_HANDLE, ManifestHandler::class.java, fetcher)
addRoute(basePath + MANIFEST_ITEM_HANDLE, PublicationResourceHandler::class.java, fetcher)
addRoute(ASSETS_HANDLE, AssetHandler::class.java, assets)
addRoute(JS_HANDLE, ResourceHandler::class.java, resources)
addRoute(CSS_HANDLE, ResourceHandler::class.java, resources)
addRoute(FONT_HANDLE, FileHandler::class.java, fonts)
setRoute(basePath + JSON_MANIFEST_HANDLE, ManifestHandler::class.java, fetcher)
setRoute(basePath + MANIFEST_HANDLE, ManifestHandler::class.java, fetcher)
setRoute(basePath + MANIFEST_ITEM_HANDLE, PublicationResourceHandler::class.java, fetcher)
setRoute(ASSETS_HANDLE, AssetHandler::class.java, assets)
setRoute(JS_HANDLE, ResourceHandler::class.java, resources)
setRoute(CSS_HANDLE, ResourceHandler::class.java, resources)
setRoute(FONT_HANDLE, FileHandler::class.java, fonts)
}

private fun setRoute(url: String, handler: Class<*>, vararg initParameter: Any) {
try { removeRoute(url) } catch (e: Exception) {}
addRoute(url, handler, *initParameter)
}

// FIXME: To review once the media-overlays will be supported in the Publication model
Expand Down

0 comments on commit 754f174

Please sign in to comment.