feat(pushNotifications): added anonymous token for push notifications

This commit is contained in:
misha
2025-09-24 15:23:01 +03:00
parent 68ea8da6e3
commit 517e493b5e
6 changed files with 87 additions and 10 deletions

View File

@@ -26,6 +26,22 @@ class FirebaseApi {
return token;
}
Future<void> registerAnonymousPushToken() async {
try {
final deviceInfo = DeviceInfoPlugin();
await sl<Dio>().post(
'/api/anonymous_token',
data: {
'platform': Platform.isIOS ? 'ios' : 'android',
'hw_id': Platform.isIOS ? (await deviceInfo.iosInfo).identifierForVendor : (await deviceInfo.androidInfo).id,
'token': await getToken(),
},
);
} catch (e, st) {
log(e.toString(), stackTrace: st);
}
}
Future<void> registerPushToken() async {
if (await TokenStorage.haveTokenInStorage()) {
try {