Füge Unterstützung für die Registrierung von Geräten hinzu: Implementiere die Registrierung des aktuellen Geräts und verbessere die Fehlerbehandlung für Push-Token.
This commit is contained in:
@@ -102,6 +102,11 @@ export function upsertPushToken(user, { token, platform = 'android', appVersion
|
||||
return user
|
||||
}
|
||||
|
||||
export async function androidPushTokenCountForUser(userId) {
|
||||
const user = (await readUsers()).find(entry => entry?.id === userId)
|
||||
return pushTokensForUser(user).length
|
||||
}
|
||||
|
||||
async function sendFcmMessage({ serviceAccount, accessToken, token, data = {} }) {
|
||||
const projectId = projectIdFromServiceAccount(serviceAccount)
|
||||
if (!projectId) throw new Error('FCM project_id fehlt.')
|
||||
|
||||
Reference in New Issue
Block a user