Skip to content

Commit 9b69c56

Browse files
committed
feat: Add NotificationManager for CodeXP notifications
1 parent ad888fc commit 9b69c56

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.github.ilovegamecoding.intellijcodexp.manager
2+
3+
import com.github.ilovegamecoding.intellijcodexp.model.CodeXPChallenge
4+
import com.intellij.notification.NotificationGroup
5+
import com.intellij.notification.NotificationGroupManager
6+
import com.intellij.notification.NotificationType
7+
8+
object CodeXPNotificationManager {
9+
private val notifiationGroup: NotificationGroup =
10+
NotificationGroupManager.getInstance().getNotificationGroup("CodeXP")
11+
12+
fun notify(title: String, content: String) {
13+
notifiationGroup.createNotification(title, content, NotificationType.INFORMATION).notify(null)
14+
}
15+
16+
fun notifyChallengeComplete(codeXPChallenge: CodeXPChallenge) {
17+
notify("${codeXPChallenge.name} completed!", "Reward: ${codeXPChallenge.rewardXP} XP")
18+
}
19+
20+
fun notifyLevelUp(level: Int, xpToNextLevel: Long) {
21+
notify("Level up!", "Congratulations! You are now level $level. You need $xpToNextLevel XP to reach the next level.")
22+
}
23+
}

src/main/resources/META-INF/plugin.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<toolWindow factoryClass="com.github.ilovegamecoding.intellijcodexp.toolWindow.CodeXPToolWindowFactory"
1313
id="CodeXPToolWindow"/>
1414
<applicationService serviceImplementation="com.github.ilovegamecoding.intellijcodexp.services.CodeXPService"/>
15+
<notificationGroup displayType="BALLOON" id="CodeXP"/>
1516
</extensions>
1617

1718
<application-components>

0 commit comments

Comments
 (0)