Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob][photos] Remove code that was for handling edge cases when magic section was depending on newly computed results every time instead of using cache

ashilknfcb79907cfe9
diff --git a/mobile/lib/models/search/search_types.dart b/mobile/lib/models/search/search_types.dart
index e6dab467e1..1b5a186522 100644
--- a/mobile/lib/models/search/search_types.dart
+++ b/mobile/lib/models/search/search_types.dart
@@ -13,7 +13,6 @@ import "package:photos/models/collection/collection_items.dart";
import "package:photos/models/search/search_result.dart";
import "package:photos/models/typedefs.dart";
import "package:photos/services/collections_service.dart";
-import "package:photos/services/machine_learning/semantic_search/frameworks/ml_framework.dart";
import "package:photos/services/search_service.dart";
import "package:photos/ui/viewer/gallery/collection_page.dart";
import "package:photos/ui/viewer/location/add_location_sheet.dart";
@@ -292,8 +291,6 @@ extension SectionTypeExtensions on SectionType {
switch (this) {
case SectionType.location:
return [Bus.instance.on<LocationTagUpdatedEvent>()];
- case SectionType.magic:
- return [Bus.instance.on<MLFrameworkInitializationUpdateEvent>()];
default:
return [];
}
diff --git a/mobile/lib/ui/viewer/search_tab/magic_section.dart b/mobile/lib/ui/viewer/search_tab/magic_section.dart
index d088de92e5..c3a4a98712 100644
--- a/mobile/lib/ui/viewer/search_tab/magic_section.dart
+++ b/mobile/lib/ui/viewer/search_tab/magic_section.dart
@@ -33,28 +33,6 @@ class _MagicSectionState extends State<MagicSection> {
super.initState();
_magicSearchResults = widget.magicSearchResults;
- //At times, ml framework is not initialized when the search results are
- //requested (widget.momentsSearchResults is empty) and is initialized
- //(which fires MLFrameworkInitializationUpdateEvent with
- //InitializationState.initialized) before initState of this widget is
- //called. We do listen to MLFrameworkInitializationUpdateEvent and reload
- //this widget but the event with InitializationState.initialized would have
- //already been fired in the above case.
- if (_magicSearchResults.isEmpty) {
- SectionType.magic
- .getData(
- context,
- limit: kSearchSectionLimit,
- )
- .then((value) {
- if (mounted) {
- setState(() {
- _magicSearchResults = value as List<GenericSearchResult>;
- });
- }
- });
- }
-
final streamsToListenTo = SectionType.magic.sectionUpdateEvents();
for (Stream<Event> stream in streamsToListenTo) {
streamSubscriptions.add(
@@ -84,7 +62,6 @@ class _MagicSectionState extends State<MagicSection> {
@override
void didUpdateWidget(covariant MagicSection oldWidget) {
super.didUpdateWidget(oldWidget);
- //widget.magicSearch is empty when doing a hot reload
if (widget.magicSearchResults.isNotEmpty) {
_magicSearchResults = widget.magicSearchResults;
}