Do not block on user interactions in the background
This commit is contained in:
parent
5050767de1
commit
7708c38ef5
2 changed files with 9 additions and 2 deletions
|
@ -193,7 +193,7 @@ Future<void> _init(bool isBackground, {String via = ''}) async {
|
|||
});
|
||||
}
|
||||
unawaited(FeatureFlagService.instance.init());
|
||||
unawaited(SemanticSearchService.instance.init());
|
||||
unawaited(SemanticSearchService.instance.init(isInBackground: isBackground));
|
||||
// Can not including existing tf/ml binaries as they are not being built
|
||||
// from source.
|
||||
// See https://gitlab.com/fdroid/fdroiddata/-/merge_requests/12671#note_1294346819
|
||||
|
|
|
@ -66,7 +66,10 @@ class SemanticSearchService {
|
|||
}
|
||||
}
|
||||
|
||||
Future<void> init({bool shouldSyncImmediately = false}) async {
|
||||
Future<void> init({
|
||||
bool shouldSyncImmediately = false,
|
||||
bool isInBackground = false,
|
||||
}) async {
|
||||
if (!LocalSettings.instance.hasEnabledMagicSearch()) {
|
||||
return;
|
||||
}
|
||||
|
@ -111,6 +114,10 @@ class SemanticSearchService {
|
|||
if (shouldSyncImmediately) {
|
||||
unawaited(sync());
|
||||
}
|
||||
if (isInBackground) {
|
||||
// Do not block on user interactions
|
||||
resumeIndexing();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> release() async {
|
||||
|
|
Loading…
Reference in a new issue