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 #32 from readium/develop
Browse files Browse the repository at this point in the history
1.2.4
  • Loading branch information
aferditamuriqi authored Jul 18, 2018
2 parents 63305ce + ec50bb0 commit f14646e
Show file tree
Hide file tree
Showing 29 changed files with 421 additions and 78 deletions.
16 changes: 16 additions & 0 deletions r2-shared-swift.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
objects = {

/* Begin PBXBuildFile section */
AEF39DF320E3895200A560F3 /* UserProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEF39DF220E3895200A560F3 /* UserProperties.swift */; };
57470F7E20ED0D1A000CDCA3 /* DownloadSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57470F7D20ED0D1A000CDCA3 /* DownloadSession.swift */; };
F32314A21F8616C2000FCFB0 /* Drm.swift in Sources */ = {isa = PBXBuildFile; fileRef = F32314A11F8616C2000FCFB0 /* Drm.swift */; };
F34CB2891FC56CAD005E3A37 /* DrmLicense.swift in Sources */ = {isa = PBXBuildFile; fileRef = F34CB2881FC56CAD005E3A37 /* DrmLicense.swift */; };
F39E9E6F1FC2E1B70098F77E /* ObjectMapper.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F3E7D4201F4ECA9800DF166D /* ObjectMapper.framework */; };
Expand Down Expand Up @@ -36,6 +38,8 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
AEF39DF220E3895200A560F3 /* UserProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserProperties.swift; sourceTree = "<group>"; };
57470F7D20ED0D1A000CDCA3 /* DownloadSession.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DownloadSession.swift; sourceTree = "<group>"; };
F32314A11F8616C2000FCFB0 /* Drm.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Drm.swift; sourceTree = "<group>"; };
F34CB2881FC56CAD005E3A37 /* DrmLicense.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DrmLicense.swift; sourceTree = "<group>"; };
F3B1879F1FA33D4D00BB46BF /* Feed.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Feed.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -78,6 +82,14 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
57470F7F20ED0D25000CDCA3 /* Toolkit */ = {
isa = PBXGroup;
children = (
57470F7D20ED0D1A000CDCA3 /* DownloadSession.swift */,
);
path = Toolkit;
sourceTree = "<group>";
};
F34CB28A1FC5714D005E3A37 /* Drm */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -122,6 +134,7 @@
F3E7D3F81F4EBE2100DF166D /* Info.plist */,
F3E7D40C1F4EC69100DF166D /* RootFile.swift */,
F3E7D4221F4ECB3D00DF166D /* ISO8601DateString.swift */,
57470F7F20ED0D25000CDCA3 /* Toolkit */,
F34CB28A1FC5714D005E3A37 /* Drm */,
F3E7D41B1F4EC69C00DF166D /* Publication */,
F3B1879E1FA33D3700BB46BF /* OPDS */,
Expand All @@ -134,6 +147,7 @@
children = (
F3E7D40A1F4EC69100DF166D /* Publication.swift */,
F3E7D4061F4EC69100DF166D /* Metadata.swift */,
AEF39DF220E3895200A560F3 /* UserProperties.swift */,
F3E7D41C1F4EC6B300DF166D /* Metadata */,
F3E7D41D1F4EC6B900DF166D /* Link */,
F3E7D41E1F4EC6CC00DF166D /* MediaOverlays */,
Expand Down Expand Up @@ -275,9 +289,11 @@
F3E7D4161F4EC69100DF166D /* Properties.swift in Sources */,
F3E7D4231F4ECB3D00DF166D /* ISO8601DateString.swift in Sources */,
F3E7D41A1F4EC69100DF166D /* Subject.swift in Sources */,
57470F7E20ED0D1A000CDCA3 /* DownloadSession.swift in Sources */,
F3B187A61FA33E4900BB46BF /* Group.swift in Sources */,
F3E7D4191F4EC69100DF166D /* RootFile.swift in Sources */,
F3E7D4141F4EC69100DF166D /* MetadataItem.swift in Sources */,
AEF39DF320E3895200A560F3 /* UserProperties.swift in Sources */,
F3F41E181FA3377E00F97737 /* Price.swift in Sources */,
F3E7D4101F4EC69100DF166D /* Link.swift in Sources */,
F34CB2891FC56CAD005E3A37 /* DrmLicense.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0930"
LastUpgradeVersion = "0940"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
7 changes: 5 additions & 2 deletions r2-shared-swift/BelongsTo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
// r2-shared-swift
//
// Created by Alexandre Camilleri on 10/27/17.
// Copyright © 2017 Readium. All rights reserved.
//
// Copyright 2018 Readium Foundation. All rights reserved.
// Use of this source code is governed by a BSD-style license which is detailed
// in the LICENSE file present in the project repository where this source code is maintained.
//


/// Used to establish a relation between a publication and a serie or a collection
public class BelongsTo {
public init() {}

Expand Down
5 changes: 4 additions & 1 deletion r2-shared-swift/Collection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
// r2-shared-swift
//
// Created by Alexandre Camilleri on 10/27/17.
// Copyright © 2017 Readium. All rights reserved.
//
// Copyright 2018 Readium Foundation. All rights reserved.
// Use of this source code is governed by a BSD-style license which is detailed
// in the LICENSE file present in the project repository where this source code is maintained.
//

/// Collection construct used for collection/serie metadata
Expand Down
17 changes: 15 additions & 2 deletions r2-shared-swift/Contributor.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
//
// Contributors.swift
// R2Streamer
// r2-shared-swift
//
// Created by Alexandre Camilleri on 2/16/17.
// Copyright © 2017 Readium. All rights reserved.
//
// Copyright 2018 Readium Foundation. All rights reserved.
// Use of this source code is governed by a BSD-style license which is detailed
// in the LICENSE file present in the project repository where this source code is maintained.
//

import Foundation
Expand Down Expand Up @@ -90,6 +93,10 @@ extension Contributor {
case "links":
if let linkDict = v as? [String: Any] {
c.links.append(try Link.parse(linkDict: linkDict))
}else if let array = v as? [[String: Any]] {
for dict in array {
c.links.append(try Link.parse(linkDict: dict))
}
}
default:
continue
Expand All @@ -108,6 +115,12 @@ extension Contributor {
case let cDict as [String: Any]:
let c = try parse(cDict)
result.append(c)
case let cArray as [String]:
for name in cArray {
let c = Contributor()
c.multilangName.singleString = name
result.append(c)
}
case let cArray as [[String: Any]]:
for cDict in cArray {
let c = try parse(cDict)
Expand Down
5 changes: 4 additions & 1 deletion r2-shared-swift/Drm/Drm.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
// r2-shared-swift
//
// Created by Alexandre Camilleri on 10/5/17.
// Copyright © 2017 Readium. All rights reserved.
//
// Copyright 2018 Readium Foundation. All rights reserved.
// Use of this source code is governed by a BSD-style license which is detailed
// in the LICENSE file present in the project repository where this source code is maintained.
//

import Foundation
Expand Down
5 changes: 4 additions & 1 deletion r2-shared-swift/Drm/DrmLicense.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
// r2-shared-swift
//
// Created by Alexandre Camilleri on 11/22/17.
// Copyright © 2017 Readium. All rights reserved.
//
// Copyright 2018 Readium Foundation. All rights reserved.
// Use of this source code is governed by a BSD-style license which is detailed
// in the LICENSE file present in the project repository where this source code is maintained.
//

import Foundation
Expand Down
7 changes: 5 additions & 2 deletions r2-shared-swift/Encryption.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
//
// Encryption.swift
// R2Streamer
// r2-shared-swift
//
// Created by Alexandre Camilleri on 4/11/17.
// Copyright © 2017 Readium. All rights reserved.
//
// Copyright 2018 Readium Foundation. All rights reserved.
// Use of this source code is governed by a BSD-style license which is detailed
// in the LICENSE file present in the project repository where this source code is maintained.
//

import Foundation
Expand Down
7 changes: 5 additions & 2 deletions r2-shared-swift/ISO8601DateString.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
//
// DateExtension.swift
// R2Shared
// r2-shared-swift
//
// Created by Alexandre Camilleri on 3/22/17.
// Copyright © 2017 Readium. All rights reserved.
//
// Copyright 2018 Readium Foundation. All rights reserved.
// Use of this source code is governed by a BSD-style license which is detailed
// in the LICENSE file present in the project repository where this source code is maintained.
//

import Foundation
Expand Down
12 changes: 8 additions & 4 deletions r2-shared-swift/Link.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
//
// Link.swift
// R2Streamer
// r2-shared-swift
//
// Created by Alexandre Camilleri on 2/17/17.
// Copyright © 2017 Readium. All rights reserved.
//
// Copyright 2018 Readium Foundation. All rights reserved.
// Use of this source code is governed by a BSD-style license which is detailed
// in the LICENSE file present in the project repository where this source code is maintained.
//

import Foundation
Expand Down Expand Up @@ -123,7 +126,7 @@ extension Link {
case "numberOfItems":
prop.numberOfItems = vp as? Int
case "indirectAcquisition":
guard let acquisitions = v as? [[String: Any]] else {
guard let acquisitions = vp as? [[String: Any]] else {
throw LinkError.invalidLink
}
for a in acquisitions {
Expand All @@ -136,7 +139,7 @@ extension Link {
}
}
case "price":
guard let priceDict = v as? [String: Any],
guard let priceDict = vp as? [String: Any],
let currency = priceDict["currency"] as? String,
let value = priceDict["value"] as? Double
else {
Expand All @@ -149,6 +152,7 @@ extension Link {
}
}
}
l.properties = prop
case "children":
guard let childLinkDict = v as? [String: Any] else {
throw LinkError.invalidLink
Expand Down
7 changes: 5 additions & 2 deletions r2-shared-swift/MediaOverlayNode.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
//
// MediaOverlayNode.swift
// R2Streamer
// r2-shared-swift
//
// Created by Alexandre Camilleri on 4/4/17.
// Copyright © 2017 Readium. All rights reserved.
//
// Copyright 2018 Readium Foundation. All rights reserved.
// Use of this source code is governed by a BSD-style license which is detailed
// in the LICENSE file present in the project repository where this source code is maintained.
//

import Foundation
Expand Down
7 changes: 5 additions & 2 deletions r2-shared-swift/MediaOverlays.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
//
// MediaOverlays.swift
// R2Streamer
// r2-shared-swift
//
// Created by Alexandre Camilleri on 4/11/17.
// Copyright © 2017 Readium. All rights reserved.
//
// Copyright 2018 Readium Foundation. All rights reserved.
// Use of this source code is governed by a BSD-style license which is detailed
// in the LICENSE file present in the project repository where this source code is maintained.
//

import Foundation
Expand Down
20 changes: 15 additions & 5 deletions r2-shared-swift/Metadata.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
//
// Metadata.swift
// R2Streamer
// r2-shared-swift
//
// Created by Alexandre Camilleri on 2/16/17.
// Copyright © 2017 Readium. All rights reserved.
//
// Copyright 2018 Readium Foundation. All rights reserved.
// Use of this source code is governed by a BSD-style license which is detailed
// in the LICENSE file present in the project repository where this source code is maintained.
//

import Foundation
Expand Down Expand Up @@ -38,7 +41,7 @@ public class Metadata {
let layout = Metadata.contentlayoutStyle(for: langType, pageDirection: direction)
self.primaryContentLayout = layout; break
}
} // for
}
return
}
self.primaryLanguage = languages.first // Unknow
Expand Down Expand Up @@ -96,8 +99,6 @@ public class Metadata {
public var belongsTo: BelongsTo?

public var duration: Int?

//belongto duration

public init() {
direction = .Default
Expand All @@ -119,6 +120,7 @@ public class Metadata {
return multilangSubtitle?.multiString[lang]
}
}

// JSON Serialisation extension.
extension Metadata: Mappable {
public func mapping(map: Map) {
Expand Down Expand Up @@ -301,6 +303,14 @@ extension Metadata {
subject.scheme = sv as? String
case "code":
subject.code = sv as? String
case "links":
if let dict = sv as? [String: Any] {
subject.links.append(try Link.parse(linkDict: dict))
}else if let array = sv as? [[String: Any]] {
for dict in array {
subject.links.append(try Link.parse(linkDict: dict))
}
}
default:
continue
}
Expand Down
7 changes: 5 additions & 2 deletions r2-shared-swift/MetadataItem.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
//
// MetadataItem.swift
// R2Streamer
// r2-shared-swift
//
// Created by Alexandre Camilleri on 2/16/17.
// Copyright © 2017 Readium. All rights reserved.
//
// Copyright 2018 Readium Foundation. All rights reserved.
// Use of this source code is governed by a BSD-style license which is detailed
// in the LICENSE file present in the project repository where this source code is maintained.
//

import Foundation
Expand Down
7 changes: 5 additions & 2 deletions r2-shared-swift/MultilangString.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
//
// MultilangString.swift
// R2Streamer
// r2-shared-swift
//
// Created by Alexandre Camilleri on 3/30/17.
// Copyright © 2017 Readium. All rights reserved.
//
// Copyright 2018 Readium Foundation. All rights reserved.
// Use of this source code is governed by a BSD-style license which is detailed
// in the LICENSE file present in the project repository where this source code is maintained.
//

import Foundation
Expand Down
5 changes: 4 additions & 1 deletion r2-shared-swift/OPDS/Facet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
// r2-shared-swift
//
// Created by Alexandre Camilleri on 10/27/17.
// Copyright © 2017 Readium. All rights reserved.
//
// Copyright 2018 Readium Foundation. All rights reserved.
// Use of this source code is governed by a BSD-style license which is detailed
// in the LICENSE file present in the project repository where this source code is maintained.
//

/// Enables faceted navigation in OPDS.
Expand Down
5 changes: 4 additions & 1 deletion r2-shared-swift/OPDS/Feed.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
// r2-shared-swift
//
// Created by Alexandre Camilleri on 10/27/17.
// Copyright © 2017 Readium. All rights reserved.
//
// Copyright 2018 Readium Foundation. All rights reserved.
// Use of this source code is governed by a BSD-style license which is detailed
// in the LICENSE file present in the project repository where this source code is maintained.
//


Expand Down
5 changes: 4 additions & 1 deletion r2-shared-swift/OPDS/Group.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
// r2-shared-swift
//
// Created by Alexandre Camilleri on 10/27/17.
// Copyright © 2017 Readium. All rights reserved.
//
// Copyright 2018 Readium Foundation. All rights reserved.
// Use of this source code is governed by a BSD-style license which is detailed
// in the LICENSE file present in the project repository where this source code is maintained.
//

/// A substructure of a feed.
Expand Down
6 changes: 5 additions & 1 deletion r2-shared-swift/OPDS/OpdsMetadata.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
// r2-shared-swift
//
// Created by Alexandre Camilleri on 10/27/17.
// Copyright © 2017 Readium. All rights reserved.
//
// Copyright 2018 Readium Foundation. All rights reserved.
// Use of this source code is governed by a BSD-style license which is detailed
// in the LICENSE file present in the project repository where this source code is maintained.
//

import Foundation

/// OPDS metadata properties.
public class OpdsMetadata {
public var title: String
public var numberOfItem: Int?
Expand Down
Loading

0 comments on commit f14646e

Please sign in to comment.