mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2025-05-14 20:20:40 +00:00
added logging to CameraInfoService
This commit is contained in:
parent
7410d7ed60
commit
04b5e8d4ef
2 changed files with 24 additions and 7 deletions
|
@ -33,9 +33,9 @@ class ApplicationWrapper extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ApplicationWrapperState extends State<ApplicationWrapper> {
|
class _ApplicationWrapperState extends State<ApplicationWrapper> {
|
||||||
late final remoteConfigService = widget.env.buildType != BuildType.dev
|
static const analytics = LightmeterAnalytics(api: LightmeterAnalyticsFirebase());
|
||||||
? const RemoteConfigService(LightmeterAnalytics(api: LightmeterAnalyticsFirebase()))
|
late final remoteConfigService =
|
||||||
: const MockRemoteConfigService();
|
widget.env.buildType != BuildType.dev ? const RemoteConfigService(analytics) : const MockRemoteConfigService();
|
||||||
|
|
||||||
late final UserPreferencesService userPreferencesService;
|
late final UserPreferencesService userPreferencesService;
|
||||||
late final bool hasLightSensor;
|
late final bool hasLightSensor;
|
||||||
|
@ -100,7 +100,7 @@ class _ApplicationWrapperState extends State<ApplicationWrapper> {
|
||||||
await Future.wait([
|
await Future.wait([
|
||||||
SharedPreferences.getInstance(),
|
SharedPreferences.getInstance(),
|
||||||
const LightSensorService(LocalPlatform()).hasSensor(),
|
const LightSensorService(LocalPlatform()).hasSensor(),
|
||||||
const CameraInfoService().mainCameraEfl(),
|
const CameraInfoService(analytics).mainCameraEfl(),
|
||||||
remoteConfigService.activeAndFetchFeatures(),
|
remoteConfigService.activeAndFetchFeatures(),
|
||||||
equipmentProfilesStorageService.init(),
|
equipmentProfilesStorageService.init(),
|
||||||
filmsStorageService.init(),
|
filmsStorageService.init(),
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:lightmeter/data/analytics/analytics.dart';
|
||||||
|
|
||||||
class CameraInfoService {
|
class CameraInfoService {
|
||||||
@visibleForTesting
|
@visibleForTesting
|
||||||
|
@ -7,10 +8,26 @@ class CameraInfoService {
|
||||||
"com.vodemn.lightmeter.CameraInfoPlatformChannel.MethodChannel",
|
"com.vodemn.lightmeter.CameraInfoPlatformChannel.MethodChannel",
|
||||||
);
|
);
|
||||||
|
|
||||||
const CameraInfoService();
|
final LightmeterAnalytics analytics;
|
||||||
|
|
||||||
|
const CameraInfoService(this.analytics);
|
||||||
|
|
||||||
Future<int?> mainCameraEfl() async {
|
Future<int?> mainCameraEfl() async {
|
||||||
final focalLength = await cameraInfoPlatformChannel.invokeMethod<double?>('mainCameraEfl');
|
try {
|
||||||
return focalLength?.round();
|
final focalLength = await cameraInfoPlatformChannel.invokeMethod<double?>('mainCameraEfl');
|
||||||
|
return focalLength?.round();
|
||||||
|
} on PlatformException catch (e) {
|
||||||
|
analytics.logEvent(
|
||||||
|
e.code,
|
||||||
|
parameters: {
|
||||||
|
"message": "${e.message}",
|
||||||
|
"details": e.details.toString(),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
return null;
|
||||||
|
} catch (e) {
|
||||||
|
analytics.logEvent(e.toString());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue