Skip to content

Commit

Permalink
feat: Fix API changes of ios-core 5.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
adrien-coye committed Jan 15, 2024
1 parent 24fc76d commit c185c2e
Showing 1 changed file with 10 additions and 26 deletions.
36 changes: 10 additions & 26 deletions kDriveCore/Utils/Files/FileImportHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,13 @@ import kDriveResources
import Photos
import RealmSwift

extension ItemProviderURLRepresentation {
var URLResult: Result<URL, Error> {
get async {
let result = await result
switch result {
case .success((let url, _)):
return .success(url)
case .failure(let error):
return .failure(error)
}
}
}
// TODO: move to core
protocol ItemProviderResultable {
var result: Result<(url: URL, title: String), Error> { get async }
var URLResult: Result<URL, Error> { get async }
}

extension ItemProviderFileRepresentation {
extension ItemProviderResultable {
var URLResult: Result<URL, Error> {
get async {
let result = await result
Expand All @@ -54,19 +46,11 @@ extension ItemProviderFileRepresentation {
}
}

extension ItemProviderZipRepresentation {
var URLResult: Result<URL, Error> {
get async {
let result = await result
switch result {
case .success((let url, _)):
return .success(url)
case .failure(let error):
return .failure(error)
}
}
}
}
extension ItemProviderURLRepresentation: ItemProviderResultable {}

extension ItemProviderFileRepresentation: ItemProviderResultable {}

extension ItemProviderZipRepresentation: ItemProviderResultable {}

public enum ImportError: LocalizedError {
case accessDenied
Expand Down

0 comments on commit c185c2e

Please sign in to comment.