[platform] refactoring: introduce UpdateStrategyCustomization.showWhatIsNewPageAfterUpdate (IJPL-204)

...as a replacement for 'show-on-update' attribute in 'whatsnew' tag in ApplicationInfo.xml

IntelliJ IDEA has been migrated to use the new property.

GitOrigin-RevId: 13f502c36c30b971f028d732e3c67202cb11c11c
This commit is contained in:
Nikolay Chashnikov
2023-08-24 12:29:46 +02:00
committed by intellij-monorepo-bot
parent 4a00023eab
commit 80980fc2b7
6 changed files with 26 additions and 3 deletions

View File

@@ -19,5 +19,8 @@
<applicationService serviceInterface="com.intellij.platform.ide.customization.ExternalProductResourceUrls"
serviceImplementation="com.intellij.idea.customization.base.IntelliJIdeaExternalResourceUrls"
overrides="true"/>
<applicationService serviceInterface="com.intellij.openapi.updateSettings.UpdateStrategyCustomization"
serviceImplementation="com.intellij.idea.customization.base.IntelliJIdeaUpdateStrategyCustomization"
overrides="true"/>
</extensions>
</idea-plugin>

View File

@@ -9,6 +9,4 @@
<essential-plugin>com.intellij.java</essential-plugin>
<essential-plugin>com.intellij.java.ide</essential-plugin>
<whatsnew show-on-update="true"/>
</component>

View File

@@ -0,0 +1,8 @@
package com.intellij.idea.customization.base
import com.intellij.openapi.updateSettings.UpdateStrategyCustomization
class IntelliJIdeaUpdateStrategyCustomization : UpdateStrategyCustomization() {
override val showWhatIsNewPageAfterUpdate: Boolean
get() = true
}

View File

@@ -97,6 +97,9 @@ interface ExternalProductResourceUrls {
* Returns URL of the page containing information about new features in the product.
* It's opened in the browser or in the editor when a user invokes the "What's New" action.
* If the property returns `null`, the action won't be shown.
*
* This page will be also shown in IDE automatically if [UpdateStrategyCustomization.showWhatIsNewPageAfterUpdate][com.intellij.openapi.updateSettings.UpdateStrategyCustomization.showWhatIsNewPageAfterUpdate]
* returns `true`.
*/
val whatIsNewPageUrl: Url?
get() = null

View File

@@ -3,11 +3,15 @@ package com.intellij.ide.actions;
import com.intellij.idea.AppMode;
import com.intellij.openapi.application.ex.ApplicationInfoEx;
import com.intellij.openapi.updateSettings.UpdateStrategyCustomization;
import com.intellij.platform.ide.customization.ExternalProductResourceUrls;
import org.jetbrains.annotations.ApiStatus;
public final class WhatsNewUtil {
@ApiStatus.Internal
public static boolean isWhatsNewAvailable() {
return ApplicationInfoEx.getInstanceEx().isShowWhatsNewOnUpdate() && !AppMode.isRemoteDevHost();
return (UpdateStrategyCustomization.getInstance().getShowWhatIsNewPageAfterUpdate() || ApplicationInfoEx.getInstanceEx().isShowWhatsNewOnUpdate())
&& ExternalProductResourceUrls.getInstance().getWhatIsNewPageUrl() != null
&& !AppMode.isRemoteDevHost();
}
}

View File

@@ -84,4 +84,11 @@ open class UpdateStrategyCustomization {
if (ApplicationInfoEx.getInstanceEx().isMajorEAP && forceEapUpdateChannelForEapBuilds())
IdeBundle.message("updates.settings.channel.locked")
else null
/**
* Override this property and return `true` to show [What's New][com.intellij.platform.ide.customization.ExternalProductResourceUrls.whatIsNewPageUrl]
* page after update.
*/
open val showWhatIsNewPageAfterUpdate: Boolean
get() = false
}