[plugins] IJPL-173011 FUS: no download events for opening download page of suggested IDE

(cherry picked from commit 2506805c5995b4401be327b07143d9c2647ef7cf)

IJ-CR-151331

GitOrigin-RevId: 477a992c91ec7eee47f8c0b0099911216a3a3bb3
This commit is contained in:
Yuriy Artamonov
2024-12-04 14:27:57 +01:00
committed by intellij-monorepo-bot
parent 604b412918
commit 19d6ad45a2
2 changed files with 10 additions and 7 deletions

View File

@@ -664,7 +664,7 @@ fun tryUltimate(
val eventSource = fusEventSource ?: FUSEventSource.EDITOR
if (Registry.`is`("ide.try.ultimate.automatic.installation") && project != null) {
eventSource.logTryUltimate(project, pluginId)
project.service<UltimateInstallationService>().install(pluginId, suggestedIde)
project.service<UltimateInstallationService>().install(pluginId, suggestedIde, eventSource)
}
else {
fallback?.invoke() ?: eventSource.openDownloadPageAndLog(project = project,

View File

@@ -61,16 +61,19 @@ class UltimateInstallationService(
}
}
fun install(pluginId: PluginId? = null, suggestedIde: SuggestedIde) {
fun install(pluginId: PluginId? = null, suggestedIde: SuggestedIde, eventSource: FUSEventSource) {
if (!canBeAutoInstalled(suggestedIde)) {
eventSource.openDownloadPageAndLog(project = project,
url = suggestedIde.defaultDownloadUrl,
suggestedIde = suggestedIde,
pluginId = pluginId)
return
}
coroutineScope.launch {
try {
installerLock.withLock {
withBackgroundProgress(project, IdeBundle.message("plugins.advertiser.try.ultimate.upgrade", suggestedIde.name), true) {
if (!canBeAutoInstalled(suggestedIde)) {
useFallback(pluginId, suggestedIde.defaultDownloadUrl)
return@withBackgroundProgress
}
val productData = UpdateChecker.loadProductData(null)
val status = if (Registry.`is`("ide.try.ultimate.use.eap")) ChannelStatus.EAP else ChannelStatus.RELEASE
val build = productData?.channels?.firstOrNull { it.status == status }?.builds?.first() ?: return@withBackgroundProgress