Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

Commit

Permalink
Location fixes (#1721)
Browse files Browse the repository at this point in the history
  • Loading branch information
ua741 authored Feb 15, 2024
2 parents 6ff97a8 + c1c9d74 commit ea723f1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lib/services/search_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,8 @@ class SearchService {
tagToItemsMap[tag]!.add(file);
}
}
// If the location tag already exists for a city, do not consider
// it for the city suggestions
if (!hasLocationTag) {
filesWithNoLocTag.add(file);
}
Expand Down Expand Up @@ -769,14 +771,12 @@ class SearchService {
..sort((a, b) => results[b]!.length.compareTo(results[a]!.length));
for (final city in sortedByResultCount) {
if (results[city]!.length <= 1) continue;
// If the location tag already exists for a city, don't add it again
tagSearchResults.add(
GenericSearchResult(
ResultType.locationSuggestion,
city.city,
results[city]!,
onResultTap: (ctx) {
Navigator.of(ctx).pop();
showAddLocationSheet(
ctx,
Location(latitude: city.lat, longitude: city.lng),
Expand Down
14 changes: 8 additions & 6 deletions lib/ui/viewer/location/add_location_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,13 @@ class _AddLocationSheetState extends State<AddLocationSheet> {
late ValueNotifier<double> _selectedRadiusNotifier;
final _focusNode = FocusNode();
final _textEditingController = TextEditingController();
final _isEmptyNotifier = ValueNotifier(true);
late final ValueNotifier<bool> _isEmptyNotifier;
Widget? _keyboardTopButtons;

@override
void initState() {
_textEditingController.text = widget.name;
_isEmptyNotifier = ValueNotifier(widget.name.isEmpty);
_focusNode.addListener(_focusNodeListener);
_selectedRadiusNotifier = ValueNotifier(widget.radius);
_selectedRadiusNotifier.addListener(_selectedRadiusListener);
Expand Down Expand Up @@ -169,11 +170,12 @@ class _AddLocationSheetState extends State<AddLocationSheet> {
RadiusPickerWidget(
_selectedRadiusNotifier,
),
const SizedBox(height: 16),
Text(
S.of(context).locationTagFeatureDescription,
style: textTheme.smallMuted,
),
if (widget.name.isEmpty) const SizedBox(height: 16),
if (widget.name.isEmpty)
Text(
S.of(context).locationTagFeatureDescription,
style: textTheme.smallMuted,
),
],
),
),
Expand Down

0 comments on commit ea723f1

Please sign in to comment.