Skip to content

FileProvider macOS xcode13.0 beta1

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_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderActions.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderActions.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderActions.h	2021-03-16 04:44:11.000000000 -0400
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderActions.h	2021-05-22 07:33:59.000000000 -0400
@@ -11,11 +11,13 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
+FILEPROVIDER_API_AVAILABILITY_V2_V3
 typedef NSString *NSFileProviderExtensionActionIdentifier NS_EXTENSIBLE_STRING_ENUM;
 
 /**
  This category encapsulates common user-driven actions on FileProvider's items.
  */
+FILEPROVIDER_API_AVAILABILITY_V2
 @interface NSFileProviderExtension (NSFileProviderActions)
 
 /**
@@ -32,7 +34,7 @@
    - filename (to fileURL's resource value for key NSURLNameKey)
    - creationDate (to NSURLCreationDateKey)
    - contentModificationDate (to NSURLContentModificationDateKey)
-   - typeIdentifier (to NSURLTypeIdentifierKey)
+   - contentType (to NSURLContentTypeKey)
    - documentSize (to NSURLTotalFileSizeKey on a flat file, or to the sum of the
      files sizes for a package)
    - capabilities
@@ -93,7 +95,7 @@
  - parentItemIdentifier (to the value passed in to this method)
  - filename (to directoryName)
  - creationDate (to the current date and time)
- - typeIdentifier (to "public.folder")
+ - contentType (to "public.folder" - UTTypeFolder)
  - childItemCount (to 0)
  - capabilities
 
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderDefines.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderDefines.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderDefines.h	2021-03-16 09:55:01.000000000 -0400
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderDefines.h	2021-06-02 11:07:33.000000000 -0400
@@ -5,10 +5,10 @@
 //  Copyright © 2017-2020 Apple Inc. All rights reserved.
 //
 
-#ifndef PREPROCESS_AVAILABILITY_MACROS
-
 // original API
-#define FILEPROVIDER_CLASS_AVAILABILITY API_AVAILABLE(ios(8.0)) API_UNAVAILABLE(macos, macCatalyst) API_UNAVAILABLE(watchos, tvos)
+#define FILEPROVIDER_API_AVAILABILITY_V1 API_AVAILABLE(ios(8.0)) API_UNAVAILABLE(macos, macCatalyst) API_UNAVAILABLE(watchos, tvos)
+// original API that made it to macOS
+#define FILEPROVIDER_API_AVAILABILITY_V1_V2_V3 API_AVAILABLE(ios(8.0), macos(11.0)) API_UNAVAILABLE(macCatalyst) API_UNAVAILABLE(watchos, tvos)
 // iOS API with file enumeration
 #define FILEPROVIDER_API_AVAILABILITY_V2 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, macCatalyst) API_UNAVAILABLE(watchos, tvos)
 // iOS API with file enumeration and macOS API with FPFS
@@ -17,7 +17,5 @@
 #define FILEPROVIDER_API_AVAILABILITY_V3 API_AVAILABLE(macos(11.0)) API_UNAVAILABLE(watchos, tvos) API_UNAVAILABLE(ios, macCatalyst)
 // macOS API with first revision of FPFS
 #define FILEPROVIDER_API_AVAILABILITY_V3_1 API_AVAILABLE(macos(11.3)) API_UNAVAILABLE(watchos, tvos) API_UNAVAILABLE(ios, macCatalyst)
-
-#else
-// This file intentionally left blank.
-#endif
+// macOS API with second revision of FPFS
+#define FILEPROVIDER_API_AVAILABILITY_V4_0 API_AVAILABLE(macos(12.0)) API_UNAVAILABLE(watchos, tvos) API_UNAVAILABLE(ios, macCatalyst)
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderDomain.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderDomain.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderDomain.h	2021-03-16 09:55:01.000000000 -0400
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderDomain.h	2021-06-02 12:47:29.000000000 -0400
@@ -11,6 +11,7 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
+FILEPROVIDER_API_AVAILABILITY_V2_V3
 typedef NSString *NSFileProviderDomainIdentifier NS_EXTENSIBLE_STRING_ENUM;
 
 /**
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderEnumerating.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderEnumerating.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderEnumerating.h	2021-03-16 04:44:11.000000000 -0400
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderEnumerating.h	2021-05-22 07:29:07.000000000 -0400
@@ -19,6 +19,7 @@
 
  The size of a sync anchor should not exceed a combined 500 bytes.
  */
+FILEPROVIDER_API_AVAILABILITY_V2_V3
 typedef NSData *NSFileProviderSyncAnchor NS_TYPED_EXTENSIBLE_ENUM;
 
 /**
@@ -28,6 +29,7 @@
 
  The size of a page should not exceed 500 bytes.
  */
+FILEPROVIDER_API_AVAILABILITY_V2_V3
 typedef NSData *NSFileProviderPage NS_TYPED_EXTENSIBLE_ENUM;
 
 FOUNDATION_EXPORT FILEPROVIDER_API_AVAILABILITY_V2_V3
@@ -35,6 +37,7 @@
 FOUNDATION_EXPORT FILEPROVIDER_API_AVAILABILITY_V2_V3
 NSFileProviderPage const NSFileProviderInitialPageSortedByName;
 
+FILEPROVIDER_API_AVAILABILITY_V2_V3
 @protocol NSFileProviderEnumerationObserver <NSObject>
 
 - (void)didEnumerateItems:(NSArray <id<NSFileProviderItem>> *)updatedItems;
@@ -67,6 +70,7 @@
 
 @end
 
+FILEPROVIDER_API_AVAILABILITY_V2_V3
 @protocol NSFileProviderChangeObserver <NSObject>
 
 /**
@@ -126,7 +130,7 @@
 
 @end
 
-
+FILEPROVIDER_API_AVAILABILITY_V2_V3
 @protocol NSFileProviderEnumerator <NSObject>
 
 - (void)invalidate;
@@ -185,15 +189,13 @@
  - continue enumerating pages, each time from the page returned in the previous
    enumeration, until finishEnumeratingUpToPage: is called with nextPage set to
    nil
- - enumerate changes starting from the sync anchor returned in (1)
- - continue enumerating changes, each time from the sync anchor returned in the
-   previous enumeration, until finishEnumeratingChangesUpToSyncAnchor: is called
-   with moreComing:NO
-
- This method will be called again if you signal that there are more changes with
- -[NSFileProviderManager signalEnumeratorForContainerItemIdentifier:
- completionHandler:] and again, the system will enumerate changes until
- finishEnumeratingChangesUpToSyncAnchor: is called with moreComing:NO.
+ - enumerate changes starting from the sync anchor returned in (1), until
+   finishEnumeratingChangesUpToSyncAnchor: is called with the latest sync anchor.
+   If moreComing is YES, continue enumerating changes, using the latest sync anchor returned.
+   If moreComing is NO, stop enumerating.
+ - When the extension calls -[NSFileProviderManager signalEnumeratorForContainerItemIdentifier:
+   completionHandler:] to signal more changes, the system will again enumerate changes,
+   starting at the latest known sync anchor from finishEnumeratingChangesUpToSyncAnchor.
 
  NOTE that the change-based observation methods are marked optional for historical
  reasons, but are really required. System performance will be severely degraded if
@@ -204,6 +206,7 @@
 
 @end
 
+FILEPROVIDER_API_AVAILABILITY_V2
 @interface NSFileProviderExtension (NSFileProviderEnumeration)
 
 /**
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderError.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderError.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderError.h	2021-03-16 09:55:01.000000000 -0400
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderError.h	2021-06-02 12:47:29.000000000 -0400
@@ -13,7 +13,7 @@
 
 FOUNDATION_EXPORT NSErrorDomain const NSFileProviderErrorDomain FILEPROVIDER_API_AVAILABILITY_V2_V3;
 
-FOUNDATION_EXPORT NSErrorUserInfoKey const NSFileProviderErrorCollidingItemKey API_DEPRECATED("NSFileProviderErrorItemKey", ios(8.0, 13.0)) API_UNAVAILABLE(macos, tvos, watchos);
+FOUNDATION_EXPORT NSErrorUserInfoKey const NSFileProviderErrorCollidingItemKey API_DEPRECATED("NSFileProviderErrorItemKey", ios(8.0, 13.0)) API_UNAVAILABLE(macos, tvos, watchos) API_UNAVAILABLE(macCatalyst);
 FOUNDATION_EXPORT NSErrorUserInfoKey const NSFileProviderErrorItemKey API_AVAILABLE(ios(13.0), macos(10.15)) API_UNAVAILABLE(macCatalyst) API_UNAVAILABLE(watchos, tvos);
 FOUNDATION_EXPORT NSErrorUserInfoKey const NSFileProviderErrorNonExistentItemIdentifierKey FILEPROVIDER_API_AVAILABILITY_V2_V3;
 
@@ -80,10 +80,17 @@
     NSFileProviderErrorNewerExtensionVersionFound FILEPROVIDER_API_AVAILABILITY_V3 = -2004,
 
     /**
-     Returned by NSFileProviderManager if a barrier failed for a sync-related error.
+     Indicates that synchronization cannot happen.
+
+     This error can be returned by the provider or the system.
+
+     This is returned by NSFileProviderManager if a barrier failed for a sync-related error.
 
      If the failure is caused by a specific item, the NSFileProviderErrorItemKey will be set to the corresponding item identifier
      and the NSUnderlyingErrorKey will be set to the error encountered by that item.
+
+     When a provider returns that error, it means the syncing an item is definitively broken, and cannot be resolved without an update of
+     either the provider or the system.
      */
     NSFileProviderErrorCannotSynchronize FILEPROVIDER_API_AVAILABILITY_V3 = -2005,
 
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderExtension.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderExtension.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderExtension.h	2021-03-16 09:55:01.000000000 -0400
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderExtension.h	2021-06-02 12:44:31.000000000 -0400
@@ -11,7 +11,7 @@
 
 @class NSFileProviderDomain;
 
-FILEPROVIDER_CLASS_AVAILABILITY
+FILEPROVIDER_API_AVAILABILITY_V1
 @interface NSFileProviderExtension : NSObject
 
 - (nullable NSFileProviderItem)itemForIdentifier:(NSFileProviderItemIdentifier)identifier error:(NSError * _Nullable *)error NS_SWIFT_NAME(item(for:)) FILEPROVIDER_API_AVAILABILITY_V2;
@@ -61,6 +61,7 @@
 
 @end
 
+FILEPROVIDER_API_AVAILABILITY_V2
 @interface NSFileProviderExtension (Deprecated)
 
 /**
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderItem.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderItem.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderItem.h	2021-03-16 09:55:01.000000000 -0400
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderItem.h	2021-06-02 12:44:31.000000000 -0400
@@ -12,6 +12,7 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
+FILEPROVIDER_API_AVAILABILITY_V1_V2_V3
 typedef NSString *NSFileProviderItemIdentifier NS_EXTENSIBLE_STRING_ENUM;
 
 /**
@@ -107,6 +108,7 @@
  */
 FOUNDATION_EXPORT unsigned long long const NSFileProviderFavoriteRankUnranked FILEPROVIDER_API_AVAILABILITY_V2_V3;
 
+FILEPROVIDER_API_AVAILABILITY_V2_V3
 typedef NS_OPTIONS(NSUInteger, NSFileProviderItemCapabilities) {
     /**
      Indicates that the file can be opened for reading.  If set on a folder
@@ -170,7 +172,7 @@
      */
     NSFileProviderItemCapabilitiesAllowsContentEnumerating = NSFileProviderItemCapabilitiesAllowsReading,
 
-    NSFileProviderItemCapabilitiesAllowsAll =
+    NSFileProviderItemCapabilitiesAllowsAll API_DEPRECATED("This capability is no longer supported, and does not contain all capabilities. Please migrate to directly specifying each of the individual capabilities that should be allowed for the item.", ios(11.0, 15.0), macos(11.0, 12.0)) =
           NSFileProviderItemCapabilitiesAllowsReading
         | NSFileProviderItemCapabilitiesAllowsWriting
         | NSFileProviderItemCapabilitiesAllowsReparenting
@@ -201,8 +203,27 @@
     NSFileProviderFileSystemPathExtensionHidden = 1 << 4,
 };
 
+FILEPROVIDER_API_AVAILABILITY_V4_0
+typedef struct NSFileProviderTypeAndCreator {
+    /**
+     The first word of the FinderInfo structure. It matches the file type code
+     */
+    OSType type;
+    /**
+     The second word of the FinderInfo structure. It matches the creator code
+     */
+    OSType creator;
+} NSFileProviderTypeAndCreator;
+
+FILEPROVIDER_API_AVAILABILITY_V2_V3
 @protocol NSFileProviderItem <NSObject>
 
+/**
+ The identifier of the item.
+
+ The itemIdentifier should not contain sensitive information, as it may be recorded in system logs and
+ diagnostic files.
+ */
 @property (nonatomic, readonly, copy) NSFileProviderItemIdentifier itemIdentifier;
 
 /**
@@ -223,6 +244,10 @@
 
 /**
  The file or directory name, complete with its file extension.
+
+ The filename property must not be an empty string, including when the item identifier is
+ NSFileProviderRootContainerItemIdentifier. The filename for NSFileProviderRootContainerItemIdentifier
+ may be displayed in the user interface. Therefore it should be a user-friendly string.
  */
 @property (nonatomic, readonly, copy) NSString *filename;
 
@@ -236,6 +261,9 @@
  On iOS, items must implement either contentType or typeIdentifier. Note
  that contentType is not available on iOS 13 and earlier, so typeIdentifier
  is required in order to target iOS 13 and earlier.
+
+ Changing the contentType for a given item that would result in a transition to/from a folder
+ or to/from a symlink is not supported.
  */
 @property (nonatomic, readonly, copy) UTType *contentType API_AVAILABLE(ios(14.0), macos(11.0));
 
@@ -252,12 +280,27 @@
  is required in order to target iOS 13 and earlier.
  */
 @property (nonatomic, readonly, copy) NSString *typeIdentifier
-    API_DEPRECATED_WITH_REPLACEMENT("contentType", ios(11.0, API_TO_BE_DEPRECATED))
+    API_DEPRECATED_WITH_REPLACEMENT("contentType", ios(11.0, 15.0))
     API_UNAVAILABLE(macos);
 
 /**
+ File type and creator code for the item.
+
+ This property contains two variables, one for the file type code and one for the creator code.
+ Both will be synchronized at the same time, so you have to define both when changing one.
+
+ On change on this structure, the NSFileProviderItemTypeAndCreator field will be set in the
+ NSFileProviderItemFields argument to createItem/modifyItem.
+
+ These will be written down in the FinderInfo structure if relevant.
+ */
+@property (nonatomic, readonly) NSFileProviderTypeAndCreator typeAndCreator FILEPROVIDER_API_AVAILABILITY_V4_0;
+
+/**
  The capabilities of the item.  This controls the list of actions that the UI
  will allow for the item.
+
+ Capabilities on an item only apply to the item itself. They are not inherited by the children of directories.
  */
 @property (nonatomic, readonly) NSFileProviderItemCapabilities capabilities;
 
@@ -441,15 +484,39 @@
 /**
  The target of a symlink.
 
- If a replicated extension expose an item with the typeIdentifier public.symlink (kUTTypeSymLink),
+ If a replicated extension expose an item with the contentType public.symlink (UTTypeSymbolicLink),
  this field should contain the target of the symlink.
  */
 @property (nonatomic, readonly, copy, nullable) NSString *symlinkTargetPath
     FILEPROVIDER_API_AVAILABILITY_V3;
 
 /**
- Use this dictionary to add state information to the item. It is accessible to
- FileProviderUI action predicates and user interaction predicates [1].
+ Use this dictionary to add state information to the item. Entries are accessible to
+ FileProviderUI and non-UI action predicates and user interaction predicates [1] via the
+ `userInfo` context key.
+
+ Additionally, any entry of this dictionary with a key ending in `.inherited`
+ will be accessible to predicates for descendants of this item via the context key `inheritedUserInfo`.
+
+ Items can redefine inherited values for their descendants by specifying the same key used in an ancestor's `userInfo`.
+ Thus, `inheritedUserInfo` for a given item is a dictionary of `*.inherited` keys from all if its ancestors, with each value
+ taken from the nearest ancestor that has the entry defined.
+
+ In this example directory structure:
+ root
+ |_ parent
+   |_ child
+     |_ grandchild
+
+ with the following userInfo values set:
+ parent.userInfo = { "a.inherited": YES, "b.inherited": YES }
+ child.userInfo = { "a.inherited": NO, "c.inherited": NO }
+ grandchild.userInfo = { }
+
+ the following inheritedUserInfo values will be provided:
+ parent.inheritedUserInfo = { }
+ child.inheritedUserInfo = { "a.inherited": YES, "b.inherited": YES }
+ grandchild.inheritedUserInfo = { "a.inherited": NO, "b.inherited": YES, "c.inherited": NO }
 
  All values for this dictionary must be of type String, Number, Bool or Date.
 
@@ -460,12 +527,23 @@
         @parameters predicates
             - `destinationItem`: the destination item for an action (only present for Move/Import)
             - `action` : the action that is being performed
-                 'Move'       : moving items within the same provider
-                 'MoveOut' : moving items out of the provider
-                 'MoveIn'    : importing item(s) into a folder/root of the provider
+                 'Move'       : moving item(s) within the same provider
+                 'MoveOut'    : moving item(s) out of the provider
+                 'MoveIn'     : importing item(s) into a folder/root of the provider
+                 'Copy'       : copying item(s) within the same provider
+                 'CopyOut'    : copying item(s) out of the provider
+                 'CopyIn'     : copying item(s) into a folder/root of the provider
                  'Trash'      : trashing item(s)
+                 'Create'      : creating an item (available in macOS 12.0 and later)
+                            The Create action will be evaluated when the user creates a new file
+                            or folder in a system Open/Save panel.
+                            The sourceItem is the file/folder being created. The only field that is
+                            populated for this item is the filename. The type of file/folder, size, etc,
+                            are unknown at Create evaluation time.
+                            The destinationItem is the directory which the file/folder is being created
+                            within.
                  'Delete'     : deleting item(s)
-                 'ExcludeFromSync' : deleting items(s) because the user chose to exclude those from sync
+                 'ExcludeFromSync' : deleting items(s) because the user chose to exclude those from sync (available in macOS 11.3 and later)
                  'Rename'  : renaming item(s) (available in macOS 11.3 and later)
             - `sourceItem` : current item that the predicate is evaluating
             - `sourceItemsCount` :
@@ -487,12 +565,26 @@
         - `RecoveryOptions` (optional)
             - `Continue` *bool*, the boolean for whether to have a continue button - default value is YES if not specified
             - `Destructive` *bool*, the boolean for whether continuing is a destructive action - default value is NO if not specified
+    - `HelpURL` *string*: If present, a help button will be displayed on the Alert that is shown. If the user
+                   clicks the help button, this help URL will be opened. (available in macOS 12.0 and later)
     - `SubInteractions `: *dictionary* (same as `NSFileProviderUserInteractions`)
+    - `SupressionIdentifier` *string*: If present, when this predicate matches, the alert will display an option to
+                           suppress future alerts from UserInteractions with the same
+                           SuppressionIdentifier (including the current UserInteraction). This also
+                           requires implementing the `NSFileProviderUserInteractionSuppressing`
+                           protocol on the principal class of the FileProvider extension (available in
+                           macOS 12.0 and later).
 
  For each interaction, either Alert or SubInteractions must be specified. SubInteractions will be evaluated if the main ActivationRule evaluates to
  YES for at least once. This allows you to match a general pattern via the top-level activation rule and then select a specialized error message from a list
  of subpatterns.
 
+ At most one UserInteraction alert will be shown for each FileProvider domain involved in the user's Action. For
+ instance, if provider A defines a UserInteraction for MoveOut actions, and provider B defines a UserInteraction
+ for MoveIn operations. When the user moves a file from A to B, and the predicate for both UserInteraction
+ matches, then both of the UserInteraction alerts will be shown to the user. However, as soon as the user
+ denies any of the alerts, the remainder will not be shown, and the action will be denied.
+
  Here is a sample extension Info.plist:
 

@@ -583,7 +675,7 @@

@end

+FILEPROVIDER_API_AVAILABILITY_V2_V3 typedef id NSFileProviderItem;

NS_ASSUME_NONNULL_END diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderItemDecoration.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderItemDecoration.h --- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderItemDecoration.h 2021-03-16 04:44:11.000000000 -0400 +++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderItemDecoration.h 2021-05-22 08:31:34.000000000 -0400 @@ -9,6 +9,7 @@ #import <FileProvider/NSFileProviderDefines.h> #import <FileProvider/NSFileProviderItem.h>

+FILEPROVIDER_API_AVAILABILITY_V3 typedef NSString *NSFileProviderItemDecorationIdentifier NS_TYPED_EXTENSIBLE_ENUM;

/** @@ -59,6 +60,7 @@

*/

+FILEPROVIDER_API_AVAILABILITY_V3 @protocol NSFileProviderItemDecorating /** Returns an array of decorations for the item. @@ -66,5 +68,5 @@ To adopt this protocol, implement the -decorations method on your NSFileProviderItem to return valid decoration identifiers from your Info.plist. */

  • @property (nonatomic, nullable, readonly, strong) NSArray *decorations FILEPROVIDER_API_AVAILABILITY_V3;
  • @property (nonatomic, nullable, readonly, strong) NSArray *decorations; @end diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderManager.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderManager.h --- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderManager.h 2021-03-16 09:55:01.000000000 -0400 +++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderManager.h 2021-06-02 12:44:31.000000000 -0400 @@ -16,6 +16,20 @@ @class NSFileProviderDomain; @class NSFileProviderRequest;

+typedef NS_ENUM(NSInteger, NSFileProviderDomainRemovalMode) {

  • /// Don't keep any files that are current in the domain
  • NSFileProviderDomainRemovalModeRemoveAll = 0,
  • /// Delete the domain from the system but keeps the at least all the
  • /// dirty corresponding user data around.
  • NSFileProviderDomainRemovalModePreserveDirtyUserData = 1,
  • /// Delete the domain from the system but keeps all the downloaded
  • /// corresponding user data around.
  • NSFileProviderDomainRemovalModePreserveDownloadedUserData = 2, +} NS_SWIFT_NAME(NSFileProviderManager.DomainRemovalMode) FILEPROVIDER_API_AVAILABILITY_V4_0;

/** The file provider manager allows you to communicate with the file provider framework from both the extension and related processes. @@ -198,6 +212,11 @@

  • (void)removeDomain:(NSFileProviderDomain *)domain completionHandler:(void(^)(NSError *_Nullable error))completionHandler;

/**

  • Remove a domain with options
  • */ ++ (void)removeDomain:(NSFileProviderDomain *)domain mode:(NSFileProviderDomainRemovalMode)mode completionHandler:(void(^)(NSURL *_Nullable_result preservedLocation, NSError *_Nullable error))completionHandler FILEPROVIDER_API_AVAILABILITY_V4_0;

+/** Get all registered domains. */

  • (void)getDomainsWithCompletionHandler:(void (^)(NSArray<NSFileProviderDomain > domains, NSError * _Nullable error))completionHandler; @@ -210,10 +229,11 @@ / Cancel throttling applied by the system to any item because of that error.
  • This call supports 3 types of errors:
  • This call supports 4 types of errors:
    • NSFileProviderErrorNotAuthenticated
    • NSFileProviderErrorInsufficientQuota
    • NSFileProviderErrorServerUnreachable
    • NSFileProviderErrorCannotSynchronize */
  • (void)signalErrorResolved:(NSError *)error completionHandler:(void(^)(NSError *_Nullable error))completionHandler FILEPROVIDER_API_AVAILABILITY_V3; @@ -291,6 +311,9 @@

/** The version of the domain when the pending set was last refreshed by the system. +

  • This property is updated when the enumeration methods are called on the pending set enumerator. The value
  • is initially nil. */ @property (nonatomic, readonly, nullable) NSFileProviderDomainVersion *domainVersion;

diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderReplicatedExtension.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderReplicatedExtension.h --- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderReplicatedExtension.h 2021-03-16 04:44:11.000000000 -0400 +++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderReplicatedExtension.h 2021-05-22 08:31:34.000000000 -0400 @@ -98,6 +98,7 @@ NSFileProviderItemContentModificationDate = 1 << 7, NSFileProviderItemFileSystemFlags = 1 << 8, NSFileProviderItemExtendedAttributes = 1 << 9,

  • NSFileProviderItemTypeAndCreator FILEPROVIDER_API_AVAILABILITY_V4_0 = 1 << 10, } FILEPROVIDER_API_AVAILABILITY_V3;

#pragma mark - Extension with FPFS support @@ -117,10 +118,13 @@ Once this has been called, the directory and its children should be included in the working set.

  • This is also used to subscribe to live updates for a single document. In that
  • case, -[NSFileProviderEnumerator enumerateChangesToObserver:fromSyncAnchor:]
  • will be called and the enumeration results shouldn't include items other than
  • the very item that the enumeration was started on.
  • This is also used to subscribe to live updates for a single document.

  • The system will keep an enumerator open in the extension on directories that are

  • presented to the user (for instance, in Finder), and on document on which an application

  • has a NSFilePresenter. The provider can use the existence of that enumerator as a hint

  • that the user is actively seeing / using the item in question, and prioritize the delivery

  • of updates on the item or its children in the working set.

    If returning nil, you must set the error out parameter.

@@ -171,6 +175,14 @@

Any other error 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.
  • For errors which can not be represented using an existing error code in one of these domains, the extension
  • should construct an NSError with domain NSCocoaErrorDomain and code NSXPCConnectionReplyInvalid.
  • The extension should set the NSUnderlyingErrorKey in the NSError's userInfo to the error which could not
  • be represented. */
  • (nullable id)enumeratorForContainerItemIdentifier:(NSFileProviderItemIdentifier)containerItemIdentifier request:(NSFileProviderRequest *)request @@ -235,6 +247,14 @@ Any other error 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.

  • For errors which can not be represented using an existing error code in one of these domains, the extension

  • should construct an NSError with domain NSCocoaErrorDomain and code NSXPCConnectionReplyInvalid.

  • The extension should set the NSUnderlyingErrorKey in the NSError's userInfo to the error which could not

  • be represented.

  • Cancellations:

    If the NSProgress returned by this method is cancelled, the extension should @@ -285,6 +305,18 @@ moment the system unlinks the file, the file may unexpectedly still be on disk the next time an instance of the extension is created. The extension is then responsible for deleting that file.

  • Disallowing processes from fetching items:


  • The system automatically downloads files on POSIX accesses. The extension may wish to disallow this class of

  • downloads for specific applications.

  • The extension can set an array of strings into the UserDefault key

  • "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.

  • Error cases:

    If the download fails because the item is unknown, the call should @@ -304,6 +336,14 @@ Any other error 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.

  • For errors which can not be represented using an existing error code in one of these domains, the extension

  • should construct an NSError with domain NSCocoaErrorDomain and code NSXPCConnectionReplyInvalid.

  • The extension should set the NSUnderlyingErrorKey in the NSError's userInfo to the error which could not

  • be represented.

  • Cancellations:

    If the NSProgress returned by this method is cancelled, the extension should @@ -438,15 +478,23 @@ the system will call createItemBasedOnTemplate again.

    The extension can also report the NSFileProviderErrorNotAuthenticated,

  • NSFileProviderErrorServerUnreachable or NSFileProviderErrorInsufficientQuota
  • in case the modification cannot be applied because of the current state of the
  • system / domain. In that case, the system will present an appropriate error
  • message and back off until the next time it is signalled.
  • NSFileProviderErrorServerUnreachable, NSFileProviderErrorInsufficientQuota

  • or NSFileProviderErrorCannotSynchronize in case the modification cannot be applied

  • because of the current state of the system / domain. In that case, the system will

  • 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.

  • Errors must be in one of the following domains: NSCocoaErrorDomain, NSFileProviderErrorDomain,

  • or NSPOSIXErrorDomain.

  • For errors which can not be represented using an existing error code in one of these domains, the extension

  • should construct an NSError with domain NSCocoaErrorDomain and code NSXPCConnectionReplyInvalid.

  • The extension should set the NSUnderlyingErrorKey in the NSError's userInfo to the error which could not

  • be represented.

  • Cancellations:

    If the NSProgress returned by this method is cancelled, the extension should @@ -569,15 +617,23 @@ modifyItem again.

    The extension can also report the NSFileProviderErrorNotAuthenticated,

  • NSFileProviderErrorServerUnreachable or NSFileProviderErrorInsufficientQuota
  • in case the modification cannot be applied because of the current state of the
  • system / domain. In that case, the system will present an appropriate error
  • message and back off until the next time it is signalled.
  • NSFileProviderErrorServerUnreachable, NSFileProviderErrorInsufficientQuota

  • or NSFileProviderErrorCannotSynchronize in case the modification cannot be applied

  • because of the current state of the system / domain. In that case, the system will

  • 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.

  • Errors must be in one of the following domains: NSCocoaErrorDomain, NSFileProviderErrorDomain,

  • or NSPOSIXErrorDomain.

  • For errors which can not be represented using an existing error code in one of these domains, the extension

  • should construct an NSError with domain NSCocoaErrorDomain and code NSXPCConnectionReplyInvalid.

  • The extension should set the NSUnderlyingErrorKey in the NSError's userInfo to the error which could not

  • be represented.

  • Cancellations:

    If the NSProgress returned by this method is cancelled, the extension should @@ -648,15 +704,23 @@ that item may have already been deleted remotely, then the extension should report a success.

  • The extension can also report the NSFileProviderErrorNotAuthenticated and
  • NSFileProviderErrorServerUnreachable in case the deletion cannot be applied
  • because of the current state of the system / domain. In that case, the system
  • will present an appropriate error message and back off until the next time it
  • is signalled.
  • The extension can also report the NSFileProviderErrorNotAuthenticated,

  • NSFileProviderErrorServerUnreachable, or NSFileProviderErrorCannotSynchronize

  • in case the deletion cannot be applied because of the current state of the

  • 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.

  • Errors must be in one of the following domains: NSCocoaErrorDomain, NSFileProviderErrorDomain,

  • or NSPOSIXErrorDomain.

  • For errors which can not be represented using an existing error code in one of these domains, the extension

  • should construct an NSError with domain NSCocoaErrorDomain and code NSXPCConnectionReplyInvalid.

  • The extension should set the NSUnderlyingErrorKey in the NSError's userInfo to the error which could not

  • be represented.

  • Cancellations:

    If the NSProgress returned by this method is cancelled, the extension should @@ -902,6 +966,38 @@

@end

+/**

  • Protocol to implement for managing UserInteraction alerts.
  • */ +FILEPROVIDER_API_AVAILABILITY_V4_0 +@protocol NSFileProviderUserInteractionSuppressing

+/**

  • Suppression management:
  • The extension may choose to give the user the option to suppress certain UserInteraction alerts.
  • In order to do so, the extension must both implement NSFileProviderUserInteractionSuppressing, as well as
  • configure the desired UserInteractions in the Info.plist with the SuppressionIdentifier field.
  • When FileProvider needs to evaluate whether to display a UserInteraction alert, it will call
  • -[NSFileProviderUserInteractionSuppressing isInteractionSuppressedForIdentifier:]. When the user indicates that they do not
  • wish to see a given SuppressionIdentifiers's alert again, FileProvider will call
  • -[NSFileProviderUserInteractionSuppressing setInteractionSuppressed:forIdentifier:].
  • The extension can choose whether the suppression should apply only to the domain upon which
  • -[NSFileProviderUserInteractionSuppressing setInteractionSuppressed:forIdentifier:] was called, or if it should apply to all
  • domains for their provider. For instance, the extension could choose to suppress future alerts related
  • to adding an item to a shared folder across all domains, after the user chooses to suppress the alerts
  • in a specific domain's context. Or, the extension could choose to only suppress that alert for the
  • specific domain it was displayed within, and in the future, the user would see the same alert in the same
  • context, if they take the same action in another domain.
  • */

+- (void)setInteractionSuppressed:(BOOL)suppression forIdentifier:(NSString *)suppressionIdentifier; +- (BOOL)isInteractionSuppressedForIdentifier:(NSString *)suppressionIdentifier; + +@end + FILEPROVIDER_API_AVAILABILITY_V3_1 @protocol NSFileProviderDomainState

@@ -928,8 +1024,9 @@ /** Global state of the domain.

  • Use this dictionary to add state information to the domain. It is accessible to
  • user interaction predicates via the domainUserInfo context key.
  • Use this dictionary to add state information to the domain. It is accessible to predicates for

  • User Interactions, FileProvider Actions, and FileProviderUI Actions, via the top-level domainUserInfo context

  • key.

    This dictionary must only contain key and value classes in the following list: NSString, NSNumber, NSDate, and NSPersonNameComponents. diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderService.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderService.h --- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderService.h 2021-03-16 04:44:11.000000000 -0400 +++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderService.h 2021-05-22 08:31:34.000000000 -0400 @@ -44,6 +44,7 @@ Client applications can retrieve the list of supported services by calling @c -[NSFileManager getFileProviderServicesForItemAtURL:] for a specific item URL. */ +FILEPROVIDER_API_AVAILABILITY_V2 @interface NSFileProviderExtension (NSFileProviderService)

  • (nullable NSArray <id > *)supportedServiceSourcesForItemIdentifier:(NSFileProviderItemIdentifier)itemIdentifier error:(NSError **)error NS_SWIFT_NAME(supportedServiceSources(for:)) FILEPROVIDER_API_AVAILABILITY_V2; diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderThumbnailing.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderThumbnailing.h --- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderThumbnailing.h 2021-03-16 04:44:11.000000000 -0400 +++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderThumbnailing.h 2021-05-22 08:31:34.000000000 -0400 @@ -12,6 +12,7 @@

NS_ASSUME_NONNULL_BEGIN

+FILEPROVIDER_API_AVAILABILITY_V2 @interface NSFileProviderExtension (NSFileProviderThumbnailing)

/**

Clone this wiki locally