mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
RUST-15869 Show Contact Support ini non-commercial RustRover
The button points to our special Slack workspace (cherry picked from commit f4d0287d609ee4d90b14319166cbb324950e5afa) IJ-CR-148887 GitOrigin-RevId: 05dc103d1cd15dd085812dfa21a961322aad9228
This commit is contained in:
committed by
intellij-monorepo-bot
parent
3c2549301a
commit
5c7fd97b96
+7
@@ -62,6 +62,13 @@ interface ExternalProductResourceUrls {
|
||||
val technicalSupportUrl: ((description: String) -> Url)?
|
||||
get() = null
|
||||
|
||||
/**
|
||||
* Used just like [technicalSupportUrl] if the product is activated with a free (non-commercial) license
|
||||
*/
|
||||
@get:ApiStatus.Internal
|
||||
val freeTechnicalSupportUrl: ((description: String) -> Url)?
|
||||
get() = null
|
||||
|
||||
/**
|
||||
* Returns an instance which will be used to submit feedback about the product via the "Submit Feedback" action.
|
||||
* If this function returns `null`, the action won't be available.
|
||||
|
||||
@@ -10,22 +10,31 @@ import com.intellij.openapi.components.service
|
||||
import com.intellij.openapi.project.DumbAware
|
||||
import com.intellij.platform.ide.customization.ExternalProductResourceUrls
|
||||
import com.intellij.util.PlatformUtils
|
||||
import com.intellij.util.Url
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
internal class TechnicalSupportAction : AnAction(), DumbAware {
|
||||
override fun update(e: AnActionEvent) {
|
||||
e.presentation.setEnabledAndVisible(ExternalProductResourceUrls.getInstance().technicalSupportUrl != null &&
|
||||
PlatformUtils.isCommercialEdition() &&
|
||||
!service<ConsentOptionsProvider>().isActivatedWithFreeLicense)
|
||||
e.presentation.setEnabledAndVisible(getTechnicalSupportUrl() != null)
|
||||
}
|
||||
|
||||
override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.BGT
|
||||
|
||||
override fun actionPerformed(e: AnActionEvent) {
|
||||
val url = ExternalProductResourceUrls.getInstance().technicalSupportUrl ?: return
|
||||
val url = getTechnicalSupportUrl() ?: return
|
||||
val project = e.project
|
||||
service<ReportFeedbackService>().coroutineScope.launch {
|
||||
BrowserUtil.browse(url(SendFeedbackAction.getDescription(project)).toExternalForm(), project)
|
||||
}
|
||||
}
|
||||
|
||||
private fun getTechnicalSupportUrl(): ((description: String) -> Url)? {
|
||||
val isPaid = PlatformUtils.isCommercialEdition() &&
|
||||
!service<ConsentOptionsProvider>().isActivatedWithFreeLicense
|
||||
return if (isPaid) {
|
||||
ExternalProductResourceUrls.getInstance().technicalSupportUrl
|
||||
} else {
|
||||
ExternalProductResourceUrls.getInstance().freeTechnicalSupportUrl
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user