From 3f7aa2374de025c27ae5b8cb994393c78dcb85eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20Coye=20de=20Brune=CC=81lis?= Date: Fri, 31 Jan 2025 09:34:22 +0100 Subject: [PATCH] refactor(PublicShareMetadata): Remove explicit codable code --- kDrive/AppDelegate.swift | 24 +++++++++++++++ kDriveCore/Data/Api/PublicShareMetadata.swift | 29 ------------------- 2 files changed, 24 insertions(+), 29 deletions(-) diff --git a/kDrive/AppDelegate.swift b/kDrive/AppDelegate.swift index 98cc22a97..b63e059e4 100644 --- a/kDrive/AppDelegate.swift +++ b/kDrive/AppDelegate.swift @@ -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 } diff --git a/kDriveCore/Data/Api/PublicShareMetadata.swift b/kDriveCore/Data/Api/PublicShareMetadata.swift index 9700fac00..0d7a6b8a7 100644 --- a/kDriveCore/Data/Api/PublicShareMetadata.swift +++ b/kDriveCore/Data/Api/PublicShareMetadata.swift @@ -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) - } }