Skip to content

Commit

Permalink
refactor(PublicShareMetadata): Remove explicit codable code
Browse files Browse the repository at this point in the history
  • Loading branch information
adrien-coye committed Jan 31, 2025
1 parent fda65da commit 3f7aa23
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 29 deletions.
24 changes: 24 additions & 0 deletions kDrive/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,30 @@ final class AppDelegate: UIResponder, UIApplicationDelegate {
// Attach an observer to the payment queue.
SKPaymentQueue.default().add(StoreObserver.shared)

Task {
/* TODO: Remove later
@InjectService var router: AppNavigable
let upsaleViewController = UpsaleViewController()
let noDriveViewController = NoDriveUpsaleViewController()
let floatingPanel = UpsaleFloatingPanelController(upsaleViewController: noDriveViewController)
router.topMostViewController?.present(floatingPanel, animated: true, completion: nil)
*/

/* TODO: Remove later
// a public share expired
let somePublicShareExpired =
URL(string: "https://kdrive.infomaniak.com/app/share/140946/81de098a-3156-4ae6-93df-be7f9ae78ddd")
// a public share password protected
let somePublicShareProtected =
URL(string: "https://kdrive.infomaniak.com/app/share/140946/34844cea-db8d-4d87-b66f-e944e9759a2e")
*/

// a valid public share
let somePublicShare =
URL(string: "https://kdrive.infomaniak.com/app/share/100338/02d8bfc4-9d53-4f03-9ffa-3f29228ad453")
await UniversalLinksHelper.handleURL(somePublicShare!)
}

return true
}

Expand Down
29 changes: 0 additions & 29 deletions kDriveCore/Data/Api/PublicShareMetadata.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,33 +30,4 @@ public struct PublicShareMetadata: Decodable {
public let createdAt: TimeInterval
public let updatedAt: TimeInterval
public let accessBlocked: Bool

enum CodingKeys: String, CodingKey {
case url
case fileId
case right
case validUntil
case capabilities
case createdBy
case createdAt
case updatedAt
case accessBlocked
}

public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)

url = try container.decode(URL.self, forKey: .url)
fileId = try container.decode(Int.self, forKey: .fileId)
right = try container.decode(String.self, forKey: .right)

validUntil = try container.decodeIfPresent(TimeInterval.self, forKey: .validUntil)
capabilities = try container.decode(Rights.self, forKey: .capabilities)

createdBy = try container.decode(TimeInterval.self, forKey: .createdBy)
createdAt = try container.decode(TimeInterval.self, forKey: .createdAt)
updatedAt = try container.decode(TimeInterval.self, forKey: .updatedAt)

accessBlocked = try container.decode(Bool.self, forKey: .accessBlocked)
}
}

0 comments on commit 3f7aa23

Please sign in to comment.