mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-04 20:11:27 +08:00
update example
This commit is contained in:
parent
a4c4ab6c8f
commit
acad85e603
@ -30,6 +30,9 @@ func main() {
|
|||||||
Mac: application.MacOptions{
|
Mac: application.MacOptions{
|
||||||
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
||||||
},
|
},
|
||||||
|
Windows: application.WindowsOptions{
|
||||||
|
WndClass: "Notifications",
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
|
app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
|
||||||
@ -65,7 +68,7 @@ func main() {
|
|||||||
Data: map[string]interface{}{
|
Data: map[string]interface{}{
|
||||||
"messageId": "msg-123",
|
"messageId": "msg-123",
|
||||||
"senderId": "user-123",
|
"senderId": "user-123",
|
||||||
"timestamp": time.Now().String(),
|
"timestamp": time.Now().Unix(),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -92,7 +95,7 @@ func main() {
|
|||||||
Data: map[string]interface{}{
|
Data: map[string]interface{}{
|
||||||
"messageId": "msg-456",
|
"messageId": "msg-456",
|
||||||
"senderId": "user-456",
|
"senderId": "user-456",
|
||||||
"timestamp": time.Now().String(),
|
"timestamp": time.Now().Unix(),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ func (ns *Service) ServiceStartup(ctx context.Context, options application.Servi
|
|||||||
return fmt.Errorf("failed to connect to D-Bus session bus: %v", err)
|
return fmt.Errorf("failed to connect to D-Bus session bus: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
appName := "Wails Application"
|
appName := application.Get().Config().Name
|
||||||
|
|
||||||
var iconPath string
|
var iconPath string
|
||||||
|
|
||||||
@ -52,14 +52,13 @@ func (ns *Service) ServiceStartup(ctx context.Context, options application.Servi
|
|||||||
ActionIdentifier: action,
|
ActionIdentifier: action,
|
||||||
}
|
}
|
||||||
|
|
||||||
if action == "default" {
|
if action == "" {
|
||||||
response.ActionIdentifier = DefaultActionIdentifier
|
response.ActionIdentifier = DefaultActionIdentifier
|
||||||
}
|
}
|
||||||
|
|
||||||
if target.Signature().String() == "s" {
|
if target.Signature().String() == "s" {
|
||||||
var targetStr string
|
var targetStr string
|
||||||
if err := target.Store(&targetStr); err == nil {
|
if err := target.Store(&targetStr); err == nil {
|
||||||
// Try to parse as JSON
|
|
||||||
var userInfo map[string]interface{}
|
var userInfo map[string]interface{}
|
||||||
if err := json.Unmarshal([]byte(targetStr), &userInfo); err == nil {
|
if err := json.Unmarshal([]byte(targetStr), &userInfo); err == nil {
|
||||||
response.UserInfo = userInfo
|
response.UserInfo = userInfo
|
||||||
|
Loading…
Reference in New Issue
Block a user