onSignInHandler method
Handles the notification initialization required when a user signs in.
Implementation
Future<void> onSignInHandler(
UserModel user,
Map<String, bool> notificationPreferences,
) async {
// Subscribing to topics is not supported on web
if (kIsWeb) return;
await instance.requestPermission();
instance.setForegroundNotificationPresentationOptions(
alert: true,
badge: true,
sound: true,
);
updateTopicSubscription('allUsers');
updateTopicSubscription(user.uid!);
updateTopicSubscription('admin', enabled: user.customClaims.admin);
for (final entry in notificationPreferences.entries) {
updateTopicSubscription(entry.key, enabled: entry.value);
}
}