From 297a8db7880c6a33a16f256b0dd6d76fc1579999 Mon Sep 17 00:00:00 2001 From: a3d21 <93191329+a3d21@users.noreply.github.com> Date: Tue, 7 Nov 2023 10:44:08 +0800 Subject: [PATCH] feat: use dummy pusher by default (#1349) --- internal/push/offlinepush/dummy/push.go | 17 +++++++++++++++++ internal/push/push_to_client.go | 3 +++ 2 files changed, 20 insertions(+) create mode 100644 internal/push/offlinepush/dummy/push.go diff --git a/internal/push/offlinepush/dummy/push.go b/internal/push/offlinepush/dummy/push.go new file mode 100644 index 000000000..1be234d68 --- /dev/null +++ b/internal/push/offlinepush/dummy/push.go @@ -0,0 +1,17 @@ +package dummy + +import ( + "context" + "github.com/openimsdk/open-im-server/v3/internal/push/offlinepush" +) + +func NewClient() *Dummy { + return &Dummy{} +} + +type Dummy struct { +} + +func (d *Dummy) Push(ctx context.Context, userIDs []string, title, content string, opts *offlinepush.Opts) error { + return nil +} diff --git a/internal/push/push_to_client.go b/internal/push/push_to_client.go index 8f671c21d..61d094d27 100644 --- a/internal/push/push_to_client.go +++ b/internal/push/push_to_client.go @@ -18,6 +18,7 @@ import ( "context" "encoding/json" "errors" + "github.com/openimsdk/open-im-server/v3/internal/push/offlinepush/dummy" "github.com/OpenIMSDK/protocol/conversation" @@ -82,6 +83,8 @@ func NewOfflinePusher(cache cache.MsgModel) offlinepush.OfflinePusher { offlinePusher = fcm.NewClient(cache) case "jpush": offlinePusher = jpush.NewClient() + default: + offlinePusher = dummy.NewClient() } return offlinePusher }