Skip to content

TVServices tvOS xcode14.0 beta2

Manuel de la Pena edited this page Jul 19, 2022 · 3 revisions

#TVServices.framework https://github.com/xamarin/xamarin-macios/pull/15553

diff -ruN /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/TVServices.framework/Headers/TVAppProfileDescriptor.h /Applications/Xcode_14.0.0-beta2.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/TVServices.framework/Headers/TVAppProfileDescriptor.h
--- /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/TVServices.framework/Headers/TVAppProfileDescriptor.h	2022-06-03 18:06:57.000000000 -0400
+++ /Applications/Xcode_14.0.0-beta2.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/TVServices.framework/Headers/TVAppProfileDescriptor.h	2022-06-17 14:48:51.000000000 -0400
@@ -2,7 +2,7 @@
 //  TVAppProfileDescriptor.h
 //  TVServices Framework
 //
-//  Copyright © 2019 Apple. All rights reserved.
+//  Copyright © 2022 Apple. All rights reserved.
 //
 
 #import <Foundation/Foundation.h>
@@ -15,7 +15,7 @@
  @class         TVAppProfileDescriptor
  @abstract      A simple model object that describes a profile within an app that has multiple user profiles.
  */
-API_AVAILABLE(tvos(13.0))
+API_DEPRECATED("User Management capability get-current-user is no longer supported. Please use runs-as-current-user instead alongside kSecUseUserIndependentKeychain for sharing keychain items across users.", tvos(13.0, 16.0))
 @interface TVAppProfileDescriptor : NSObject <NSCopying, NSSecureCoding>
 
 /*!
diff -ruN /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/TVServices.framework/Headers/TVUserManager.h /Applications/Xcode_14.0.0-beta2.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/TVServices.framework/Headers/TVUserManager.h
--- /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/TVServices.framework/Headers/TVUserManager.h	2022-06-03 18:06:57.000000000 -0400
+++ /Applications/Xcode_14.0.0-beta2.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/TVServices.framework/Headers/TVUserManager.h	2022-06-17 14:51:06.000000000 -0400
@@ -2,7 +2,7 @@
 //  TVUserManager.h
 //  TVServices Framework
 //
-//  Copyright © 2019 Apple. All rights reserved.
+//  Copyright © 2022 Apple. All rights reserved.
 //
 
 #import <Foundation/Foundation.h>
@@ -15,22 +15,51 @@
 /*
  User identifiers are ASCII strings of 64 characters or less. They should never be shown to the user in UI, as they will be meaningless to the user.  These identifiers should be compared case-sensitively (e.g., isEqual: is just fine).
  */
-typedef NSString *TVUserIdentifier NS_SWIFT_BRIDGED_TYPEDEF;
+typedef NSString *TVUserIdentifier NS_SWIFT_BRIDGED_TYPEDEF API_DEPRECATED("User Management capability get-current-user is no longer supported. Please use runs-as-current-user instead alongside kSecUseUserIndependentKeychain for sharing keychain items across users.", tvos(13.0, 16.0));
 
 
 /*!
  @class         TVUserManager
- @abstract      Allows apps to maintain a mapping from system users to preferred app-specific profiles.
- @discussion    Applications sometimes have their own notion of a "profile", to track users' preferences or other state. This class allows an application to find out which user that the system is currently focused on, and manage mappings from the users to their preferred profiles.
+ @abstract      An object that provides facilities to best handle system users
+ as it relates to their preferences like app-specific profiles.
+ @discussion    Applications sometimes have their own notion of a "profile", to
+ track users' preferences or other state. Those applications can rely on tvOS
+ to handle separating each user's data by adopting the "Runs as Current User"
+ entitlement, with this entitlement reading and writing data will happen for the
+ selected user.
+
+ @note When running as the current user each user would have to sign in again to
+ the app, to avoid that behavior it is highly recommended that those apps also
+ use `kSecUseUserIndependentKeychain` to store their account credentials across
+ users.
+ */
+API_AVAILABLE(tvos(13.0))
+@interface TVUserManager : NSObject
+
+/*!
+ @property shouldStorePreferencesForCurrentUser
+ @abstract Indicates if the system recommends that the app saves the user's
+ preferences.
 
- You can allocate and init TVUserManagers as you need them; they will all return and store the same information, as this is just an interface to common underlying system facilities.  You can discard the TVUserManager when you're done with it, you don't need to hold onto one either, unless you want to observe one's properties via KVO.
+ @discussion Apps with the User Management capability "Runs as Current User"
+ should remember the user's choices, like which profile they use, that way
+ people will immediately see the content they want without any interruptions
+ like having to pick their profile again.
 
- Apps must have the "com.apple.developer.user-management" entitlement, with array value containing the string object @"get-current-user", to make use of this API.  You should do this by turning on the <TBD NAME IN PROGRESS> Capability in the Capabilities tab of your project's app target settings in Xcode.
+ You can safely assume that storing the user's preferences is the desirable
+ behavior. In some situations though it might not be, and this method represents
+ when the system believe it best to continue to, for example, show the profile
+ picker.
 
- An application would typically read the currentUserIdentifier property at launch, and if there is a saved preferred profile for that user, adopt that profile without putting up a profile picker. If there is no preference, an application should put up its profile picker and decide whether to save the chosen profile as the user's preferred profile.  An application can also listen for changes in that property, and automatically switch to the new user's preferred profile, if appropriate.
+ This property will return `NO` if there is only one Apple TV user, or if your
+ app doesn't have the capability of running as the current user.
+
+ @note If your app is deployed on tvOS 15 or earlier, you should treat those as
+ if this property is returning `NO`.
  */
-API_AVAILABLE(tvos(13.0))
-@interface TVUserManager : NSObject
+@property (nonatomic, assign, readonly) BOOL shouldStorePreferencesForCurrentUser API_AVAILABLE(tvos(16.0)) API_UNAVAILABLE(macos, ios, watchos);
+
+// MARK: - Deprecated
 
 /*!
  @property      currentUserIdentifier
@@ -38,7 +67,7 @@
  @discussion    This value may be nil if no value is available to the application.  When this is nil or the application has no existing mapping from the user to a preferred profile, the application can put up its profile picker or adopt some other appropriate behavior. For users which are part of the Home this Apple TV is in, this value is the same on all the Apple TVs that are part of that Home.
  This property is KVO-observable, to watch for changes.  You will need to hold onto a TVUserManager instance to observe this property on it.
  */
-@property (nonatomic, nullable, readonly) TVUserIdentifier currentUserIdentifier;
+@property (nonatomic, nullable, readonly) TVUserIdentifier currentUserIdentifier API_DEPRECATED("User Management capability get-current-user is no longer supported. Please use runs-as-current-user instead alongside kSecUseUserIndependentKeychain for sharing keychain items across users.", tvos(13.0, 16.0));
 
 /*!
  @property      userIdentifiersForCurrentProfile
@@ -46,7 +75,7 @@
  @discussion    The value should be an NSArray with the system user identifiers that prefer the current profile in the application. An application which is maintaining system user identifer to profile mappings should write a new value to this set whenever the user changes the current profile within the application. The value of this property can be read, but it simply contains the last value stored in it, and starts empty when an application launches.
  This property is KVO-observable, to watch for changes.  You will need to hold onto a TVUserManager instance to observe this property on it.
  */
-@property (nonatomic, copy) NSArray<TVUserIdentifier> *userIdentifiersForCurrentProfile;
+@property (nonatomic, copy) NSArray<TVUserIdentifier> *userIdentifiersForCurrentProfile API_DEPRECATED("User Management capability get-current-user is no longer supported. Please use runs-as-current-user instead alongside kSecUseUserIndependentKeychain for sharing keychain items across users.", tvos(13.0, 16.0));
 
 /*!
  @method        presentProfilePreferencePanelWithCurrentSettings:availableProfiles:completion:
@@ -58,7 +87,7 @@
  The completion block is executed on an arbitrary dispatch queue / thread.
  If invoked from within an extension, no UI will be presented and the dictionary parameter to the callback will be empty.
  */
-- (void)presentProfilePreferencePanelWithCurrentSettings:(NSDictionary<TVUserIdentifier, TVAppProfileDescriptor *> *)currentSettings availableProfiles:(NSArray<TVAppProfileDescriptor *> *)availableProfiles completion:(void (^)(NSDictionary<TVUserIdentifier, TVAppProfileDescriptor *> *newSettings))completion NS_SWIFT_NAME(presentProfilePreferencePanel(currentSettings:availableProfiles:completion:));
+- (void)presentProfilePreferencePanelWithCurrentSettings:(NSDictionary<TVUserIdentifier, TVAppProfileDescriptor *> *)currentSettings availableProfiles:(NSArray<TVAppProfileDescriptor *> *)availableProfiles completion:(void (^)(NSDictionary<TVUserIdentifier, TVAppProfileDescriptor *> *newSettings))completion NS_SWIFT_NAME(presentProfilePreferencePanel(currentSettings:availableProfiles:completion:)) API_DEPRECATED("User Management capability get-current-user is no longer supported. Please use runs-as-current-user instead alongside kSecUseUserIndependentKeychain for sharing keychain items across users.", tvos(13.0, 16.0));
 
 /*!
  @method        shouldStorePreferenceForCurrentUserToProfile:completion:
@@ -69,7 +98,8 @@
  The completion block is executed on an arbitrary dispatch queue / thread.
  If invoked from within an extension, no UI will be presented and the result will always be NO.
  */
-- (void)shouldStorePreferenceForCurrentUserToProfile:(TVAppProfileDescriptor *)profile completion:(void (^)(BOOL shouldCreateMapping))completion NS_SWIFT_NAME(shouldStorePreferenceForCurrentUser(to:completion:));
+- (void)shouldStorePreferenceForCurrentUserToProfile:(TVAppProfileDescriptor *)profile completion:(void (^)(BOOL shouldCreateMapping))completion NS_SWIFT_NAME(shouldStorePreferenceForCurrentUser(to:completion:)) API_DEPRECATED("User Management capability get-current-user is no longer supported. Please use runs-as-current-user instead alongside kSecUseUserIndependentKeychain for sharing keychain items across users.", tvos(13.0, 16.0));
+
 
 @end
 
@@ -77,9 +107,9 @@
 /*!
  @constant      TVUserManagerCurrentUserIdentifierDidChangeNotification
  @abstract      Posted to the default NSNotificationCenter whenever the current system user changes.
- @discussion    The object of the notification is nil.
+ @discussion    The object of the notification is nil. In order to start receiving notification you have to instantiate TVUserManager at least once.
  */
-TV_EXTERN NSNotificationName const TVUserManagerCurrentUserIdentifierDidChangeNotification NS_SWIFT_NAME(TVUserManager.currentUserIdentifierDidChangeNotification);
+TV_EXTERN NSNotificationName const TVUserManagerCurrentUserIdentifierDidChangeNotification NS_SWIFT_NAME(TVUserManager.currentUserIdentifierDidChangeNotification) API_DEPRECATED("User Management capability `get-current-user` is no longer supported. Use the capability `runs-as-current-user` with it there is no need to be notified of user changes.", tvos(13.0, 16.0));
 
 
 NS_ASSUME_NONNULL_END
Clone this wiki locally