Skip to content

Commit

Permalink
Merge branch 'milestone/12.0.3' into translation-sync
Browse files Browse the repository at this point in the history
# Conflicts:
#	ios-sdk
  • Loading branch information
hosy committed Jul 28, 2023
2 parents bd7b83a + abe25cb commit f947032
Show file tree
Hide file tree
Showing 87 changed files with 214 additions and 1,293 deletions.
2 changes: 1 addition & 1 deletion .xcode-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.2
14.3.1
34 changes: 6 additions & 28 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,8 @@ platform :ios do
)

puts("Build EMM iOS App…")
# Set EMM App-Icon for App Build
sh "mv ../ownCloud/Resources/Assets.xcassets/AppIcon.appiconset/ ../ownCloud/Resources/Assets.xcassets/AppIcon-regular.appiconset/"
sh "mv ../ownCloud/Resources/Assets.xcassets/AppIcon-emm.appiconset/ ../ownCloud/Resources/Assets.xcassets/AppIcon.appiconset/"
# Moving all EMM resources to the correct place
sh "cp -R ../ownCloud/Resources/Theming/com.owncloud.ios-app.emm/* ../ownCloud/Resources/Theming/"

# Build App
owncloud_emm_build()
Expand Down Expand Up @@ -222,30 +221,9 @@ platform :ios do

puts("Build ownCloud Online iOS App…")

# Moving the ownCloud.online Branding.plist to the correct place
sh "mv ../ownCloud/Resources/Theming/Branding.plist ../ownCloud/Resources/Theming/Branding-regular.plist"
sh "mv ../ownCloud/Resources/Theming/Branding-owncloud-online.plist ../ownCloud/Resources/Theming/Branding.plist"

# Set ownCloud.online Splashscreen Background for App Build
sh "mv ../ownCloud/Resources/Theming/branding-splashscreen-background.png ../ownCloud/Resources/Theming/branding-splashscreen-background-regular.png"
sh "mv ../ownCloud/Resources/Theming/branding-splashscreen-background-owncloud-online.png ../ownCloud/Resources/Theming/branding-splashscreen-background.png"

# Set ownCloud.online Splashscreen Logo for App Build
sh "mv ../ownCloud/Resources/Theming/branding-splashscreen.png ../ownCloud/Resources/Theming/branding-splashscreen-regular.png"
sh "mv ../ownCloud/Resources/Theming/branding-splashscreen-owncloud-online.png ../ownCloud/Resources/Theming/branding-splashscreen.png"

# Set ownCloud.online Branded Login Logo for App Build
sh "mv ../ownCloud/Resources/Theming/branding-login-logo.png ../ownCloud/Resources/Theming/branding-login-logo-regular.png"
sh "mv ../ownCloud/Resources/Theming/branding-login-logo-owncloud-online.png ../ownCloud/Resources/Theming/branding-login-logo.png"

# Set ownCloud.online Branded Login Background for App Build
sh "mv ../ownCloud/Resources/Theming/branding-login-background.png ../ownCloud/Resources/Theming/branding-login-background-regular.png"
sh "mv ../ownCloud/Resources/Theming/branding-login-background-owncloud-online.png ../ownCloud/Resources/Theming/branding-login-background.png"

# Set ownCloud.online App-Icon for App Build
sh "mv ../ownCloud/Resources/Assets.xcassets/AppIcon.appiconset/ ../ownCloud/Resources/Assets.xcassets/AppIcon-regular.appiconset/"
sh "mv ../ownCloud/Resources/Assets.xcassets/AppIcon-ownCloud-online.appiconset/ ../ownCloud/Resources/Assets.xcassets/AppIcon.appiconset/"

# Moving all ownCloud.online resources to the correct place
sh "cp -R ../ownCloud/Resources/Theming/online.owncloud.ios-app/* ../ownCloud/Resources/Theming/"

# Build App
owncloud_online_build()

Expand Down Expand Up @@ -424,7 +402,7 @@ end
end

lane :generate_appicon do
iconPath = "ownCloud/Resources/Theming/icon-1024.png"
iconPath = "ownCloud/Resources/Theming/branding-icon.png"
if File.exist?("../" + iconPath)
appicon(
appicon_image_file: iconPath,
Expand Down
2 changes: 2 additions & 0 deletions ownCloud File Provider/FileProviderContentEnumerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ NS_ASSUME_NONNULL_BEGIN
{
NSMutableArray <FileProviderEnumeratorObserver *> *_enumerationObservers;
NSMutableArray <FileProviderEnumeratorObserver *> *_changeObservers;

NSHashTable<OCQuery *> *_didReturnAnyContentQueries;
}

@property(nonatomic,readonly,class) OCAsyncSequentialQueue *queue;
Expand Down
61 changes: 49 additions & 12 deletions ownCloud File Provider/FileProviderContentEnumerator.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ - (instancetype)initWithVFSCore:(OCVFSCore *)vfsCore containerItemIdentifier:(OC
_enumerationObservers = [NSMutableArray new];
_changeObservers = [NSMutableArray new];

_didReturnAnyContentQueries = [NSHashTable weakObjectsHashTable];

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_displaySettingsChanged:) name:DisplaySettingsChanged object:nil];
}

Expand Down Expand Up @@ -261,7 +263,6 @@ - (void)requestContentWithErrorHandler:(void(^)(NSError *))errorHandler contentC
{
OCWLogDebug(@"[ERROR] Content Enumerator VFS response error %@ for %@", error, contentRequestUUID);
errorHandler(error);
completionHandler();
}
else
{
Expand All @@ -270,7 +271,6 @@ - (void)requestContentWithErrorHandler:(void(^)(NSError *))errorHandler contentC
// Content is a snapshot, so there's no need to keep the content around - it can be sent now
OCWLogDebug(@"[CMPLT] Content Enumerator VFS snapshot response for %@", contentRequestUUID);
contentConsumer(content);
completionHandler();
}
else
{
Expand All @@ -280,25 +280,24 @@ - (void)requestContentWithErrorHandler:(void(^)(NSError *))errorHandler contentC
// Content already available
OCWLogDebug(@"[CMPLT] Content Enumerator VFS immediately available content response for %@", contentRequestUUID);
contentConsumer(strongSelf.content);
completionHandler();
}
else
{
// Content to be provided by observer
OCWLogDebug(@"[REQST] Content Enumerator VFS provided asynchronously for %@", contentRequestUUID);
strongSelf.content = content; // effectively sets it to nil, since this can only be reached following (strongSelf.content == nil)

if (!observerQueuer(completionHandler))
if (!observerQueuer(nil))
{
// No observer available - unexpected, so complete with an error
OCWLogDebug(@"[ERROR] No content observer available for %@", contentRequestUUID);
errorHandler(OCErrorWithDescription(OCErrorInternal, @"No content observer available"));

completionHandler();
}
}
}
}

completionHandler();
});
}];
}];
Expand Down Expand Up @@ -571,8 +570,11 @@ - (void)setContent:(OCVFSContent *)content
#pragma mark - Content distribution
- (BOOL)provideItemsToEnumerationObserver:(id<NSFileProviderEnumerationObserver>)enumerationObserver fromContent:(OCVFSContent *)content
{
if (((content.query.state == OCQueryStateContentsFromCache) || ((content.query.state == OCQueryStateWaitingForServerReply) && (content.query.queryResults.count > 0)) || (content.query.state == OCQueryStateIdle))
|| ((content.query == nil) && (content != nil)))
if (( (content.query.state == OCQueryStateContentsFromCache) ||
((content.query.state == OCQueryStateWaitingForServerReply) && (content.query.queryResults.count > 0)) ||
(content.query.state == OCQueryStateIdle)
) ||
((content.query == nil) && (content != nil)))
{
NSArray <OCItem *> *queryResults = content.query.queryResults;
OCBookmarkUUIDString bookmarkUUIDString = content.core.bookmark.uuid.UUIDString;
Expand All @@ -582,6 +584,11 @@ - (BOOL)provideItemsToEnumerationObserver:(id<NSFileProviderEnumerationObserver>
item.bookmarkUUID = bookmarkUUIDString;
}

if (content.query != nil)
{
[_didReturnAnyContentQueries addObject:content.query];
}

OCLogDebug(@"##### PROVIDE ITEMS TO %ld --ENUMERATION-- OBSERVER %@ FOR %@: %@", _enumerationObservers.count, enumerationObserver, content.query.queryLocation.path, queryResults);

dispatch_async(dispatch_get_main_queue(), ^{
Expand Down Expand Up @@ -616,6 +623,11 @@ - (BOOL)provideItemsForChangeObserver:(id<NSFileProviderChangeObserver>)changeOb
item.bookmarkUUID = bookmarkUUIDString;
}

if (content.query != nil)
{
[_didReturnAnyContentQueries addObject:content.query];
}

NSFileProviderSyncAnchor syncAnchor = [content.core.latestSyncAnchor syncAnchorData];

dispatch_async(dispatch_get_main_queue(), ^{
Expand All @@ -627,14 +639,14 @@ - (BOOL)provideItemsForChangeObserver:(id<NSFileProviderChangeObserver>)changeOb
}

#pragma mark - OCQuery delegate
- (void)queryHasChangesAvailable:(OCQuery *)query
- (void)_updateFromQuery:(OCQuery *)query
{
OCLogDebug(@"##### Query for %@ has changes. Query state: %lu, SinceSyncAnchor: %@, Changes available: %d", query.queryLocation.path, (unsigned long)query.state, query.querySinceSyncAnchor, query.hasChangesAvailable);

if ( (query.state == OCQueryStateContentsFromCache) ||
((query.state == OCQueryStateWaitingForServerReply) && (query.queryResults.count > 0)) ||
(query.state == OCQueryStateIdle))
{
OCLogDebug(@"##### Serving query %@ for %@ content. Query state: %lu, SinceSyncAnchor: %@, Changes available: %d", query, query.queryLocation.path, (unsigned long)query.state, query.querySinceSyncAnchor, query.hasChangesAvailable);

dispatch_async(FileProviderContentEnumerator.dispatchQueue, ^{
// Send content to enumeration observers
NSArray<FileProviderEnumeratorObserver *> *enumerationObservers = [self->_enumerationObservers copy];
Expand All @@ -648,7 +660,6 @@ - (void)queryHasChangesAvailable:(OCQuery *)query
}
}


// Send content to change observers
NSArray<FileProviderEnumeratorObserver *> *changeObservers = [self->_changeObservers copy];

Expand All @@ -664,6 +675,32 @@ - (void)queryHasChangesAvailable:(OCQuery *)query
}
}

- (void)queryHasChangesAvailable:(OCQuery *)query
{
OCLogDebug(@"##### Query %@ for %@ has changes. Query state: %lu, SinceSyncAnchor: %@, Changes available: %d", query, query.queryLocation.path, (unsigned long)query.state, query.querySinceSyncAnchor, query.hasChangesAvailable);

[self _updateFromQuery:query];
}

- (void)queryHasChangedState:(OCQuery *)query
{
OCLogDebug(@"##### Query %@ for %@ has changed state. Query state: %lu, SinceSyncAnchor: %@, Changes available: %d", query, query.queryLocation.path, (unsigned long)query.state, query.querySinceSyncAnchor, query.hasChangesAvailable);

BOOL didReturnContentForQueryBefore = [_didReturnAnyContentQueries containsObject:query];
BOOL isEmptyQueryResult = (query.queryResults.count == 0);

// This catches the following special case:
// - query has no results (f.ex. empty folder)
// -> query had no results when returning from the database and waiting for a reply (=> does not provide items to FP)
// -> query returns from PROPFIND and changes state to idle, but still has no results (=> chance that only state changes, no additional call to -queryHasChangesAvailable:, because it has not)
// -> query does not return any results -> Files.app shows spinner indefinitely (=> now, the state change to idle with an empty result set triggers a return of items
if ((query.state == OCQueryStateIdle) && !didReturnContentForQueryBefore && isEmptyQueryResult)
{
OCLogDebug(@"Would have updated %@", query);
// [self _updateFromQuery:query];
}
}

- (void)query:(OCQuery *)query failedWithError:(NSError *)error
{
OCLogDebug(@"### Query failed with error: %@", error);
Expand Down
50 changes: 0 additions & 50 deletions ownCloud File Provider/FileProviderEnumerator.h

This file was deleted.

Loading

0 comments on commit f947032

Please sign in to comment.