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

Commit

Permalink
Merge pull request #73 from readium/develop
Browse files Browse the repository at this point in the history
1.2.3
  • Loading branch information
aferditamuriqi authored Jan 13, 2020
2 parents 19eafc2 + 7d62f90 commit 9e88974
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 11 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @aferditamuriqi
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
github "readium/r2-shared-swift" == 1.4.2
github "readium/r2-shared-swift" == 1.4.3
github "stephencelis/SQLite.swift" == 0.12.2
github "krzyzanowskim/CryptoSwift" == 1.2.0
github "weichsel/ZIPFoundation" == 0.9.9
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
github "krzyzanowskim/CryptoSwift" "1.2.0"
github "readium/r2-shared-swift" "1.4.2"
github "readium/r2-shared-swift" "1.4.3"
github "stephencelis/SQLite.swift" "0.12.2"
github "weichsel/ZIPFoundation" "0.9.9"
4 changes: 2 additions & 2 deletions ReadiumLCP.podspec
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Pod::Spec.new do |s|

s.name = "ReadiumLCP"
s.version = "1.2.2"
s.version = "1.2.3"
s.license = "BSD 3-Clause License"
s.summary = "Readium LCP"
s.homepage = "http://readium.github.io"
s.author = { "Aferdita Muriqi" => "[email protected]" }
s.source = { :git => "https://github.com/readium/r2-lcp-swift.git", :tag => "1.2.2" }
s.source = { :git => "https://github.com/readium/r2-lcp-swift.git", :tag => "1.2.3" }
s.exclude_files = ["**/Info*.plist"]
s.requires_arc = true
s.resources = ['readium-lcp-swift/Resources/**']
Expand Down
6 changes: 2 additions & 4 deletions r2-lcp-swift.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
objects = {

/* Begin PBXBuildFile section */
03C3CC66222DBD5B00A01731 /* R2LCPClient.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 03C3CC65222DBD5B00A01731 /* R2LCPClient.framework */; };
CA26EF7C2280331E0011653E /* Connection.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA26EF7B2280331E0011653E /* Connection.swift */; };
CA2AE328221C3CFB008BD18F /* Deprecated.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA2AE327221C3CFB008BD18F /* Deprecated.swift */; };
CA4A38742208647400599297 /* PassphrasesRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA4A38732208647400599297 /* PassphrasesRepository.swift */; };
Expand Down Expand Up @@ -51,7 +50,7 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
03C3CC65222DBD5B00A01731 /* R2LCPClient.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = R2LCPClient.framework; sourceTree = BUILT_PRODUCTS_DIR; };
03A5DB9F23B78AD500D5FCBD /* R2LCPClient.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = R2LCPClient.framework; path = Carthage/Build/iOS/R2LCPClient.framework; sourceTree = "<group>"; };
CA26EF7B2280331E0011653E /* Connection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Connection.swift; sourceTree = "<group>"; };
CA2AE327221C3CFB008BD18F /* Deprecated.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Deprecated.swift; sourceTree = "<group>"; };
CA4A38732208647400599297 /* PassphrasesRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PassphrasesRepository.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -103,7 +102,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
03C3CC66222DBD5B00A01731 /* R2LCPClient.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -276,7 +274,7 @@
F3B2C8AD1F6672E1007601E4 /* Frameworks */ = {
isa = PBXGroup;
children = (
03C3CC65222DBD5B00A01731 /* R2LCPClient.framework */,
03A5DB9F23B78AD500D5FCBD /* R2LCPClient.framework */,
);
name = Frameworks;
sourceTree = "<group>";
Expand Down
4 changes: 2 additions & 2 deletions readium-lcp-swift/Resources/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
"ReadiumLCP.LCPClientError.unknown" = "Unknown error.";

/* StatusError: Errors while checking the status of the License, using the Status Document. */
"ReadiumLCP.StatusError.cancelled" = "You have cancelled this license on %@.";
"ReadiumLCP.StatusError.cancelled" = "This license was cancelled on %@.";
"ReadiumLCP.StatusError.returned" = "This license has been returned on %@.";
"ReadiumLCP.StatusError.expired.start" = "This license starts on %@.";
"ReadiumLCP.StatusError.expired.end" = "This license expired on %@.";
"ReadiumLCP.StatusError.revoked" = "This license has been revoked by its provider on %1$@.\nThe license was registered by %2$d device(s)";
"ReadiumLCP.StatusError.revoked" = "This license was revoked by its provider on %1$@.\nIt was registered by %2$d device(s)";

/* RenewError: Errors while renewing a loan. */
"ReadiumLCP.RenewError.renewFailed" = "Your publication could not be renewed properly.";
Expand Down
14 changes: 13 additions & 1 deletion readium-lcp-swift/Services/LicensesService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ extension LicensesService: LCPService {
let downloadProgress = license.fetchPublication { result, error in
progress.value = .infinite
if let result = result {
let publication = LCPImportedPublication(localURL: result.0, downloadTask: result.1, suggestedFilename: "\(license.license.id).epub")
let filename = self.suggestedFilename(for: result.0, license: license)
let publication = LCPImportedPublication(localURL: result.0, downloadTask: result.1, suggestedFilename: filename)
completion(publication, nil)
} else {
completion(nil, error)
Expand All @@ -103,4 +104,15 @@ extension LicensesService: LCPService {
}
}

/// Returns the suggested filename to be used when importing a publication.
private func suggestedFilename(for file: URL, license: License) -> String {
var mimetypes: [String] = []
if let mimetype = license.license.link(for: .publication)?.type {
mimetypes.append(mimetype)
}
let format = Publication.Format(file: file, mimetypes: mimetypes)
let fileExtension = (format == .pdf) ? "lcpdf" : "epub"
return "\(license.license.id).\(fileExtension)"
}

}

0 comments on commit 9e88974

Please sign in to comment.