Merge pull request #485 from ente-io/search_changes
This commit is contained in:
commit
2e66c3236d
|
@ -42,7 +42,6 @@ class FFDefault {
|
||||||
static const bool disableUrlSharing = false;
|
static const bool disableUrlSharing = false;
|
||||||
static const bool disableCFWorker = false;
|
static const bool disableCFWorker = false;
|
||||||
static const bool enableMissingLocationMigration = false;
|
static const bool enableMissingLocationMigration = false;
|
||||||
static const bool enableSearch = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const kDefaultProductionEndpoint = 'https://api.ente.io';
|
const kDefaultProductionEndpoint = 'https://api.ente.io';
|
||||||
|
|
|
@ -86,15 +86,6 @@ class FeatureFlagService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool enableSearch() {
|
|
||||||
try {
|
|
||||||
return isInternalUserOrDebugBuild() || _getFeatureFlags().enableSearch;
|
|
||||||
} catch (e) {
|
|
||||||
_logger.severe("failed to getSearchFeatureFlag", e);
|
|
||||||
return FFDefault.enableSearch;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isInternalUserOrDebugBuild() {
|
bool isInternalUserOrDebugBuild() {
|
||||||
final String email = Configuration.instance.getEmail();
|
final String email = Configuration.instance.getEmail();
|
||||||
return (email != null && email.endsWith("@ente.io")) || kDebugMode;
|
return (email != null && email.endsWith("@ente.io")) || kDebugMode;
|
||||||
|
@ -122,21 +113,18 @@ class FeatureFlags {
|
||||||
disableUrlSharing: FFDefault.disableUrlSharing,
|
disableUrlSharing: FFDefault.disableUrlSharing,
|
||||||
enableStripe: FFDefault.enableStripe,
|
enableStripe: FFDefault.enableStripe,
|
||||||
enableMissingLocationMigration: FFDefault.enableMissingLocationMigration,
|
enableMissingLocationMigration: FFDefault.enableMissingLocationMigration,
|
||||||
enableSearch: FFDefault.enableSearch,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
final bool disableCFWorker;
|
final bool disableCFWorker;
|
||||||
final bool disableUrlSharing;
|
final bool disableUrlSharing;
|
||||||
final bool enableStripe;
|
final bool enableStripe;
|
||||||
final bool enableMissingLocationMigration;
|
final bool enableMissingLocationMigration;
|
||||||
final bool enableSearch;
|
|
||||||
|
|
||||||
FeatureFlags({
|
FeatureFlags({
|
||||||
@required this.disableCFWorker,
|
@required this.disableCFWorker,
|
||||||
@required this.disableUrlSharing,
|
@required this.disableUrlSharing,
|
||||||
@required this.enableStripe,
|
@required this.enableStripe,
|
||||||
@required this.enableMissingLocationMigration,
|
@required this.enableMissingLocationMigration,
|
||||||
@required this.enableSearch,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Map<String, dynamic> toMap() {
|
Map<String, dynamic> toMap() {
|
||||||
|
@ -145,7 +133,6 @@ class FeatureFlags {
|
||||||
"disableUrlSharing": disableUrlSharing,
|
"disableUrlSharing": disableUrlSharing,
|
||||||
"enableStripe": enableStripe,
|
"enableStripe": enableStripe,
|
||||||
"enableMissingLocationMigration": enableMissingLocationMigration,
|
"enableMissingLocationMigration": enableMissingLocationMigration,
|
||||||
"enableSearch": enableSearch,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,7 +149,6 @@ class FeatureFlags {
|
||||||
enableStripe: json["enableStripe"] ?? FFDefault.enableStripe,
|
enableStripe: json["enableStripe"] ?? FFDefault.enableStripe,
|
||||||
enableMissingLocationMigration: json["enableMissingLocationMigration"] ??
|
enableMissingLocationMigration: json["enableMissingLocationMigration"] ??
|
||||||
FFDefault.enableMissingLocationMigration,
|
FFDefault.enableMissingLocationMigration,
|
||||||
enableSearch: json["enableSearch"] ?? FFDefault.enableSearch,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,14 +84,12 @@ class _StatusBarWidgetState extends State<StatusBarWidget> {
|
||||||
Positioned(
|
Positioned(
|
||||||
right: 0,
|
right: 0,
|
||||||
top: 0,
|
top: 0,
|
||||||
child: FeatureFlagService.instance.enableSearch()
|
child: Container(
|
||||||
? Container(
|
|
||||||
color:
|
color:
|
||||||
Theme.of(context).colorScheme.defaultBackgroundColor,
|
Theme.of(context).colorScheme.defaultBackgroundColor,
|
||||||
height: kContainerHeight,
|
height: kContainerHeight,
|
||||||
child: const SearchIconWidget(),
|
child: const SearchIconWidget(),
|
||||||
)
|
),
|
||||||
: const SizedBox(height: 36, width: 48),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
@ -57,10 +57,11 @@ class NoResultWidget extends StatelessWidget {
|
||||||
Container(
|
Container(
|
||||||
margin: const EdgeInsets.only(bottom: 20, top: 12),
|
margin: const EdgeInsets.only(bottom: 20, top: 12),
|
||||||
child: Text(
|
child: Text(
|
||||||
'''\u2022 Places (e.g. "London")
|
'''\u2022 Album names (e.g. "Camera")
|
||||||
|
\u2022 Types of files (e.g. "Videos", ".gif")
|
||||||
\u2022 Years and months (e.g. "2022", "January")
|
\u2022 Years and months (e.g. "2022", "January")
|
||||||
\u2022 Holidays (e.g. "Christmas")
|
\u2022 Holidays (e.g. "Christmas")
|
||||||
\u2022 Album names (e.g. "Recents")''',
|
''',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
color: Theme.of(context)
|
color: Theme.of(context)
|
||||||
|
|
|
@ -5,6 +5,7 @@ import 'dart:async';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:photos/ente_theme_data.dart';
|
import 'package:photos/ente_theme_data.dart';
|
||||||
import 'package:photos/models/search/search_result.dart';
|
import 'package:photos/models/search/search_result.dart';
|
||||||
|
import 'package:photos/services/feature_flag_service.dart';
|
||||||
import 'package:photos/services/search_service.dart';
|
import 'package:photos/services/search_service.dart';
|
||||||
import 'package:photos/ui/viewer/search/result/no_result_widget.dart';
|
import 'package:photos/ui/viewer/search/result/no_result_widget.dart';
|
||||||
import 'package:photos/ui/viewer/search/search_suffix_icon_widget.dart';
|
import 'package:photos/ui/viewer/search/search_suffix_icon_widget.dart';
|
||||||
|
@ -196,9 +197,12 @@ class _SearchWidgetState extends State<SearchWidget> {
|
||||||
await _searchService.getCollectionSearchResults(query);
|
await _searchService.getCollectionSearchResults(query);
|
||||||
allResults.addAll(collectionResults);
|
allResults.addAll(collectionResults);
|
||||||
|
|
||||||
final locationResults =
|
if (FeatureFlagService.instance.isInternalUserOrDebugBuild() &&
|
||||||
await _searchService.getLocationSearchResults(query);
|
query.startsWith("l:")) {
|
||||||
|
final locationResults = await _searchService
|
||||||
|
.getLocationSearchResults(query.replaceAll("l:", ""));
|
||||||
allResults.addAll(locationResults);
|
allResults.addAll(locationResults);
|
||||||
|
}
|
||||||
|
|
||||||
final monthResults = await _searchService.getMonthSearchResults(query);
|
final monthResults = await _searchService.getMonthSearchResults(query);
|
||||||
allResults.addAll(monthResults);
|
allResults.addAll(monthResults);
|
||||||
|
|
Loading…
Reference in a new issue