|
|
|
@ -4,7 +4,6 @@ import (
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
"github.com/aditya-K2/gomp/ui"
|
|
|
|
|
|
|
|
|
|
"github.com/aditya-K2/gomp/utils"
|
|
|
|
|
|
|
|
|
|
"github.com/aditya-K2/tview"
|
|
|
|
@ -12,7 +11,6 @@ import (
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
var (
|
|
|
|
|
UI *ui.Application
|
|
|
|
|
Notify *NotificationServer
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
@ -22,10 +20,6 @@ type Notification struct {
|
|
|
|
|
Text string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func ConnectUI(a *ui.Application) {
|
|
|
|
|
UI = a
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Get A Pointer to A Notification Struct */
|
|
|
|
|
func NewNotification(s string) *Notification {
|
|
|
|
|
return &Notification{
|
|
|
|
@ -80,11 +74,11 @@ func NotificationRoutine(c chan string, s string) {
|
|
|
|
|
if s != "EMPTY NOTIFICATION" {
|
|
|
|
|
go func() {
|
|
|
|
|
currentTime := time.Now().String()
|
|
|
|
|
UI.Pages.AddPage(currentTime, NewNotification(s), false, true)
|
|
|
|
|
UI.App.SetFocus(UI.ExpandedView)
|
|
|
|
|
ui.Ui.Pages.AddPage(currentTime, NewNotification(s), false, true)
|
|
|
|
|
ui.Ui.App.SetFocus(ui.Ui.ExpandedView)
|
|
|
|
|
time.Sleep(time.Second * 1)
|
|
|
|
|
UI.Pages.RemovePage(currentTime)
|
|
|
|
|
UI.App.SetFocus(UI.ExpandedView)
|
|
|
|
|
ui.Ui.Pages.RemovePage(currentTime)
|
|
|
|
|
ui.Ui.App.SetFocus(ui.Ui.ExpandedView)
|
|
|
|
|
}()
|
|
|
|
|
}
|
|
|
|
|
NewNotification := <-c
|
|
|
|
|