Skip to content

FileProvider macOS xcode13.0 beta3

Manuel de la Pena edited this page Jul 29, 2021 · 3 revisions

#FileProvider.framework https://github.com/xamarin/xamarin-macios/pull/12300

diff -ruN /Applications/Xcode_13.0.0-beta2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderItem.h /Applications/Xcode_13.0.0-beta3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderItem.h
--- /Applications/Xcode_13.0.0-beta2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderItem.h	2021-06-22 17:34:09.000000000 -0400
+++ /Applications/Xcode_13.0.0-beta3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderItem.h	2021-07-13 00:41:42.000000000 -0400
@@ -376,12 +376,15 @@
 @property (nonatomic, readonly, copy, nullable) NSDate *lastUsedDate;
 
 /**
- An abstract data blob reprenting the tags associated with the item.  The same
+ An abstract data blob representing the tags associated with the item.  The same
  tags that are available via -[NSURL getResourceValue:forKey:error:] with key
  NSURLTagNamesKey on macOS, except that this data blob may transport more
  information than just the tag names.
 
  This property must not be shared between users, even if the item is.
+
+ Starting in macOS 12 and iOS 15, the system suppports the value of the
+ `com.apple.metadata:_kMDItemUserTags` xattr as a valid `tagData` blob input.
  */
 @property (nonatomic, readonly, copy, nullable) NSData *tagData;
 
@@ -518,6 +521,13 @@
  child.inheritedUserInfo = { "a.inherited": YES, "b.inherited": YES }
  grandchild.inheritedUserInfo = { "a.inherited": NO, "b.inherited": YES, "c.inherited": NO }
 
+ The context key `resolvedUserInfo` is also available. For each item, the resolvedUserInfo is it's
+ inheritedUserInfo, combined with the keys suffixed with .inherited from it's userInfo.
+ Continuing the previous example:
+ parent.resolvedUserInfo = { "a.inherited": YES, "b.inherited": YES }
+ child.resolvedUserInfo = { "a.inherited": NO, "b.inherited": YES, "c.inherited": NO }
+ grandchild.resolvedUserInfo = { "a.inherited": NO, "b.inherited": YES, "c.inherited": NO }
+
  All values for this dictionary must be of type String, Number, Bool or Date.
 
  [1] UserInteraction can be defined when a user level action occurs with a file.
@@ -546,7 +556,7 @@
                              If the provider wishes to take full responsibility for showing warnings on Delete,
                              the provider can set NSExtensionFileProviderAllowsSystemDeleteAlerts=0 in the provider's Info.plist.
                              This will ensure that the system does not display it's warnings when the user is deleting a file.
-                 'ExcludeFromSync' : deleting items(s) because the user chose to exclude those from sync (available in macOS 11.3 and later)
+                 'ExcludeFromSync' : deleting items(s) because the user chose to exclude those from sync (available in macOS 12.0 and later)
                  'Rename'  : renaming item(s) (available in macOS 11.3 and later)
             - `sourceItem` : current item that the predicate is evaluating. Present for Move/MoveOut/Copy/CopyOut/Create/Trash/Delete/ExcludeFromSync/Rename
             - `sourceItemsCount` :
@@ -597,7 +607,7 @@
  <key>NSFileProviderUserInteractions</key>
  <array>
     <key>ActivationRule</key>
-    <string>action == Move</string>
+    <string>action == "Move"</string>
     <key>SubInteractions</key>
     <array>
         <dict>
diff -ruN /Applications/Xcode_13.0.0-beta2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderManager.h /Applications/Xcode_13.0.0-beta3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderManager.h
--- /Applications/Xcode_13.0.0-beta2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderManager.h	2021-06-17 14:34:04.000000000 -0400
+++ /Applications/Xcode_13.0.0-beta3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderManager.h	2021-07-13 00:41:42.000000000 -0400
@@ -234,8 +234,8 @@
 + (void)removeAllDomainsWithCompletionHandler:(void(^)(NSError *_Nullable error))completionHandler;
 
 /**
- Cancel throttling applied by the system to any item because of that error.
- 
+ Calling this method will cause the system to cancel throttling on every item which has been throttled due to the given error.
+
  This call supports 4 types of errors:
  - NSFileProviderErrorNotAuthenticated
  - NSFileProviderErrorInsufficientQuota
@@ -398,11 +398,19 @@
  When the import of the file hierarchy is finished, the system calls
  -[NSFileProviderExtension importDidFinishWithCompletionHandler:].
 
+ In some circumstances, in particular in case the requested item is the root item, calling
+ reimport will cause the system to stop the extension process. If the call is initiated
+ from the extension, the system does not guarantee that the completion handler will be called
+ before the extension is stopped. When called on the root item, reimport will cause the system
+ to rebuild its backing store for the domain. See `-[NSFileProviderDomain backingStoreIdentity]`.
+
  If this method succeeds, the system will reimport at least the requested sub-tree, but may
  import more.
 
  If the requested item has no on-disk representation, the completion handler will be called with
- a NSFileProviderErrorNoSuchItem error.
+ a NSFileProviderErrorNoSuchItem error. The same error will be reported if the reimport request
+ happens quickly after a previous import / reimport and the corresponding item hasn't been
+ reimported yet.
  */
 - (void)reimportItemsBelowItemWithIdentifier:(NSFileProviderItemIdentifier)itemIdentifier
                            completionHandler:(void (^)(NSError * _Nullable error))completionHandler
diff -ruN /Applications/Xcode_13.0.0-beta2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderReplicatedExtension.h /Applications/Xcode_13.0.0-beta3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderReplicatedExtension.h
--- /Applications/Xcode_13.0.0-beta2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderReplicatedExtension.h	2021-06-17 01:28:17.000000000 -0400
+++ /Applications/Xcode_13.0.0-beta3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderReplicatedExtension.h	2021-07-10 09:47:46.000000000 -0400
@@ -173,8 +173,8 @@
  system will present an appropriate error message and back off until the
  next time it is signalled.
 
- Any other error will be considered to be transient and will cause the
- enumeration to be retried.
+ Any other error, including crashes of the extension process, will be considered to be transient
+ and will cause the enumeration to be retried.
 
  Errors must be in one of the following domains: NSCocoaErrorDomain, NSFileProviderErrorDomain,
  or NSPOSIXErrorDomain.
@@ -264,8 +264,8 @@
  system will present an appropriate error message and back off until the
  next time it is signalled.
 
- Any other error will be considered to be transient and will cause the
- lookup to be retried.
+ Any other error, including crashes of the extension process, will be considered to be
+ transient and will cause the lookup to be retried.
 
  Errors must be in one of the following domains: NSCocoaErrorDomain, NSFileProviderErrorDomain,
  or NSPOSIXErrorDomain.
@@ -335,15 +335,17 @@
  "NSFileProviderExtensionNonMaterializingProcessNames". A process whose name is an exact match for an
  entry in this array will not be allowed to fetch items in the extension's domains.
 
- This list will not be checked for downloads requested through file coordination.
+ In macOS 11.0 and later, this list will be checked when a download is initiated through a POSIX filesystem call.
+ In macOS 11.4 and later, this list will also be checked for downloads initiated through file coordination.
 
  Error cases:
  ------------
- If the download fails because the item is unknown, the call should
+ If the download fails because the item was deleted on the server, the call should
  fail with the NSFileProviderErrorNoSuchItem error. In that case, the system
  will consider the item has been removed from the domain and will attempt to
  delete it from disk. In case that deletion fails because there are local
- changes on this item, the system will re-create the item using createItemBasedOnTemplate.
+ changes on this item, the system will re-create the item using createItemBasedOnTemplate,
+ passing the NSFileProviderCreateItemDeletionConflicted flag.
 
  If the user does not have access to the content of the file, the provider
  can fail the call with NSCocoaErrorDomain and code NSFileReadNoPermissionError.
@@ -353,8 +355,8 @@
  In those cases, the system will present an appropriate error message and back off
  until the next time it is signalled.
 
- Any other error will be considered to be transient and will cause the
- download to be retried.
+ Any other error, including crashes of the extension process, will be considered to be transient
+ and will cause the download to be retried.
 
  Errors must be in one of the following domains: NSCocoaErrorDomain, NSFileProviderErrorDomain,
  or NSPOSIXErrorDomain.
@@ -504,8 +506,8 @@
  present an appropriate error message and back off until the next time it is signalled.
  The provider can signal the error resolution by calling signalErrorResolved:completionHandler:.
 
- Any other error will be considered to be transient and will cause the
- creation to be retried.
+ Any other error, including crashes of the extension process, will be considered to be transient
+ and will cause the creation to be retried.
 
  Errors must be in one of the following domains: NSCocoaErrorDomain, NSFileProviderErrorDomain,
  or NSPOSIXErrorDomain.
@@ -660,8 +662,8 @@
  present an appropriate error message and back off until the next time it is signalled.
  The provider can signal the error resolution by calling signalErrorResolved:completionHandler:.
 
- Any other error will be considered to be transient and will cause the
- modification to be retried.
+ Any other error, including crashes of the extension process, will be considered to be transient
+ and will cause the modification to be retried.
 
  Errors must be in one of the following domains: NSCocoaErrorDomain, NSFileProviderErrorDomain,
  or NSPOSIXErrorDomain.
@@ -747,8 +749,8 @@
  system / domain. In that case, the system will present an appropriate error
  message and back off until the next time it is signalled.
 
- Any other error will be considered to be transient and will cause the
- deletion to be retried.
+ Any other error, including crashes of the extension process, will be considered to be transient
+ and will cause the deletion to be retried.
 
  Errors must be in one of the following domains: NSCocoaErrorDomain, NSFileProviderErrorDomain,
  or NSPOSIXErrorDomain.
@@ -778,17 +780,27 @@
 
 /** Signal the end of import of on-disk items.
 
- This is called after an import of on-disk items has been triggered by either
- -[NSFileProviderManager reimportItemsBelowItemWithIdentifier:completionHandler:] or
- +[NSFileProviderManager importDomain:fromDirectoryAtURL:completionHandler:]. A
- reimport can also be started by the system independently from any request by the
- provider.
+ This is called after a reimport of on-disk items has been triggered by either
+ `-[NSFileProviderManager reimportItemsBelowItemWithIdentifier:completionHandler:]`
+ or after a new domain is created using
+ `+[NSFileProviderManager importDomain:fromDirectoryAtURL:completionHandler:]` or
+ `+[NSFileProviderManager addDomain:completionHandler:]`.
+
+ `reimport` can also be started by the system independently from any request by the
+ provider. The provider can detect those events by monitoring
+ `-[NSFileProviderDomain backingStoreIdentity]`.
 
  During import, found items will be created via the
  -[NSFileProviderExtension createItemBasedOnTemplate:fields:contents:options:completionHandler:]
  call with the NSFileProviderCreateItemMayAlreadyExist flag set.
  At the end of an import the -[NSFileProviderExtension importDidFinishWithCompletionHandler:]
  is called.
+
+ The system will attempt to import items as they are accessed by the user or applications. Import
+ of the other items is scheduled by the system as a background task. That task may be delayed,
+ for instance in low-power situations, or when the system is under heavy load. The provider can
+ force the system to process a folder and its direct children by issuing a coordination request
+ on that folder.
  */
 - (void)importDidFinishWithCompletionHandler:(void (^)(void))completionHandler;
 
@@ -965,6 +977,12 @@
  The system will cache the thumbnail for the item, and the cache will be
  invalidated when itemVersion.contentVersion changes.
 
+ Thread safety:
+ ------------
+
+ The @p perThumbnailCompletionHandler may be called from multiple threads
+ concurrently.
+
  Cancellations:
  ------------
  If the NSProgress returned by this method is cancelled, the extension should
Clone this wiki locally