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
|
// cataloguing
|
||||||
if (!startAnalysisService) {
|
if (!startAnalysisService) {
|
||||||
final opCount = (force ? todoEntries : todoEntries.where(TagMixin.catalogEntriesTest)).length;
|
final opCount = (force ? todoEntries : todoEntries.where(TagMixin.catalogEntriesTest)).length;
|
||||||
if (opCount > TagMixin.commitCountThreshold) {
|
startAnalysisService = opCount > TagMixin.commitCountThreshold;
|
||||||
startAnalysisService = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// ignore locating countries
|
// ignore locating countries
|
||||||
// locating places
|
// locating places
|
||||||
if (!startAnalysisService && await availability.canLocatePlaces) {
|
if (!startAnalysisService && await availability.canLocatePlaces) {
|
||||||
final opCount = (force ? todoEntries.where((entry) => entry.hasGps) : todoEntries.where(LocationMixin.locatePlacesTest)).length;
|
final opCount = (force ? todoEntries.where((entry) => entry.hasGps) : todoEntries.where(LocationMixin.locatePlacesTest)).length;
|
||||||
if (opCount > LocationMixin.commitCountThreshold) {
|
startAnalysisService = opCount > LocationMixin.commitCountThreshold;
|
||||||
startAnalysisService = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -203,7 +203,10 @@ class _AvesAppState extends State<AvesApp> with WidgetsBindingObserver {
|
||||||
_subscriptions.add(_errorChannel.receiveBroadcastStream().listen((event) => _onError(event as String?)));
|
_subscriptions.add(_errorChannel.receiveBroadcastStream().listen((event) => _onError(event as String?)));
|
||||||
_updateCutoutInsets();
|
_updateCutoutInsets();
|
||||||
_appModeNotifier.addListener(_onAppModeChanged);
|
_appModeNotifier.addListener(_onAppModeChanged);
|
||||||
|
|
||||||
|
debugPrint('start listening to app lifecycle');
|
||||||
WidgetsBinding.instance.addObserver(this);
|
WidgetsBinding.instance.addObserver(this);
|
||||||
|
AvesApp.lifecycleStateNotifier.value = WidgetsBinding.instance.lifecycleState ?? AppLifecycleState.detached;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -211,7 +214,10 @@ class _AvesAppState extends State<AvesApp> with WidgetsBindingObserver {
|
||||||
_subscriptions
|
_subscriptions
|
||||||
..forEach((sub) => sub.cancel())
|
..forEach((sub) => sub.cancel())
|
||||||
..clear();
|
..clear();
|
||||||
|
|
||||||
|
debugPrint('stop listening to app lifecycle');
|
||||||
WidgetsBinding.instance.removeObserver(this);
|
WidgetsBinding.instance.removeObserver(this);
|
||||||
|
|
||||||
_pageTransitionsBuilderNotifier.dispose();
|
_pageTransitionsBuilderNotifier.dispose();
|
||||||
_tvMediaQueryModifierNotifier.dispose();
|
_tvMediaQueryModifierNotifier.dispose();
|
||||||
_appModeNotifier.dispose();
|
_appModeNotifier.dispose();
|
||||||
|
|
Loading…
Reference in a new issue