Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

package software.aws.toolkits.jetbrains.core.notifications

import com.intellij.notification.NotificationType
import com.intellij.openapi.actionSystem.AnAction
import software.aws.toolkits.jetbrains.utils.notifySticky

object DisplayToastNotifications {

Check warning on line 10 in plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/core/notifications/DisplayToastNotifications.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unused symbol

Object "DisplayToastNotifications" is never used

Check warning

Code scanning / QDJVMC

Unused symbol Warning

Object "DisplayToastNotifications" is never used
fun show(title: String, message: String, action: List<AnAction>, notificationType: ToastNotificationType) {
val notifyType = when (notificationType) {
ToastNotificationType.CRITICAL -> NotificationType.ERROR
ToastNotificationType.WARNING -> NotificationType.WARNING
ToastNotificationType.PRODUCT_UPDATE -> NotificationType.INFORMATION

Check warning on line 15 in plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/core/notifications/DisplayToastNotifications.kt

View check run for this annotation

Codecov / codecov/patch

plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/core/notifications/DisplayToastNotifications.kt#L13-L15

Added lines #L13 - L15 were not covered by tests
}
notifySticky(notifyType, title, message, null, action)
}

Check warning on line 18 in plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/core/notifications/DisplayToastNotifications.kt

View check run for this annotation

Codecov / codecov/patch

plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/core/notifications/DisplayToastNotifications.kt#L17-L18

Added lines #L17 - L18 were not covered by tests
}

enum class ToastNotificationType {
CRITICAL,
WARNING,
PRODUCT_UPDATE,
}

Check warning on line 25 in plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/core/notifications/DisplayToastNotifications.kt

View check run for this annotation

Codecov / codecov/patch

plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/core/notifications/DisplayToastNotifications.kt#L22-L25

Added lines #L22 - L25 were not covered by tests
Comment on lines +21 to +25
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm assuming this will be part of model, so plan ahead and move this to another file

Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
notify(notification, project)
}

private fun notifySticky(type: NotificationType, title: String, content: String = "", project: Project? = null, notificationActions: Collection<AnAction>) {
fun notifySticky(type: NotificationType, title: String, content: String = "", project: Project? = null, notificationActions: Collection<AnAction>) {

Check warning on line 51 in plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/utils/NotificationUtils.kt

View check run for this annotation

Codecov / codecov/patch

plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/utils/NotificationUtils.kt#L51

Added line #L51 was not covered by tests
val notification = Notification(GROUP_DISPLAY_ID_STICKY, title, content, type)
notificationActions.forEach {
notification.addAction(if (it !is NotificationAction) createNotificationExpiringAction(it) else it)
Expand Down
Loading