Skip to content

Commit

Permalink
Only log CodyInstalled and CodyUninstalled events on installs/uninsta… (
Browse files Browse the repository at this point in the history
#286)

…lls. Log settings change events on server and access token changes

Fixes #43
  • Loading branch information
dadlerj authored Jan 12, 2024
1 parent 36d9c23 commit fee2d77
Showing 1 changed file with 4 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,7 @@ class AccountSettingChangeListener(project: Project) : ChangeListener(project) {
connection.subscribe(
AccountSettingChangeActionNotifier.TOPIC,
object : AccountSettingChangeActionNotifier {
override fun beforeAction(serverUrlChanged: Boolean) {
if (serverUrlChanged) {
GraphQlLogger.logUninstallEvent(project)
CodyApplicationSettings.instance.isInstallEventLogged = false
}
}
override fun beforeAction(serverUrlChanged: Boolean) {}

override fun afterAction(context: AccountSettingChangeContext) {
val codyApplicationSettings = CodyApplicationSettings.instance
Expand Down Expand Up @@ -58,16 +53,10 @@ class AccountSettingChangeListener(project: Project) : ChangeListener(project) {
codyToolWindowContent.refreshSubscriptionTab()
}

// Log install events
if (context.serverUrlChanged) {
GraphQlLogger.logInstallEvent(project).thenAccept { e ->
codyApplicationSettings.isInstallEventLogged = e
}
} else if (context.accessTokenChanged &&
!codyApplicationSettings.isInstallEventLogged) {
GraphQlLogger.logInstallEvent(project).thenAccept { e ->
codyApplicationSettings.isInstallEventLogged = e
}
GraphQlLogger.logCodyEvent(project, "settings.serverURL", "changed")
} else if (context.accessTokenChanged) {
GraphQlLogger.logCodyEvent(project, "settings.accessToken", "changed")
}
}
})
Expand Down

0 comments on commit fee2d77

Please sign in to comment.