fix: remove instance_launch_started event and fix time played not coming through for Analytics

This commit is contained in:
Ryan Dowling 2024-02-28 22:19:37 +11:00
parent 8068887163
commit 7e00e967f4
No known key found for this signature in database
GPG key ID: 9C50815FAB6308A1
3 changed files with 6 additions and 12 deletions

View file

@ -11,5 +11,6 @@ This changelog only contains the changes that are unreleased. For changes for in
- Issue with Modrinth instance version checker causing error when project ID is not defined [#877]
- Issue with CurseForge export including non available files causing it to be rejected [#875]
- Remove initial screen view and CurseForge/Modrinth selector dialogs from Analytics
- Remove instance_launch_started event and fix time played not coming through for Analytics
### Misc

View file

@ -924,8 +924,6 @@ public class Instance extends MinecraftVersion {
}
}
Analytics.trackEvent(AnalyticsEvent.forStartInstanceLaunch(this, offline));
ProgressDialog<Boolean> prepareDialog = new ProgressDialog<>(GetText.tr("Preparing For Launch"),
9,
GetText.tr("Preparing For Launch"));

View file

@ -69,7 +69,7 @@ public class AnalyticsEvent {
}
private static Map<String, Object> getPayloadForStartingInstance(Instance instance, boolean offline,
String reason, Integer time) {
String reason, Integer timePlayed) {
final Map<String, Object> payload = new HashMap<>();
payload.put("offline", offline);
payload.put("name", instance.launcher.pack);
@ -80,18 +80,13 @@ public class AnalyticsEvent {
payload.put("reason", reason);
}
if (time != null) {
payload.put("time", time);
if (timePlayed != null) {
payload.put("time_played", timePlayed);
}
return payload;
}
public static AnalyticsEvent forStartInstanceLaunch(Instance instance, boolean offline) {
return new AnalyticsEvent("instance_launch_started",
getPayloadForStartingInstance(instance, offline, null, null));
}
public static AnalyticsEvent forInstanceLaunchFailed(Instance instance, boolean offline, String reason) {
return new AnalyticsEvent("instance_launch_failed",
getPayloadForStartingInstance(instance, offline, reason, null));
@ -101,9 +96,9 @@ public class AnalyticsEvent {
return new AnalyticsEvent("instance_launched", getPayloadForStartingInstance(instance, offline, null, null));
}
public static AnalyticsEvent forInstanceLaunchCompleted(Instance instance, boolean offline, int time) {
public static AnalyticsEvent forInstanceLaunchCompleted(Instance instance, boolean offline, int timePlayed) {
return new AnalyticsEvent("instance_launch_completed",
getPayloadForStartingInstance(instance, offline, null, time));
getPayloadForStartingInstance(instance, offline, null, timePlayed));
}
public static AnalyticsEvent forInstanceEvent(String event, Instance instance) {