TF-4136 Fix DeviceInfoPlugin is instantiated on every access.

This commit is contained in:
dab246
2026-01-12 11:19:34 +07:00
committed by Dat H. Pham
parent 72e4343398
commit 6601a48984
2 changed files with 5 additions and 1 deletions
+4 -1
View File
@@ -15,8 +15,10 @@ class ApplicationManager {
@visibleForTesting @visibleForTesting
static DeviceInfoPlugin? debugDeviceInfoOverride; static DeviceInfoPlugin? debugDeviceInfoOverride;
DeviceInfoPlugin? _deviceInfoCache;
DeviceInfoPlugin get _deviceInfo => DeviceInfoPlugin get _deviceInfo =>
debugDeviceInfoOverride ?? DeviceInfoPlugin(); debugDeviceInfoOverride ?? (_deviceInfoCache ??= DeviceInfoPlugin());
PackageInfo? _packageInfoCache; PackageInfo? _packageInfoCache;
String? _versionCache; String? _versionCache;
@@ -31,6 +33,7 @@ class ApplicationManager {
_cachedWebUserAgent = null; _cachedWebUserAgent = null;
_cachedMobileUserAgent = null; _cachedMobileUserAgent = null;
_isMobileUserAgentInitialized = false; _isMobileUserAgentInitialized = false;
_deviceInfoCache = null;
} }
Future<PackageInfo> getPackageInfo() async { Future<PackageInfo> getPackageInfo() async {
@@ -17,6 +17,7 @@ class SentryInitializer {
'bearer', 'bearer',
'session', 'session',
'password', 'password',
'token',
]; ];
static Future<bool> init(FutureOr<void> Function() appRunner) async { static Future<bool> init(FutureOr<void> Function() appRunner) async {