TF-4268 Cache Sentry config and user for FCM background re-initialization

Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
dab246
2026-04-09 16:22:37 +07:00
committed by Dat H. Pham
parent cb5d43630a
commit eeaab49e93
20 changed files with 755 additions and 183 deletions
@@ -0,0 +1,66 @@
import 'package:core/utils/sentry/sentry_config.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:tmail_ui_user/features/caching/entries/sentry_configuration_cache.dart';
import 'package:tmail_ui_user/features/caching/entries/sentry_user_cache.dart';
extension SentryConfigExtension on SentryConfig {
SentryConfigurationCache toSentryConfigurationCache() {
return SentryConfigurationCache(
dsn: dsn,
environment: environment,
release: release,
isAvailable: isAvailable,
tracesSampleRate: tracesSampleRate,
profilesSampleRate: profilesSampleRate,
sessionSampleRate: sessionSampleRate,
onErrorSampleRate: onErrorSampleRate,
enableLogs: enableLogs,
enableFramesTracking: enableFramesTracking,
isDebug: isDebug,
attachScreenshot: attachScreenshot,
dist: dist,
);
}
}
extension SentryConfigurationCacheExtension on SentryConfigurationCache {
SentryConfig toSentryConfig() {
return SentryConfig(
dsn: dsn,
environment: environment,
release: release,
isAvailable: isAvailable,
tracesSampleRate: tracesSampleRate,
profilesSampleRate: profilesSampleRate,
sessionSampleRate: sessionSampleRate,
onErrorSampleRate: onErrorSampleRate,
enableLogs: enableLogs,
enableFramesTracking: enableFramesTracking,
isDebug: isDebug,
attachScreenshot: attachScreenshot,
dist: dist,
);
}
}
extension SentryUserExtension on SentryUser {
SentryUserCache toSentryUserCache() {
return SentryUserCache(
id: id ?? '',
name: name ?? '',
username: username ?? '',
email: email ?? '',
);
}
}
extension SentryUserCacheExtension on SentryUserCache {
SentryUser toSentryUser() {
return SentryUser(
id: id.isEmpty ? null : id,
name: name.isEmpty ? null : name,
username: username.isEmpty ? null : username,
email: email.isEmpty ? null : email,
);
}
}