[platform] refactoring: use Url type instead of String where possible in BaseJetBrainsExternalProductResourceUrls (IJPL-204)

This improves type-safety and consistency (IJ-CR-113542).

GitOrigin-RevId: c57462784ebdfd35fc371eff4310d01957929ee3
This commit is contained in:
Nikolay Chashnikov
2023-09-01 10:59:59 +02:00
committed by intellij-monorepo-bot
parent 75069bb066
commit 9ea400899a
2 changed files with 13 additions and 13 deletions

View File

@@ -9,11 +9,11 @@ import com.intellij.util.Url
import com.intellij.util.Urls
class IntelliJIdeaExternalResourceUrls : BaseJetBrainsExternalProductResourceUrls() {
override val basePatchDownloadUrl: String
get() = "https://download.jetbrains.com/idea/"
override val basePatchDownloadUrl: Url
get() = Urls.newFromEncoded("https://download.jetbrains.com/idea/")
override val productPageUrl: String
get() = "https://www.jetbrains.com/idea/"
override val productPageUrl: Url
get() = Urls.newFromEncoded("https://www.jetbrains.com/idea/")
override val youtrackProjectId: String
get() = "IDEA"
@@ -52,6 +52,6 @@ class IntelliJIdeaExternalResourceUrls : BaseJetBrainsExternalProductResourceUrl
override val gettingStartedPageUrl: Url
get() = Urls.newFromEncoded("https://www.jetbrains.com/idea/resources/")
override val baseWebHelpUrl: String
get() = "https://www.jetbrains.com/help/idea/"
override val baseWebHelpUrl: Url
get() = Urls.newFromEncoded("https://www.jetbrains.com/help/idea/")
}

View File

@@ -17,7 +17,7 @@ import org.jetbrains.annotations.ApiStatus
* A base class for implementations of [ExternalProductResourceUrls] describing IDEs developed by JetBrains.
*/
abstract class BaseJetBrainsExternalProductResourceUrls : ExternalProductResourceUrls {
abstract val basePatchDownloadUrl: String
abstract val basePatchDownloadUrl: Url
/**
* Returns ID of YouTrack Project which will be used by "Submit a Bug Report" action.
@@ -35,14 +35,14 @@ abstract class BaseJetBrainsExternalProductResourceUrls : ExternalProductResourc
* * [productPageUrl]/download to get the address of the download page;
* * [productPageUrl]/whatsnew to get the address of "What's New" page.
*/
abstract val productPageUrl: String
abstract val productPageUrl: Url
/**
* Returns base URL of context help pages.
* The current IDE version number and ID of the requested topic are added to it to obtain the actual URL:
* [baseWebHelpUrl]`/<version>/?<topicId>`.
*/
abstract val baseWebHelpUrl: String
abstract val baseWebHelpUrl: Url
/**
* Returns ID of the form used to contact support at intellij-support.jetbrains.com site
@@ -67,7 +67,7 @@ abstract class BaseJetBrainsExternalProductResourceUrls : ExternalProductResourc
override fun computePatchUrl(from: BuildNumber, to: BuildNumber): Url? {
return computeCustomPatchDownloadUrl(from, to)
?: Urls.newFromEncoded(basePatchDownloadUrl).resolve(computePatchFileName(from, to))
?: basePatchDownloadUrl.resolve(computePatchFileName(from, to))
}
override val bugReportUrl: ((String) -> Url)?
@@ -95,14 +95,14 @@ abstract class BaseJetBrainsExternalProductResourceUrls : ExternalProductResourc
get() = JetBrainsFeedbackReporter(shortProductNameUsedInForms, zenDeskFeedbackFormData)
override val downloadPageUrl: Url?
get() = Urls.newFromEncoded(productPageUrl).resolve("download")
get() = productPageUrl.resolve("download")
override val whatIsNewPageUrl: Url?
get() = Urls.newFromEncoded(productPageUrl).resolve("whatsnew")
get() = productPageUrl.resolve("whatsnew")
override val helpPageUrl: ((topicId: String) -> Url)
get() = { topicId ->
Urls.newFromEncoded(baseWebHelpUrl).resolve("${ApplicationInfo.getInstance().shortVersion}/").addParameters(mapOf(
baseWebHelpUrl.resolve("${ApplicationInfo.getInstance().shortVersion}/").addParameters(mapOf(
topicId to ""
))
}