mirror of
https://github.com/n08i40k/schedule-parser-next.git
synced 2025-12-06 09:47:46 +03:00
1.3.1
Уведомления об обновлении приложения.
This commit is contained in:
@@ -66,6 +66,8 @@ export class FirebaseAdminService implements OnModuleInit {
|
||||
const currentTopics = new Set(fcm.topics);
|
||||
|
||||
for (const topic of topics) {
|
||||
if (!fcm.topics.includes(topic)) continue;
|
||||
|
||||
await this.messaging.unsubscribeFromTopic(fcm.token, topic);
|
||||
currentTopics.delete(topic);
|
||||
}
|
||||
@@ -84,6 +86,8 @@ export class FirebaseAdminService implements OnModuleInit {
|
||||
const currentTopics = new Set(fcm.topics);
|
||||
|
||||
for (const topic of topics) {
|
||||
if (fcm.topics.includes(topic)) continue;
|
||||
|
||||
await this.messaging.subscribeToTopic(fcm.token, topic);
|
||||
currentTopics.add(topic);
|
||||
}
|
||||
@@ -96,4 +100,17 @@ export class FirebaseAdminService implements OnModuleInit {
|
||||
data: { fcm: fcm },
|
||||
});
|
||||
}
|
||||
|
||||
async updateApp(
|
||||
userDto: UserDto,
|
||||
version: string,
|
||||
topics: Set<string>,
|
||||
): Promise<void> {
|
||||
await this.subscribe(userDto, topics).then(async (userDto) => {
|
||||
await this.usersService.update({
|
||||
where: { id: userDto.id },
|
||||
data: { version: version },
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user