OPENIDE #39 Analysis and replacement of external links for OpenIDE

(cherry picked from commit b0138a5045360e83e95748ba8deec3b84f137bc0)
(cherry picked from commit afdb9e5d1f)
(cherry picked from commit 0cca83cacc)
(cherry picked from commit 5e200bbc4b)
(cherry picked from commit 3d26b38afc)
This commit is contained in:
Nikita Iarychenko
2024-11-22 10:45:31 +04:00
parent fb076afc80
commit a93c91fd31
2 changed files with 58 additions and 11 deletions

View File

@@ -2,31 +2,65 @@
// Use is subject to license terms.
package com.intellij.idea.customization.base
import com.intellij.openapi.application.ApplicationInfo
import com.intellij.openapi.updateSettings.impl.PatchInfo
import com.intellij.openapi.util.BuildNumber
import com.intellij.openapi.util.SystemInfo
import com.intellij.platform.ide.customization.ExternalProductResourceUrls
import com.intellij.platform.ide.impl.customization.OpenIdeFeedbackReporter
import com.intellij.util.Url
import com.intellij.util.Urls
import com.intellij.util.system.CpuArch
// TODO [OpenIDE]: replaces urls
class OpenIdeExternalResourceUrls : ExternalProductResourceUrls {
override val helpPageUrl: ((topicId: String) -> Url)? = null
private val productUrl = Urls.newFromEncoded("https://openide.ru")
override val gettingStartedPageUrl = null
override val updateMetadataUrl = productUrl.resolve("update/updates.xml")
override val youTubeChannelUrl = null
override fun computePatchUrl(from: BuildNumber, to: BuildNumber): Url =
Urls.newFromEncoded("https://download.openide.ru/ide").resolve(computePatchFileName(from, to))
override val updateMetadataUrl = Urls.newFromEncoded("https://www.openide.com")
override val bugReportUrl: ((String) -> Url)
get() = { description ->
Urls.newFromEncoded("https://youtrack.openide.ru/newissue").addParameters(mapOf(
"project" to "12345",
"clearDraft" to "true",
"description" to description,
"c" to "Affected versions: ${ApplicationInfo.getInstance().fullVersion}"
))
}
override fun computePatchUrl(from: BuildNumber, to: BuildNumber): Url = Urls.newFromEncoded("https://www.openide.com")
override val technicalSupportUrl: ((description: String) -> Url) = { productUrl.resolve("contacts") }
override val bugReportUrl: ((String) -> Url)? = null
override val feedbackReporter = OpenIdeFeedbackReporter()
override val technicalSupportUrl: ((description: String) -> Url) ? = null
override val downloadPageUrl = productUrl.resolve("download")
override val feedbackReporter = null
override val youTubeChannelUrl = Urls.newFromEncoded("https://www.youtube.com/openide")
override val downloadPageUrl = null
override val keyboardShortcutsPdfUrl: Url
get() {
val suffix = if (SystemInfo.isMac) "_Mac" else ""
return productUrl.resolve("ide/docs/OpenIDE_ReferenceCard$suffix.pdf")
}
override val whatIsNewPageUrl = null
override val whatIsNewPageUrl = productUrl.resolve("whatsnew")
override val gettingStartedPageUrl = productUrl.resolve("ide/resources")
override val helpPageUrl: ((topicId: String) -> Url)
get() = productUrl.resolve("help/ide/").let { baseUrl ->
{ topicId ->
baseUrl.resolve("${ApplicationInfo.getInstance().shortVersion}/").addParameters(mapOf(
topicId to ""
))
}
}
private fun computePatchFileName(from: BuildNumber, to: BuildNumber): String {
val product = ApplicationInfo.getInstance().build.productCode
val runtime = if (CpuArch.isArm64()) "-aarch64" else ""
return "${product}-${from.withoutProductCode().asString()}-${to.withoutProductCode().asString()}-patch${runtime}-${PatchInfo.OS_SUFFIX}.jar"
}
}

View File

@@ -0,0 +1,13 @@
// Copyright (c) Haulmont 2024. All Rights Reserved.
// Use is subject to license terms.
package com.intellij.platform.ide.impl.customization
import com.intellij.platform.ide.customization.FeedbackReporter
import com.intellij.util.Urls
class OpenIdeFeedbackReporter : FeedbackReporter {
override val destinationDescription = "openide.ru"
override fun feedbackFormUrl(description: String) = Urls.newFromEncoded("https://openide.ru/feedback")
}