-
Notifications
You must be signed in to change notification settings - Fork 517
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Photos] Update bindings for Xcode 13.0 beta 1 and beta 2 #12163
[Photos] Update bindings for Xcode 13.0 beta 1 and beta 2 #12163
Conversation
src/photos.cs
Outdated
[TV (15,0), Mac (12,0), iOS (15,0)] | ||
[Export ("localIdentifierMappingsForCloudIdentifiers:")] | ||
NSDictionary<PHCloudIdentifier, PHLocalIdentifierMapping> LocalIdentifierMappingsForCloudIdentifiers (PHCloudIdentifier[] cloudIdentifiers); | ||
|
||
[TV (15,0), Mac (12,0), iOS (15,0)] | ||
[Export ("cloudIdentifierMappingsForLocalIdentifiers:")] | ||
NSDictionary<NSString, PHCloudIdentifierMapping> CloudIdentifierMappingsForLocalIdentifiers (string[] localIdentifiers); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to add MacCatalyst (15,0) else it will be using the default min version.
[Export ("localIdentifiersForCloudIdentifiers:")] | ||
string[] GetLocalIdentifiers (PHCloudIdentifier[] cloudIdentifiers); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want this to be added in MacCatalyst if it is deprecated, We should add NotMacCatalyst if we are deprecating. Is it deprecated on iOS and Tv?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup, it looks like this needs a [NoTV][NoiOS][NoMacCatalyst]
since they are unlikely to be both added and deprecated
and if that's the case then it's generally better not to include them anyway
[Export ("localIdentifiersForCloudIdentifiers:")] | ||
string[] GetLocalIdentifiers (PHCloudIdentifier[] cloudIdentifiers); | ||
|
||
[Deprecated (PlatformName.MacOSX, 12, 0, message: "Use 'cloudIdentifierMappingsForCloudIdentifiers:' instead.")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same.
src/photos.cs
Outdated
[Export ("cloudIdentifiersForLocalIdentifiers:")] | ||
PHCloudIdentifier[] GetCloudIdentifiers (string[] localIdentifiers); | ||
|
||
[Deprecated (PlatformName.MacOSX, 12, 0, message: "Use 'PHPhotosErrorIdentifierNotFound' instead.")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
src/Photos/Enums.cs
Outdated
@@ -356,7 +358,9 @@ public enum PHProjectSectionType : long { | |||
[Native] | |||
[ErrorDomain ("PHLivePhotoEditingErrorDomain")] | |||
public enum PHLivePhotoEditingError : long { | |||
[Deprecated (PlatformName.MacOSX, 10, 15, message: "Use 'InternalError' instead.")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the suggested alternative is inside a different enum, which might be hard to use. Sadly not much we can do about it :(
However we should name that enum Use 'PHPhotosError.InternalError' instead.
src/Photos/Enums.cs
Outdated
Unknown, | ||
[Deprecated (PlatformName.MacOSX, 10, 15, message: "Use 'UserCancelled' instead.")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same, prefix value with PHPhotosError.
src/Photos/Enums.cs
Outdated
UserCancelled = 3072, | ||
LibraryVolumeOffline = 3114, | ||
RelinquishingLibraryBundleToWriter = 3142, | ||
SwitchingSystemPhotoLibrary = 3143, | ||
[TV (14,0), Mac (11,0), iOS (14,0)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a special case but we do not annotate error codes with OS versions.
Why ? They are are output-only and, as enum values, they do not have to exists to be used. E.g.
var error = CallApi ();
switch (error)
case PHPhotosError. NetworkAccessRequired:
// it does not make sense to add a version check here
// and we don't want compiler/tooling warnings for them if we don't
Console.WriteLine ("Network Access Required");
break;
// ... more cases ...
default:
Console.WriteLine ($"Error {error}");
break;
}
It's also a bunch of (not really useful) metadata to include inside platform assemblies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that makes sense, thank you! removing now
src/photos.cs
Outdated
@@ -146,9 +146,14 @@ interface PHAsset { | |||
[Export ("playbackStyle", ArgumentSemantic.Assign)] | |||
PHAssetPlaybackStyle PlaybackStyle { get; } | |||
|
|||
[Deprecated (PlatformName.MacOSX, 12, 0, message: "Use 'PHPhotosErrorIdentifierNotFound' instead.")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing dot .
-> PHPhotosError.IdentifierNotFound
src/photos.cs
Outdated
|
||
[TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] | ||
[Field ("PHLocalIdentifiersErrorKey")] | ||
NSString PHLocalIdentifiersErrorKey { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if it's the best place for that key
but it's not named correctly, IOW you do not want to use PHPhotoLibrary.PHLocalIdentifiersErrorKey
minimally remove PH
prefix
also check if other constants exists - there might be a better place for this one (or not)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WE already did that :) That key is only for when the indentifer is not matched and we noticed that the only Object with methods for identifiers is this class, so it would be something like:
PHPhotoLibrary.LocalIdentifierMappingsForCloudIdentifiers(.., out var error);
// access the error info
error.UserInfo[PHPhotoLibrary.LocalIdentifiersErrorKey]
Yet, I did not know that @rachelkang was going to add those two methods as a Category in a diff object, I would have added them in the library and not in PHPhotoLibrary_CloudIdentifiers. If we want a diff class for the category, lets move the key there, else lets move the category methods to PHPhotoLibrary. My preference is PHPhotoLibrary but I'm happy either way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good - but the
remove
PH
prefix
remains :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed the prefix!
Let me know if I should definitively move the key to PHPhotoLibrary_CloudIdentifiers or move the category methods to PHPhotoLibrary. Moving neither for now, although I think it would make sense to move the key to PHPhotoLibrary_CloudIdentifiers where the category methods are. I put the category methods there because the older versions of them (deprecated) also live there
[Export ("localIdentifiersForCloudIdentifiers:")] | ||
string[] GetLocalIdentifiers (PHCloudIdentifier[] cloudIdentifiers); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup, it looks like this needs a [NoTV][NoiOS][NoMacCatalyst]
since they are unlikely to be both added and deprecated
and if that's the case then it's generally better not to include them anyway
src/photos.cs
Outdated
[NoiOS][NoTV] | ||
[Unavailable (PlatformName.MacCatalyst)] | ||
[TV (15,0)] | ||
[iOS (15,0)] | ||
[Advice ("This API is not available when using UIKit on macOS.")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that needs to be removed as you already removed the [Unavailable (PlatformName.MacCatalyst)]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The [Advice]? Doesn't that apply to macOS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"UIKit on macOS" => Mac Catalyst (it's an old name).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, good to know! thanks!
src/photos.cs
Outdated
[Category] | ||
[Unavailable (PlatformName.MacCatalyst)] | ||
[Advice ("This API is not available when using UIKit on macOS.")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that needs to be removed as you already removed the [Unavailable (PlatformName.MacCatalyst)]
src/photos.cs
Outdated
[Advice ("This API is not available when using UIKit on macOS.")] | ||
[BaseType (typeof (NSObject))] | ||
[DisableDefaultCtor] | ||
interface PHCloudIdentifier : NSSecureCoding { | ||
|
||
[Deprecated (PlatformName.MacOSX, 12, 0, message: "Use 'PHPhotosErrorIdentifierNotFound' instead.")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing dot .
src/photos.cs
Outdated
[NoiOS][NoTV] | ||
[Unavailable (PlatformName.MacCatalyst)] | ||
[TV (15,0)] | ||
[iOS (15,0)] | ||
[Advice ("This API is not available when using UIKit on macOS.")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"UIKit on macOS" => Mac Catalyst (it's an old name).
Invalid = -1, | ||
#endif | ||
InternalError = -1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will having 2 enums with the value -1 cause issues?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, it's totally valid to have multiple enum fields with the same numerical value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh wait, the [Deprecated] attribute goes inside the #if as well.
src/photos.cs
Outdated
@@ -1423,4 +1445,28 @@ interface PHCloudIdentifier : NSSecureCoding { | |||
[Export ("initWithStringValue:")] | |||
IntPtr Constructor (string stringValue); | |||
} | |||
|
|||
[TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] | |||
[BaseType (typeof(NSObject))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[BaseType (typeof(NSObject))] | |
[BaseType (typeof (NSObject))] |
small
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed! having seen both spacing styles all over (even in this file), I'm curious if this is the actual stylistic guideline we should stick with?
src/photos.cs
Outdated
} | ||
|
||
[TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] | ||
[BaseType (typeof(NSObject))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[BaseType (typeof(NSObject))] | |
[BaseType (typeof (NSObject))] |
small also
src/photos.cs
Outdated
[NoTV][NoiOS] | ||
[Field ("PHLocalIdentifierNotFound")] | ||
NSString LocalIdentifierNotFound { get; } | ||
|
||
[TV (15, 0), Mac (12, 0), iOS (15, 0), MacCatalyst (15,0)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra extra small but maybe try to be consistent with the spacing in the attribute versions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch, thanks!
Invalid = -1, | ||
#endif | ||
InternalError = -1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh wait, the [Deprecated] attribute goes inside the #if as well.
❌ [PR Build] Tests failed on Build ❌Tests failed on Build. API diff✅ API Diff from stable View API diffAPI & Generator diffℹ️ API Diff (from PR only) (please review changes) GitHub pagesResults can be found in the following github pages (it might take some time to publish): Test results2 tests failed, 87 tests passed.Failed tests
Pipeline on Agent XAMBOT-1104.BigSur' |
src/photos.cs
Outdated
[BaseType (typeof (PHPhotoLibrary))] | ||
interface PHPhotoLibrary_CloudIdentifiers { | ||
|
||
[Mac (12,0)] | ||
[Export ("localIdentifierMappingsForCloudIdentifiers:")] | ||
NSDictionary<PHCloudIdentifier, PHLocalIdentifierMapping> LocalIdentifierMappingsForCloudIdentifiers (PHCloudIdentifier[] cloudIdentifiers); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-> GetLocalIdentifierMappings
- prefix with
Get
so there's a verb/action in the method name - remove
ForCloudIdentifiers
suffix, it's the parameter
src/photos.cs
Outdated
|
||
[Mac (12,0)] | ||
[Export ("cloudIdentifierMappingsForLocalIdentifiers:")] | ||
NSDictionary<NSString, PHCloudIdentifierMapping> CloudIdentifierMappingsForLocalIdentifiers (string[] localIdentifiers); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-> GetCloudIdentifierMappings
for the same reasons as above
src/photos.cs
Outdated
[BaseType (typeof (NSObject))] | ||
[DisableDefaultCtor] | ||
interface PHCloudIdentifier : NSSecureCoding { | ||
|
||
[Deprecated (PlatformName.MacOSX, 12, 0, message: "Use 'PHPhotosError.IdentifierNotFound' instead.")] | ||
[NoTV, NoiOS] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can add [NoMacCatalyst]
like the cases above
src/Photos/Enums.cs
Outdated
@@ -182,6 +182,8 @@ public enum PHAssetCollectionSubtype : long { | |||
SmartAlbumLongExposures = 215, | |||
[iOS (13,0)][TV(13,0)][Mac (10,15)] | |||
SmartAlbumUnableToUpload = 216, | |||
[iOS (15,0), TV (15,0), Mac (12,0)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like it should also have [MacCatalyst (15,0)]
❌ [PR Build] Tests failed on Build ❌Tests failed on Build. API diff✅ API Diff from stable View API diffAPI & Generator diffℹ️ API Diff (from PR only) (please review changes) GitHub pagesResults can be found in the following github pages (it might take some time to publish): Test results2 tests failed, 87 tests passed.Failed tests
Pipeline on Agent XAMBOT-1097.BigSur' |
❌ [PR Build] Tests failed on Build ❌Tests failed on Build. API diff✅ API Diff from stable View API diffAPI & Generator diffℹ️ API Diff (from PR only) (please review changes) GitHub pagesResults can be found in the following github pages (it might take some time to publish): Test results12 tests failed, 77 tests passed.Failed tests
Pipeline on Agent XAMBOT-1100.BigSur' |
✅ [PR Build] Tests passed on Build. ✅Tests passed on Build. API diff✅ API Diff from stable View API diffAPI & Generator diffℹ️ API Diff (from PR only) (please review changes) GitHub pagesResults can be found in the following github pages (it might take some time to publish): 🎉 All 89 tests passed 🎉Pipeline on Agent XAMBOT-1099.BigSur' |
No beta 3 updates