-
Notifications
You must be signed in to change notification settings - Fork 520
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
[UIKit] Add Constructor for UIHoverGestureRecognizer #15837
Conversation
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.
Great work, in theory, there are not changes needed if you don't want them. I wonder, if we add at the top of the file:
#nullable enable
What happens? It might as for some changes, maybe to many for the intent of the PR (but good for you to check). Tests for the other actions are missing, but we should write them. We need to add tests under:
tests/monotouch/UIkit
I think we can look at how to test the execution of the callback, and then use a pattern for it.
src/UIKit/UIGestureRecognizer.cs
Outdated
@@ -319,4 +319,27 @@ public void Activated (UIScreenEdgePanGestureRecognizer sender) | |||
#endif | |||
} | |||
|
|||
// start code for UIHoverGestureRecognizer Constructor | |||
public partial class UIHoverGestureRecognizer : UIGestureRecognizer { | |||
public UIHoverGestureRecognizer (Action action) : base (action) {} |
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.
I believe this is not needed since we already expose a constructor in the generated code:
[NoWatch, NoTV, iOS (13,0)]
[BaseType (typeof (UIGestureRecognizer))]
[DisableDefaultCtor]
interface UIHoverGestureRecognizer {
[DesignatedInitializer]
[Export ("initWithTarget:action:")]
NativeHandle Constructor (NSObject target, Selector action);
[DesignatedInitializer]
[Wrap ("base (action)")]
NativeHandle Constructor (Action action);
}
Have your tried removing it? Is it giving you an issue?
src/UIKit/UIGestureRecognizer.cs
Outdated
public void Activated (UIHoverGestureRecognizer sender) | ||
{ | ||
action (sender); | ||
} |
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.
Little trick in the new c# syntax, you can do:
public void Activated (UIHoverGestureRecognizer sender) | |
{ | |
action (sender); | |
} | |
public void Activated (UIHoverGestureRecognizer sender) => action (sender); |
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.
This is great 👍
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Will be coming back to fix this issue. After talking to Manuel, we realized it would be better to add generics and clean up the code to make the bug much easier to fix. |
👀 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Added generic callbacks- this simplifies the code and makes it much easier to fix the issue (dotnet#15335).
14f0391
to
202cd73
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
.gitignore
Outdated
tests/BundledResources/BundledResources.csproj | ||
tests/EmbeddedResources/EmbeddedResources.csproj | ||
tests/fsharplibrary/fsharplibrary.fsproj |
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.
This change is not related to this PR, so it should be removed.
If needed, it should go in a separate PR, explaining the reason for the change (I'm also a bit puzzled about this change, because these files are already checked into git, so they shouldn't be ignored, nor should this actually change any behavior),
tests/.gitignore
Outdated
BundledResources/Info.plist | ||
EmbeddedResources/Info.plist | ||
fsharplibrary/Info.plist |
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
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.
This is due to vsmac making changes. I wpuld blame VSMac for modifying files when it should 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.
After addressing the other issues!
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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 great!
Except that the compiler complains about the test:
tests/monotouch-test/UIKit/GestureRecognizerTest.cs(98,8): error CS0815: Cannot assign lambda expression to an implicitly-typed variable
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
💻 [PR Build] Tests on macOS M1 - Mac Big Sur (11.5) passed 💻✅ All tests on macOS M1 - Mac Big Sur (11.5) passed. Pipeline on Agent |
✅ API diff for current PR / commitLegacy Xamarin (No breaking changes).NET (No breaking changes)✅ API diff vs stableLegacy Xamarin (No breaking changes).NET (No breaking changes)✅ Generator diffGenerator diff is empty Pipeline on Agent |
🔥 [CI Build] Test results 🔥Test results❌ Tests failed on VSTS: simulator tests 0 tests crashed, 1 tests failed, 222 tests passed. Failures❌ msbuild tests
Html Report (VSDrops) Download Successes✅ bcl: All 69 tests passed. Html Report (VSDrops) Download Pipeline on Agent |
Test failure is unrelated (https://github.com/xamarin/maccore/issues/2620), so this is good to go! |
Fixes #15335