-
Notifications
You must be signed in to change notification settings - Fork 514
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
[AudioToolbox] Update API to xcode 12 beta 6. #9603
[AudioToolbox] Update API to xcode 12 beta 6. #9603
Conversation
The most important changes in the API are ignored until we fix issue xamarin#9602
Build failure 🔥 Build failed 🔥 |
Build success |
src/AudioUnit/AudioComponent.cs
Outdated
@@ -342,6 +351,13 @@ public UIKit.UIImage GetIcon (float desiredPointSize) | |||
return AudioComponentGetLastActiveTime (handle); | |||
} | |||
} | |||
|
|||
[Watch (7,0), TV (14,0), iOS (14,0)] | |||
public UIImage CopyIcon () { |
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.
minor
- style,
{
on the next line - maybe
GetIcon
since we don't have to follow the ObjC copy rule/convention
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 have a GetIcon, either we ignore the method of we use Copy
src/AudioUnit/AudioComponent.cs
Outdated
public AppKit.NSImage CopyIcon () { | ||
var ptr = AudioComponentCopyIcon (handle); | ||
return ptr == IntPtr.Zero ? null : new AppKit.NSImage (ptr); | ||
} |
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 merge both method if you add using NSImage = UIKit.UIImage;
in the #if MONOMAC
on top of the file
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.
There is some extra ugliness, but sure, can be done.
src/AudioUnit/AudioComponent.cs
Outdated
@@ -342,6 +351,13 @@ public UIKit.UIImage GetIcon (float desiredPointSize) | |||
return AudioComponentGetLastActiveTime (handle); | |||
} | |||
} | |||
|
|||
[Watch (7,0), TV (14,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.
API diff for watchOS is empty so this code is not included in the platform assembly
Either it's available and should be added or the [Watch (7,0)]
attribute should be removed (here and elsewhere).
Considering that there was no xtro file updated for the watchOS profile I suspect it's the former.
src/AudioUnit/AudioComponent.cs
Outdated
[Watch (7,0), TV (14,0), iOS (14,0)] | ||
public UIImage CopyIcon () { | ||
var ptr = AudioComponentCopyIcon (handle); | ||
return ptr == IntPtr.Zero ? null : new UIImage (ptr); |
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.
AudioComponentCopyIcon
returns a retained handle, and it can also be an existing UIImage (for which we have a managed instance), so:
return ptr == IntPtr.Zero ? null : new UIImage (ptr); | |
return (UIImage) Runtime.GetNSObject (ptr, true); |
And most importantly: manual API need manual tests! |
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.
After feedback is addressed 👍
Build failure Test results3 tests failed, 73 tests passed.Failed tests
|
Failures are unrelated, but lets kick it again (that msbuild issue is starting to happy more often). |
build |
Build failure Test results3 tests failed, 73 tests passed.Failed tests
|
The failures are very much related:
|
[Test] | ||
public void CopyIconTest () | ||
{ | ||
AudioComponentDescription cd = new AudioComponentDescription () { |
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 a version check here to only run on Xcode 12+ OSes.
Assert.DoesNotThrow ( () => { | ||
var icon = component.CopyIcon (); // ensuring that the manual binding does not throw, we do not care about the result | ||
}); |
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 could do something like this:
Assert.IsNotNull (component.CopyIcon (), "CopyIcon");
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 can be null, there is no guarantee, I much prefer to make sure it does not crash.
src/AudioUnit/AudioComponent.cs
Outdated
@@ -342,6 +361,7 @@ public UIKit.UIImage GetIcon (float desiredPointSize) | |||
return AudioComponentGetLastActiveTime (handle); | |||
} | |||
} | |||
|
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.
Whitespace!
src/AudioUnit/AudioComponent.cs
Outdated
@@ -353,6 +373,7 @@ public AppKit.NSImage GetIcon () | |||
{ | |||
return new AppKit.NSImage (AudioComponentGetIcon (handle)); | |||
} | |||
|
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.
And more whitespace 😄
Build success |
The most important changes in the API are ignored until we fix issue #9602