-
Notifications
You must be signed in to change notification settings - Fork 330
Action analytics #2233
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
Merged
Merged
Action analytics #2233
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9fb591d
Flutter View Action analytics.
pq f08691d
cleaned up imports
pq bf239a2
Analytics for “open in…” actions.
pq 1a903d5
Merge branch 'action_analytics' of https://github.com/pq/flutter-inte…
pq 988ec2f
rebase of flutterview
pq 28d3720
open module analytics
pq 1ec3b0c
Merge branch 'master' into action_analytics
pq 5a0bbb4
rebase
pq d34c9e2
Merge branch 'master' into action_analytics
pq 95a1ff3
rebase and renames
pq File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| /* | ||
| * Copyright 2018 The Chromium Authors. All rights reserved. | ||
| * Use of this source code is governed by a BSD-style license that can be | ||
| * found in the LICENSE file. | ||
| */ | ||
| package io.flutter.actions; | ||
|
|
||
| import com.intellij.openapi.actionSystem.AnAction; | ||
| import com.intellij.openapi.actionSystem.AnActionEvent; | ||
| import io.flutter.FlutterInitializer; | ||
| import org.jetbrains.annotations.NotNull; | ||
|
|
||
| /** | ||
| * An action that sends analytics when performed. | ||
| */ | ||
| public abstract class ActionWithAnalytics extends AnAction { | ||
|
|
||
| /** | ||
| * Template method. Implement @performAction. | ||
| */ | ||
| @Override | ||
| public final void actionPerformed(AnActionEvent e) { | ||
| FlutterInitializer.getAnalytics().sendEvent("flutter", getAnalyticsId()); | ||
| performAction(e); | ||
| } | ||
|
|
||
| /** | ||
| * Return the unique analytics Id for this action. | ||
| */ | ||
| @NotNull | ||
| public abstract String getAnalyticsId(); | ||
|
|
||
| /** | ||
| * Perform the action. | ||
| * | ||
| * Called by @actionPerformed. | ||
| */ | ||
| public abstract void performAction(AnActionEvent e); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -999,4 +999,3 @@ private static DefaultActionGroup createPopupActionGroup(FlutterView view, Flutt | |
| return group; | ||
| } | ||
| } | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Final methods often end up causing unexpected problems. It would be better to omit that modifier.
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.
👍 In general I hear you. In this case though it's a template method and I don't want it accidentally overridden since the analytics call won't happen unless they think to call super.
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.
@OverridingMethodsMustInvokeSuperwill do what you want and won't do what I don't want.You'll need to add a library dependency on jsr305 to enable that annotation, but I think it's worth doing. (Remember to add it to all relevant module definitions. I think there are two.)
In its current form, this method appears to contradict the instructions from JetBrains:
https://www.jetbrains.org/intellij/sdk/docs/tutorials/action_system/working_with_custom_actions.html
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 have an opinion here, but we may want to move discussion out of a PR; perhaps when you're in the office Monday Steve?
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.
Sure. We can discuss and rejigger.