fix: accept jpush token metadata fields
This commit is contained in:
+24
-15
@@ -319,10 +319,13 @@ type imYouthModeEnableRequest struct {
|
||||
}
|
||||
|
||||
type imDevicePushTokenRequest struct {
|
||||
Provider string `json:"provider"`
|
||||
Token string `json:"token"`
|
||||
AppVersion string `json:"app_version,omitempty"`
|
||||
Platform string `json:"platform,omitempty"`
|
||||
Provider string `json:"provider"`
|
||||
Token string `json:"token"`
|
||||
AppVersion string `json:"app_version,omitempty"`
|
||||
Platform string `json:"platform,omitempty"`
|
||||
SDKVersion string `json:"sdk_version,omitempty"`
|
||||
PushEnv string `json:"push_env,omitempty"`
|
||||
NotificationPermission string `json:"notification_permission,omitempty"`
|
||||
}
|
||||
|
||||
type imP2PConversationRequest struct {
|
||||
@@ -3356,12 +3359,15 @@ func serveIMDevicePushToken(wrt http.ResponseWriter, req *http.Request) {
|
||||
return
|
||||
}
|
||||
token, err := store.DevicePushTokens.Upsert(principal.TenantID, &types.DevicePushToken{
|
||||
UserID: principal.Uid,
|
||||
DeviceID: deviceID,
|
||||
Provider: body.Provider,
|
||||
Token: body.Token,
|
||||
AppVersion: body.AppVersion,
|
||||
Platform: body.Platform,
|
||||
UserID: principal.Uid,
|
||||
DeviceID: deviceID,
|
||||
Provider: body.Provider,
|
||||
Token: body.Token,
|
||||
AppVersion: body.AppVersion,
|
||||
Platform: body.Platform,
|
||||
SDKVersion: body.SDKVersion,
|
||||
PushEnv: body.PushEnv,
|
||||
NotificationPermission: body.NotificationPermission,
|
||||
})
|
||||
if err != nil {
|
||||
writeIMRelationError(wrt, req, err)
|
||||
@@ -9664,11 +9670,14 @@ func youthModeRestrictionItems(restrictions []string) []map[string]any {
|
||||
|
||||
func devicePushTokenPayload(token *types.DevicePushToken) map[string]any {
|
||||
return map[string]any{
|
||||
"device_id": token.DeviceID,
|
||||
"provider": token.Provider,
|
||||
"app_version": token.AppVersion,
|
||||
"platform": token.Platform,
|
||||
"updated_at": token.UpdatedAt.UTC().Format(time.RFC3339Nano),
|
||||
"device_id": token.DeviceID,
|
||||
"provider": token.Provider,
|
||||
"app_version": token.AppVersion,
|
||||
"platform": token.Platform,
|
||||
"sdk_version": token.SDKVersion,
|
||||
"push_env": token.PushEnv,
|
||||
"notification_permission": token.NotificationPermission,
|
||||
"updated_at": token.UpdatedAt.UTC().Format(time.RFC3339Nano),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user