feat: analytics interface in :common#20736
Conversation
:common
There was a problem hiding this comment.
You should implement and switch to the interface in this PR, rather than leaving it as 'dead' code.
You may want to make UsageAnalytics private, to be sure you're not accessing the object directly.
Add a public accessor for which setsAnalytics
And a public accessor (test only)
calling the methods is more verbose:
- sendAnalyticsEvent("", "")
+ AnalyticsProvider.instance.sendAnalyticsEvent("", "") Analytics would be a better name for the object, not the interface
eabadbc to
c82ee0e
Compare
|
Can we get this in and then I can update the usage in GA4 PR? |
|
Hmm... let's check with @ankidroid/reviewers |
|
Sharing my reply to David from Discord to support my plans in GA4
Implementation lives in :AnkiDroid (AnkiDroidUsageAnalytics) Interface + provider lives in :common (UsageAnalytics interface + Analytics object) Clean calling Analytics.sendAnalyticsEvent("Widget", "enabled") So: // In :AnkiDroid internal, invisible to other modules
internal object AnkiDroidUsageAnalytics : UsageAnalytics { ... }
// In onCreate()
Analytics.setAnalytics(AnkiDroidUsageAnalytics) |
|
I think it's best if we work on this pattern initially in CrashReportService, drafting this PR, then bringing what we've learned over to Analytics |
Purpose / Description
Create interface in :common for analytics, I want to use this i.e. actual implementation after GA4 PR is merged
after everything is in modules this will look something like this
Fixes
NA
Approach
see commit
How Has This Been Tested?
NA
Learning (optional, can help others)
Things are very coupled to move in one go
Checklist
Please, go through these checks before submitting the PR.