Skip to content

Commit

Permalink
Simplify LcpService.injectLicense (readium#479)
Browse files Browse the repository at this point in the history
  • Loading branch information
qnga committed Mar 1, 2024
1 parent 5746e7f commit e129905
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions readium/lcp/src/main/java/org/readium/r2/lcp/LcpService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import org.readium.r2.shared.util.Try
import org.readium.r2.shared.util.asset.Asset
import org.readium.r2.shared.util.asset.AssetRetriever
import org.readium.r2.shared.util.format.Format
import org.readium.r2.shared.util.mediatype.MediaType

/**
* Service used to acquire and open publications protected with LCP.
Expand Down Expand Up @@ -126,8 +125,7 @@ public interface LcpService {
*/
public suspend fun injectLicenseDocument(
licenseDocument: LicenseDocument,
publicationFile: File,
mediaType: MediaType? = null
publicationFile: File
): Try<Unit, LcpError>

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ internal class LicensesService(

override suspend fun injectLicenseDocument(
licenseDocument: LicenseDocument,
publicationFile: File,
mediaType: MediaType?
publicationFile: File
): Try<Unit, LcpError> {
val mediaType = licenseDocument.publicationLink.mediaType
val format = assetRetriever.sniffFormat(publicationFile, FormatHints(mediaType))
.getOrElse {
Format(
Expand Down

0 comments on commit e129905

Please sign in to comment.