From 24fc76de55e609e79f86e8c5a3bab8bd6be9116f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20Coye=20de=20Brune=CC=81lis?= Date: Mon, 15 Jan 2024 14:21:49 +0100 Subject: [PATCH] chore: Bump ios-core --- .package.resolved | 30 ++++++------ Project.swift | 8 ++-- kDriveCore/Utils/Files/FileImportHelper.swift | 48 +++++++++++++++++-- 3 files changed, 64 insertions(+), 22 deletions(-) diff --git a/.package.resolved b/.package.resolved index 995d0664b..bd560da22 100644 --- a/.package.resolved +++ b/.package.resolved @@ -86,8 +86,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/Infomaniak/ios-core", "state" : { - "revision" : "02f54f97557ea8340df63649081e39faddd8af26", - "version" : "4.1.29" + "revision" : "504932a51c978b6aa0bbc086054875a36241674e", + "version" : "5.0.1" } }, { @@ -95,8 +95,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/Infomaniak/ios-core-ui", "state" : { - "revision" : "0a6b23bc6c37d9c75033428ca07d0a2a6cf4e97b", - "version" : "2.5.5" + "revision" : "2ade7b9cfc5942d1126570b40a6680e4ffcff105", + "version" : "3.0.0" } }, { @@ -104,8 +104,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/Infomaniak/ios-dependency-injection", "state" : { - "revision" : "b4d872b5baf5d6f19b98fdfd765205c57870d02e", - "version" : "1.1.11" + "revision" : "8dc9e67e6d3d9f4f5bd02d693a7ce1f93b125bcd", + "version" : "2.0.1" } }, { @@ -113,8 +113,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/Infomaniak/ios-login", "state" : { - "revision" : "b9f5d87da453b52eec72fb1e0443f28209c6ac67", - "version" : "4.1.0" + "revision" : "ba2e72bc84a673d4e1626f898419da82b54baefb", + "version" : "5.0.0" } }, { @@ -194,8 +194,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/realm/realm-core.git", "state" : { - "revision" : "c569bec4d04da84030d94f376437bc4efda3686b", - "version" : "13.23.1" + "revision" : "7227d6a447821c28895daa099b6c7cd4c99d461b", + "version" : "13.25.1" } }, { @@ -203,8 +203,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/realm/realm-swift", "state" : { - "revision" : "fd199ce07edb4db69e862f74151b95602aad3b43", - "version" : "10.44.0" + "revision" : "836cc4b8619886f979f8961c3f592a82b0741591", + "version" : "10.45.3" } }, { @@ -212,14 +212,14 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/getsentry/sentry-cocoa", "state" : { - "revision" : "74cf23b2946c92550fb1185612077151497e648e", - "version" : "8.17.1" + "revision" : "3b9a8e69ca296bd8cd0e317ad7a448e5daf4a342", + "version" : "8.18.0" } }, { "identity" : "snackbar.swift", "kind" : "remoteSourceControl", - "location" : "https://github.com/PhilippeWeidmann/SnackBar.swift", + "location" : "https://github.com/Infomaniak/SnackBar.swift", "state" : { "revision" : "9a3c0c71796625ec3804df993483aa80266fa1ff", "version" : "1.1.0" diff --git a/Project.swift b/Project.swift index ace4d926c..9f2ce42a6 100644 --- a/Project.swift +++ b/Project.swift @@ -24,10 +24,10 @@ let project = Project(name: "kDrive", packages: [ .package(url: "https://github.com/apple/swift-algorithms", .upToNextMajor(from: "1.2.0")), .package(url: "https://github.com/Alamofire/Alamofire", .upToNextMajor(from: "5.2.2")), - .package(url: "https://github.com/Infomaniak/ios-core", .upToNextMajor(from: "4.1.29")), - .package(url: "https://github.com/Infomaniak/ios-core-ui", .upToNextMajor(from: "2.5.5")), - .package(url: "https://github.com/Infomaniak/ios-login", .upToNextMajor(from: "4.0.0")), - .package(url: "https://github.com/Infomaniak/ios-dependency-injection", .upToNextMajor(from: "1.1.11")), + .package(url: "https://github.com/Infomaniak/ios-core", .upToNextMajor(from: "5.0.1")), + .package(url: "https://github.com/Infomaniak/ios-core-ui", .upToNextMajor(from: "3.0.0")), + .package(url: "https://github.com/Infomaniak/ios-login", .upToNextMajor(from: "5.0.0")), + .package(url: "https://github.com/Infomaniak/ios-dependency-injection", .upToNextMajor(from: "2.0.0")), .package(url: "https://github.com/Infomaniak/swift-concurrency", .upToNextMajor(from: "0.0.4")), .package(url: "https://github.com/realm/realm-swift", .upToNextMajor(from: "10.43.0")), .package(url: "https://github.com/SCENEE/FloatingPanel", .upToNextMajor(from: "2.0.0")), diff --git a/kDriveCore/Utils/Files/FileImportHelper.swift b/kDriveCore/Utils/Files/FileImportHelper.swift index be827603f..5640ce391 100644 --- a/kDriveCore/Utils/Files/FileImportHelper.swift +++ b/kDriveCore/Utils/Files/FileImportHelper.swift @@ -26,6 +26,48 @@ import kDriveResources import Photos import RealmSwift +extension ItemProviderURLRepresentation { + var URLResult: Result { + get async { + let result = await result + switch result { + case .success((let url, _)): + return .success(url) + case .failure(let error): + return .failure(error) + } + } + } +} + +extension ItemProviderFileRepresentation { + var URLResult: Result { + get async { + let result = await result + switch result { + case .success((let url, _)): + return .success(url) + case .failure(let error): + return .failure(error) + } + } + } +} + +extension ItemProviderZipRepresentation { + var URLResult: Result { + get async { + let result = await result + switch result { + case .success((let url, _)): + return .success(url) + case .failure(let error): + return .failure(error) + } + } + } +} + public enum ImportError: LocalizedError { case accessDenied case emptyImageData @@ -145,7 +187,7 @@ public final class FileImportHelper { case .isURL: let getPlist = try ItemProviderURLRepresentation(from: itemProvider) progress.addChild(getPlist.progress, withPendingUnitCount: perItemUnitCount) - return await getPlist.result + return await getPlist.URLResult case .isText: let getText = try ItemProviderTextRepresentation(from: itemProvider) @@ -166,12 +208,12 @@ public final class FileImportHelper { ) progress.addChild(getFile.progress, withPendingUnitCount: perItemUnitCount) - return await getFile.result + return await getFile.URLResult case .isDirectory: let getFile = try ItemProviderZipRepresentation(from: itemProvider) progress.addChild(getFile.progress, withPendingUnitCount: perItemUnitCount) - return await getFile.result + return await getFile.URLResult case .none: return .failure(ErrorDomain.UTINotFound)