Skip to content
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
6 changes: 5 additions & 1 deletion doc/CONFIGURATION.json
Original file line number Diff line number Diff line change
Expand Up @@ -2245,6 +2245,10 @@
"description" : "Extension with the identifier license.Down.",
"value" : "license.Down"
},
{
"description" : "Extension with the identifier license.FontAwesome.",
"value" : "license.FontAwesome"
},
{
"description" : "Extension with the identifier license.ISRunLoopThread.",
"value" : "license.ISRunLoopThread"
Expand Down Expand Up @@ -3031,4 +3035,4 @@
"status" : "advanced",
"type" : "stringArray"
}
]
]
3 changes: 3 additions & 0 deletions doc/configuration.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1426,6 +1426,9 @@ tag::extensions[]
! `license.Down`
! Extension with the identifier license.Down.

! `license.FontAwesome`
! Extension with the identifier license.FontAwesome.

! `license.ISRunLoopThread`
! Extension with the identifier license.ISRunLoopThread.

Expand Down
4 changes: 2 additions & 2 deletions ownCloud File Provider/FileProviderContentEnumerator.m
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ - (BOOL)provideItemsToEnumerationObserver:(id<NSFileProviderEnumerationObserver>
((content.query == nil) && (content != nil)))
{
NSArray <OCItem *> *queryResults = content.query.queryResults;
OCBookmarkUUIDString bookmarkUUIDString = content.core.bookmark.uuid.UUIDString;
OCBookmarkUUIDString bookmarkUUIDString = content.core.bookmark.uuidString;

for (OCItem *item in queryResults)
{
Expand Down Expand Up @@ -620,7 +620,7 @@ - (BOOL)provideItemsForChangeObserver:(id<NSFileProviderChangeObserver>)changeOb
OCLogDebug(@"##### PROVIDE ITEMS TO %lu --CHANGE-- OBSERVER FOR %@: %@", _changeObservers.count, content.query.queryLocation.path, content.query.queryResults);

NSArray <OCItem *> *queryResults = content.query.queryResults;
OCBookmarkUUIDString bookmarkUUIDString = content.core.bookmark.uuid.UUIDString;
OCBookmarkUUIDString bookmarkUUIDString = content.core.bookmark.uuidString;

for (OCItem *item in queryResults)
{
Expand Down
41 changes: 31 additions & 10 deletions ownCloud File Provider/FileProviderExtension.m
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ - (nullable OCItem *)cachedItemInParent:(OCItem *)parentItem withName:(NSString

if ((item = [self.core cachedItemInParent:parentItem withName:name isDirectory:isDirectory error:outError]) != nil)
{
item.bookmarkUUID = self.core.bookmark.uuid.UUIDString;
item.bookmarkUUID = self.core.bookmark.uuidString; // ensure bookmarkUUID is present so that vfsItemID / itemIdentifier succeed
}

return (item);
Expand Down Expand Up @@ -337,15 +337,29 @@ - (void)startProvidingItemAtURL:(NSURL *)provideAtURL completionHandler:(void (^
{
if ((item = [self itemForIdentifier:itemIdentifier error:&error]) != nil)
{
FPLogCmdBegin(@"StartProviding", @"Downloading %@", item);
OCItem *ocItem = OCTypedCast(item, OCItem);

if (((OCItem *)item).type == OCItemTypeCollection) {
// Can't download folders
completionHandler([NSError errorWithDomain:NSCocoaErrorDomain code:NSFeatureUnsupportedError userInfo:@{}]);
if (ocItem == nil)
{
// itemForIdentifier can also return OCVFSNode items, typically for virtual folders. Nothing to download in this case.
// Return success regardless for consistency with the behaviour for "real" folders (=> see below)
FPLogCmdBegin(@"StartProviding", @"Completed with success for VFS item %@", item);
completionHandler(nil);
return;
}

[self.core downloadItem:(OCItem *)item options:@{
if (ocItem.type == OCItemTypeCollection)
{
// Folder item - nothing to download
// Return success regardless to avoid breaking recursive ops in Files.app.
FPLogCmdBegin(@"StartProviding", @"Completed with success for folder %@", item);
completionHandler(nil);
return;
}

FPLogCmdBegin(@"StartProviding", @"Downloading %@", item);

[self.core downloadItem:ocItem options:@{

OCCoreOptionAddFileClaim : [OCClaim claimForLifetimeOfCore:core explicitIdentifier:OCClaimExplicitIdentifierFileProvider withLockType:OCClaimLockTypeRead]

Expand Down Expand Up @@ -552,14 +566,18 @@ - (void)createDirectoryWithName:(NSString *)directoryName inParentItemIdentifier
__block BOOL calledCompletionHandler = NO;

[self.core createFolder:directoryName inside:parentItem options:nil placeholderCompletionHandler:^(NSError * _Nullable error, OCItem * _Nullable item) {
FPLogCmd(@"Completed placeholder creation with item=%@, error=%@", item, error);
FPLogCmd(@"Completed placeholder creation with item=%@, error=%@, offline=%d", item, error, (self.core.connectionStatus != OCCoreConnectionStatusOnline));

if (!calledCompletionHandler)
if (!calledCompletionHandler &&
(self.core.connectionStatus != OCCoreConnectionStatusOnline)) // Only return placeholder item right away if we're offline - otherwise wait for actual outcome (avoids DB race condition)
{
calledCompletionHandler = YES;
item.bookmarkUUID = self.bookmark.uuidString; // ensure bookmarkUUID is present so that vfsItemID / itemIdentifier succeed
completionHandler(item, [error translatedError]);
}
} resultHandler:^(NSError *error, OCCore *core, OCItem *item, id parameter) {
item.bookmarkUUID = self.core.bookmark.uuidString; // ensure bookmarkUUID is present so that vfsItemID / itemIdentifier succeed

if (error != nil)
{
if (error.HTTPStatus.code == OCHTTPStatusCodeMETHOD_NOT_ALLOWED)
Expand Down Expand Up @@ -623,6 +641,7 @@ - (void)reparentItemWithIdentifier:(NSFileProviderItemIdentifier)itemIdentifier
[self.core moveItem:item to:parentItem withName:((newName != nil) ? newName : item.name) options:nil resultHandler:^(NSError *error, OCCore *core, OCItem *item, id parameter) {
FPLogCmd(@"Completed with item=%@, error=%@", item, error);

item.bookmarkUUID = self.core.bookmark.uuidString; // ensure bookmarkUUID is present so that vfsItemID / itemIdentifier succeed
completionHandler(item, [error translatedError]);
}];
}
Expand Down Expand Up @@ -657,6 +676,8 @@ - (void)renameItemWithIdentifier:(NSFileProviderItemIdentifier)itemIdentifier to

[self.core renameItem:item to:itemName options:nil resultHandler:^(NSError *error, OCCore *core, OCItem *item, id parameter) {
FPLogCmd(@"Completed with item=%@, error=%@", item, error);

item.bookmarkUUID = self.core.bookmark.uuidString; // ensure bookmarkUUID is present so that vfsItemID / itemIdentifier succeed
completionHandler(item, [error translatedError]);
}];
}
Expand Down Expand Up @@ -769,7 +790,7 @@ - (void)importDocumentAtURL:(NSURL *)fileURL toParentItemIdentifier:(NSFileProvi
OCCoreOptionImportByCopying : @(importByCopying)
} placeholderCompletionHandler:^(NSError *error, OCItem *item) {
FPLogCmd(@"Completed with placeholderItem=%@, error=%@", item, error);
item.bookmarkUUID = self.core.bookmark.uuid.UUIDString; // ensure bookmarkUUID is present so that vfsItemID / itemIdentifier succeed
item.bookmarkUUID = self.core.bookmark.uuidString; // ensure bookmarkUUID is present so that vfsItemID / itemIdentifier succeed
completionHandler(item, [error translatedError]);
} resultHandler:^(NSError *error, OCCore *core, OCItem *item, id parameter) {
if ([error.domain isEqual:OCHTTPStatusErrorDomain] && (error.code == OCHTTPStatusCodePRECONDITION_FAILED))
Expand Down Expand Up @@ -1307,7 +1328,7 @@ - (void)core:(OCCore *)core handleError:(NSError *)error issue:(OCIssue *)issue

UNNotificationRequest *request;

request = [UNNotificationRequest requestWithIdentifier:ComposeNotificationIdentifier(NotificationAuthErrorForwarder, bookmark.uuid.UUIDString) content:content trigger:nil];
request = [UNNotificationRequest requestWithIdentifier:ComposeNotificationIdentifier(NotificationAuthErrorForwarder, bookmark.uuidString) content:content trigger:nil];

[NotificationManager.sharedNotificationManager addNotificationRequest:request withCompletionHandler:^(NSError * _Nonnull error) {
OCLogDebug(@"Add Notification error: %@", error);
Expand Down
8 changes: 4 additions & 4 deletions ownCloud Intents/OCBookmarkManager+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ extension OCBookmarkManager {
var accountList : [Account] {
var accountList : [Account] = []
accountList = OCBookmarkManager.shared.bookmarks.map { (bookmark) -> Account in
let account = Account(identifier: bookmark.uuid.uuidString, display: bookmark.shortName)
let account = Account(identifier: bookmark.uuidString, display: bookmark.shortName)
account.name = bookmark.shortName
account.serverURL = bookmark.url
account.uuid = bookmark.uuid.uuidString
account.uuid = bookmark.uuidString

return account
}
Expand All @@ -38,10 +38,10 @@ extension OCBookmarkManager {

func accountBookmark(for uuidString: String) -> (OCBookmark, Account)? {
if let bookmark = bookmark(forUUIDString: uuidString) {
let account = Account(identifier: bookmark.uuid.uuidString, display: bookmark.shortName)
let account = Account(identifier: bookmark.uuidString, display: bookmark.shortName)
account.name = bookmark.shortName
account.serverURL = bookmark.url
account.uuid = bookmark.uuid.uuidString
account.uuid = bookmark.uuidString

return (bookmark, account)
}
Expand Down
2 changes: 1 addition & 1 deletion ownCloud/Bookmarks/BookmarkViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,7 @@ extension BookmarkViewController {

if let bookmark {
// Retrieve latest version of bookmark from OCBookmarkManager
if let latestStoredBookmarkVersion = OCBookmarkManager.shared.bookmark(forUUIDString: bookmark.uuid.uuidString) {
if let latestStoredBookmarkVersion = OCBookmarkManager.shared.bookmark(forUUIDString: bookmark.uuidString) {
editBookmark = latestStoredBookmarkVersion
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class CopyAction : Action {
}

let items = context.items
let uuid = core.bookmark.uuid.uuidString
let uuid = core.bookmark.uuidString
let globalPasteboard = UIPasteboard.general
globalPasteboard.items = []
var itemProviderItems: [NSItemProvider] = []
Expand Down
2 changes: 1 addition & 1 deletion ownCloud/Client/Actions/Actions+Extensions/CutAction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class CutAction : Action {
}

let items = context.items
let uuid = core.bookmark.uuid.uuidString
let uuid = core.bookmark.uuidString
var itemProviderItems: [NSItemProvider] = []
let globalPasteboard = UIPasteboard.general
globalPasteboard.items = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class ImportPasteboardAction : Action {
return
}

if core.bookmark.uuid.uuidString == bookmarkUUID {
if core.bookmark.uuidString == bookmarkUUID {
// Copy within account
core.copy(item, to: rootItem, withName: name, options: nil, resultHandler: { (error, _, _, _) in
if error != nil {
Expand Down Expand Up @@ -136,7 +136,7 @@ class ImportPasteboardAction : Action {
return
}

if core.bookmark.uuid.uuidString == bookmarkUUID {
if core.bookmark.uuidString == bookmarkUUID {
// Move within same account
core.move(item, to: rootItem, withName: name, options: nil) { (error, _, _, _) in
if error != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class FileProviderInterfaceManager: NSObject {

// Collect info on bookmarks
for bookmark in bookmarks {
let bookmarkUUIDString = bookmark.uuid.uuidString
let bookmarkUUIDString = bookmark.uuidString

bookmarkUUIDStrings.append(bookmarkUUIDString)
bookmarksByUUIDString[bookmarkUUIDString] = bookmark
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ + (instancetype)environmentWithBookmark:(OCBookmark *)bookmark
{
OCLicenseEnvironment *environment = [self new];

environment.identifier = bookmark.uuid.UUIDString;
environment.identifier = bookmark.uuidString;
environment.bookmarkUUID = bookmark.uuid;
environment.bookmark = bookmark;
environment.hostname = bookmark.url.host;
Expand Down
2 changes: 1 addition & 1 deletion ownCloudAppFramework/VFS/OCVault+VFSManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ - (OCVFSNode *)vfsNodeForDriveID:(OCDriveID)driveID
OCVFSNode *vfsNode = nil;
OCVFSItemID vfsItemID = nil, parentVFSItemID = nil;

item.bookmarkUUID = self.bookmark.uuid.UUIDString;
item.bookmarkUUID = self.bookmark.uuidString;

switch (item.type)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class AccountConnectionPool: NSObject {

public func connection(for bookmark: OCBookmark) -> AccountConnection? {
var connection: AccountConnection?
let bookmarkUUID = bookmark.uuid.uuidString
let bookmarkUUID = bookmark.uuidString

OCSynchronized(self) {
OCSynchronized(connectionsByBookmarkUUID) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class AccountControllerSection: CollectionViewSection {

public init(with accountController: AccountController) {
self.accountController = accountController
let uuid = accountController.connection?.bookmark.uuid.uuidString ?? "_missing_bookmark_"
let uuid = accountController.connection?.bookmark.uuidString ?? "_missing_bookmark_"
super.init(identifier: "account.\(uuid)", dataSource: accountController.accountSectionDataSource, cellStyle: CollectionViewCellStyle(with: .sideBar), cellLayout: .list(appearance: accountController.configuration.sectionAppearance), clientContext: accountController.clientContext)
accountController.accountControllerSection = self
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ public class ClientLocationPicker : NSObject {
}
} else if let item, location == nil {
// Add missing location for item
if item.bookmarkUUID == nil, let bookmarkUUID = context?.core?.bookmark.uuid.uuidString {
if item.bookmarkUUID == nil, let bookmarkUUID = context?.core?.bookmark.uuidString {
item.bookmarkUUID = bookmarkUUID
}
if let itemLocation = item.location, let core = context?.core {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,6 @@ public class AppStateActionConnect: AppStateAction {

public extension AppStateAction {
static func connection(with bookmark: OCBookmark, children: [AppStateAction]? = nil) -> AppStateActionConnect {
return AppStateActionConnect(bookmarkUUID: bookmark.uuid.uuidString, children: children)
return AppStateActionConnect(bookmarkUUID: bookmark.uuidString, children: children)
}
}