Skip to content

Commit

Permalink
Fix compatibility issues, drop support for 212
Browse files Browse the repository at this point in the history
  • Loading branch information
WarningImHack3r committed Jan 8, 2024
1 parent f434e51 commit d498c59
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pluginRepositoryUrl = https://github.com/WarningImHack3r/intellij-shadcn-plugin
pluginVersion = 1.0.0

# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild = 212
pluginSinceBuild = 213
pluginUntilBuild =

# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ abstract class Source<C : Config>(val project: Project, private val serializer:
"Installed $dependenciesList for ${component.name}.",
)
}
notif.hideBalloon()
notif.expire()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import com.intellij.notification.NotificationAction
import com.intellij.notification.NotificationType
import com.intellij.notification.Notifications
import com.intellij.openapi.project.Project
import com.intellij.util.concurrency.AppExecutorUtil
import java.util.concurrent.ScheduledExecutorService
import java.util.concurrent.TimeUnit

class NotificationManager(val project: Project? = null) {

Expand All @@ -22,19 +25,18 @@ class NotificationManager(val project: Project? = null) {
actions.forEach { addAction(it) }
}

@Suppress("UnstableApiUsage") // notifyAndHide is still experimental
private fun sendNotification(
notification: Notification,
hide: Boolean = false
) {
project?.let {
Notifications.Bus.notify(notification, it)
} ?: Notifications.Bus.notify(notification)
if (hide) {
project?.let {
Notifications.Bus.notifyAndHide(notification, it)
} ?: Notifications.Bus.notifyAndHide(notification)
} else {
project?.let {
Notifications.Bus.notify(notification, it)
} ?: Notifications.Bus.notify(notification)
// Taken from experimental Notifications.Bus.notifyAndHide
(AppExecutorUtil.getAppExecutorService() as ScheduledExecutorService).schedule({
notification.expire()
}, 5, TimeUnit.SECONDS)
}
}

Expand Down

0 comments on commit d498c59

Please sign in to comment.