Make share extension container picker update the main ui
This commit is contained in:
parent
26031f7a4d
commit
b8d2a5a054
|
@ -10,7 +10,7 @@ import UIKit
|
|||
import Account
|
||||
|
||||
protocol ShareFolderPickerControllerDelegate: class {
|
||||
func shareFolderPickerDidSelect(_ container: Container)
|
||||
func shareFolderPickerDidSelect(_ container: Container, _ selectionName: String)
|
||||
}
|
||||
|
||||
class ShareFolderPickerController: UITableViewController {
|
||||
|
@ -45,8 +45,7 @@ class ShareFolderPickerController: UITableViewController {
|
|||
|
||||
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
||||
guard let pickerData = pickerData else { return }
|
||||
delegate?.shareFolderPickerDidSelect(pickerData.containers[indexPath.row])
|
||||
navigationController?.popViewController(animated: true)
|
||||
delegate?.shareFolderPickerDidSelect(pickerData.containers[indexPath.row], pickerData.containerNames[indexPath.row])
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ class ShareViewController: SLComposeServiceViewController, ShareFolderPickerCont
|
|||
|
||||
private var url: URL?
|
||||
private var container: Container?
|
||||
private var folderItem: SLComposeSheetConfigurationItem!
|
||||
|
||||
override func viewDidLoad() {
|
||||
|
||||
|
@ -100,7 +101,6 @@ class ShareViewController: SLComposeServiceViewController, ShareFolderPickerCont
|
|||
}
|
||||
|
||||
override func didSelectPost() {
|
||||
|
||||
var account: Account?
|
||||
if let containerAccount = container as? Account {
|
||||
account = containerAccount
|
||||
|
@ -127,16 +127,12 @@ class ShareViewController: SLComposeServiceViewController, ShareFolderPickerCont
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// This is called after the user selects Post. Do the upload of contentText and/or NSExtensionContext attachments.
|
||||
|
||||
// Inform the host that we're done, so it un-blocks its UI. Note: Alternatively you could call super's -didSelectPost, which will similarly complete the extension context.
|
||||
}
|
||||
|
||||
func shareFolderPickerDidSelect(_ container: Container) {
|
||||
func shareFolderPickerDidSelect(_ container: Container, _ selectionName: String) {
|
||||
self.container = container
|
||||
self.folderItem.value = selectionName
|
||||
self.popConfigurationViewController()
|
||||
}
|
||||
|
||||
override func configurationItems() -> [Any]! {
|
||||
|
@ -146,7 +142,7 @@ class ShareViewController: SLComposeServiceViewController, ShareFolderPickerCont
|
|||
urlItem.title = "URL"
|
||||
urlItem.value = url?.absoluteString ?? ""
|
||||
|
||||
guard let folderItem = SLComposeSheetConfigurationItem() else { return nil }
|
||||
folderItem = SLComposeSheetConfigurationItem()
|
||||
folderItem.title = "Folder"
|
||||
|
||||
if let nameProvider = container as? DisplayNameProvider {
|
||||
|
@ -166,7 +162,7 @@ class ShareViewController: SLComposeServiceViewController, ShareFolderPickerCont
|
|||
|
||||
}
|
||||
|
||||
return [folderItem, urlItem]
|
||||
return [folderItem!, urlItem]
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue