fixed app lifecycle state init
This commit is contained in:
parent
cfb546f056
commit
68a285b7fa
2 changed files with 8 additions and 6 deletions
|
@ -493,17 +493,13 @@ abstract class CollectionSource with SourceBase, AlbumMixin, CountryMixin, Place
|
|||
// cataloguing
|
||||
if (!startAnalysisService) {
|
||||
final opCount = (force ? todoEntries : todoEntries.where(TagMixin.catalogEntriesTest)).length;
|
||||
if (opCount > TagMixin.commitCountThreshold) {
|
||||
startAnalysisService = true;
|
||||
}
|
||||
startAnalysisService = opCount > TagMixin.commitCountThreshold;
|
||||
}
|
||||
// ignore locating countries
|
||||
// locating places
|
||||
if (!startAnalysisService && await availability.canLocatePlaces) {
|
||||
final opCount = (force ? todoEntries.where((entry) => entry.hasGps) : todoEntries.where(LocationMixin.locatePlacesTest)).length;
|
||||
if (opCount > LocationMixin.commitCountThreshold) {
|
||||
startAnalysisService = true;
|
||||
}
|
||||
startAnalysisService = opCount > LocationMixin.commitCountThreshold;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -203,7 +203,10 @@ class _AvesAppState extends State<AvesApp> with WidgetsBindingObserver {
|
|||
_subscriptions.add(_errorChannel.receiveBroadcastStream().listen((event) => _onError(event as String?)));
|
||||
_updateCutoutInsets();
|
||||
_appModeNotifier.addListener(_onAppModeChanged);
|
||||
|
||||
debugPrint('start listening to app lifecycle');
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
AvesApp.lifecycleStateNotifier.value = WidgetsBinding.instance.lifecycleState ?? AppLifecycleState.detached;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -211,7 +214,10 @@ class _AvesAppState extends State<AvesApp> with WidgetsBindingObserver {
|
|||
_subscriptions
|
||||
..forEach((sub) => sub.cancel())
|
||||
..clear();
|
||||
|
||||
debugPrint('stop listening to app lifecycle');
|
||||
WidgetsBinding.instance.removeObserver(this);
|
||||
|
||||
_pageTransitionsBuilderNotifier.dispose();
|
||||
_tvMediaQueryModifierNotifier.dispose();
|
||||
_appModeNotifier.dispose();
|
||||
|
|
Loading…
Reference in a new issue