TF-2298 Update expires time when old token has expired
Signed-off-by: dab246 <tdvu@linagora.com> (cherry picked from commit fb26afe8f52df6e16476aea8a68f9f92c5c4b001)
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
|
||||
|
||||
import 'package:tmail_ui_user/features/push_notification/data/model/fcm_subscription.dart';
|
||||
import 'package:tmail_ui_user/features/push_notification/domain/model/fcm_subscription.dart';
|
||||
|
||||
extension FCMSubscriptionExtension on FCMSubscription {
|
||||
FCMSubscriptionCache toFCMSubscriptionCache() {
|
||||
return FCMSubscriptionCache(deviceId, subscriptionId);
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
import 'package:fcm/converter/device_client_id_nullable_converter.dart';
|
||||
import 'package:fcm/converter/fcm_token_nullable_converter.dart';
|
||||
import 'package:fcm/converter/firebase_registration_id_nullable_converter.dart';
|
||||
import 'package:fcm/converter/type_name_converter.dart';
|
||||
import 'package:fcm/model/firebase_registration.dart';
|
||||
import 'package:fcm/model/firebase_registration_expired_time.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/utc_date.dart';
|
||||
import 'package:tmail_ui_user/features/push_notification/data/model/firebase_registration_cache.dart';
|
||||
|
||||
extension FirebaseRegistrationCacheExtension on FirebaseRegistrationCache {
|
||||
FirebaseRegistration toFirebaseRegistration() {
|
||||
return FirebaseRegistration(
|
||||
id: const FirebaseRegistrationIdNullableConverter().fromJson(id),
|
||||
token: const FcmTokenNullableConverter().fromJson(token),
|
||||
deviceClientId: const DeviceClientIdNullableConverter().fromJson(deviceClientId),
|
||||
expires: expires != null ? FirebaseRegistrationExpiredTime(UTCDate(expires!)) : null,
|
||||
types: types?.map((type) => const TypeNameConverter().fromJson(type)).toList()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import 'package:fcm/model/firebase_registration.dart';
|
||||
import 'package:tmail_ui_user/features/push_notification/data/model/firebase_registration_cache.dart';
|
||||
|
||||
extension FirebaseRegistrationExtension on FirebaseRegistration {
|
||||
FirebaseRegistrationCache toFirebaseRegistrationCache() {
|
||||
return FirebaseRegistrationCache(
|
||||
deviceClientId: deviceClientId!.value,
|
||||
id: id?.id.value,
|
||||
token: token?.value,
|
||||
expires: expires?.value.value,
|
||||
types: types?.map((type) => type.value).toList(),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user