mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-28 00:05:01 +00:00
refactor: extract analytics disable logic into dedicated method
This commit is contained in:
parent
c0e137889c
commit
bd59a8debf
1 changed files with 8 additions and 6 deletions
|
@ -29,18 +29,20 @@ class Analytics:
|
|||
self.get_or_create_uuid()
|
||||
|
||||
if not enable or self.permanently_disable or permanently_disable:
|
||||
#ai refactor this into a method called disable()!
|
||||
self.mp = None
|
||||
self.ph = None
|
||||
if permanently_disable and not self.permanently_disable:
|
||||
self.permanently_disable = True
|
||||
self.save_data()
|
||||
self.disable(permanently_disable)
|
||||
return
|
||||
|
||||
if self.user_id and not self.permanently_disable:
|
||||
self.mp = Mixpanel(mixpanel_project_token)
|
||||
self.ph = Posthog(project_api_key=posthog_project_api_key, host=posthog_host)
|
||||
|
||||
def disable(self, permanently_disable):
|
||||
self.mp = None
|
||||
self.ph = None
|
||||
if permanently_disable and not self.permanently_disable:
|
||||
self.permanently_disable = True
|
||||
self.save_data()
|
||||
|
||||
def get_data_file_path(self):
|
||||
data_file = Path.home() / ".aider" / "analytics.json"
|
||||
data_file.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue