Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] [feature/un-compress] Implementation of "Compress/Uncompress" Action #720

Open
wants to merge 6 commits into
base: milestone/1.4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions external/libzip/libzip.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,12 @@
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
"HAVE_CONFIG_H=1",
"HAVE_CRYPTO=1",
);
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
Expand All @@ -765,6 +771,10 @@
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
GCC_PREPROCESSOR_DEFINITIONS = (
"HAVE_CONFIG_H=1",
"HAVE_CRYPTO=1",
);
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
Expand Down
1 change: 1 addition & 0 deletions ownCloud Intents/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<array/>
<key>IntentsSupported</key>
<array>
<string>CompressPathItemsIntent</string>
<string>CreateFolderIntent</string>
<string>DeletePathItemIntent</string>
<string>GetAccountIntent</string>
Expand Down
2 changes: 2 additions & 0 deletions ownCloud Intents/IntentHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ class IntentHandler: INExtension {
return PathExistsIntentHandler()
} else if intent is DeletePathItemIntent {
return DeletePathItemIntentHandler()
} else if intent is CompressPathItemsIntent {
return CompressPathItemsIntentHandler()
}

fatalError("Unhandled intent type: \(intent)")
Expand Down
18 changes: 18 additions & 0 deletions ownCloud.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@
3998F5D3224102FE00B66713 /* UITableView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3998F5D2224102FE00B66713 /* UITableView+Extension.swift */; };
3998F5D522411EDF00B66713 /* BorderedLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3998F5D422411EDF00B66713 /* BorderedLabel.swift */; };
3998F5D72241486F00B66713 /* OCCertificate+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3998F5D62241486F00B66713 /* OCCertificate+Extension.swift */; };
39999DF224629FA800880D45 /* OCCore+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39A513AB22674E56002CF1AA /* OCCore+Extension.swift */; };
39999DF42462D57800880D45 /* UncompressAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39999DF32462D57800880D45 /* UncompressAction.swift */; };
399A4C002317CC460027DDD6 /* AppLockHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 399A4BFF2317CC460027DDD6 /* AppLockHelper.swift */; };
399A4C032317D1ED0027DDD6 /* OCBookmarkManager+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 399A4C022317D1ED0027DDD6 /* OCBookmarkManager+Extension.swift */; };
399A4C1023190ADF0027DDD6 /* PathExistsIntentHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 399A4C0F23190ADF0027DDD6 /* PathExistsIntentHandler.swift */; };
Expand All @@ -93,6 +95,8 @@
39B289A8226F1EE000BE0E11 /* MessageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39B289A7226F1EE000BE0E11 /* MessageView.swift */; };
39B9675022BE0FBA0074DB22 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 593A821320C7D4C5000E2A90 /* Localizable.strings */; };
39BC9C3023DB831F0097C52D /* DocumentEditingAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39CD755123D787E400193950 /* DocumentEditingAction.swift */; };
39BCDD7F246006AD00FE3D23 /* CompressAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39BCDD79246006AC00FE3D23 /* CompressAction.swift */; };
39BCDD812460858300FE3D23 /* CompressViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39BCDD802460858200FE3D23 /* CompressViewController.swift */; };
39BE385D23435AFE0062A2FE /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39BE385C23435AFE0062A2FE /* String+Extension.swift */; };
39CC8AE6228C12100020253B /* Array+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39CC8AE5228C12100020253B /* Array+Extension.swift */; };
39CC8B01228C8A950020253B /* MediaUploadSettingsSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39CC8B00228C8A950020253B /* MediaUploadSettingsSection.swift */; };
Expand All @@ -104,6 +108,7 @@
39E2FDED21FDEC7500F0117F /* ServerListTableHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39E2FDEC21FDEC7500F0117F /* ServerListTableHeaderView.swift */; };
39E2FE0021FF814A00F0117F /* ThemeRoundedButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39E2FDFF21FF814A00F0117F /* ThemeRoundedButton.swift */; };
39E42D1C2315288B00B82AC3 /* KeyCommands.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39E42D1B2315288B00B82AC3 /* KeyCommands.swift */; };
39E49DBF24619CB40069414A /* CompressPathItemsIntentHandler .swift in Sources */ = {isa = PBXBuildFile; fileRef = 39E49DBE24619CB40069414A /* CompressPathItemsIntentHandler .swift */; };
39E6DE84233CC39A008DAE04 /* Intents.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = 39057AAA233BA7A60008E6C0 /* Intents.intentdefinition */; };
39E6DE86233CDF1E008DAE04 /* OCItemTracker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39E6DE85233CDF1E008DAE04 /* OCItemTracker.swift */; };
39E98B3E22797D1B009911F1 /* PublicLinkTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39E98B3D22797D1B009911F1 /* PublicLinkTableViewController.swift */; };
Expand Down Expand Up @@ -819,6 +824,7 @@
3998F5D2224102FE00B66713 /* UITableView+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITableView+Extension.swift"; sourceTree = "<group>"; };
3998F5D422411EDF00B66713 /* BorderedLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BorderedLabel.swift; sourceTree = "<group>"; };
3998F5D62241486F00B66713 /* OCCertificate+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "OCCertificate+Extension.swift"; sourceTree = "<group>"; };
39999DF32462D57800880D45 /* UncompressAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UncompressAction.swift; sourceTree = "<group>"; };
399A4BFF2317CC460027DDD6 /* AppLockHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppLockHelper.swift; sourceTree = "<group>"; };
399A4C022317D1ED0027DDD6 /* OCBookmarkManager+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "OCBookmarkManager+Extension.swift"; sourceTree = "<group>"; };
399A4C0F23190ADF0027DDD6 /* PathExistsIntentHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PathExistsIntentHandler.swift; sourceTree = "<group>"; };
Expand All @@ -833,6 +839,8 @@
39AFC3D0225E72FB00A6D3AE /* GroupSharingTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GroupSharingTableViewController.swift; sourceTree = "<group>"; };
39AFC3D7225E79CD00A6D3AE /* GroupSharingEditTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GroupSharingEditTableViewController.swift; sourceTree = "<group>"; };
39B289A7226F1EE000BE0E11 /* MessageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageView.swift; sourceTree = "<group>"; };
39BCDD79246006AC00FE3D23 /* CompressAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CompressAction.swift; sourceTree = "<group>"; };
39BCDD802460858200FE3D23 /* CompressViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CompressViewController.swift; sourceTree = "<group>"; };
39BE385C23435AFE0062A2FE /* String+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Extension.swift"; sourceTree = "<group>"; };
39CC8AE5228C12100020253B /* Array+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Array+Extension.swift"; sourceTree = "<group>"; };
39CC8B00228C8A950020253B /* MediaUploadSettingsSection.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MediaUploadSettingsSection.swift; sourceTree = "<group>"; };
Expand All @@ -845,6 +853,7 @@
39E2FDEC21FDEC7500F0117F /* ServerListTableHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServerListTableHeaderView.swift; sourceTree = "<group>"; };
39E2FDFF21FF814A00F0117F /* ThemeRoundedButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThemeRoundedButton.swift; sourceTree = "<group>"; };
39E42D1B2315288B00B82AC3 /* KeyCommands.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyCommands.swift; sourceTree = "<group>"; };
39E49DBE24619CB40069414A /* CompressPathItemsIntentHandler .swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CompressPathItemsIntentHandler .swift"; sourceTree = "<group>"; };
39E6DE85233CDF1E008DAE04 /* OCItemTracker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OCItemTracker.swift; sourceTree = "<group>"; };
39E98B3D22797D1B009911F1 /* PublicLinkTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PublicLinkTableViewController.swift; sourceTree = "<group>"; };
39E98B442279ACF5009911F1 /* PublicLinkEditTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PublicLinkEditTableViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1409,6 +1418,7 @@
23D77FC6212BFBD100DE76F1 /* NamingViewController.swift */,
6E37F48A2188B27D00CF16CA /* Action.swift */,
DC3393A322E0A75C00DD3DA4 /* ClientItemResolvingCell.swift */,
39BCDD802460858200FE3D23 /* CompressViewController.swift */,
39CD755323D8392D00193950 /* EditDocumentViewController.swift */,
);
path = Actions;
Expand Down Expand Up @@ -1535,6 +1545,7 @@
39A5C3A0231566D9009D9EE3 /* GetFileInfoIntentHandler.swift */,
399A4C0F23190ADF0027DDD6 /* PathExistsIntentHandler.swift */,
3984F56B2319202200DC2639 /* DeletePathItemIntentHandler.swift */,
39E49DBE24619CB40069414A /* CompressPathItemsIntentHandler .swift */,
);
path = Intent;
sourceTree = "<group>";
Expand Down Expand Up @@ -1758,6 +1769,8 @@
DC62514B225D254500736874 /* UploadBaseAction.swift */,
DC625147225CEB2C00736874 /* UploadFileAction.swift */,
DC625149225CEB4300736874 /* UploadMediaAction.swift */,
39BCDD79246006AC00FE3D23 /* CompressAction.swift */,
39999DF32462D57800880D45 /* UncompressAction.swift */,
);
path = "Actions+Extensions";
sourceTree = "<group>";
Expand Down Expand Up @@ -3269,6 +3282,7 @@
4C464BF12187AF1500D30602 /* PDFTocTableViewCell.swift in Sources */,
DC1B270C209CF34B004715E1 /* BookmarkViewController.swift in Sources */,
DC63208321FCAC1E007EC0A8 /* ClientActivityViewController.swift in Sources */,
39999DF42462D57800880D45 /* UncompressAction.swift in Sources */,
DC3DEC7E22B03ACD00F3352D /* CardPresentationController.swift in Sources */,
4C464BF62187AF1500D30602 /* PDFTocItem.swift in Sources */,
6E3A103E219D5BBA00F90C96 /* RenameAction.swift in Sources */,
Expand Down Expand Up @@ -3368,6 +3382,7 @@
394804DA225CBDBA00AA8183 /* BreadCrumbTableViewController.swift in Sources */,
4C235CEE21F88C0300A989A8 /* UIViewController+Extension.swift in Sources */,
DC27A19D20CAB602008ACB6C /* FileProviderInterfaceManager.swift in Sources */,
39BCDD7F246006AD00FE3D23 /* CompressAction.swift in Sources */,
4C51727D22DE04BD001BC97F /* ScheduledTaskExtension.swift in Sources */,
DCC085512293ED52008CC05C /* DisplaySettingsSection.swift in Sources */,
23EC77582137F3DD0032D4E6 /* PDFViewerViewController.swift in Sources */,
Expand Down Expand Up @@ -3439,6 +3454,7 @@
DC29F09022974AEA00F77349 /* QueryFileListTableViewController.swift in Sources */,
6E586D002199A78E00F680C4 /* DeleteAction.swift in Sources */,
DC3317CE2084966700E36C8F /* ThemeTableViewCell.swift in Sources */,
39BCDD812460858300FE3D23 /* CompressViewController.swift in Sources */,
3913213822946E5E00EF88F4 /* FileListTableViewController.swift in Sources */,
DC0196AB20F7690C00C41B78 /* OCBookmark+FileProvider.m in Sources */,
4C6B78122226B86300C5F3DB /* PhotoAlbumTableViewCell.swift in Sources */,
Expand Down Expand Up @@ -3485,7 +3501,9 @@
397754E223279EED00119FCB /* OCItem+Extension.swift in Sources */,
39BE385D23435AFE0062A2FE /* String+Extension.swift in Sources */,
39E6DE86233CDF1E008DAE04 /* OCItemTracker.swift in Sources */,
39999DF224629FA800880D45 /* OCCore+Extension.swift in Sources */,
393D2B3F23FEB6DC00ED4F8C /* DispatchQueueTools.swift in Sources */,
39E49DBF24619CB40069414A /* CompressPathItemsIntentHandler .swift in Sources */,
3984F5712319202200DC2639 /* DeletePathItemIntentHandler.swift in Sources */,
39F689AC22F0206900E63429 /* OCBookmark+Extension.swift in Sources */,
395E16FF22F172C900DE89A1 /* CreateFolderIntentHandler.swift in Sources */,
Expand Down
2 changes: 2 additions & 0 deletions ownCloud/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
OCExtensionManager.shared.addExtension(LinksAction.actionExtension)
OCExtensionManager.shared.addExtension(FavoriteAction.actionExtension)
OCExtensionManager.shared.addExtension(UnfavoriteAction.actionExtension)
OCExtensionManager.shared.addExtension(CompressAction.actionExtension)
OCExtensionManager.shared.addExtension(UncompressAction.actionExtension)
if #available(iOS 13.0, *) {
if UIDevice.current.isIpad() {
// iPad & iOS 13+ only
Expand Down
14 changes: 11 additions & 3 deletions ownCloud/Client/Actions/Action.swift
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,19 @@ class Action : NSObject {

// MARK: - Provide Card view controller

class func cardViewController(for item: OCItem, with context: ActionContext, progressHandler: ActionProgressHandler? = nil, completionHandler: ((Action, Error?) -> Void)? = nil) -> UIViewController? {
class func cardViewController(for items: [OCItem], with context: ActionContext, progressHandler: ActionProgressHandler? = nil, completionHandler: ((Action, Error?) -> Void)? = nil) -> UIViewController? {
guard let core = context.core else { return nil }

let tableViewController = MoreStaticTableViewController(style: .grouped)
let header = MoreViewHeader(for: item, with: core)
let moreViewController = MoreViewController(item: item, core: core, header: header, viewController: tableViewController)

var moreViewController : MoreViewController!

if items.count > 1 {
let header = MoreViewHeader(title: String(format: "%ld Items Selected".localized, items.count))
moreViewController = MoreViewController(core: core, header: header, viewController: tableViewController)
} else if let item = items.first {
let header = MoreViewHeader(for: item, with: core)
moreViewController = MoreViewController(core: core, header: header, viewController: tableViewController)

if core.connectionStatus == .online {
if core.connection.capabilities?.sharingAPIEnabled == 1 {
Expand Down Expand Up @@ -214,6 +221,7 @@ class Action : NSObject {
}
}
}
}

let title = NSAttributedString(string: "Actions".localized, attributes: [NSAttributedString.Key.font: UIFont.systemFont(ofSize: 20, weight: .heavy)])

Expand Down
Loading