Skip to content

Commit

Permalink
[feature/open_in] Open in another app (via UIDocumentInteractionContr…
Browse files Browse the repository at this point in the history
…oller) (#132)

* - Made a new option for open in another app inside the card view controller shown up via the 3 dots
in the file list cell.
- Made the open in another app via UIDocumentInteractionController.

* - Removed unneeded observerContext in ClientQueryViewController

* - Coded open in inside the file preview.

* - Coded support for open in when the previewed file is not supported

* - Made new screen to download files before open in, being able to cancel
the download.

* - Clean up the code.

* - Localize "Downloading" string

* - Managed state of the view when there is no network (WIP).
- Removed unneeded constraint for the progress view.

* - Coding style changes.

* - Coded missing license.

* - Made a completion handler for actions

* - Made actions mechanism based on @felix-schwarz one.
- Made one Action subclass per action.
- Register the actions in the AppDelegate
- Ask for extensions in ClientQueryViewController.

* - Coded some debug logs
- Reversed the extensions array because the pction's priority mechanism
needs more work.

* - Removed unused Result type.
- Code new Rename Action.

* - Made de Duplicate action.
- Made the actions inside the preview to use the extensions mechanism.

* - Changes from code review.
- Use the correct API for get the actions.

* - Changed BeforeRunHandler to its own method called willRun()

* - Use Felix's implementation to  be able to get the parent item with a
OCItem extension.
- Make sure the actions uses all the items when it makes sense.
- Removed some of  main thread calls.

* - Coded some left legal headers.

* - Decoupled the creation of the actions card view controller.
- Removed some unused code.

* - Coded the move action for multiple items.
- Removed empty white line to fix the linter warning.

* - Fix little typo this -> these in the confirmation message to delete
items.

* - Check to return .none when there is more than one items in the context for OpenInAction

Co-Authored-By: pablocarmu <[email protected]>

* - Dismiss the DocumentInteractionController when there is an error
downloading the item.

* - Coded a security check for when the root item is now found.

* Code location identifier for actions ClientQueryViewController

Co-Authored-By: pablocarmu <[email protected]>

* Update ownCloud/Viewer/DisplayViewController.swift

Co-Authored-By: pablocarmu <[email protected]>

* - Remove left-over extension from ClientQueryViewController.

- Removed left-over code from DisplayViewController.

* - Coded publish(progress: Progress) and completed(with error: Error? =
nil) as suggested by @felix-schwarz
- Replace old calls to completionHandlers with these two new functions.

* - Make detele as trailing action in the item list.

* - CrateFolder is now an Action

* - Create folder as an action

* - SDK update.
- Removed unneeded code (fixed in the SDK).

* - SDK updated.
- Added code removed while rebasing against.
  • Loading branch information
pablocarmu authored and jesmrec committed Nov 30, 2018
1 parent 2c09514 commit 1a345de
Show file tree
Hide file tree
Showing 19 changed files with 1,132 additions and 231 deletions.
40 changes: 40 additions & 0 deletions ownCloud.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,20 @@
59B09E7221AD6215007827B8 /* ownCloudMocking.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = DC0196A620F754CA00C41B78 /* ownCloudMocking.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
59D4895220C83F2E00369C2E /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 59D4895420C83F2E00369C2E /* InfoPlist.strings */; };
6D107AA0B21417432C72755A /* EarlGrey.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7F3B3E74D4B04F9CAF95C09 /* EarlGrey.swift */; };
6E0A569E218702400056B7B4 /* DownloadFileProgressHUDViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E0A569D218702400056B7B4 /* DownloadFileProgressHUDViewController.swift */; };
6E37F48B2188B27D00CF16CA /* Action.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E37F48A2188B27D00CF16CA /* Action.swift */; };
6E3A103E219D5BBA00F90C96 /* RenameAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E3A103D219D5BBA00F90C96 /* RenameAction.swift */; };
6E3A104D219D6F0100F90C96 /* DuplicateAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E3A104C219D6F0100F90C96 /* DuplicateAction.swift */; };
6E4F1734217749910049A71B /* ImageDisplayViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E4F1733217749910049A71B /* ImageDisplayViewController.swift */; };
6E586CFC2199A72600F680C4 /* OpenInAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E586CFB2199A72600F680C4 /* OpenInAction.swift */; };
6E586CFE2199A75900F680C4 /* MoveAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E586CFD2199A75900F680C4 /* MoveAction.swift */; };
6E586D002199A78E00F680C4 /* DeleteAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E586CFF2199A78E00F680C4 /* DeleteAction.swift */; };
6E83C77E20A32C1B0066EC23 /* SettingsSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E83C77D20A32C1B0066EC23 /* SettingsSection.swift */; };
6E83C78420A33C180066EC23 /* LAContext+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E83C78320A33C180066EC23 /* LAContext+Extension.swift */; };
6EA78B8F2179B55400A5216A /* ImageScrollView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6EA78B8E2179B55400A5216A /* ImageScrollView.swift */; };
6EADE9372192E235006821B3 /* UIImagePickerController+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6EADE9362192E235006821B3 /* UIImagePickerController+Extension.swift */; };
6EB8EDC52114358400C2BF44 /* folder-create.tvg in Resources */ = {isa = PBXBuildFile; fileRef = 6EB8EDBE2114358300C2BF44 /* folder-create.tvg */; };
6ED1B80B21A4004900E16C95 /* CreateFolderAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6ED1B80A21A4004900E16C95 /* CreateFolderAction.swift */; };
75AC0B4AD332C8CC785FE349 /* Pods_ownCloudTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A56EA84D8AD331FFA604138B /* Pods_ownCloudTests.framework */; };
A45A8D98137C902524B84E6D /* EarlGrey.framework in EarlGrey Copy Files */ = {isa = PBXBuildFile; fileRef = D0D9C062DD1E85A838608B0F /* EarlGrey.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
DC018F8320A0F56300135198 /* UIView+Animation.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC018F8220A0F56300135198 /* UIView+Animation.swift */; };
Expand Down Expand Up @@ -432,13 +440,21 @@
59D4895320C83F2E00369C2E /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
59EACA8020CAA37F00F082EE /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/InfoPlist.strings; sourceTree = "<group>"; };
6CBDF92D3844CF78B20B5770 /* Pods-ownCloudTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ownCloudTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-ownCloudTests/Pods-ownCloudTests.release.xcconfig"; sourceTree = "<group>"; };
6E0A569D218702400056B7B4 /* DownloadFileProgressHUDViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DownloadFileProgressHUDViewController.swift; sourceTree = "<group>"; };
6E216A632112F58700ED21BD /* NamingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NamingViewController.swift; sourceTree = "<group>"; };
6E37F48A2188B27D00CF16CA /* Action.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Action.swift; sourceTree = "<group>"; };
6E3A103D219D5BBA00F90C96 /* RenameAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RenameAction.swift; sourceTree = "<group>"; };
6E3A104C219D6F0100F90C96 /* DuplicateAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DuplicateAction.swift; sourceTree = "<group>"; };
6E4F1733217749910049A71B /* ImageDisplayViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageDisplayViewController.swift; sourceTree = "<group>"; };
6E586CFB2199A72600F680C4 /* OpenInAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenInAction.swift; sourceTree = "<group>"; };
6E586CFD2199A75900F680C4 /* MoveAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoveAction.swift; sourceTree = "<group>"; };
6E586CFF2199A78E00F680C4 /* DeleteAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeleteAction.swift; sourceTree = "<group>"; };
6E83C77D20A32C1B0066EC23 /* SettingsSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsSection.swift; sourceTree = "<group>"; };
6E83C78320A33C180066EC23 /* LAContext+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "LAContext+Extension.swift"; sourceTree = "<group>"; };
6EA78B8E2179B55400A5216A /* ImageScrollView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageScrollView.swift; sourceTree = "<group>"; };
6EADE9362192E235006821B3 /* UIImagePickerController+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIImagePickerController+Extension.swift"; sourceTree = "<group>"; };
6EB8EDBE2114358300C2BF44 /* folder-create.tvg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = "folder-create.tvg"; path = "img/filetypes-tvg/folder-create.tvg"; sourceTree = SOURCE_ROOT; };
6ED1B80A21A4004900E16C95 /* CreateFolderAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateFolderAction.swift; sourceTree = "<group>"; };
A56EA84D8AD331FFA604138B /* Pods_ownCloudTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ownCloudTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
D0D9C062DD1E85A838608B0F /* EarlGrey.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = EarlGrey.framework; path = Pods/EarlGrey/EarlGrey/EarlGrey.framework; sourceTree = SOURCE_ROOT; };
D7F3B3E74D4B04F9CAF95C09 /* EarlGrey.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = EarlGrey.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -701,11 +717,13 @@
236735A421217C2300E5834A /* Actions */ = {
isa = PBXGroup;
children = (
6E586CF52199A70100F680C4 /* Actions+Extensions */,
2308F93C21467F6200CF0B91 /* ClientDirectoryPickerViewController.swift */,
236735A521217C3500E5834A /* MoreViewController.swift */,
232B01F32126B0CE00366FA0 /* MoreViewHeader.swift */,
232B01F52126B10900366FA0 /* MoreStaticTableViewController.swift */,
23D77FC6212BFBD100DE76F1 /* NamingViewController.swift */,
6E37F48A2188B27D00CF16CA /* Action.swift */,
);
path = Actions;
sourceTree = "<group>";
Expand Down Expand Up @@ -823,6 +841,19 @@
name = Pods;
sourceTree = "<group>";
};
6E586CF52199A70100F680C4 /* Actions+Extensions */ = {
isa = PBXGroup;
children = (
6E586CFB2199A72600F680C4 /* OpenInAction.swift */,
6E586CFD2199A75900F680C4 /* MoveAction.swift */,
6E586CFF2199A78E00F680C4 /* DeleteAction.swift */,
6E3A103D219D5BBA00F90C96 /* RenameAction.swift */,
6E3A104C219D6F0100F90C96 /* DuplicateAction.swift */,
6ED1B80A21A4004900E16C95 /* CreateFolderAction.swift */,
);
path = "Actions+Extensions";
sourceTree = "<group>";
};
DC1B26FD209CF0D2004715E1 /* Issues Animators */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1096,6 +1127,7 @@
DC018F8B20A1060A00135198 /* ProgressHUDViewController.swift */,
DC89C46220860B680044BCAE /* Progress */,
6EA78B8E2179B55400A5216A /* ImageScrollView.swift */,
6E0A569D218702400056B7B4 /* DownloadFileProgressHUDViewController.swift */,
);
path = "UI Elements";
sourceTree = "<group>";
Expand Down Expand Up @@ -1576,17 +1608,20 @@
DC1B270C209CF34B004715E1 /* BookmarkViewController.swift in Sources */,
23EC775A2137F3DD0032D4E6 /* DisplayHostViewController.swift in Sources */,
4C464BF62187AF1500D30602 /* PDFTocItem.swift in Sources */,
6E3A103E219D5BBA00F90C96 /* RenameAction.swift in Sources */,
DC018F8320A0F56300135198 /* UIView+Animation.swift in Sources */,
DC42244A207CAFAA0006A2A6 /* Theme.swift in Sources */,
4C464BF52187AF1500D30602 /* PDFThumbnailsCollectionViewController.swift in Sources */,
4C464BF02187AF1500D30602 /* PDFTocTableViewController.swift in Sources */,
DC4FEAEA209E48E800D4476B /* DispatchQueueTools.swift in Sources */,
6ED1B80B21A4004900E16C95 /* CreateFolderAction.swift in Sources */,
DC1B2708209CF0D3004715E1 /* IssuesPresentationAnimator.swift in Sources */,
DC3BE0DF2077CC14002A0AC0 /* ClientRootViewController.swift in Sources */,
DC854936218331CF00782BA8 /* UserInterfaceSettingsSection.swift in Sources */,
4C464BF42187AF1500D30602 /* PDFSearchTableViewCell.swift in Sources */,
DC1B2709209CF0D3004715E1 /* CertificateViewController.swift in Sources */,
DC248C67213E7DB00067FE94 /* NSLayoutConstraint+Extension.swift in Sources */,
6E586CFC2199A72600F680C4 /* OpenInAction.swift in Sources */,
DC136582208223F000FC0F60 /* OCBookmark+Extension.swift in Sources */,
23D77FCD212BFBD100DE76F1 /* NamingViewController.swift in Sources */,
23FA23E620BFD3D8009A6D73 /* SortBar.swift in Sources */,
Expand All @@ -1607,6 +1642,7 @@
4C464BF32187AF1500D30602 /* PDFOutlineViewController.swift in Sources */,
6EADE9372192E235006821B3 /* UIImagePickerController+Extension.swift in Sources */,
DC85572C20513B8C00189B9A /* ServerListTableViewController.swift in Sources */,
6E0A569E218702400056B7B4 /* DownloadFileProgressHUDViewController.swift in Sources */,
233BDEA0204FEFE500C06732 /* AppDelegate.swift in Sources */,
236735A621217C3500E5834A /* MoreViewController.swift in Sources */,
23957A6D209AFFE8003C8537 /* MoreSettingsSection.swift in Sources */,
Expand All @@ -1631,8 +1667,10 @@
DC42244C207CAFBB0006A2A6 /* ThemeCollection.swift in Sources */,
DC68057A212EAB5E006C3B1F /* ThemeCertificateViewController.swift in Sources */,
DCFED9BA20809B8900A2D984 /* ThemeTVGResource.swift in Sources */,
6E37F48B2188B27D00CF16CA /* Action.swift in Sources */,
DC3BE0DE2077CC14002A0AC0 /* ClientQueryViewController.swift in Sources */,
23C56538212167BE00BD4B47 /* CardTransitionDelegate.swift in Sources */,
6E3A104D219D6F0100F90C96 /* DuplicateAction.swift in Sources */,
DC1B270A209CF0D3004715E1 /* ConnectionIssueViewController.swift in Sources */,
DC0B37972051681600189B9A /* ThemeButton.swift in Sources */,
DCF4F17B20519F9D00189B9A /* StaticTableViewSection.swift in Sources */,
Expand All @@ -1649,8 +1687,10 @@
23EC77592137F3DD0032D4E6 /* DisplayExtension.swift in Sources */,
DC321261207EB01B00DB171D /* ThemeImage.swift in Sources */,
DC7DBA54207FA80C00E7337D /* TVGImage.swift in Sources */,
6E586CFE2199A75900F680C4 /* MoveAction.swift in Sources */,
DC4FEAE7209E3A7700D4476B /* OCConnectionIssue+Extension.swift in Sources */,
DC434D1320D7A8F100740056 /* UIAlertController+OCConnectionIssue.swift in Sources */,
6E586D002199A78E00F680C4 /* DeleteAction.swift in Sources */,
DC3317CE2084966700E36C8F /* ThemeTableViewCell.swift in Sources */,
6E83C77E20A32C1B0066EC23 /* SettingsSection.swift in Sources */,
DC0196AB20F7690C00C41B78 /* OCBookmark+FileProvider.m in Sources */,
Expand Down
9 changes: 9 additions & 0 deletions ownCloud/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,19 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

application.setMinimumBackgroundFetchInterval(UIApplicationBackgroundFetchIntervalMinimum + 10)

// Display Extensions
OCExtensionManager.shared.addExtension(WebViewDisplayViewController.displayExtension)
OCExtensionManager.shared.addExtension(PDFViewerViewController.displayExtension)
OCExtensionManager.shared.addExtension(ImageDisplayViewController.displayExtension)

// Action Extensions
OCExtensionManager.shared.addExtension(OpenInAction.actionExtension)
OCExtensionManager.shared.addExtension(DeleteAction.actionExtension)
OCExtensionManager.shared.addExtension(MoveAction.actionExtension)
OCExtensionManager.shared.addExtension(RenameAction.actionExtension)
OCExtensionManager.shared.addExtension(DuplicateAction.actionExtension)
OCExtensionManager.shared.addExtension(CreateFolderAction.actionExtension)

Theme.shared.activeCollection = ThemeCollection(with: ThemeStyle.preferredStyle)

return true
Expand Down
Loading

0 comments on commit 1a345de

Please sign in to comment.