Analytics: allow opt-out

This commit is contained in:
Mykola Grymalyuk
2023-04-11 19:08:52 -06:00
parent b34eaccd35
commit 4c19f51a04
2 changed files with 21 additions and 3 deletions

View File

@@ -3,7 +3,7 @@ import plistlib
from pathlib import Path
import json
from resources import network_handler, constants
from resources import network_handler, constants, global_settings
DATE_FORMAT: str = "%Y-%m-%d %H-%M-%S"
@@ -29,6 +29,9 @@ class Analytics:
def __init__(self, global_constants: constants.Constants) -> None:
self.constants: constants.Constants = global_constants
if global_settings.GlobalEnviromentSettings().read_property("DisableAnalytics") is True:
return
self._generate_base_data()
self._post_data()

View File

@@ -2980,12 +2980,24 @@ class wx_python_gui:
self.delete_unused_kdks_checkbox.GetPosition().y + self.delete_unused_kdks_checkbox.GetSize().height))
self.set_ignore_app_updates_checkbox.SetToolTip(wx.ToolTip("This will set whether OpenCore will ignore App Updates on launch.\nEnable this option if you do not want to be prompted for App Updates"))
# Set Disable Analytics
res = global_settings.GlobalEnviromentSettings().read_property("DisableAnalytics")
if res is None:
res = False
self.set_disable_analytics_checkbox = wx.CheckBox(self.frame_modal, label="Disable Analytics")
self.set_disable_analytics_checkbox.SetValue(res)
self.set_disable_analytics_checkbox.Bind(wx.EVT_CHECKBOX, self.set_disable_analytics_click)
self.set_disable_analytics_checkbox.SetPosition(wx.Point(
self.set_ignore_app_updates_checkbox.GetPosition().x,
self.set_ignore_app_updates_checkbox.GetPosition().y + self.set_ignore_app_updates_checkbox.GetSize().height))
self.set_disable_analytics_checkbox.SetToolTip(wx.ToolTip("Sets whether anonymized analytics are sent to the Dortania team.\nThis is used to help improve the application and is completely optional."))
# Button: Developer Debug Info
self.debug_button = wx.Button(self.frame_modal, label="Developer Debug Info")
self.debug_button.Bind(wx.EVT_BUTTON, self.additional_info_menu)
self.debug_button.SetPosition(wx.Point(
self.set_ignore_app_updates_checkbox.GetPosition().x,
self.set_ignore_app_updates_checkbox.GetPosition().y + self.set_ignore_app_updates_checkbox.GetSize().height + 5))
self.set_disable_analytics_checkbox.GetPosition().x,
self.set_disable_analytics_checkbox.GetPosition().y + self.set_disable_analytics_checkbox.GetSize().height + 5))
self.debug_button.Center(wx.HORIZONTAL)
# Button: return to main menu
@@ -3038,6 +3050,9 @@ class wx_python_gui:
else:
global_settings.GlobalEnviromentSettings().write_property("IgnoreAppUpdates", False)
def set_disable_analytics_click(self, event):
global_settings.GlobalEnviromentSettings().write_property("DisableAnalytics", self.set_disable_analytics_checkbox.GetValue())
def firewire_click(self, event=None):
if self.firewire_boot_checkbox.GetValue():
logging.info("Firewire Enabled")