mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
fcm push modify
This commit is contained in:
parent
787cef54f5
commit
1eda0ebea7
@ -1,4 +1,4 @@
|
|||||||
package push
|
package fcm
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/internal/push"
|
"Open_IM/internal/push"
|
||||||
@ -17,12 +17,9 @@ type Fcm struct {
|
|||||||
FcmMsgCli *messaging.Client
|
FcmMsgCli *messaging.Client
|
||||||
}
|
}
|
||||||
|
|
||||||
var FcmClient *Fcm
|
func NewFcm() *Fcm {
|
||||||
|
return newFcmClient()
|
||||||
func init() {
|
|
||||||
FcmClient = newFcmClient()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func newFcmClient() *Fcm {
|
func newFcmClient() *Fcm {
|
||||||
opt := option.WithCredentialsFile(filepath.Join(config.Root, "config", config.Config.Push.Fcm.ServiceAccount))
|
opt := option.WithCredentialsFile(filepath.Join(config.Root, "config", config.Config.Push.Fcm.ServiceAccount))
|
||||||
fcmApp, err := firebase.NewApp(context.Background(), nil, opt)
|
fcmApp, err := firebase.NewApp(context.Background(), nil, opt)
|
||||||
|
@ -44,7 +44,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if config.Config.Push.Fcm.Enable {
|
if config.Config.Push.Fcm.Enable {
|
||||||
offlinePusher = fcm.FcmClient
|
offlinePusher = fcm.NewFcm()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user