From 7edde848763795201267006cf655565691a45cbd Mon Sep 17 00:00:00 2001 From: Pablo Carrascal Date: Fri, 30 Nov 2018 12:56:43 +0100 Subject: [PATCH] - SDK updated. - Added code removed while rebasing against. --- ios-sdk | 2 +- .../Client/Actions/MoreViewController.swift | 7 ++++++- .../Client/ClientQueryViewController.swift | 20 ++++++++++++++----- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/ios-sdk b/ios-sdk index 8173316d4..2663fbca7 160000 --- a/ios-sdk +++ b/ios-sdk @@ -1 +1 @@ -Subproject commit 8173316d4254c8a398a337c9678e57682be29f76 +Subproject commit 2663fbca7c051fec04723767ea6c808acb233f91 diff --git a/ownCloud/Client/Actions/MoreViewController.swift b/ownCloud/Client/Actions/MoreViewController.swift index 9057d5d29..8616fa952 100644 --- a/ownCloud/Client/Actions/MoreViewController.swift +++ b/ownCloud/Client/Actions/MoreViewController.swift @@ -21,6 +21,9 @@ import ownCloudSDK class MoreViewController: UIViewController { + private var item: OCItem + private var core: OCCore + private var headerView: UIView private var viewController: UIViewController @@ -32,7 +35,9 @@ class MoreViewController: UIViewController { } } - init(header: UIView, viewController: UIViewController) { + init(item: OCItem, core: OCCore, header: UIView, viewController: UIViewController) { + self.item = item + self.core = core self.headerView = header self.viewController = viewController diff --git a/ownCloud/Client/ClientQueryViewController.swift b/ownCloud/Client/ClientQueryViewController.swift index 0980c3023..841320ce9 100644 --- a/ownCloud/Client/ClientQueryViewController.swift +++ b/ownCloud/Client/ClientQueryViewController.swift @@ -486,6 +486,20 @@ class ClientQueryViewController: UITableViewController, Themeable { // MARK: - Search var searchController: UISearchController? + func upload(itemURL: URL, name: String, completionHandler: ClientActionCompletionHandler? = nil) { + if let progress = core.importFileNamed(name, at: query.rootItem, from: itemURL, isSecurityScoped: false, options: nil, placeholderCompletionHandler: nil, resultHandler: { [weak self](error, _ core, _ item, _) in + if error != nil { + Log.debug("Error uploading \(Log.mask(name)) file to \(Log.mask(self?.query.rootItem.path))") + completionHandler?(false) + } else { + Log.debug("Success uploading \(Log.mask(name)) file to \(Log.mask(self?.query.rootItem.path))") + completionHandler?(true) + } + }) { + self.progressSummarizer?.startTracking(progress: progress) + } + } + // MARK: - Navigation Bar Actions @objc func uploadsBarButtonPressed(_ sender: UIBarButtonItem) { @@ -717,11 +731,7 @@ extension ClientQueryViewController: UITableViewDropDelegate { } -<<<<<<< HEAD - if let progress = self.core.move(item, to: destinationItem, withName: item.name, options: nil, resultHandler: { (error, _, _, _) in -======= - if let progress = self.core.move(item, to: destinationItem!, withName: item.name, options: nil, resultHandler: { (error, _, _, _) in ->>>>>>> 3aded8b... - Made de Duplicate action. + if let progress = self.core.move(item, to: destinationItem, withName: item.name, options: nil, resultHandler: { (error, _, _, _) in if error != nil { Log.log("Error \(String(describing: error)) moving \(String(describing: item.path))") }