From 639ec6e9d4f9e60acc121580a28efb33eb8c6538 Mon Sep 17 00:00:00 2001 From: Vadim <44135514+vodemn@users.noreply.github.com> Date: Sat, 6 Apr 2024 19:04:19 +0200 Subject: [PATCH] fixed camera not being initialized on Android --- .../bloc_container_camera.dart | 26 +++++-------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/lib/screens/metering/components/camera_container/bloc_container_camera.dart b/lib/screens/metering/components/camera_container/bloc_container_camera.dart index eecbef2..f3eefdb 100644 --- a/lib/screens/metering/components/camera_container/bloc_container_camera.dart +++ b/lib/screens/metering/components/camera_container/bloc_container_camera.dart @@ -251,26 +251,12 @@ class _WidgetsBindingObserver with WidgetsBindingObserver { /// Revoking camera permissions results in app being killed both on Android and iOS @override void didChangeAppLifecycleState(AppLifecycleState state) { - switch (defaultTargetPlatform) { - /// On Android opening a dialog results in [AppLifecycleState.inactive] - case TargetPlatform.android: - if (_prevState == AppLifecycleState.inactive && state == AppLifecycleState.resumed) { - return; - } - _prevState = state; - onLifecycleStateChanged(state); - - /// When coming from the app's settings iOS fires paused -> inactive -> resumed state which falls into this condition. - /// So the inactive state is skipped. - case TargetPlatform.iOS: - if (state == AppLifecycleState.inactive) { - return; - } - if (_prevState != state) { - _prevState = state; - onLifecycleStateChanged(state); - } - default: + if (state == AppLifecycleState.inactive) { + return; + } + if (_prevState != state) { + _prevState = state; + onLifecycleStateChanged(state); } } }