Skip to content

Commit

Permalink
Add: Added hold to remove search query (#293)
Browse files Browse the repository at this point in the history
  • Loading branch information
gokadzev committed Nov 18, 2023
1 parent bcfeb55 commit 1d8e072
Show file tree
Hide file tree
Showing 13 changed files with 63 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/localization/app_ar.arb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"clear": "مسح",
"clearCache": "مسح ذاكرة التخزين المؤقت",
"clearSearchHistory": "امسح سجل البحث",
"confirm": "Confirm",
"confirmation": "Confirmation",
"copyLogs": "نسخ السجلات",
"copyLogsNoLogs": "لم يتم العثور على سجلات للنسخ",
Expand Down Expand Up @@ -55,6 +56,7 @@
"recommendedForYou": "موصى به لك",
"remove": "Remove",
"removePlaylistQuestion": "Are you sure you want to remove this playlist?",
"removeSearchQueryQuestion": "Are you sure you want to remove this search query?",
"restoreError": "خطأ أثناء استعادة البيانات",
"restoreUserData": "استعادة بيانات المستخدم",
"restoredSuccess": "تمت الاستعادة بنجاح",
Expand Down
2 changes: 2 additions & 0 deletions lib/localization/app_de.arb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"clear": "Löschen",
"clearCache": "Cache leeren",
"clearSearchHistory": "Suchverlauf löschen",
"confirm": "Confirm",
"confirmation": "Confirmation",
"copyLogs": "Logs kopieren",
"copyLogsNoLogs": "Keine Logs zum Kopieren gefunden",
Expand Down Expand Up @@ -55,6 +56,7 @@
"recommendedForYou": "Empfohlen für dich",
"remove": "Remove",
"removePlaylistQuestion": "Are you sure you want to remove this playlist?",
"removeSearchQueryQuestion": "Are you sure you want to remove this search query?",
"restoreError": "Fehler bei der Datenwiederherstellung",
"restoreUserData": "Benutzerdaten wiederherstellen",
"restoredSuccess": "Erfolgreich wiederhergestellt",
Expand Down
2 changes: 2 additions & 0 deletions lib/localization/app_el.arb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"clear": "Απαλοιφή",
"clearCache": "Απαλοιφή cache",
"clearSearchHistory": "Καθαρισμός ιστορικού αναζήτησης",
"confirm": "Confirm",
"confirmation": "Confirmation",
"copyLogs": "Αντιγραφή καταγραφών",
"copyLogsNoLogs": "Δεν βρέθηκαν καταγραφές για αντιγραφή",
Expand Down Expand Up @@ -55,6 +56,7 @@
"recommendedForYou": "Συνιστάται για εσάς",
"remove": "Remove",
"removePlaylistQuestion": "Are you sure you want to remove this playlist?",
"removeSearchQueryQuestion": "Are you sure you want to remove this search query?",
"restoreError": "Σφάλμα κατά την επαναφορά δεδομένων",
"restoreUserData": "Επαναφορά δεδομένων χρήστη",
"restoredSuccess": "Η επαναφορά ολοκληρώθηκε με επιτυχία",
Expand Down
2 changes: 2 additions & 0 deletions lib/localization/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"clear": "Clear",
"clearCache": "Clear cache",
"clearSearchHistory": "Clear Search History",
"confirm": "Confirm",
"confirmation": "Confirmation",
"copyLogs": "Copy logs",
"copyLogsNoLogs": "No logs found to copy",
Expand Down Expand Up @@ -55,6 +56,7 @@
"recommendedForYou": "Recommended for you",
"remove": "Remove",
"removePlaylistQuestion": "Are you sure you want to remove this playlist?",
"removeSearchQueryQuestion": "Are you sure you want to remove this search query?",
"restoreError": "Error while data restore",
"restoreUserData": "Restore user data",
"restoredSuccess": "Restored Successfully",
Expand Down
2 changes: 2 additions & 0 deletions lib/localization/app_es.arb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"clear": "Limpiar",
"clearCache": "Limpiar caché",
"clearSearchHistory": "Limpiar historial de búsqueda",
"confirm": "Confirm",
"confirmation": "Confirmation",
"copyLogs": "Copiar registros",
"copyLogsNoLogs": "No se encontraron registros para copiar",
Expand Down Expand Up @@ -55,6 +56,7 @@
"recommendedForYou": "Recomendado para ti",
"remove": "Remove",
"removePlaylistQuestion": "Are you sure you want to remove this playlist?",
"removeSearchQueryQuestion": "Are you sure you want to remove this search query?",
"restoreError": "Error al restaurar los datos",
"restoreUserData": "Restaurar datos de usuario",
"restoredSuccess": "Restaurado con éxito",
Expand Down
2 changes: 2 additions & 0 deletions lib/localization/app_fr.arb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"clear": "Effacer",
"clearCache": "Vider le cache",
"clearSearchHistory": "Effacer l'historique de recherche",
"confirm": "Confirm",
"confirmation": "Confirmation",
"copyLogs": "Copier les logs",
"copyLogsNoLogs": "Pas de logs à copier",
Expand Down Expand Up @@ -55,6 +56,7 @@
"recommendedForYou": "Recommandé pour vous",
"remove": "Remove",
"removePlaylistQuestion": "Are you sure you want to remove this playlist?",
"removeSearchQueryQuestion": "Are you sure you want to remove this search query?",
"restoreError": "Erreur pendant la restauration",
"restoreUserData": "Restaurer les données utilisateur",
"restoredSuccess": "Restauration réussie",
Expand Down
2 changes: 2 additions & 0 deletions lib/localization/app_ka.arb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"clear": "გასუფთავება",
"clearCache": "ქეშის გასუფთავება",
"clearSearchHistory": "საძიებო ისტორიის გასუფთავება",
"confirm": "Confirm",
"confirmation": "დადასტურება",
"copyLogs": "ლოგების კოპირება",
"copyLogsNoLogs": "ლოგები არ მოიძებნა",
Expand Down Expand Up @@ -55,6 +56,7 @@
"recommendedForYou": "შემოთავაზებები შენთვის",
"remove": "Remove",
"removePlaylistQuestion": "დარწმუნებული ხართ რომ გსურთ ამ ფლეილისთის წაშლა?",
"removeSearchQueryQuestion": "Are you sure you want to remove this search query?",
"restoreError": "შეცდომა ინფორმაციის დაბრუნებისას",
"restoreUserData": "მომხმარებლის ინფორმაციის დაბრუნება",
"restoredSuccess": "წარმატებით დაბრუნდა",
Expand Down
2 changes: 2 additions & 0 deletions lib/localization/app_pl.arb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"clear": "Wyczyść",
"clearCache": "Wyczyść pamięć podręczną",
"clearSearchHistory": "Wyczyść historię wyszukiwania",
"confirm": "Confirm",
"confirmation": "Confirmation",
"copyLogs": "Kopiuj logi",
"copyLogsNoLogs": "Brak logów do skopiowania",
Expand Down Expand Up @@ -55,6 +56,7 @@
"recommendedForYou": "Polecane dla Ciebie",
"remove": "Remove",
"removePlaylistQuestion": "Are you sure you want to remove this playlist?",
"removeSearchQueryQuestion": "Are you sure you want to remove this search query?",
"restoreError": "Błąd podczas przywracania danych",
"restoreUserData": "Przywróć dane użytkownika",
"restoredSuccess": "Przywrócono pomyślnie",
Expand Down
2 changes: 2 additions & 0 deletions lib/localization/app_pt.arb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"clear": "Limpar",
"clearCache": "Limpar cache",
"clearSearchHistory": "Limpar histórico de pesquisa",
"confirm": "Confirm",
"confirmation": "Confirmação",
"copyLogs": "Copiar logs",
"copyLogsNoLogs": "Sem logs encontradas para copiar",
Expand Down Expand Up @@ -55,6 +56,7 @@
"recommendedForYou": "Recomendado para você",
"remove": "Remover",
"removePlaylistQuestion": "Você tem certeza que deseja remover essa playlist?",
"removeSearchQueryQuestion": "Are you sure you want to remove this search query?",
"restoreError": "Erro ao restaurar os dados",
"restoreUserData": "Restaurar dados do usuário",
"restoredSuccess": "Restaurado com sucesso",
Expand Down
2 changes: 2 additions & 0 deletions lib/localization/app_tr.arb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"clear": "Temizle",
"clearCache": "Önbelleği Temizle",
"clearSearchHistory": "Arama Geçmişini Temizle",
"confirm": "Confirm",
"confirmation": "Confirmation",
"copyLogs": "Logları Kopyala",
"copyLogsNoLogs": "Kopyalanacak log bulunamadı",
Expand Down Expand Up @@ -55,6 +56,7 @@
"recommendedForYou": "Sizin İçin Tavsiye Edilen",
"remove": "Remove",
"removePlaylistQuestion": "Are you sure you want to remove this playlist?",
"removeSearchQueryQuestion": "Are you sure you want to remove this search query?",
"restoreError": "Veri geri yükleme sırasında hata oluştu",
"restoreUserData": "Kullanıcı Verilerini Geri Yükle",
"restoredSuccess": "Başarıyla Geri Yüklendi",
Expand Down
2 changes: 2 additions & 0 deletions lib/localization/app_uk.arb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"clear": "Очистити",
"clearCache": "Очистити кеш",
"clearSearchHistory": "Очистити історію пошуку",
"confirm": "Confirm",
"confirmation": "Confirmation",
"copyLogs": "Копіювати журнали",
"copyLogsNoLogs": "Не знайдено журналів для копіювання",
Expand Down Expand Up @@ -55,6 +56,7 @@
"recommendedForYou": "Рекомендовано вам",
"remove": "Remove",
"removePlaylistQuestion": "Are you sure you want to remove this playlist?",
"removeSearchQueryQuestion": "Are you sure you want to remove this search query?",
"restoreError": "Помилка під час відновлення даних",
"restoreUserData": "Відновити дані користувача",
"restoredSuccess": "Відновлено успішно",
Expand Down
2 changes: 2 additions & 0 deletions lib/localization/app_vi.arb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"clear": "Xoá",
"clearCache": "Xóa bộ nhớ đệm",
"clearSearchHistory": "Xóa lịch sử tìm kiếm",
"confirm": "Confirm",
"confirmation": "Confirmation",
"copyLogs": "Sao chép logs",
"copyLogsNoLogs": "Không tìm thấy logs để sao chép",
Expand Down Expand Up @@ -55,6 +56,7 @@
"recommendedForYou": "Được đề xuất cho bạn",
"remove": "Remove",
"removePlaylistQuestion": "Are you sure you want to remove this playlist?",
"removeSearchQueryQuestion": "Are you sure you want to remove this search query?",
"restoreError": "Lỗi khi khôi phục dữ liệu",
"restoreUserData": "Khôi phục dữ liệu người dùng",
"restoredSuccess": "Khôi phục thành công",
Expand Down
39 changes: 39 additions & 0 deletions lib/screens/search_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,19 @@ class _SearchPageState extends State<SearchPage> {
await search();
_inputNode.unfocus();
},
onLongPress: () async {
final confirm =
await _showConfirmationDialog(context) ?? false;

if (confirm) {
setState(() {
searchHistory.remove(query);
});

await Hive.box('user')
.put('searchHistory', searchHistory);
}
},
),
),
);
Expand All @@ -193,4 +206,30 @@ class _SearchPageState extends State<SearchPage> {
),
);
}

Future<bool?> _showConfirmationDialog(BuildContext context) {
return showDialog<bool>(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text(context.l10n!.confirmation),
content: Text(context.l10n!.removeSearchQueryQuestion),
actions: <Widget>[
TextButton(
child: Text(context.l10n!.cancel),
onPressed: () {
Navigator.of(context).pop(false);
},
),
TextButton(
child: Text(context.l10n!.confirm),
onPressed: () {
Navigator.of(context).pop(true);
},
),
],
);
},
);
}
}

0 comments on commit 1d8e072

Please sign in to comment.