From 6601a48984495625373cae1702fd1c3563c524b9 Mon Sep 17 00:00:00 2001 From: dab246 Date: Mon, 12 Jan 2026 11:19:34 +0700 Subject: [PATCH] TF-4136 Fix DeviceInfoPlugin is instantiated on every access. --- core/lib/utils/application_manager.dart | 5 ++++- core/lib/utils/sentry/sentry_initializer.dart | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/core/lib/utils/application_manager.dart b/core/lib/utils/application_manager.dart index 495c5f8b7..fbb924541 100644 --- a/core/lib/utils/application_manager.dart +++ b/core/lib/utils/application_manager.dart @@ -15,8 +15,10 @@ class ApplicationManager { @visibleForTesting static DeviceInfoPlugin? debugDeviceInfoOverride; + DeviceInfoPlugin? _deviceInfoCache; + DeviceInfoPlugin get _deviceInfo => - debugDeviceInfoOverride ?? DeviceInfoPlugin(); + debugDeviceInfoOverride ?? (_deviceInfoCache ??= DeviceInfoPlugin()); PackageInfo? _packageInfoCache; String? _versionCache; @@ -31,6 +33,7 @@ class ApplicationManager { _cachedWebUserAgent = null; _cachedMobileUserAgent = null; _isMobileUserAgentInitialized = false; + _deviceInfoCache = null; } Future getPackageInfo() async { diff --git a/core/lib/utils/sentry/sentry_initializer.dart b/core/lib/utils/sentry/sentry_initializer.dart index 6d1281beb..db2f62c69 100644 --- a/core/lib/utils/sentry/sentry_initializer.dart +++ b/core/lib/utils/sentry/sentry_initializer.dart @@ -17,6 +17,7 @@ class SentryInitializer { 'bearer', 'session', 'password', + 'token', ]; static Future init(FutureOr Function() appRunner) async {