-
-
Notifications
You must be signed in to change notification settings - Fork 339
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
feat: UI event transactions for clicks #1784
Conversation
Add a wrapper around swizzling sendAction:to:from:forEvent: for testability and to only swizzle once when multiple implementations need to be called for the same swizzled method.
…entry-cocoa into feat/ui-transactions
|
…entry-cocoa into feat/ui-transactions
Codecov Report
@@ Coverage Diff @@
## master #1784 +/- ##
==========================================
+ Coverage 91.74% 92.30% +0.56%
==========================================
Files 198 200 +2
Lines 9159 9388 +229
==========================================
+ Hits 8403 8666 +263
+ Misses 756 722 -34
Continue to review full report at Codecov.
|
Creates transactions when a control sends an action to the application, like button clicks and switch toggles. Co-authored-by: Philipp Hofmann <philipp.hofmann@sentry.io>
Co-authored-by: Dhiogo Brustolin <dhiogorb@gmail.com>
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! A few more things we should talk about it.
* convert the selector to a Swift appropriate format aligned with the Swift #selector syntax. | ||
* method:first:second:third: gets converted to method(first:second:third:) | ||
*/ | ||
- (NSString *)getTransactionName:(NSString *)action target:(id)target |
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.
Here are some usage samples to simplify my explanation:
Swift Function | Result | How I think it should be to not cause confusion |
---|---|---|
func testClick() | iOS_Swift.ViewController.testClick | iOS_Swift.ViewController.testClick() |
func testClick(_ sender : Any) | iOS_Swift.ViewController.testClick | iOS_Swift.ViewController.testClick(_:) |
func testClick(sender : Any) | iOS_Swift.ViewController.testClickWithSender | iOS_Swift.ViewController.testClick(sender:) |
func testClick(sender : Any, second : Any) | iOS_Swift.ViewController.testClickWithSender(second:) | iOS_Swift.ViewController.testClick(sender:second:) |
func testClick(_ sender : Any, second : Any) | iOS_Swift.ViewController.testClick(second:) | iOS_Swift.ViewController.testClick(_:secondParam:) |
As I said before, it is a little trickier to achieve perfect solution, Im kind fine with the result we have right now, because the first and second items are more common, but I do believe this will cause some confusion with some users.
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.
Hmm, I get your point but aren't most of these events coming from the storyboard, and there we only have
func testClick()
func testClick(_ sender : Any)
func testClick(_ sender : Any, _ second : Any)
I agree that our solution is not optimal, but I think it's enough for you to figure out which code was executed. The problem is that only when looking at the action I don't know how to get the difference between func testClick(_ sender : Any)
and func testClick()
without using other objc_runtime functions. Do have any idea how we could solve this? Maybe we can also fix this before enabling enableUserInteractionTracing
per default.
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.
Are you okay with creating an issue for this and fixing it later, @brustolin?
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 don't know how to get the difference between func testClick(_ sender : Any) and func testClick()
if actions contain :
, it has parameter, otherwise not.
But I thing we can release this way and wait for feedbacks
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 we already have a good feature. Let's merge it and gather feedbacks.
Creates transactions when the user clicks an UIButton, UISegmentedControl, UIBarButtonItem, or UIPageControl. Co-authored-by: Dhiogo Brustolin <dhiogorb@gmail.com>
Creates transactions when the user clicks an UIButton, UISegmentedControl, UIBarButtonItem, or UIPageControl. Co-authored-by: Dhiogo Brustolin <dhiogorb@gmail.com>
📜 Description
Creates transactions when the user clicks an UIButton, UISegmentedControl, UIBarButtonItem or UIPageControl. For more details, see getsentry/team-mobile#4.
💡 Motivation and Context
getsentry/team-mobile#4
💚 How did you test it?
Unit tests, simulator, and real devices.
📝 Checklist
🔮 Next steps