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

[feature/sharing-ng] Support for new ocis spaces/sharing capabilities #1435

Open
wants to merge 11 commits into
base: master
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
2 changes: 1 addition & 1 deletion ios-sdk
Submodule ios-sdk updated 227 files
40 changes: 40 additions & 0 deletions ownCloud.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions ownCloud/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
OCExtensionManager.shared.addExtension(ScanAction.actionExtension)
OCExtensionManager.shared.addExtension(DocumentEditingAction.actionExtension)

OCExtensionManager.shared.addExtension(ManageSpaceAction.actionExtension)
OCExtensionManager.shared.addExtension(MembersSpaceAction.actionExtension)
OCExtensionManager.shared.addExtension(DisableSpaceAction.actionExtension)
OCExtensionManager.shared.addExtension(DetailsSpaceAction.actionExtension)

// Register class settings for extensions added on a per-connection basis
OnMainThread {
OpenInWebAppAction.registerSettings()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
//
// DetailsSpaceAction.swift
// ownCloud
//
// Created by Felix Schwarz on 16.12.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 ownCloudApp
import ownCloudAppShared

public class DetailsSpaceAction : Action {
override open class var identifier : OCExtensionIdentifier? { return OCExtensionIdentifier("com.owncloud.action.detailspace") }
override open class var category : ActionCategory? { return .edit }
override open class var name : String? { return OCLocalizedString("Details", nil) }
override open class var locations : [OCExtensionLocationIdentifier]? { return [.moreFolder] }

// MARK: - Extension matching
override open class func applicablePosition(forContext: ActionContext) -> ActionPosition {
if let core = forContext.core, core.connectionStatus == .online, let drive = forContext.drive, drive.specialType == .space {
if let shareActions = core.connection.shareActions(for: drive) {
if !shareActions.contains(.updatePermissions) {
return .first
}
}
}
return .none
}

// MARK: - Action implementation
override open func run() {
guard let viewController = context.viewController, let drive = context.drive, let clientContext = context.clientContext else {
self.completed(with: NSError(ocError: .insufficientParameters))
return
}

let editSpaceViewController = SpaceManagementViewController(clientContext: clientContext, rootItem: context.items.first, drive: drive, mode: .details, completionHandler: { error, drive in
})
let navigationController = ThemeNavigationController(rootViewController: editSpaceViewController)
viewController.present(navigationController, animated: true)

completed()
}

override open class func iconForLocation(_ location: OCExtensionLocationIdentifier) -> UIImage? {
return UIImage(systemName: "info.circle")?.withRenderingMode(.alwaysTemplate)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
//
// DisableSpaceAction.swift
// ownCloud
//
// Created by Felix Schwarz on 15.12.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 ownCloudApp
import ownCloudAppShared

public class DisableSpaceAction : Action {
override open class var identifier : OCExtensionIdentifier? { return OCExtensionIdentifier("com.owncloud.action.disablespace") }
override open class var category : ActionCategory? { return .edit }
override open class var name : String? { return OCLocalizedString("Disable space", nil) }
override open class var locations : [OCExtensionLocationIdentifier]? { return [.moreFolder, .spaceAction] }

// MARK: - Extension matching
override open class func applicablePosition(forContext: ActionContext) -> ActionPosition {
if let core = forContext.core, core.connectionStatus == .online, let drive = forContext.drive, drive.specialType == .space {
if let shareActions = core.connection.shareActions(for: drive) {
if shareActions.contains(.updatePermissions) {
return .last
}
}
}

return .none
}

// MARK: - Action implementation
override open func run() {
guard let viewController = context.viewController, let drive = context.drive, let clientContext = context.clientContext else {
self.completed(with: NSError(ocError: .insufficientParameters))
return
}

drive.disable(with: clientContext, completionHandler: { [weak self] error in
self?.completed(with: error)
})
}

override open class func iconForLocation(_ location: OCExtensionLocationIdentifier) -> UIImage? {
return UIImage(systemName: "stop.circle")?.withRenderingMode(.alwaysTemplate)
}
}
61 changes: 61 additions & 0 deletions ownCloud/Client/Actions/Actions+Extensions/ManageSpaceAction.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
//
// ManageSpaceAction.swift
// ownCloud
//
// Created by Felix Schwarz on 15.12.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 ownCloudApp
import ownCloudAppShared

public class ManageSpaceAction : Action {
override open class var identifier : OCExtensionIdentifier? { return OCExtensionIdentifier("com.owncloud.action.managespace") }
override open class var category : ActionCategory? { return .edit }
override open class var name : String? { return OCLocalizedString("Edit space", nil) }
override open class var locations : [OCExtensionLocationIdentifier]? { return [.moreFolder] }

// MARK: - Extension matching
override open class func applicablePosition(forContext: ActionContext) -> ActionPosition {
if let core = forContext.core, core.connectionStatus == .online, let drive = forContext.drive, drive.specialType == .space {
if let shareActions = core.connection.shareActions(for: drive) {
if shareActions.contains(.updatePermissions) {
return .first
}
}
}
return .none
}

// MARK: - Action implementation
override open func run() {
guard let viewController = context.viewController, let drive = context.drive, let clientContext = context.clientContext else {
self.completed(with: NSError(ocError: .insufficientParameters))
return
}

let editSpaceViewController = SpaceManagementViewController(clientContext: clientContext, rootItem: context.items.first, drive: drive, mode: .edit, completionHandler: { error, drive in
})
let navigationController = ThemeNavigationController(rootViewController: editSpaceViewController)
viewController.present(navigationController, animated: true)

completed()
}

override open class func iconForLocation(_ location: OCExtensionLocationIdentifier) -> UIImage? {
return UIImage(systemName: "pencil")?.withRenderingMode(.alwaysTemplate)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
//
// MembersSpaceAction.swift
// ownCloud
//
// Created by Felix Schwarz on 29.12.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 MembersSpaceAction: Action {
override class var identifier : OCExtensionIdentifier? { return OCExtensionIdentifier("com.owncloud.action.spacemembers") }
override class var category : ActionCategory? { return .normal }
override class var name : String { return OCLocalizedString("Members", nil) }
override class var locations : [OCExtensionLocationIdentifier]? { return [.moreFolder, .spaceAction] }

// MARK: - Extension matching
override class func applicablePosition(forContext: ActionContext) -> ActionPosition {
if let core = forContext.core, core.connectionStatus == .online, let drive = forContext.drive, drive.specialType == .space {
return .first
}

return .none
}

// MARK: - Action implementation
override func run() {
guard context.items.count == 1, let item = context.items.first, let viewController = context.viewController, let clientContext = context.clientContext else {
self.completed(with: NSError(ocError: .insufficientParameters))
return
}

let sharingViewController = SharingViewController(clientContext: clientContext, item: item)
let navigationController = ThemeNavigationController(rootViewController: sharingViewController)
viewController.present(navigationController, animated: true)
}

override class func iconForLocation(_ location: OCExtensionLocationIdentifier) -> UIImage? {
return OCItem.groupIcon?.withRenderingMode(.alwaysTemplate)
}
}
Loading