mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-16 06:49:02 +08:00
push
This commit is contained in:
@@ -22,7 +22,7 @@ type Fcm struct {
|
||||
cache cache.Cache
|
||||
}
|
||||
|
||||
func newFcmClient(cache cache.Cache) *Fcm {
|
||||
func NewClient(cache cache.Cache) *Fcm {
|
||||
opt := option.WithCredentialsFile(filepath.Join(config.Root, "config", config.Config.Push.Fcm.ServiceAccount))
|
||||
fcmApp, err := firebase.NewApp(context.Background(), nil, opt)
|
||||
if err != nil {
|
||||
@@ -42,7 +42,7 @@ func newFcmClient(cache cache.Cache) *Fcm {
|
||||
return &Fcm{fcmMsgCli: fcmMsgClient}
|
||||
}
|
||||
|
||||
func (f *Fcm) Push(ctx context.Context, userIDs []string, title, content string, opts push.Opts) error {
|
||||
func (f *Fcm) Push(ctx context.Context, userIDs []string, title, content string, opts *push.Opts) error {
|
||||
// accounts->registrationToken
|
||||
allTokens := make(map[string][]string, 0)
|
||||
for _, account := range userIDs {
|
||||
@@ -105,7 +105,6 @@ func (f *Fcm) Push(ctx context.Context, userIDs []string, title, content string,
|
||||
}
|
||||
messages = append(messages, temp)
|
||||
}
|
||||
|
||||
}
|
||||
messageCount := len(messages)
|
||||
if messageCount > 0 {
|
||||
|
||||
Reference in New Issue
Block a user