mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-21 11:29:29 +08:00
quick fixes
This commit is contained in:
parent
6d44068ede
commit
ab9c460088
@ -7,7 +7,8 @@ const notificationsElement = document.getElementById('notifications');
|
||||
window.sendNotification = async () => {
|
||||
const granted = await Notifications.RequestUserNotificationAuthorization();
|
||||
if (granted) {
|
||||
await Notifications.SendNotification("some-uuid-fronted", "Frontend Notificaiton", "", "Notificaiton sent through JS!");
|
||||
const uuid = crypto.randomUUID();
|
||||
await Notifications.SendNotification(uuid, "Frontend Notification", "", "Notification sent through JS!");
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,11 +27,12 @@ window.sendComplexNotification = async () => {
|
||||
replyPlaceholder: "Reply to frontend...",
|
||||
});
|
||||
|
||||
const uuid = crypto.randomUUID();
|
||||
await Notifications.SendNotificationWithActions({
|
||||
id: "some-uuid-complex",
|
||||
id: uuid,
|
||||
title: "Complex Frontend Notification",
|
||||
subtitle: "From: Jane Doe",
|
||||
body: "Is it rainging today where you are?",
|
||||
body: "Is it raining today where you are?",
|
||||
categoryId: "FRONTEND_NOTIF",
|
||||
data: {
|
||||
messageId: "msg-456",
|
||||
|
@ -52,7 +52,7 @@ func (c ApplicationEventContext) HasVisibleWindows() bool {
|
||||
return c.getBool("hasVisibleWindows")
|
||||
}
|
||||
|
||||
func (c *ApplicationEventContext) setData(data map[string]any) {
|
||||
func (c ApplicationEventContext) setData(data map[string]any) {
|
||||
c.data = data
|
||||
}
|
||||
|
||||
@ -72,10 +72,6 @@ func (c ApplicationEventContext) Filename() string {
|
||||
return result
|
||||
}
|
||||
|
||||
func (c *ApplicationEventContext) GetData() map[string]any {
|
||||
return c.data
|
||||
}
|
||||
|
||||
func newApplicationEventContext() *ApplicationEventContext {
|
||||
return &ApplicationEventContext{
|
||||
data: make(map[string]any),
|
||||
|
@ -167,6 +167,7 @@ func (ns *Service) RemoveDeliveredNotification(_ string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Is there a better way for me to grab this from the Wails config?
|
||||
func getExeName() string {
|
||||
executable, err := os.Executable()
|
||||
if err != nil {
|
||||
@ -178,6 +179,9 @@ func getExeName() string {
|
||||
|
||||
func saveCategoriesToRegistry() error {
|
||||
appName := getExeName()
|
||||
if appName == "" {
|
||||
return fmt.Errorf("failed to save categories to registry: empty executable name")
|
||||
}
|
||||
registryPath := fmt.Sprintf(`SOFTWARE\%s\NotificationCategories`, appName)
|
||||
|
||||
key, _, err := registry.CreateKey(
|
||||
@ -200,7 +204,9 @@ func saveCategoriesToRegistry() error {
|
||||
|
||||
func loadCategoriesFromRegistry() error {
|
||||
appName := getExeName()
|
||||
println(appName)
|
||||
if appName == "" {
|
||||
return fmt.Errorf("failed to save categories to registry: empty executable name")
|
||||
}
|
||||
registryPath := fmt.Sprintf(`SOFTWARE\%s\NotificationCategories`, appName)
|
||||
|
||||
key, err := registry.OpenKey(
|
||||
|
Loading…
Reference in New Issue
Block a user