2020-10-28 07:56:14 +00:00
|
|
|
package localnotifications
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2024-10-28 20:54:17 +00:00
|
|
|
"github.com/status-im/status-go/logutils"
|
2020-10-28 07:56:14 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func NewAPI(s *Service) *API {
|
|
|
|
return &API{s}
|
|
|
|
}
|
|
|
|
|
|
|
|
type API struct {
|
|
|
|
s *Service
|
|
|
|
}
|
|
|
|
|
|
|
|
func (api *API) NotificationPreferences(ctx context.Context) ([]NotificationPreference, error) {
|
|
|
|
return api.s.db.GetPreferences()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (api *API) SwitchWalletNotifications(ctx context.Context, preference bool) error {
|
2024-10-28 20:54:17 +00:00
|
|
|
logutils.ZapLogger().Debug("Switch Transaction Notification")
|
2020-10-28 07:56:14 +00:00
|
|
|
err := api.s.db.ChangeWalletPreference(preference)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2020-12-28 15:09:25 +00:00
|
|
|
api.s.WatchingEnabled = preference
|
2020-10-28 07:56:14 +00:00
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|