mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 14:45:49 +01:00
fix(ios): correct service implementation pattern for dock and notifications
The iOS service stubs were importing a non-existent package `github.com/wailsapp/wails/v3/pkg/services` and using an incompatible interface pattern. This fix rewrites both files to follow the same pattern as other platforms (Linux, Windows, Darwin): - Implement the internal platformDock/platformNotifier interfaces - Provide New() functions returning *DockService/*NotificationService - Stub all required interface methods 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
a878b2c1af
commit
2e396bd48f
2 changed files with 122 additions and 24 deletions
|
|
@ -2,30 +2,63 @@
|
|||
|
||||
package dock
|
||||
|
||||
import "github.com/wailsapp/wails/v3/pkg/services"
|
||||
import (
|
||||
"context"
|
||||
|
||||
type iosBadgeService struct{}
|
||||
"github.com/wailsapp/wails/v3/pkg/application"
|
||||
)
|
||||
|
||||
func NewService() services.Service {
|
||||
return &iosBadgeService{}
|
||||
type iosDock struct{}
|
||||
|
||||
// New creates a new Dock Service.
|
||||
// On iOS, this returns a stub implementation.
|
||||
// iOS badge functionality will be implemented via native bridges.
|
||||
func New() *DockService {
|
||||
return &DockService{
|
||||
impl: &iosDock{},
|
||||
}
|
||||
}
|
||||
|
||||
func (s *iosBadgeService) Name() string {
|
||||
return "badge"
|
||||
// NewWithOptions creates a new dock service with badge options.
|
||||
// On iOS, this returns a stub implementation. Options are ignored.
|
||||
func NewWithOptions(options BadgeOptions) *DockService {
|
||||
return New()
|
||||
}
|
||||
|
||||
func (s *iosBadgeService) Route() string {
|
||||
return "/badge"
|
||||
}
|
||||
|
||||
func (s *iosBadgeService) Shutdown() {}
|
||||
|
||||
func setBadgeLabel(_ string) error {
|
||||
// iOS badge implementation would go here
|
||||
func (d *iosDock) Startup(ctx context.Context, options application.ServiceOptions) error {
|
||||
// iOS dock/badge startup - implementation pending native bridge
|
||||
return nil
|
||||
}
|
||||
|
||||
func clearBadgeLabel() error {
|
||||
// iOS badge implementation would go here
|
||||
func (d *iosDock) Shutdown() error {
|
||||
// iOS dock/badge shutdown - implementation pending native bridge
|
||||
return nil
|
||||
}
|
||||
|
||||
// HideAppIcon is a stub on iOS.
|
||||
func (d *iosDock) HideAppIcon() {
|
||||
// No-op: iOS doesn't support hiding app icon
|
||||
}
|
||||
|
||||
// ShowAppIcon is a stub on iOS.
|
||||
func (d *iosDock) ShowAppIcon() {
|
||||
// No-op: iOS doesn't support showing/hiding app icon
|
||||
}
|
||||
|
||||
// SetBadge sets the badge on the iOS app icon.
|
||||
func (d *iosDock) SetBadge(label string) error {
|
||||
// iOS badge implementation would go here via native bridge
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetCustomBadge is a stub on iOS since iOS badges don't support custom styling.
|
||||
func (d *iosDock) SetCustomBadge(label string, options BadgeOptions) error {
|
||||
// iOS doesn't support custom badge styling, fall back to standard badge
|
||||
return d.SetBadge(label)
|
||||
}
|
||||
|
||||
// RemoveBadge removes the badge from the iOS app icon.
|
||||
func (d *iosDock) RemoveBadge() error {
|
||||
// iOS badge removal would go here via native bridge
|
||||
return nil
|
||||
}
|
||||
|
|
@ -2,25 +2,90 @@
|
|||
|
||||
package notifications
|
||||
|
||||
import "github.com/wailsapp/wails/v3/pkg/services"
|
||||
import (
|
||||
"context"
|
||||
|
||||
type darwinNotificationService struct{}
|
||||
"github.com/wailsapp/wails/v3/pkg/application"
|
||||
)
|
||||
|
||||
func NewService() services.Service {
|
||||
return &darwinNotificationService{}
|
||||
type iosNotifier struct{}
|
||||
|
||||
// New creates a new Notifications Service.
|
||||
// On iOS, this returns a stub implementation.
|
||||
// iOS notification functionality will be implemented via native bridges.
|
||||
func New() *NotificationService {
|
||||
notificationServiceOnce.Do(func() {
|
||||
impl := &iosNotifier{}
|
||||
|
||||
NotificationService_ = &NotificationService{
|
||||
impl: impl,
|
||||
}
|
||||
})
|
||||
|
||||
return NotificationService_
|
||||
}
|
||||
|
||||
func (s *darwinNotificationService) Name() string {
|
||||
return "notifications"
|
||||
func (n *iosNotifier) Startup(ctx context.Context, options application.ServiceOptions) error {
|
||||
// iOS notification startup - implementation pending native bridge
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *darwinNotificationService) Route() string {
|
||||
return "/notifications"
|
||||
func (n *iosNotifier) Shutdown() error {
|
||||
// iOS notification shutdown - implementation pending native bridge
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *darwinNotificationService) Shutdown() {}
|
||||
func (n *iosNotifier) RequestNotificationAuthorization() (bool, error) {
|
||||
// iOS notification authorization would go here via native bridge
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func sendNotification(opts SendNotificationOptions) error {
|
||||
// iOS notification implementation would go here
|
||||
func (n *iosNotifier) CheckNotificationAuthorization() (bool, error) {
|
||||
// iOS notification authorization check would go here via native bridge
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func (n *iosNotifier) SendNotification(options NotificationOptions) error {
|
||||
// iOS notification would go here via native bridge
|
||||
return nil
|
||||
}
|
||||
|
||||
func (n *iosNotifier) SendNotificationWithActions(options NotificationOptions) error {
|
||||
// iOS notification with actions would go here via native bridge
|
||||
return nil
|
||||
}
|
||||
|
||||
func (n *iosNotifier) RegisterNotificationCategory(category NotificationCategory) error {
|
||||
// iOS notification category registration would go here via native bridge
|
||||
return nil
|
||||
}
|
||||
|
||||
func (n *iosNotifier) RemoveNotificationCategory(categoryID string) error {
|
||||
// iOS notification category removal would go here via native bridge
|
||||
return nil
|
||||
}
|
||||
|
||||
func (n *iosNotifier) RemoveAllPendingNotifications() error {
|
||||
// iOS pending notifications removal would go here via native bridge
|
||||
return nil
|
||||
}
|
||||
|
||||
func (n *iosNotifier) RemovePendingNotification(identifier string) error {
|
||||
// iOS pending notification removal would go here via native bridge
|
||||
return nil
|
||||
}
|
||||
|
||||
func (n *iosNotifier) RemoveAllDeliveredNotifications() error {
|
||||
// iOS delivered notifications removal would go here via native bridge
|
||||
return nil
|
||||
}
|
||||
|
||||
func (n *iosNotifier) RemoveDeliveredNotification(identifier string) error {
|
||||
// iOS delivered notification removal would go here via native bridge
|
||||
return nil
|
||||
}
|
||||
|
||||
func (n *iosNotifier) RemoveNotification(identifier string) error {
|
||||
// iOS notification removal would go here via native bridge
|
||||
return nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue