-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- regrouping shortcut actions into their own folder
- CreateShortcutFileAction: break out creation functionality into its own view controller - CreateShortcutFileViewController: - dedicated view controller for creating shortcuts - allows picking files and folders for shortcuts to point to and presents an embedded preview for them - improved error handling - INIFile: fix formatting bug that could accidentally leak memory into the .url file - ClientLocationPicker: add ability to allow picking files via new .allowFileSelection property
- Loading branch information
1 parent
41ea6d4
commit fad824b
Showing
11 changed files
with
397 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
126 changes: 0 additions & 126 deletions
126
ownCloud/Client/Actions/Actions+Extensions/CreateShortcutFileAction.swift
This file was deleted.
Oops, something went wrong.
62 changes: 62 additions & 0 deletions
62
ownCloud/Client/Actions/Shortcuts/CreateShortcutFileAction.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// | ||
// CreateShortcutFileAction.swift | ||
// ownCloud | ||
// | ||
// Created by Felix Schwarz on 10.04.24. | ||
// Copyright © 2024 ownCloud GmbH. All rights reserved. | ||
// | ||
|
||
/* | ||
* Copyright (C) 2024, ownCloud GmbH. | ||
* | ||
* This code is covered by the GNU Public License Version 3. | ||
* | ||
* For distribution utilizing Apple mechanisms please see https://owncloud.org/contribute/iOS-license-exception/ | ||
* You should have received a copy of this license along with this program. If not, see <http://www.gnu.org/licenses/gpl-3.0.en.html>. | ||
* | ||
*/ | ||
|
||
import UIKit | ||
import ownCloudSDK | ||
import ownCloudAppShared | ||
|
||
class CreateShortcutFileAction: Action { | ||
override open class var identifier : OCExtensionIdentifier? { return OCExtensionIdentifier("com.owncloud.action.createShortcutFile") } | ||
override open class var category : ActionCategory? { return .normal } | ||
override open class var name : String? { return "Create shortcut".localized } | ||
override open class var locations : [OCExtensionLocationIdentifier]? { return [.folderAction, .emptyFolder] } | ||
|
||
// MARK: - Extension matching | ||
override open class func applicablePosition(forContext: ActionContext) -> ActionPosition { | ||
if forContext.items.count > 1 { | ||
return .none | ||
} | ||
|
||
if forContext.items.first?.type != .collection { | ||
return .none | ||
} | ||
|
||
if forContext.items.first?.permissions.contains(.createFile) == false { | ||
return .none | ||
} | ||
|
||
return .middle | ||
} | ||
|
||
// MARK: - Action implementation | ||
override func run() { | ||
guard context.items.count > 0, let parentItem = context.items.first, let clientContext = context.clientContext else { | ||
completed(with: NSError(ocError: .itemNotFound)) | ||
return | ||
} | ||
|
||
let navigationController = ThemeNavigationController(rootViewController: CreateShortcutFileViewController(parentItem: parentItem, clientContext: clientContext)) | ||
clientContext.present(navigationController, animated: true) | ||
|
||
self.completed() | ||
} | ||
|
||
override open class func iconForLocation(_ location: OCExtensionLocationIdentifier) -> UIImage? { | ||
return UIImage(systemName: "arrow.up.forward.square")?.withRenderingMode(.alwaysTemplate) | ||
} | ||
} |
Oops, something went wrong.