An open-source cross-platform alternative to AirDrop
Favorites (#736)
Tien Do Nam5e2e44ca6cce
diff --git a/app/assets/CHANGELOG.md b/app/assets/CHANGELOG.mdindex 59114e61..fad1d90a 100644--- a/app/assets/CHANGELOG.md+++ b/app/assets/CHANGELOG.md@@ -1,5 +1,6 @@## 1.12.0 (2023-)+- feat: add favorites (@Tienisto)- feat: drastically improve GPU usage by optimizing the spin animation (@Tienisto)- feat: add OLED color mode (@Tienisto)- feat: use better colors for the toggle switches in the settings (@gitstart)diff --git a/app/assets/i18n/_missing_translations_ar.json b/app/assets/i18n/_missing_translations_ar.jsonindex b3cd4749..3396ed18 100644--- a/app/assets/i18n/_missing_translations_ar.json+++ b/app/assets/i18n/_missing_translations_ar.json@@ -4,6 +4,7 @@"After editing this file, you can run 'dart run slang apply --locale=ar' to quickly apply the newly added translations."],"general": {+ "delete": "Delete","noItemInClipboard": "No item in Clipboard"},"sendTab": {@@ -17,5 +18,24 @@"oled": "OLED"}}+ },+ "dialogs": {+ "favoriteDialog": {+ "title": "Favorites",+ "noFavorites": "No favorites configured yet.",+ "addFavorite": "New"+ },+ "favoriteDeleteDialog": {+ "title": "Delete favorite",+ "content": "Do you really want to delete the favorite \"{name}\"?"+ },+ "favoriteEditDialog": {+ "titleAdd": "Add favorite",+ "titleEdit": "Edit favorite",+ "name": "Name",+ "auto": "(auto)",+ "ip": "IP Address",+ "port": "Port"+ }}}diff --git a/app/assets/i18n/_missing_translations_bn.json b/app/assets/i18n/_missing_translations_bn.jsonindex a86d711a..3a3b8c13 100644--- a/app/assets/i18n/_missing_translations_bn.json+++ b/app/assets/i18n/_missing_translations_bn.json@@ -5,6 +5,7 @@],"general": {"accepted": "Accepted",+ "delete": "Delete","noItemInClipboard": "No item in Clipboard"},"sendTab": {@@ -109,6 +110,23 @@"errorDialog": {"title": "@:general.error"},+ "favoriteDialog": {+ "title": "Favorites",+ "noFavorites": "No favorites configured yet.",+ "addFavorite": "New"+ },+ "favoriteDeleteDialog": {+ "title": "Delete favorite",+ "content": "Do you really want to delete the favorite \"{name}\"?"+ },+ "favoriteEditDialog": {+ "titleAdd": "Add favorite",+ "titleEdit": "Edit favorite",+ "name": "Name",+ "auto": "(auto)",+ "ip": "IP Address",+ "port": "Port"+ },"fileInfo": {"title": "File information","fileName": "File name:",diff --git a/app/assets/i18n/_missing_translations_ca.json b/app/assets/i18n/_missing_translations_ca.jsonindex 6fd0de1f..376bcdd3 100644--- a/app/assets/i18n/_missing_translations_ca.json+++ b/app/assets/i18n/_missing_translations_ca.json@@ -4,6 +4,7 @@"After editing this file, you can run 'dart run slang apply --locale=ca' to quickly apply the newly added translations."],"general": {+ "delete": "Delete","noItemInClipboard": "No item in Clipboard"},"sendTab": {@@ -17,5 +18,24 @@"oled": "OLED"}}+ },+ "dialogs": {+ "favoriteDialog": {+ "title": "Favorites",+ "noFavorites": "No favorites configured yet.",+ "addFavorite": "New"+ },+ "favoriteDeleteDialog": {+ "title": "Delete favorite",+ "content": "Do you really want to delete the favorite \"{name}\"?"+ },+ "favoriteEditDialog": {+ "titleAdd": "Add favorite",+ "titleEdit": "Edit favorite",+ "name": "Name",+ "auto": "(auto)",+ "ip": "IP Address",+ "port": "Port"+ }}}diff --git a/app/assets/i18n/_missing_translations_cs.json b/app/assets/i18n/_missing_translations_cs.jsonindex bbc00ee9..3e1d42d8 100644--- a/app/assets/i18n/_missing_translations_cs.json+++ b/app/assets/i18n/_missing_translations_cs.json@@ -4,6 +4,7 @@"After editing this file, you can run 'dart run slang apply --locale=cs' to quickly apply the newly added translations."],"general": {+ "delete": "Delete","noItemInClipboard": "No item in Clipboard"},"sendTab": {@@ -17,5 +18,24 @@"oled": "OLED"}}+ },+ "dialogs": {+ "favoriteDialog": {+ "title": "Favorites",+ "noFavorites": "No favorites configured yet.",+ "addFavorite": "New"+ },+ "favoriteDeleteDialog": {+ "title": "Delete favorite",+ "content": "Do you really want to delete the favorite \"{name}\"?"+ },+ "favoriteEditDialog": {+ "titleAdd": "Add favorite",+ "titleEdit": "Edit favorite",+ "name": "Name",+ "auto": "(auto)",+ "ip": "IP Address",+ "port": "Port"+ }}}diff --git a/app/assets/i18n/_missing_translations_es_ES.json b/app/assets/i18n/_missing_translations_es_ES.jsonindex ecf44337..30443d62 100644--- a/app/assets/i18n/_missing_translations_es_ES.json+++ b/app/assets/i18n/_missing_translations_es_ES.json@@ -4,6 +4,7 @@"After editing this file, you can run 'dart run slang apply --locale=es-ES' to quickly apply the newly added translations."],"general": {+ "delete": "Delete","noItemInClipboard": "No item in Clipboard"},"sendTab": {@@ -17,5 +18,24 @@"oled": "OLED"}}+ },+ "dialogs": {+ "favoriteDialog": {+ "title": "Favorites",+ "noFavorites": "No favorites configured yet.",+ "addFavorite": "New"+ },+ "favoriteDeleteDialog": {+ "title": "Delete favorite",+ "content": "Do you really want to delete the favorite \"{name}\"?"+ },+ "favoriteEditDialog": {+ "titleAdd": "Add favorite",+ "titleEdit": "Edit favorite",+ "name": "Name",+ "auto": "(auto)",+ "ip": "IP Address",+ "port": "Port"+ }}}diff --git a/app/assets/i18n/_missing_translations_fa.json b/app/assets/i18n/_missing_translations_fa.jsonindex 68c22596..0da8ef2d 100644--- a/app/assets/i18n/_missing_translations_fa.json+++ b/app/assets/i18n/_missing_translations_fa.json@@ -2,5 +2,27 @@"@@info": ["Here are translations that exist in <en> but not in <fa>.","After editing this file, you can run 'dart run slang apply --locale=fa' to quickly apply the newly added translations."- ]+ ],+ "general": {+ "delete": "Delete"+ },+ "dialogs": {+ "favoriteDialog": {+ "title": "Favorites",+ "noFavorites": "No favorites configured yet.",+ "addFavorite": "New"+ },+ "favoriteDeleteDialog": {+ "title": "Delete favorite",+ "content": "Do you really want to delete the favorite \"{name}\"?"+ },+ "favoriteEditDialog": {+ "titleAdd": "Add favorite",+ "titleEdit": "Edit favorite",+ "name": "Name",+ "auto": "(auto)",+ "ip": "IP Address",+ "port": "Port"+ }+ }}diff --git a/app/assets/i18n/_missing_translations_fr_FR.json b/app/assets/i18n/_missing_translations_fr_FR.jsonindex 9c8e65ab..1aba098f 100644--- a/app/assets/i18n/_missing_translations_fr_FR.json+++ b/app/assets/i18n/_missing_translations_fr_FR.json@@ -4,6 +4,7 @@"After editing this file, you can run 'dart run slang apply --locale=fr-FR' to quickly apply the newly added translations."],"general": {+ "delete": "Delete","noItemInClipboard": "No item in Clipboard"},"sendTab": {@@ -17,5 +18,24 @@"oled": "OLED"}}+ },+ "dialogs": {+ "favoriteDialog": {+ "title": "Favorites",+ "noFavorites": "No favorites configured yet.",+ "addFavorite": "New"+ },+ "favoriteDeleteDialog": {+ "title": "Delete favorite",+ "content": "Do you really want to delete the favorite \"{name}\"?"+ },+ "favoriteEditDialog": {+ "titleAdd": "Add favorite",+ "titleEdit": "Edit favorite",+ "name": "Name",+ "auto": "(auto)",+ "ip": "IP Address",+ "port": "Port"+ }}}diff --git a/app/assets/i18n/_missing_translations_hu.json b/app/assets/i18n/_missing_translations_hu.jsonindex 4402fdce..9435553a 100644--- a/app/assets/i18n/_missing_translations_hu.json+++ b/app/assets/i18n/_missing_translations_hu.json@@ -4,6 +4,7 @@"After editing this file, you can run 'dart run slang apply --locale=hu' to quickly apply the newly added translations."],"general": {+ "delete": "Delete","noItemInClipboard": "No item in Clipboard"},"sendTab": {@@ -17,5 +18,24 @@"oled": "OLED"}}+ },+ "dialogs": {+ "favoriteDialog": {+ "title": "Favorites",+ "noFavorites": "No favorites configured yet.",+ "addFavorite": "New"+ },+ "favoriteDeleteDialog": {+ "title": "Delete favorite",+ "content": "Do you really want to delete the favorite \"{name}\"?"+ },+ "favoriteEditDialog": {+ "titleAdd": "Add favorite",+ "titleEdit": "Edit favorite",+ "name": "Name",+ "auto": "(auto)",+ "ip": "IP Address",+ "port": "Port"+ }}}diff --git a/app/assets/i18n/_missing_translations_in.json b/app/assets/i18n/_missing_translations_in.jsonindex 739cf131..eb19fc95 100644--- a/app/assets/i18n/_missing_translations_in.json+++ b/app/assets/i18n/_missing_translations_in.json@@ -4,6 +4,7 @@"After editing this file, you can run 'dart run slang apply --locale=in' to quickly apply the newly added translations."],"general": {+ "delete": "Delete","noItemInClipboard": "No item in Clipboard"},"sendTab": {@@ -17,5 +18,24 @@"oled": "OLED"}}+ },+ "dialogs": {+ "favoriteDialog": {+ "title": "Favorites",+ "noFavorites": "No favorites configured yet.",+ "addFavorite": "New"+ },+ "favoriteDeleteDialog": {+ "title": "Delete favorite",+ "content": "Do you really want to delete the favorite \"{name}\"?"+ },+ "favoriteEditDialog": {+ "titleAdd": "Add favorite",+ "titleEdit": "Edit favorite",+ "name": "Name",+ "auto": "(auto)",+ "ip": "IP Address",+ "port": "Port"+ }}}diff --git a/app/assets/i18n/_missing_translations_it.json b/app/assets/i18n/_missing_translations_it.jsonindex 3b0e37bf..71ab9df0 100644--- a/app/assets/i18n/_missing_translations_it.json+++ b/app/assets/i18n/_missing_translations_it.json@@ -4,6 +4,7 @@"After editing this file, you can run 'dart run slang apply --locale=it' to quickly apply the newly added translations."],"general": {+ "delete": "Delete","noItemInClipboard": "No item in Clipboard"},"sendTab": {@@ -17,5 +18,24 @@"oled": "OLED"}}+ },+ "dialogs": {+ "favoriteDialog": {+ "title": "Favorites",+ "noFavorites": "No favorites configured yet.",+ "addFavorite": "New"+ },+ "favoriteDeleteDialog": {+ "title": "Delete favorite",+ "content": "Do you really want to delete the favorite \"{name}\"?"+ },+ "favoriteEditDialog": {+ "titleAdd": "Add favorite",+ "titleEdit": "Edit favorite",+ "name": "Name",+ "auto": "(auto)",+ "ip": "IP Address",+ "port": "Port"+ }}}diff --git a/app/assets/i18n/_missing_translations_iw.json b/app/assets/i18n/_missing_translations_iw.jsonindex beea35a8..2b559197 100644--- a/app/assets/i18n/_missing_translations_iw.json+++ b/app/assets/i18n/_missing_translations_iw.json@@ -2,5 +2,27 @@"@@info": ["Here are translations that exist in <en> but not in <iw>.","After editing this file, you can run 'dart run slang apply --locale=iw' to quickly apply the newly added translations."- ]+ ],+ "general": {+ "delete": "Delete"+ },+ "dialogs": {+ "favoriteDialog": {+ "title": "Favorites",+ "noFavorites": "No favorites configured yet.",+ "addFavorite": "New"+ },+ "favoriteDeleteDialog": {+ "title": "Delete favorite",+ "content": "Do you really want to delete the favorite \"{name}\"?"+ },+ "favoriteEditDialog": {+ "titleAdd": "Add favorite",+ "titleEdit": "Edit favorite",+ "name": "Name",+ "auto": "(auto)",+ "ip": "IP Address",+ "port": "Port"+ }+ }}diff --git a/app/assets/i18n/_missing_translations_ja.json b/app/assets/i18n/_missing_translations_ja.jsonindex 92e77e22..28d56e62 100644--- a/app/assets/i18n/_missing_translations_ja.json+++ b/app/assets/i18n/_missing_translations_ja.json@@ -4,6 +4,7 @@"After editing this file, you can run 'dart run slang apply --locale=ja' to quickly apply the newly added translations."],"general": {+ "delete": "Delete","noItemInClipboard": "No item in Clipboard"},"sendTab": {@@ -17,5 +18,24 @@"oled": "OLED"}}+ },+ "dialogs": {+ "favoriteDialog": {+ "title": "Favorites",+ "noFavorites": "No favorites configured yet.",+ "addFavorite": "New"+ },+ "favoriteDeleteDialog": {+ "title": "Delete favorite",+ "content": "Do you really want to delete the favorite \"{name}\"?"+ },+ "favoriteEditDialog": {+ "titleAdd": "Add favorite",+ "titleEdit": "Edit favorite",+ "name": "Name",+ "auto": "(auto)",+ "ip": "IP Address",+ "port": "Port"+ }}}diff --git a/app/assets/i18n/_missing_translations_km.json b/app/assets/i18n/_missing_translations_km.jsonindex 2338d97a..1e52a24d 100644--- a/app/assets/i18n/_missing_translations_km.json+++ b/app/assets/i18n/_missing_translations_km.json@@ -4,11 +4,31 @@"After editing this file, you can run 'dart run slang apply --locale=km' to quickly apply the newly added translations."],"general": {+ "delete": "Delete","noItemInClipboard": "No item in Clipboard"},"sendTab": {"picker": {"clipboard": "Paste"}+ },+ "dialogs": {+ "favoriteDialog": {+ "title": "Favorites",+ "noFavorites": "No favorites configured yet.",+ "addFavorite": "New"+ },+ "favoriteDeleteDialog": {+ "title": "Delete favorite",+ "content": "Do you really want to delete the favorite \"{name}\"?"+ },+ "favoriteEditDialog": {+ "titleAdd": "Add favorite",+ "titleEdit": "Edit favorite",+ "name": "Name",+ "auto": "(auto)",+ "ip": "IP Address",+ "port": "Port"+ }}}diff --git a/app/assets/i18n/_missing_translations_ko.json b/app/assets/i18n/_missing_translations_ko.jsonindex c88a9c7b..7aadaf27 100644--- a/app/assets/i18n/_missing_translations_ko.json+++ b/app/assets/i18n/_missing_translations_ko.json@@ -4,6 +4,7 @@"After editing this file, you can run 'dart run slang apply --locale=ko' to quickly apply the newly added translations."],"general": {+ "delete": "Delete","noItemInClipboard": "No item in Clipboard"},"sendTab": {@@ -17,5 +18,24 @@"oled": "OLED"}}+ },+ "dialogs": {+ "favoriteDialog": {+ "title": "Favorites",+ "noFavorites": "No favorites configured yet.",+ "addFavorite": "New"+ },+ "favoriteDeleteDialog": {+ "title": "Delete favorite",+ "content": "Do you really want to delete the favorite \"{name}\"?"+ },+ "favoriteEditDialog": {+ "titleAdd": "Add favorite",+ "titleEdit": "Edit favorite",+ "name": "Name",+ "auto": "(auto)",+ "ip": "IP Address",+ "port": "Port"+ }}}diff --git a/app/assets/i18n/_missing_translations_ne.json b/app/assets/i18n/_missing_translations_ne.jsonindex b81accd8..5214c095 100644--- a/app/assets/i18n/_missing_translations_ne.json+++ b/app/assets/i18n/_missing_translations_ne.json@@ -4,6 +4,7 @@"After editing this file, you can run 'dart run slang apply --locale=ne' to quickly apply the newly added translations."],"general": {+ "delete": "Delete","noItemInClipboard": "No item in Clipboard"},"sendTab": {@@ -17,5 +18,24 @@"oled": "OLED"}}+ },+ "dialogs": {+ "favoriteDialog": {+ "title": "Favorites",+ "noFavorites": "No favorites configured yet.",+ "addFavorite": "New"+ },+ "favoriteDeleteDialog": {+ "title": "Delete favorite",+ "content": "Do you really want to delete the favorite \"{name}\"?"+ },+ "favoriteEditDialog": {+ "titleAdd": "Add favorite",+ "titleEdit": "Edit favorite",+ "name": "Name",+ "auto": "(auto)",+ "ip": "IP Address",+ "port": "Port"+ }}}diff --git a/app/assets/i18n/_missing_translations_nl.json b/app/assets/i18n/_missing_translations_nl.jsonindex c7e346e7..91d163a6 100644--- a/app/assets/i18n/_missing_translations_nl.json+++ b/app/assets/i18n/_missing_translations_nl.json@@ -4,6 +4,7 @@"After editing this file, you can run 'dart run slang apply --locale=nl' to quickly apply the newly added translations."],"general": {+ "delete": "Delete","noItemInClipboard": "No item in Clipboard"},"sendTab": {@@ -17,5 +18,24 @@"oled": "OLED"}}+ },+ "dialogs": {+ "favoriteDialog": {+ "title": "Favorites",+ "noFavorites": "No favorites configured yet.",+ "addFavorite": "New"+ },+ "favoriteDeleteDialog": {+ "title": "Delete favorite",+ "content": "Do you really want to delete the favorite \"{name}\"?"+ },+ "favoriteEditDialog": {+ "titleAdd": "Add favorite",+ "titleEdit": "Edit favorite",+ "name": "Name",+ "auto": "(auto)",+ "ip": "IP Address",+ "port": "Port"+ }}}diff --git a/app/assets/i18n/_missing_translations_pl.json b/app/assets/i18n/_missing_translations_pl.jsonindex d26b0aab..d2f4470c 100644--- a/app/assets/i18n/_missing_translations_pl.json+++ b/app/assets/i18n/_missing_translations_pl.json@@ -4,6 +4,7 @@"After editing this file, you can run 'dart run slang apply --locale=pl' to quickly apply the newly added translations."],"general": {+ "delete": "Delete","noItemInClipboard": "No item in Clipboard"},"sendTab": {@@ -17,5 +18,24 @@"oled": "OLED"}}+ },+ "dialogs": {+ "favoriteDialog": {+ "title": "Favorites",+ "noFavorites": "No favorites configured yet.",+ "addFavorite": "New"+ },+ "favoriteDeleteDialog": {+ "title": "Delete favorite",+ "content": "Do you really want to delete the favorite \"{name}\"?"+ },+ "favoriteEditDialog": {+ "titleAdd": "Add favorite",+ "titleEdit": "Edit favorite",+ "name": "Name",+ "auto": "(auto)",+ "ip": "IP Address",+ "port": "Port"+ }}}diff --git a/app/assets/i18n/_missing_translations_pt_BR.json b/app/assets/i18n/_missing_translations_pt_BR.jsonindex a1abb53c..d6a89c77 100644--- a/app/assets/i18n/_missing_translations_pt_BR.json+++ b/app/assets/i18n/_missing_translations_pt_BR.json@@ -4,6 +4,7 @@"After editing this file, you can run 'dart run slang apply --locale=pt-BR' to quickly apply the newly added translations."],"general": {+ "delete": "Delete","noItemInClipboard": "No item in Clipboard"},"sendTab": {@@ -17,5 +18,24 @@"oled": "OLED"}}+ },+ "dialogs": {+ "favoriteDialog": {+ "title": "Favorites",+ "noFavorites": "No favorites configured yet.",+ "addFavorite": "New"+ },+ "favoriteDeleteDialog": {+ "title": "Delete favorite",+ "content": "Do you really want to delete the favorite \"{name}\"?"+ },+ "favoriteEditDialog": {+ "titleAdd": "Add favorite",+ "titleEdit": "Edit favorite",+ "name": "Name",+ "auto": "(auto)",+ "ip": "IP Address",+ "port": "Port"+ }}}diff --git a/app/assets/i18n/_missing_translations_ru.json b/app/assets/i18n/_missing_translations_ru.jsonindex d69f5f8c..f77f34a1 100644--- a/app/assets/i18n/_missing_translations_ru.json+++ b/app/assets/i18n/_missing_translations_ru.json@@ -2,5 +2,27 @@"@@info": ["Here are translations that exist in <en> but not in <ru>.","After editing this file, you can run 'dart run slang apply --locale=ru' to quickly apply the newly added translations."- ]+ ],+ "general": {+ "delete": "Delete"+ },+ "dialogs": {+ "favoriteDialog": {+ "title": "Favorites",+ "noFavorites": "No favorites configured yet.",+ "addFavorite": "New"+ },+ "favoriteDeleteDialog": {+ "title": "Delete favorite",+ "content": "Do you really want to delete the favorite \"{name}\"?"+ },+ "favoriteEditDialog": {+ "titleAdd": "Add favorite",+ "titleEdit": "Edit favorite",+ "name": "Name",+ "auto": "(auto)",+ "ip": "IP Address",+ "port": "Port"+ }+ }}diff --git a/app/assets/i18n/_missing_translations_sv.json b/app/assets/i18n/_missing_translations_sv.jsonindex 35cc7ad4..e9a6f15e 100644--- a/app/assets/i18n/_missing_translations_sv.json+++ b/app/assets/i18n/_missing_translations_sv.json@@ -4,6 +4,7 @@"After editing this file, you can run 'dart run slang apply --locale=sv' to quickly apply the newly added translations."],"general": {+ "delete": "Delete","noItemInClipboard": "No item in Clipboard"},"sendTab": {@@ -17,5 +18,24 @@"oled": "OLED"}}+ },+ "dialogs": {+ "favoriteDialog": {+ "title": "Favorites",+ "noFavorites": "No favorites configured yet.",+ "addFavorite": "New"+ },+ "favoriteDeleteDialog": {+ "title": "Delete favorite",+ "content": "Do you really want to delete the favorite \"{name}\"?"+ },+ "favoriteEditDialog": {+ "titleAdd": "Add favorite",+ "titleEdit": "Edit favorite",+ "name": "Name",+ "auto": "(auto)",+ "ip": "IP Address",+ "port": "Port"+ }}}diff --git a/app/assets/i18n/_missing_translations_tr.json b/app/assets/i18n/_missing_translations_tr.jsonindex aa265c9f..e1bb14fc 100644--- a/app/assets/i18n/_missing_translations_tr.json+++ b/app/assets/i18n/_missing_translations_tr.json@@ -4,6 +4,7 @@"After editing this file, you can run 'dart run slang apply --locale=tr' to quickly apply the newly added translations."],"general": {+ "delete": "Delete","noItemInClipboard": "No item in Clipboard"},"sendTab": {@@ -17,5 +18,24 @@"oled": "OLED"}}+ },+ "dialogs": {+ "favoriteDialog": {+ "title": "Favorites",+ "noFavorites": "No favorites configured yet.",+ "addFavorite": "New"+ },+ "favoriteDeleteDialog": {+ "title": "Delete favorite",+ "content": "Do you really want to delete the favorite \"{name}\"?"+ },+ "favoriteEditDialog": {+ "titleAdd": "Add favorite",+ "titleEdit": "Edit favorite",+ "name": "Name",+ "auto": "(auto)",+ "ip": "IP Address",+ "port": "Port"+ }}}diff --git a/app/assets/i18n/_missing_translations_uk.json b/app/assets/i18n/_missing_translations_uk.jsonindex 4eb0fee1..d6cdb785 100644--- a/app/assets/i18n/_missing_translations_uk.json+++ b/app/assets/i18n/_missing_translations_uk.json@@ -2,5 +2,27 @@"@@info": ["Here are translations that exist in <en> but not in <uk>.","After editing this file, you can run 'dart run slang apply --locale=uk' to quickly apply the newly added translations."- ]+ ],+ "general": {+ "delete": "Delete"+ },+ "dialogs": {+ "favoriteDialog": {+ "title": "Favorites",+ "noFavorites": "No favorites configured yet.",+ "addFavorite": "New"+ },+ "favoriteDeleteDialog": {+ "title": "Delete favorite",+ "content": "Do you really want to delete the favorite \"{name}\"?"+ },+ "favoriteEditDialog": {+ "titleAdd": "Add favorite",+ "titleEdit": "Edit favorite",+ "name": "Name",+ "auto": "(auto)",+ "ip": "IP Address",+ "port": "Port"+ }+ }}diff --git a/app/assets/i18n/_missing_translations_ur.json b/app/assets/i18n/_missing_translations_ur.jsonindex 8eab3359..a377a065 100644--- a/app/assets/i18n/_missing_translations_ur.json+++ b/app/assets/i18n/_missing_translations_ur.json@@ -4,6 +4,7 @@"After editing this file, you can run 'dart run slang apply --locale=ur' to quickly apply the newly added translations."],"general": {+ "delete": "Delete","noItemInClipboard": "No item in Clipboard"},"sendTab": {@@ -17,5 +18,24 @@"oled": "OLED"}}+ },+ "dialogs": {+ "favoriteDialog": {+ "title": "Favorites",+ "noFavorites": "No favorites configured yet.",+ "addFavorite": "New"+ },+ "favoriteDeleteDialog": {+ "title": "Delete favorite",+ "content": "Do you really want to delete the favorite \"{name}\"?"+ },+ "favoriteEditDialog": {+ "titleAdd": "Add favorite",+ "titleEdit": "Edit favorite",+ "name": "Name",+ "auto": "(auto)",+ "ip": "IP Address",+ "port": "Port"+ }}}diff --git a/app/assets/i18n/_missing_translations_zh_CN.json b/app/assets/i18n/_missing_translations_zh_CN.jsonindex babbeb2b..df854655 100644--- a/app/assets/i18n/_missing_translations_zh_CN.json+++ b/app/assets/i18n/_missing_translations_zh_CN.json@@ -2,5 +2,27 @@"@@info": ["Here are translations that exist in <en> but not in <zh-CN>.","After editing this file, you can run 'dart run slang apply --locale=zh-CN' to quickly apply the newly added translations."- ]+ ],+ "general": {+ "delete": "Delete"+ },+ "dialogs": {+ "favoriteDialog": {+ "title": "Favorites",+ "noFavorites": "No favorites configured yet.",+ "addFavorite": "New"+ },+ "favoriteDeleteDialog": {+ "title": "Delete favorite",+ "content": "Do you really want to delete the favorite \"{name}\"?"+ },+ "favoriteEditDialog": {+ "titleAdd": "Add favorite",+ "titleEdit": "Edit favorite",+ "name": "Name",+ "auto": "(auto)",+ "ip": "IP Address",+ "port": "Port"+ }+ }}diff --git a/app/assets/i18n/_missing_translations_zh_HK.json b/app/assets/i18n/_missing_translations_zh_HK.jsonindex aa04c9ad..a9b7f1c9 100644--- a/app/assets/i18n/_missing_translations_zh_HK.json+++ b/app/assets/i18n/_missing_translations_zh_HK.json@@ -4,6 +4,7 @@"After editing this file, you can run 'dart run slang apply --locale=zh-HK' to quickly apply the newly added translations."],"general": {+ "delete": "Delete","noItemInClipboard": "No item in Clipboard"},"sendTab": {@@ -17,5 +18,24 @@"oled": "OLED"}}+ },+ "dialogs": {+ "favoriteDialog": {+ "title": "Favorites",+ "noFavorites": "No favorites configured yet.",+ "addFavorite": "New"+ },+ "favoriteDeleteDialog": {+ "title": "Delete favorite",+ "content": "Do you really want to delete the favorite \"{name}\"?"+ },+ "favoriteEditDialog": {+ "titleAdd": "Add favorite",+ "titleEdit": "Edit favorite",+ "name": "Name",+ "auto": "(auto)",+ "ip": "IP Address",+ "port": "Port"+ }}}diff --git a/app/assets/i18n/_missing_translations_zh_TW.json b/app/assets/i18n/_missing_translations_zh_TW.jsonindex 6154bcad..b8086325 100644--- a/app/assets/i18n/_missing_translations_zh_TW.json+++ b/app/assets/i18n/_missing_translations_zh_TW.json@@ -4,6 +4,7 @@"After editing this file, you can run 'dart run slang apply --locale=zh-TW' to quickly apply the newly added translations."],"general": {+ "delete": "Delete","noItemInClipboard": "No item in Clipboard"},"sendTab": {@@ -17,5 +18,24 @@"oled": "OLED"}}+ },+ "dialogs": {+ "favoriteDialog": {+ "title": "Favorites",+ "noFavorites": "No favorites configured yet.",+ "addFavorite": "New"+ },+ "favoriteDeleteDialog": {+ "title": "Delete favorite",+ "content": "Do you really want to delete the favorite \"{name}\"?"+ },+ "favoriteEditDialog": {+ "titleAdd": "Add favorite",+ "titleEdit": "Edit favorite",+ "name": "Name",+ "auto": "(auto)",+ "ip": "IP Address",+ "port": "Port"+ }}}diff --git a/app/assets/i18n/strings.i18n.json b/app/assets/i18n/strings.i18n.jsonindex de61c126..58c677ba 100644--- a/app/assets/i18n/strings.i18n.json+++ b/app/assets/i18n/strings.i18n.json@@ -14,6 +14,7 @@"copiedToClipboard": "Copied to Clipboard","decline": "Decline","done": "Done",+ "delete": "Delete","edit": "Edit","error": "Error","example": "Example",@@ -316,6 +317,23 @@"errorDialog": {"title": "@:general.error"},+ "favoriteDialog": {+ "title": "Favorites",+ "noFavorites": "No favorites configured yet.",+ "addFavorite": "New"+ },+ "favoriteDeleteDialog": {+ "title": "Delete favorite",+ "content": "Do you really want to delete the favorite \"{name}\"?"+ },+ "favoriteEditDialog": {+ "titleAdd": "Add favorite",+ "titleEdit": "Edit favorite",+ "name": "Name",+ "auto": "(auto)",+ "ip": "IP Address",+ "port": "Port"+ },"fileInfo": {"title": "File information","fileName": "File name:",diff --git a/app/assets/i18n/strings_de.i18n.json b/app/assets/i18n/strings_de.i18n.jsonindex b7f11c3c..3f6e0478 100644--- a/app/assets/i18n/strings_de.i18n.json+++ b/app/assets/i18n/strings_de.i18n.json@@ -14,6 +14,7 @@"copiedToClipboard": "In die Zwischenablage kopiert","decline": "Ablehnen","done": "Fertig",+ "delete": "Löschen","edit": "Bearbeiten","error": "Fehler","example": "Beispiel",@@ -246,6 +247,23 @@"errorDialog": {"title": "@:general.error"},+ "favoriteDialog": {+ "title": "Favoriten",+ "noFavorites": "Keine Favoriten konfiguriert.",+ "addFavorite": "Neu"+ },+ "favoriteDeleteDialog": {+ "title": "Favorit löschen",+ "content": "Möchtest du wirklich \"{name}\" löschen?"+ },+ "favoriteEditDialog": {+ "titleAdd": "Favorit hinzufügen",+ "titleEdit": "Favorit bearbeiten",+ "name": "Name",+ "auto": "(auto)",+ "ip": "IP-Addresse",+ "port": "Port"+ },"fileInfo": {"title": "Datei-Information","fileName": "Dateiname:",diff --git a/app/lib/gen/strings.g.dart b/app/lib/gen/strings.g.dartindex 1700d108..2828aa22 100644--- a/app/lib/gen/strings.g.dart+++ b/app/lib/gen/strings.g.dart@@ -4,7 +4,7 @@/// To regenerate, run: `dart run slang`////// Locales: 28-/// Strings: 6956 (248 per locale)+/// Strings: 6980 (249 per locale)// coverage:ignore-filediff --git a/app/lib/gen/strings_de.g.dart b/app/lib/gen/strings_de.g.dartindex d3f5dbdb..c0c9142a 100644--- a/app/lib/gen/strings_de.g.dart+++ b/app/lib/gen/strings_de.g.dart@@ -64,6 +64,7 @@ class _StringsGeneralDe extends _StringsGeneralEn {@override String get copiedToClipboard => 'In die Zwischenablage kopiert';@override String get decline => 'Ablehnen';@override String get done => 'Fertig';+ @override String get delete => 'Löschen';@override String get edit => 'Bearbeiten';@override String get error => 'Fehler';@override String get example => 'Beispiel';@@ -307,6 +308,9 @@ class _StringsDialogsDe extends _StringsDialogsEn {@override late final _StringsDialogsCannotOpenFileDe cannotOpenFile = _StringsDialogsCannotOpenFileDe._(_root);@override late final _StringsDialogsEncryptionDisabledNoticeDe encryptionDisabledNotice = _StringsDialogsEncryptionDisabledNoticeDe._(_root);@override late final _StringsDialogsErrorDialogDe errorDialog = _StringsDialogsErrorDialogDe._(_root);+ @override late final _StringsDialogsFavoriteDialogDe favoriteDialog = _StringsDialogsFavoriteDialogDe._(_root);+ @override late final _StringsDialogsFavoriteDeleteDialogDe favoriteDeleteDialog = _StringsDialogsFavoriteDeleteDialogDe._(_root);+ @override late final _StringsDialogsFavoriteEditDialogDe favoriteEditDialog = _StringsDialogsFavoriteEditDialogDe._(_root);@override late final _StringsDialogsFileInfoDe fileInfo = _StringsDialogsFileInfoDe._(_root);@override late final _StringsDialogsFileNameInputDe fileNameInput = _StringsDialogsFileNameInputDe._(_root);@override late final _StringsDialogsLocalNetworkUnauthorizedDe localNetworkUnauthorized = _StringsDialogsLocalNetworkUnauthorizedDe._(_root);@@ -604,6 +608,44 @@ class _StringsDialogsErrorDialogDe extends _StringsDialogsErrorDialogEn {@override String get title => '${_root.general.error}';}+// Path: dialogs.favoriteDialog+class _StringsDialogsFavoriteDialogDe extends _StringsDialogsFavoriteDialogEn {+ _StringsDialogsFavoriteDialogDe._(_StringsDe root) : this._root = root, super._(root);++ @override final _StringsDe _root; // ignore: unused_field++ // Translations+ @override String get title => 'Favoriten';+ @override String get noFavorites => 'Keine Favoriten konfiguriert.';+ @override String get addFavorite => 'Neu';+}++// Path: dialogs.favoriteDeleteDialog+class _StringsDialogsFavoriteDeleteDialogDe extends _StringsDialogsFavoriteDeleteDialogEn {+ _StringsDialogsFavoriteDeleteDialogDe._(_StringsDe root) : this._root = root, super._(root);++ @override final _StringsDe _root; // ignore: unused_field++ // Translations+ @override String get title => 'Favorit löschen';+ @override String content({required Object name}) => 'Möchtest du wirklich "${name}" löschen?';+}++// Path: dialogs.favoriteEditDialog+class _StringsDialogsFavoriteEditDialogDe extends _StringsDialogsFavoriteEditDialogEn {+ _StringsDialogsFavoriteEditDialogDe._(_StringsDe root) : this._root = root, super._(root);++ @override final _StringsDe _root; // ignore: unused_field++ // Translations+ @override String get titleAdd => 'Favorit hinzufügen';+ @override String get titleEdit => 'Favorit bearbeiten';+ @override String get name => 'Name';+ @override String get auto => '(auto)';+ @override String get ip => 'IP-Addresse';+ @override String get port => 'Port';+}+// Path: dialogs.fileInfoclass _StringsDialogsFileInfoDe extends _StringsDialogsFileInfoEn {_StringsDialogsFileInfoDe._(_StringsDe root) : this._root = root, super._(root);diff --git a/app/lib/gen/strings_en.g.dart b/app/lib/gen/strings_en.g.dartindex 059e833f..ae2b3866 100644--- a/app/lib/gen/strings_en.g.dart+++ b/app/lib/gen/strings_en.g.dart@@ -63,6 +63,7 @@ class _StringsGeneralEn {String get copiedToClipboard => 'Copied to Clipboard';String get decline => 'Decline';String get done => 'Done';+ String get delete => 'Delete';String get edit => 'Edit';String get error => 'Error';String get example => 'Example';@@ -377,6 +378,9 @@ class _StringsDialogsEn {late final _StringsDialogsCannotOpenFileEn cannotOpenFile = _StringsDialogsCannotOpenFileEn._(_root);late final _StringsDialogsEncryptionDisabledNoticeEn encryptionDisabledNotice = _StringsDialogsEncryptionDisabledNoticeEn._(_root);late final _StringsDialogsErrorDialogEn errorDialog = _StringsDialogsErrorDialogEn._(_root);+ late final _StringsDialogsFavoriteDialogEn favoriteDialog = _StringsDialogsFavoriteDialogEn._(_root);+ late final _StringsDialogsFavoriteDeleteDialogEn favoriteDeleteDialog = _StringsDialogsFavoriteDeleteDialogEn._(_root);+ late final _StringsDialogsFavoriteEditDialogEn favoriteEditDialog = _StringsDialogsFavoriteEditDialogEn._(_root);late final _StringsDialogsFileInfoEn fileInfo = _StringsDialogsFileInfoEn._(_root);late final _StringsDialogsFileNameInputEn fileNameInput = _StringsDialogsFileNameInputEn._(_root);late final _StringsDialogsLocalNetworkUnauthorizedEn localNetworkUnauthorized = _StringsDialogsLocalNetworkUnauthorizedEn._(_root);@@ -674,6 +678,44 @@ class _StringsDialogsErrorDialogEn {String get title => '${_root.general.error}';}+// Path: dialogs.favoriteDialog+class _StringsDialogsFavoriteDialogEn {+ _StringsDialogsFavoriteDialogEn._(this._root);++ final _StringsEn _root; // ignore: unused_field++ // Translations+ String get title => 'Favorites';+ String get noFavorites => 'No favorites configured yet.';+ String get addFavorite => 'New';+}++// Path: dialogs.favoriteDeleteDialog+class _StringsDialogsFavoriteDeleteDialogEn {+ _StringsDialogsFavoriteDeleteDialogEn._(this._root);++ final _StringsEn _root; // ignore: unused_field++ // Translations+ String get title => 'Delete favorite';+ String content({required Object name}) => 'Do you really want to delete the favorite "${name}"?';+}++// Path: dialogs.favoriteEditDialog+class _StringsDialogsFavoriteEditDialogEn {+ _StringsDialogsFavoriteEditDialogEn._(this._root);++ final _StringsEn _root; // ignore: unused_field++ // Translations+ String get titleAdd => 'Add favorite';+ String get titleEdit => 'Edit favorite';+ String get name => 'Name';+ String get auto => '(auto)';+ String get ip => 'IP Address';+ String get port => 'Port';+}+// Path: dialogs.fileInfoclass _StringsDialogsFileInfoEn {_StringsDialogsFileInfoEn._(this._root);diff --git a/app/lib/init.dart b/app/lib/init.dartindex f7d3431c..2bee7cb0 100644--- a/app/lib/init.dart+++ b/app/lib/init.dart@@ -179,7 +179,7 @@ Future<void> _handleSharedIntent(SharedMedia payload, Ref ref) async {ref.redux(selectedSendingFilesProvider).dispatch(AddMessageAction(message: message));}await ref.redux(selectedSendingFilesProvider).dispatchAsync(AddFilesAction(- files: payload.attachments?.where((a) => a != null).cast<SharedAttachment>() ?? <SharedAttachment>[],- converter: CrossFileConverters.convertSharedAttachment,- ));+ files: payload.attachments?.where((a) => a != null).cast<SharedAttachment>() ?? <SharedAttachment>[],+ converter: CrossFileConverters.convertSharedAttachment,+ ));}diff --git a/app/lib/model/persistence/favorite_device.dart b/app/lib/model/persistence/favorite_device.dartnew file mode 100644index 00000000..e60b06a1--- /dev/null+++ b/app/lib/model/persistence/favorite_device.dart@@ -0,0 +1,40 @@+import 'package:dart_mappable/dart_mappable.dart';+import 'package:uuid/uuid.dart';++part 'favorite_device.mapper.dart';++const _uuid = Uuid();++@MappableClass()+class FavoriteDevice with FavoriteDeviceMappable {+ final String id;+ final String fingerprint;+ final String ip;+ final int port;+ final String alias;++ const FavoriteDevice({+ required this.id,+ required this.fingerprint,+ required this.ip,+ required this.port,+ required this.alias,+ });++ factory FavoriteDevice.fromValues({+ required String fingerprint,+ required String ip,+ required int port,+ required String alias,+ }) {+ return FavoriteDevice(+ id: _uuid.v1(),+ fingerprint: fingerprint,+ ip: ip,+ port: port,+ alias: alias,+ );+ }++ static const fromJson = FavoriteDeviceMapper.fromJson;+}diff --git a/app/lib/model/persistence/favorite_device.mapper.dart b/app/lib/model/persistence/favorite_device.mapper.dartnew file mode 100644index 00000000..9174e58d--- /dev/null+++ b/app/lib/model/persistence/favorite_device.mapper.dart@@ -0,0 +1,147 @@+// coverage:ignore-file+// GENERATED CODE - DO NOT MODIFY BY HAND+// ignore_for_file: type=lint+// ignore_for_file: unused_element++part of 'favorite_device.dart';++class FavoriteDeviceMapper extends ClassMapperBase<FavoriteDevice> {+ FavoriteDeviceMapper._();++ static FavoriteDeviceMapper? _instance;+ static FavoriteDeviceMapper ensureInitialized() {+ if (_instance == null) {+ MapperContainer.globals.use(_instance = FavoriteDeviceMapper._());+ }+ return _instance!;+ }++ static T _guard<T>(T Function(MapperContainer) fn) {+ ensureInitialized();+ return fn(MapperContainer.globals);+ }++ @override+ final String id = 'FavoriteDevice';++ static String _$id(FavoriteDevice v) => v.id;+ static const Field<FavoriteDevice, String> _f$id = Field('id', _$id);+ static String _$fingerprint(FavoriteDevice v) => v.fingerprint;+ static const Field<FavoriteDevice, String> _f$fingerprint =+ Field('fingerprint', _$fingerprint);+ static String _$ip(FavoriteDevice v) => v.ip;+ static const Field<FavoriteDevice, String> _f$ip = Field('ip', _$ip);+ static int _$port(FavoriteDevice v) => v.port;+ static const Field<FavoriteDevice, int> _f$port = Field('port', _$port);+ static String _$alias(FavoriteDevice v) => v.alias;+ static const Field<FavoriteDevice, String> _f$alias = Field('alias', _$alias);++ @override+ final Map<Symbol, Field<FavoriteDevice, dynamic>> fields = const {+ #id: _f$id,+ #fingerprint: _f$fingerprint,+ #ip: _f$ip,+ #port: _f$port,+ #alias: _f$alias,+ };++ static FavoriteDevice _instantiate(DecodingData data) {+ return FavoriteDevice(+ id: data.dec(_f$id),+ fingerprint: data.dec(_f$fingerprint),+ ip: data.dec(_f$ip),+ port: data.dec(_f$port),+ alias: data.dec(_f$alias));+ }++ @override+ final Function instantiate = _instantiate;++ static FavoriteDevice fromJson(Map<String, dynamic> map) {+ return _guard((c) => c.fromMap<FavoriteDevice>(map));+ }++ static FavoriteDevice deserialize(String json) {+ return _guard((c) => c.fromJson<FavoriteDevice>(json));+ }+}++mixin FavoriteDeviceMappable {+ String serialize() {+ return FavoriteDeviceMapper._guard((c) => c.toJson(this as FavoriteDevice));+ }++ Map<String, dynamic> toJson() {+ return FavoriteDeviceMapper._guard((c) => c.toMap(this as FavoriteDevice));+ }++ FavoriteDeviceCopyWith<FavoriteDevice, FavoriteDevice, FavoriteDevice>+ get copyWith => _FavoriteDeviceCopyWithImpl(+ this as FavoriteDevice, $identity, $identity);+ @override+ String toString() {+ return FavoriteDeviceMapper._guard((c) => c.asString(this));+ }++ @override+ bool operator ==(Object other) {+ return identical(this, other) ||+ (runtimeType == other.runtimeType &&+ FavoriteDeviceMapper._guard((c) => c.isEqual(this, other)));+ }++ @override+ int get hashCode {+ return FavoriteDeviceMapper._guard((c) => c.hash(this));+ }+}++extension FavoriteDeviceValueCopy<$R, $Out>+ on ObjectCopyWith<$R, FavoriteDevice, $Out> {+ FavoriteDeviceCopyWith<$R, FavoriteDevice, $Out> get $asFavoriteDevice =>+ $base.as((v, t, t2) => _FavoriteDeviceCopyWithImpl(v, t, t2));+}++abstract class FavoriteDeviceCopyWith<$R, $In extends FavoriteDevice, $Out>+ implements ClassCopyWith<$R, $In, $Out> {+ $R call(+ {String? id, String? fingerprint, String? ip, int? port, String? alias});+ FavoriteDeviceCopyWith<$R2, $In, $Out2> $chain<$R2, $Out2>(+ Then<$Out2, $R2> t);+}++class _FavoriteDeviceCopyWithImpl<$R, $Out>+ extends ClassCopyWithBase<$R, FavoriteDevice, $Out>+ implements FavoriteDeviceCopyWith<$R, FavoriteDevice, $Out> {+ _FavoriteDeviceCopyWithImpl(super.value, super.then, super.then2);++ @override+ late final ClassMapperBase<FavoriteDevice> $mapper =+ FavoriteDeviceMapper.ensureInitialized();+ @override+ $R call(+ {String? id,+ String? fingerprint,+ String? ip,+ int? port,+ String? alias}) =>+ $apply(FieldCopyWithData({+ if (id != null) #id: id,+ if (fingerprint != null) #fingerprint: fingerprint,+ if (ip != null) #ip: ip,+ if (port != null) #port: port,+ if (alias != null) #alias: alias+ }));+ @override+ FavoriteDevice $make(CopyWithData data) => FavoriteDevice(+ id: data.get(#id, or: $value.id),+ fingerprint: data.get(#fingerprint, or: $value.fingerprint),+ ip: data.get(#ip, or: $value.ip),+ port: data.get(#port, or: $value.port),+ alias: data.get(#alias, or: $value.alias));++ @override+ FavoriteDeviceCopyWith<$R2, FavoriteDevice, $Out2> $chain<$R2, $Out2>(+ Then<$Out2, $R2> t) =>+ _FavoriteDeviceCopyWithImpl($value, $cast, t);+}diff --git a/app/lib/model/receive_history_entry.dart b/app/lib/model/persistence/receive_history_entry.dartsimilarity index 100%rename from app/lib/model/receive_history_entry.dartrename to app/lib/model/persistence/receive_history_entry.dartdiff --git a/app/lib/model/receive_history_entry.mapper.dart b/app/lib/model/persistence/receive_history_entry.mapper.dartsimilarity index 100%rename from app/lib/model/receive_history_entry.mapper.dartrename to app/lib/model/persistence/receive_history_entry.mapper.dartdiff --git a/app/lib/pages/debug/debug_page.dart b/app/lib/pages/debug/debug_page.dartindex b3e7219a..d00b91b6 100644--- a/app/lib/pages/debug/debug_page.dart+++ b/app/lib/pages/debug/debug_page.dart@@ -6,6 +6,7 @@ import 'package:localsend_app/pages/debug/discovery_debug_page.dart';import 'package:localsend_app/pages/debug/http_logs_page.dart';import 'package:localsend_app/pages/debug/security_debug_page.dart';import 'package:localsend_app/provider/app_arguments_provider.dart';+import 'package:localsend_app/provider/persistence_provider.dart';import 'package:localsend_app/widget/debug_entry.dart';import 'package:refena_flutter/refena_flutter.dart';import 'package:routerino/routerino.dart';@@ -59,6 +60,10 @@ class DebugPage extends StatelessWidget {onPressed: () async => context.push(() => const RefenaTracingPage()),child: const Text('Refena Tracing'),),+ FilledButton(+ onPressed: () async => await context.ref.read(persistenceProvider).clear(),+ child: const Text('Clear settings'),+ ),],),],diff --git a/app/lib/pages/receive_history_page.dart b/app/lib/pages/receive_history_page.dartindex 69588028..6e6d73eb 100644--- a/app/lib/pages/receive_history_page.dart+++ b/app/lib/pages/receive_history_page.dart@@ -1,6 +1,6 @@import 'package:flutter/material.dart';import 'package:localsend_app/gen/strings.g.dart';-import 'package:localsend_app/model/receive_history_entry.dart';+import 'package:localsend_app/model/persistence/receive_history_entry.dart';import 'package:localsend_app/provider/receive_history_provider.dart';import 'package:localsend_app/provider/settings_provider.dart';import 'package:localsend_app/theme.dart';diff --git a/app/lib/pages/selected_files_page.dart b/app/lib/pages/selected_files_page.dartindex af0ef6c4..b6748d20 100644--- a/app/lib/pages/selected_files_page.dart+++ b/app/lib/pages/selected_files_page.dart@@ -46,7 +46,7 @@ class SelectedFilesPage extends StatelessWidget {],),),- ElevatedButton(+ FilledButton(onPressed: () {ref.redux(selectedSendingFilesProvider).dispatch(ClearSelectionAction());context.popUntilRoot();diff --git a/app/lib/pages/tabs/send_tab.dart b/app/lib/pages/tabs/send_tab.dartindex 0da68dc8..98fee3d3 100644--- a/app/lib/pages/tabs/send_tab.dart+++ b/app/lib/pages/tabs/send_tab.dart@@ -2,6 +2,7 @@ import 'package:collection/collection.dart';import 'package:flutter/material.dart';import 'package:localsend_app/gen/strings.g.dart';import 'package:localsend_app/model/device.dart';+import 'package:localsend_app/model/persistence/favorite_device.dart';import 'package:localsend_app/model/send_mode.dart';import 'package:localsend_app/model/session_status.dart';import 'package:localsend_app/pages/progress_page.dart';@@ -10,6 +11,7 @@ import 'package:localsend_app/pages/send_page.dart';import 'package:localsend_app/pages/troubleshoot_page.dart';import 'package:localsend_app/pages/web_send_page.dart';import 'package:localsend_app/provider/animation_provider.dart';+import 'package:localsend_app/provider/favorites_provider.dart';import 'package:localsend_app/provider/local_ip_provider.dart';import 'package:localsend_app/provider/network/nearby_devices_provider.dart';import 'package:localsend_app/provider/network/scan_provider.dart';@@ -26,6 +28,7 @@ import 'package:localsend_app/widget/big_button.dart';import 'package:localsend_app/widget/custom_icon_button.dart';import 'package:localsend_app/widget/dialogs/add_file_dialog.dart';import 'package:localsend_app/widget/dialogs/address_input_dialog.dart';+import 'package:localsend_app/widget/dialogs/favorite_dialog.dart';import 'package:localsend_app/widget/dialogs/no_files_dialog.dart';import 'package:localsend_app/widget/dialogs/send_mode_help_dialog.dart';import 'package:localsend_app/widget/file_thumbnail.dart';@@ -78,6 +81,7 @@ class _SendTabState extends State<SendTab> with Refena {final selectedFiles = ref.watch(selectedSendingFilesProvider);final networkInfo = ref.watch(localIpProvider);final nearbyDevicesState = ref.watch(nearbyDevicesProvider);+ final favoriteState = ref.watch(favoritesProvider);return ResponsiveListView(padding: EdgeInsets.zero,@@ -223,6 +227,30 @@ class _SendTabState extends State<SendTab> with Refena {child: const Icon(Icons.ads_click),),),+ Tooltip(+ message: t.dialogs.favoriteDialog.title,+ child: CustomIconButton(+ onPressed: () async {+ final files = ref.read(selectedSendingFilesProvider);+ if (files.isEmpty) {+ await context.pushBottomSheet(() => const NoFilesDialog());+ return;+ }+ final device = await showDialog<Device?>(+ context: context,+ builder: (_) => const FavoritesDialog(),+ );+ if (device != null && mounted) {+ await ref.notifier(sendProvider).startSession(+ target: device,+ files: files,+ background: false,+ );+ }+ },+ child: const Icon(Icons.favorite),+ ),+ ),_SendModeButton(onSelect: (mode) async {if (mode == SendMode.link) {@@ -252,6 +280,7 @@ class _SendTabState extends State<SendTab> with Refena {),),...nearbyDevicesState.devices.values.map((device) {+ final isFavorite = favoriteState.any((e) => e.fingerprint == device.fingerprint);return Padding(padding: const EdgeInsets.only(bottom: 10, left: _horizontalPadding, right: _horizontalPadding),child: Hero(@@ -260,6 +289,19 @@ class _SendTabState extends State<SendTab> with Refena {? _MultiSendDeviceListTile(device: device): DeviceListTile(device: device,+ isFavorite: isFavorite,+ onFavoriteTap: () async {+ if (isFavorite) {+ await ref.redux(favoritesProvider).dispatchAsync(RemoveFavoriteAction(deviceFingerprint: device.fingerprint));+ return;+ }+ await ref.redux(favoritesProvider).dispatchAsync(AddFavoriteAction(FavoriteDevice.fromValues(+ fingerprint: device.fingerprint,+ ip: device.ip,+ port: device.port,+ alias: device.alias,+ )));+ },onTap: () async {final files = ref.read(selectedSendingFilesProvider);if (files.isEmpty) {diff --git a/app/lib/provider/favorites_provider.dart b/app/lib/provider/favorites_provider.dartnew file mode 100644index 00000000..b069245f--- /dev/null+++ b/app/lib/provider/favorites_provider.dart@@ -0,0 +1,67 @@+import 'package:localsend_app/model/persistence/favorite_device.dart';+import 'package:localsend_app/provider/persistence_provider.dart';+import 'package:refena_flutter/refena_flutter.dart';++final favoritesProvider = ReduxProvider<FavoritesService, List<FavoriteDevice>>((ref) {+ return FavoritesService(ref.read(persistenceProvider));+});++class FavoritesService extends ReduxNotifier<List<FavoriteDevice>> {+ final PersistenceService _persistence;++ FavoritesService(this._persistence);++ @override+ List<FavoriteDevice> init() {+ return _persistence.getFavorites();+ }+}++class AddFavoriteAction extends AsyncReduxAction<FavoritesService, List<FavoriteDevice>> {+ final FavoriteDevice device;++ AddFavoriteAction(this.device);++ @override+ Future<List<FavoriteDevice>> reduce() async {+ final updated = List<FavoriteDevice>.unmodifiable([+ ...state,+ device,+ ]);+ await notifier._persistence.setFavorites(updated);+ return updated;+ }+}++class UpdateFavoriteAction extends AsyncReduxAction<FavoritesService, List<FavoriteDevice>> {+ final FavoriteDevice device;++ UpdateFavoriteAction(this.device);++ @override+ Future<List<FavoriteDevice>> reduce() async {+ final index = state.indexWhere((e) => e.id == device.id);+ final updated = List<FavoriteDevice>.unmodifiable(<FavoriteDevice>[+ ...state,+ ]..replaceRange(index, index + 1, [device]));+ await notifier._persistence.setFavorites(updated);+ return updated;+ }+}++class RemoveFavoriteAction extends AsyncReduxAction<FavoritesService, List<FavoriteDevice>> {+ final String deviceFingerprint;++ RemoveFavoriteAction({+ required this.deviceFingerprint,+ });++ @override+ Future<List<FavoriteDevice>> reduce() async {+ final updated = List<FavoriteDevice>.unmodifiable(<FavoriteDevice>[+ ...state,+ ]..removeWhere((e) => e.fingerprint == deviceFingerprint));+ await notifier._persistence.setFavorites(updated);+ return updated;+ }+}diff --git a/app/lib/provider/network/nearby_devices_provider.dart b/app/lib/provider/network/nearby_devices_provider.dartindex b26388d9..3118106a 100644--- a/app/lib/provider/network/nearby_devices_provider.dart+++ b/app/lib/provider/network/nearby_devices_provider.dart@@ -1,15 +1,11 @@import 'dart:async';-import 'package:dio/dio.dart';-import 'package:localsend_app/constants.dart';import 'package:localsend_app/model/device.dart';-import 'package:localsend_app/model/dto/info_dto.dart';+import 'package:localsend_app/model/persistence/favorite_device.dart';import 'package:localsend_app/model/state/nearby_devices_state.dart';-import 'package:localsend_app/provider/dio_provider.dart';import 'package:localsend_app/provider/logging/discovery_logs_provider.dart';import 'package:localsend_app/provider/network/multicast_provider.dart';-import 'package:localsend_app/provider/security_provider.dart';-import 'package:localsend_app/util/api_route_builder.dart';+import 'package:localsend_app/provider/network/targeted_discovery_provider.dart';import 'package:localsend_app/util/task_runner.dart';import 'package:logging/logging.dart';import 'package:refena_flutter/refena_flutter.dart';@@ -22,26 +18,29 @@ final _logger = Logger('NearbyDevices');////// Use [scanProvider] to have a high-level API to perform discovery operations.final nearbyDevicesProvider = NotifierProvider<NearbyDevicesNotifier, NearbyDevicesState>((ref) {- return NearbyDevicesNotifier();+ return NearbyDevicesNotifier(+ targetedDiscoveryService: ref.read(targetedDiscoveryProvider),+ multicastService: ref.read(multicastProvider),+ );});Map<String, TaskRunner> _runners = {};class NearbyDevicesNotifier extends Notifier<NearbyDevicesState> {- late Dio _dio;- late String _fingerprint;- late MulticastService _multicastService;+ final TargetedDiscoveryService _targetedDiscoveryService;+ final MulticastService _multicastService;++ NearbyDevicesNotifier({+ required TargetedDiscoveryService targetedDiscoveryService,+ required MulticastService multicastService,+ }) : _targetedDiscoveryService = targetedDiscoveryService,+ _multicastService = multicastService;@override- NearbyDevicesState init() {- _dio = ref.read(dioProvider).discovery;- _fingerprint = ref.read(securityProvider).certificateHash;- _multicastService = ref.read(multicastProvider);- return const NearbyDevicesState(- runningIps: {},- devices: {},- );- }+ NearbyDevicesState init() => const NearbyDevicesState(+ runningIps: {},+ devices: {},+ );/// Binds the UDP port and listens for incoming announcements./// This should run forever as long as the app is running.@@ -60,7 +59,7 @@ class NearbyDevicesNotifier extends Notifier<NearbyDevicesState> {/// Scans one particular subnet with traditional HTTP/TCP discovery./// This method awaits until the scan is finished.- Future<void> startScan({required int port, required String localIp, required bool https}) async {+ Future<void> startLegacyScan({required int port, required String localIp, required bool https}) async {if (state.runningIps.contains(localIp)) {// already running for the same localIpreturn;@@ -68,20 +67,20 @@ class NearbyDevicesNotifier extends Notifier<NearbyDevicesState> {state = state.copyWith(runningIps: {...state.runningIps, localIp});- await for (final device in _getStream(localIp, port, https, _fingerprint)) {+ await for (final device in _getStream(localIp, port, https)) {registerDevice(device);}state = state.copyWith(runningIps: state.runningIps.where((ip) => ip != localIp).toSet());}- Stream<Device> _getStream(String networkInterface, int port, bool https, String fingerprint) {+ Stream<Device> _getStream(String networkInterface, int port, bool https) {final ipList = List.generate(256, (i) => '${networkInterface.split('.').take(3).join('.')}.$i').where((ip) => ip != networkInterface).toList();_runners[networkInterface]?.stop();_runners[networkInterface] = TaskRunner<Device?>(initialTasks: List.generate(ipList.length,- (index) => () async => _doRequest(ipList[index], port, https, fingerprint),+ (index) => () async => _doRequest(ipList[index], port, https),),concurrency: 50,);@@ -89,6 +88,30 @@ class NearbyDevicesNotifier extends Notifier<NearbyDevicesState> {return _runners[networkInterface]!.stream.where((device) => device != null).cast<Device>();}+ Future<void> startFavoriteScan({required List<FavoriteDevice> devices, required bool https}) async {+ if (devices.isEmpty) {+ return;+ }+ await for (final device in _getFavoriteStream(devices: devices, https: https)) {+ registerDevice(device);+ }+ }++ Stream<Device> _getFavoriteStream({required List<FavoriteDevice> devices, required bool https}) {+ final runner = TaskRunner<Device?>(+ initialTasks: List.generate(+ devices.length,+ (index) => () async {+ final device = devices[index];+ return _doRequest(device.ip, device.port, https);+ },+ ),+ concurrency: 50,+ );++ return runner.stream.where((device) => device != null).cast<Device>();+ }+void registerDevice(Device device) {state = state.copyWith(devices: {...state.devices}..update(device.ip, (_) => device, ifAbsent: () => device),@@ -99,23 +122,18 @@ class NearbyDevicesNotifier extends Notifier<NearbyDevicesState> {state = state.copyWith(devices: {});}- Future<Device?> _doRequest(String currentIp, int port, bool https, String fingerprint) async {+ Future<Device?> _doRequest(String currentIp, int port, bool https) async {_logger.fine('Requesting $currentIp');- // We use the legacy route to make it less breaking for older versions- final url = ApiRoute.info.targetRaw(currentIp, port, https, peerProtocolVersion);- Device? device;- try {- final response = await _dio.get(url, queryParameters: {- 'fingerprint': fingerprint,- });- final dto = InfoDto.fromJson(response.data);- device = dto.toDevice(currentIp, port, https);+ final device = await _targetedDiscoveryService.discover(+ ip: currentIp,+ port: port,+ https: https,+ onError: null,+ );+ if (device != null) {ref.notifier(discoveryLogsProvider).addLog('[DISCOVER/TCP] ${device.alias} (${device.ip}, model: ${device.deviceModel})');- } on DioException catch (_) {- device = null;- } catch (e) {- device = null;}+return device;}}diff --git a/app/lib/provider/network/scan_provider.dart b/app/lib/provider/network/scan_provider.dartindex a76812d3..8f92e34d 100644--- a/app/lib/provider/network/scan_provider.dart+++ b/app/lib/provider/network/scan_provider.dart@@ -1,5 +1,6 @@import 'dart:async';+import 'package:localsend_app/provider/favorites_provider.dart';import 'package:localsend_app/provider/local_ip_provider.dart';import 'package:localsend_app/provider/network/nearby_devices_provider.dart';import 'package:localsend_app/provider/settings_provider.dart';@@ -26,7 +27,15 @@ class ScanFacade {// Try performant Multicast/UDP method first_ref.notifier(nearbyDevicesProvider).startMulticastScan();- if (!forceLegacy) {+ // At the same time, try to discover favorites+ final favorites = _ref.read(favoritesProvider);+ final https = _ref.read(settingsProvider).https;+ await _ref.notifier(nearbyDevicesProvider).startFavoriteScan(devices: favorites, https: https);++ if (!forceLegacy && favorites.isEmpty) {+ // Wait a bit before trying the legacy method.+ // Skip waiting if [forceLegacy] is true.+ // Also skip waiting if there are favorites.await sleepAsync(1000);}@@ -50,7 +59,7 @@ class ScanFacade {_ref.notifier(nearbyDevicesProvider).startMulticastScan();await Future.wait<void>([- for (final subnet in subnets) _ref.notifier(nearbyDevicesProvider).startScan(port: port, localIp: subnet, https: https),+ for (final subnet in subnets) _ref.notifier(nearbyDevicesProvider).startLegacyScan(port: port, localIp: subnet, https: https),]);}}diff --git a/app/lib/provider/network/targeted_discovery_provider.dart b/app/lib/provider/network/targeted_discovery_provider.dartindex a2d90b83..af736293 100644--- a/app/lib/provider/network/targeted_discovery_provider.dart+++ b/app/lib/provider/network/targeted_discovery_provider.dart@@ -23,22 +23,30 @@ class TargetedDiscoveryService {TargetedDiscoveryService(this._dio, this._fingerprint);- Future<Device?> discover(String ip, int port, bool https) async {+ Future<Device?> discover({+ required String ip,+ required int port,+ required bool https,+ void Function(String url, Object? error)? onError = defaultErrorPrinter,+ }) async {+ // We use the legacy route to make it less breaking for older versionsfinal url = ApiRoute.info.targetRaw(ip, port, https, peerProtocolVersion);- Device? device;try {final response = await _dio.get(url, queryParameters: {'fingerprint': _fingerprint,});final dto = InfoDto.fromJson(response.data);- device = dto.toDevice(ip, port, https);+ return dto.toDevice(ip, port, https);} on DioException catch (e) {- device = null;- _logger.warning('$url: ${e.error}');+ onError?.call(url, e.error);+ return null;} catch (e) {- device = null;- _logger.warning('$url: $e');+ onError?.call(url, e);+ return null;}- return device;+ }++ static void defaultErrorPrinter(String url, Object? error) {+ _logger.warning('$url: $error');}}diff --git a/app/lib/provider/persistence_provider.dart b/app/lib/provider/persistence_provider.dartindex 203d6fdb..c661ce6c 100644--- a/app/lib/provider/persistence_provider.dart+++ b/app/lib/provider/persistence_provider.dart@@ -7,8 +7,9 @@ import 'package:localsend_app/constants.dart';import 'package:localsend_app/gen/strings.g.dart';import 'package:localsend_app/model/device.dart';import 'package:localsend_app/model/persistence/color_mode.dart';+import 'package:localsend_app/model/persistence/favorite_device.dart';+import 'package:localsend_app/model/persistence/receive_history_entry.dart';import 'package:localsend_app/model/persistence/stored_security_context.dart';-import 'package:localsend_app/model/receive_history_entry.dart';import 'package:localsend_app/model/send_mode.dart';import 'package:localsend_app/provider/window_dimensions_provider.dart';import 'package:localsend_app/util/alias_generator.dart';@@ -32,6 +33,9 @@ const _securityContext = 'ls_security_context';// Received file historyconst _receiveHistory = 'ls_receive_history';+// Favorites+const _favorites = 'ls_favorites';+// App Window Offset and Size infoconst _windowOffsetX = 'ls_window_offset_x';const _windowOffsetY = 'ls_window_offset_y';@@ -137,6 +141,16 @@ class PersistenceService {await _prefs.setStringList(_receiveHistory, historyRaw);}+ List<FavoriteDevice> getFavorites() {+ final favoritesRaw = _prefs.getStringList(_favorites) ?? [];+ return favoritesRaw.map((entry) => FavoriteDevice.fromJson(jsonDecode(entry))).toList();+ }++ Future<void> setFavorites(List<FavoriteDevice> entries) async {+ final favoritesRaw = entries.map((entry) => jsonEncode(entry.toJson())).toList();+ await _prefs.setStringList(_favorites, favoritesRaw);+ }+String getShowToken() {return _prefs.getString(_showToken)!;}@@ -343,4 +357,8 @@ class PersistenceService {Future<void> setDeviceModel(String deviceModel) async {await _prefs.setString(_deviceModel, deviceModel);}++ Future<void> clear() async {+ await _prefs.clear();+ }}diff --git a/app/lib/provider/receive_history_provider.dart b/app/lib/provider/receive_history_provider.dartindex c1bb89bc..6d2c1807 100644--- a/app/lib/provider/receive_history_provider.dart+++ b/app/lib/provider/receive_history_provider.dart@@ -1,5 +1,5 @@import 'package:localsend_app/model/file_type.dart';-import 'package:localsend_app/model/receive_history_entry.dart';+import 'package:localsend_app/model/persistence/receive_history_entry.dart';import 'package:localsend_app/provider/persistence_provider.dart';import 'package:refena_flutter/refena_flutter.dart';diff --git a/app/lib/refena.dart b/app/lib/refena.dartindex 1f392031..8e61d734 100644--- a/app/lib/refena.dart+++ b/app/lib/refena.dart@@ -14,18 +14,14 @@ class CustomRefenaObserver extends RefenaMultiObserver {onLine: (line) => _logger.info(line),exclude: (event) {return event is ChangeEvent &&- (event.notifier is DiscoveryLogsNotifier ||- event.notifier is LocalIpService ||- event.notifier is ProgressNotifier);+ (event.notifier is DiscoveryLogsNotifier || event.notifier is LocalIpService || event.notifier is ProgressNotifier);},),RefenaTracingObserver(limit: 100,exclude: (event) {return event is ChangeEvent &&- (event.notifier is DiscoveryLogsNotifier ||- event.notifier is LocalIpService ||- event.notifier is ProgressNotifier);+ (event.notifier is DiscoveryLogsNotifier || event.notifier is LocalIpService || event.notifier is ProgressNotifier);},),RefenaInspectorObserver(),diff --git a/app/lib/widget/dialogs/address_input_dialog.dart b/app/lib/widget/dialogs/address_input_dialog.dartindex 4af77313..e312947f 100644--- a/app/lib/widget/dialogs/address_input_dialog.dart+++ b/app/lib/widget/dialogs/address_input_dialog.dart@@ -17,15 +17,15 @@ enum _InputMode {ip;String get label {- switch (this) {- case _InputMode.hashtag:- return t.dialogs.addressInput.hashtag;- case _InputMode.ip:- return t.dialogs.addressInput.ip;- }+ return switch (this) {+ _InputMode.hashtag => t.dialogs.addressInput.hashtag,+ _InputMode.ip => t.dialogs.addressInput.ip,+ };}}+/// A dialog to input an hash or address.+/// Pops the dialog with the device if found.class AddressInputDialog extends StatefulWidget {const AddressInputDialog();@@ -59,7 +59,7 @@ class _AddressInputDialogState extends State<AddressInputDialog> with Refena {final results = TaskRunner<Device?>(concurrency: 10,initialTasks: [- for (final ip in candidates) () => ref.read(targetedDiscoveryProvider).discover(ip, port, https),+ for (final ip in candidates) () => ref.read(targetedDiscoveryProvider).discover(ip: ip, port: port, https: https),],).stream;@@ -188,11 +188,7 @@ class _AddressInputDialogState extends State<AddressInputDialog> with Refena {onPressed: () => context.pop(),child: Text(t.general.cancel),),- ElevatedButton(- style: ElevatedButton.styleFrom(- backgroundColor: Theme.of(context).buttonTheme.colorScheme!.primary,- foregroundColor: Theme.of(context).buttonTheme.colorScheme!.onPrimary,- ),+ FilledButton(onPressed: _fetching ? null : () async => _submit(localIps, settings.port),child: Text(t.general.confirm),),diff --git a/app/lib/widget/dialogs/favorite_delete_dialog.dart b/app/lib/widget/dialogs/favorite_delete_dialog.dartnew file mode 100644index 00000000..9291b4f2--- /dev/null+++ b/app/lib/widget/dialogs/favorite_delete_dialog.dart@@ -0,0 +1,28 @@+import 'package:flutter/material.dart';+import 'package:localsend_app/gen/strings.g.dart';+import 'package:localsend_app/model/persistence/favorite_device.dart';+import 'package:routerino/routerino.dart';++class FavoriteDeleteDialog extends StatelessWidget {+ final FavoriteDevice favorite;++ const FavoriteDeleteDialog(this.favorite);++ @override+ Widget build(BuildContext context) {+ return AlertDialog(+ title: Text(t.dialogs.favoriteDeleteDialog.title),+ content: Text(t.dialogs.favoriteDeleteDialog.content(name: favorite.alias)),+ actions: [+ TextButton(+ onPressed: () => context.pop(),+ child: Text(t.general.cancel),+ ),+ FilledButton(+ onPressed: () => context.pop(true),+ child: Text(t.general.delete),+ ),+ ],+ );+ }+}diff --git a/app/lib/widget/dialogs/favorite_dialog.dart b/app/lib/widget/dialogs/favorite_dialog.dartnew file mode 100644index 00000000..281fcca2--- /dev/null+++ b/app/lib/widget/dialogs/favorite_dialog.dart@@ -0,0 +1,106 @@+import 'package:flutter/material.dart';+import 'package:localsend_app/gen/strings.g.dart';+import 'package:localsend_app/model/persistence/favorite_device.dart';+import 'package:localsend_app/provider/favorites_provider.dart';+import 'package:localsend_app/provider/network/targeted_discovery_provider.dart';+import 'package:localsend_app/provider/settings_provider.dart';+import 'package:localsend_app/theme.dart';+import 'package:localsend_app/widget/dialogs/favorite_edit_dialog.dart';+import 'package:refena_flutter/refena_flutter.dart';+import 'package:routerino/routerino.dart';++/// A dialog showing a list of favorites+class FavoritesDialog extends StatefulWidget {+ const FavoritesDialog();++ @override+ State<FavoritesDialog> createState() => _FavoritesDialogState();+}++class _FavoritesDialogState extends State<FavoritesDialog> with Refena {+ bool _fetching = false;+ bool _failed = false;++ /// Checks if the device is reachable and pops the dialog with the result if it is.+ Future<void> _checkConnectionToDevice(FavoriteDevice favorite) async {+ setState(() {+ _fetching = true;+ });++ final https = ref.read(settingsProvider).https;++ final result = await ref.read(targetedDiscoveryProvider).discover(ip: favorite.ip, port: favorite.port, https: https);+ if (result == null) {+ setState(() {+ _fetching = false;+ _failed = true;+ });+ return;+ }++ if (!mounted) {+ return;+ }++ context.pop(result);+ }++ Future<void> _showDeviceDialog([FavoriteDevice? favorite]) async {+ await showDialog(context: context, builder: (_) => FavoriteEditDialog(favorite: favorite));+ }++ @override+ Widget build(BuildContext context) {+ final favorites = ref.watch(favoritesProvider);++ return AlertDialog(+ title: Text(t.dialogs.favoriteDialog.title),+ content: Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ if (favorites.isEmpty)+ Text(+ t.dialogs.favoriteDialog.noFavorites,+ style: const TextStyle(color: Colors.grey),+ ),+ for (final favorite in favorites)+ Row(+ children: [+ Expanded(+ child: TextButton(+ style: TextButton.styleFrom(foregroundColor: Theme.of(context).colorScheme.onSurface),+ onPressed: _fetching ? null : () async => await _checkConnectionToDevice(favorite),+ child: Align(+ alignment: Alignment.centerLeft,+ child: Text('${favorite.alias}\n(${favorite.ip})'),+ ),+ ),+ ),+ TextButton(+ style: TextButton.styleFrom(foregroundColor: Theme.of(context).colorScheme.onSurface),+ onPressed: _fetching ? null : () async => await _showDeviceDialog(favorite),+ child: const Icon(Icons.edit),+ ),+ ],+ ),+ if (_failed)+ Padding(+ padding: const EdgeInsets.only(top: 10),+ child: Text(t.general.error, style: TextStyle(color: Theme.of(context).colorScheme.warning)),+ ),+ ],+ ),+ actions: [+ TextButton(+ onPressed: () => context.pop(),+ child: Text(t.general.cancel),+ ),+ FilledButton(+ onPressed: _showDeviceDialog,+ child: Text(t.dialogs.favoriteDialog.addFavorite),+ ),+ ],+ );+ }+}diff --git a/app/lib/widget/dialogs/favorite_edit_dialog.dart b/app/lib/widget/dialogs/favorite_edit_dialog.dartnew file mode 100644index 00000000..603e9522--- /dev/null+++ b/app/lib/widget/dialogs/favorite_edit_dialog.dart@@ -0,0 +1,174 @@+import 'package:flutter/material.dart';+import 'package:localsend_app/gen/strings.g.dart';+import 'package:localsend_app/model/persistence/favorite_device.dart';+import 'package:localsend_app/provider/favorites_provider.dart';+import 'package:localsend_app/provider/network/targeted_discovery_provider.dart';+import 'package:localsend_app/provider/settings_provider.dart';+import 'package:localsend_app/theme.dart';+import 'package:localsend_app/widget/dialogs/favorite_delete_dialog.dart';+import 'package:refena_flutter/refena_flutter.dart';+import 'package:routerino/routerino.dart';++/// A dialog to add or edit a favorite device.+class FavoriteEditDialog extends StatefulWidget {+ final FavoriteDevice? favorite;++ const FavoriteEditDialog({this.favorite});++ @override+ State<FavoriteEditDialog> createState() => _FavoriteEditDialogState();+}++class _FavoriteEditDialogState extends State<FavoriteEditDialog> with Refena {+ final _ipController = TextEditingController();+ final _portController = TextEditingController();+ final _aliasController = TextEditingController();+ bool _fetching = false;+ bool _failed = false;++ @override+ void initState() {+ super.initState();++ _ipController.text = widget.favorite?.ip ?? '';+ _aliasController.text = widget.favorite?.alias ?? '';++ ensureRef((ref) {+ _portController.text = widget.favorite?.port.toString() ?? ref.read(settingsProvider).port.toString();+ });+ }++ @override+ void dispose() {+ _ipController.dispose();+ _portController.dispose();+ _aliasController.dispose();+ super.dispose();+ }++ @override+ Widget build(BuildContext context) {+ return AlertDialog(+ title: Text(widget.favorite != null ? t.dialogs.favoriteEditDialog.titleEdit : t.dialogs.favoriteEditDialog.titleAdd),+ content: Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Text(t.dialogs.favoriteEditDialog.name),+ const SizedBox(height: 5),+ TextFormField(+ controller: _aliasController,+ decoration: InputDecoration(+ hintText: t.dialogs.favoriteEditDialog.auto,+ ),+ enabled: !_fetching,+ ),+ const SizedBox(height: 16),+ Text(t.dialogs.favoriteEditDialog.ip),+ const SizedBox(height: 5),+ TextFormField(+ controller: _ipController,+ autofocus: widget.favorite == null,+ enabled: !_fetching,+ ),+ const SizedBox(height: 16),+ Text(t.dialogs.favoriteEditDialog.port),+ const SizedBox(height: 5),+ TextFormField(+ controller: _portController,+ enabled: !_fetching,+ keyboardType: TextInputType.number,+ ),+ if (widget.favorite != null) ...[+ const SizedBox(height: 16),+ TextButton.icon(+ style: TextButton.styleFrom(+ foregroundColor: Theme.of(context).colorScheme.warning,+ ),+ onPressed: () async {+ final result = await showDialog<bool>(+ context: context,+ builder: (_) => FavoriteDeleteDialog(widget.favorite!),+ );++ if (mounted && result == true) {+ await context.ref.redux(favoritesProvider).dispatchAsync(RemoveFavoriteAction(deviceFingerprint: widget.favorite!.fingerprint));+ if (mounted) {+ context.pop();+ }+ }+ },+ icon: const Icon(Icons.delete),+ label: Text(t.general.delete),+ ),+ ],+ if (_failed)+ Padding(+ padding: const EdgeInsets.only(top: 10),+ child: Text(t.general.error, style: TextStyle(color: Theme.of(context).colorScheme.warning)),+ ),+ ],+ ),+ actions: [+ TextButton(+ onPressed: () => context.pop(),+ child: Text(t.general.cancel),+ ),+ FilledButton(+ onPressed: _fetching+ ? null+ : () async {+ if (_ipController.text.isEmpty) {+ return;+ }++ if (_portController.text.isEmpty) {+ return;+ }++ if (widget.favorite != null) {+ if (_aliasController.text.trim().isEmpty) {+ return;+ }++ await ref.redux(favoritesProvider).dispatchAsync(UpdateFavoriteAction(widget.favorite!.copyWith(+ ip: _ipController.text,+ port: int.parse(_portController.text),+ alias: _aliasController.text,+ )));+ } else {+ final ip = _ipController.text;+ final port = int.parse(_portController.text);+ final https = ref.read(settingsProvider).https;+ setState(() {+ _fetching = true;+ });+ final result = await ref.read(targetedDiscoveryProvider).discover(ip: ip, port: port, https: https);+ if (result == null) {+ setState(() {+ _fetching = false;+ _failed = true;+ });+ return;+ }++ final name = _aliasController.text.trim();++ await ref.redux(favoritesProvider).dispatchAsync(AddFavoriteAction(FavoriteDevice.fromValues(+ fingerprint: result.fingerprint,+ ip: _ipController.text,+ port: int.parse(_portController.text),+ alias: name.isEmpty ? result.alias : name,+ )));+ }++ if (mounted) {+ context.pop();+ }+ },+ child: Text(t.general.confirm),+ ),+ ],+ );+ }+}diff --git a/app/lib/widget/dialogs/file_info_dialog.dart b/app/lib/widget/dialogs/file_info_dialog.dartindex 85121b37..1d9a9512 100644--- a/app/lib/widget/dialogs/file_info_dialog.dart+++ b/app/lib/widget/dialogs/file_info_dialog.dart@@ -1,6 +1,6 @@import 'package:flutter/material.dart';import 'package:localsend_app/gen/strings.g.dart';-import 'package:localsend_app/model/receive_history_entry.dart';+import 'package:localsend_app/model/persistence/receive_history_entry.dart';import 'package:localsend_app/util/file_size_helper.dart';import 'package:routerino/routerino.dart';diff --git a/app/lib/widget/list_tile/device_list_tile.dart b/app/lib/widget/list_tile/device_list_tile.dartindex 3818278f..07525a2d 100644--- a/app/lib/widget/list_tile/device_list_tile.dart+++ b/app/lib/widget/list_tile/device_list_tile.dart@@ -7,11 +7,20 @@ import 'package:localsend_app/widget/list_tile/custom_list_tile.dart';class DeviceListTile extends StatelessWidget {final Device device;+ final bool isFavorite;final String? info;final double? progress;final VoidCallback? onTap;+ final VoidCallback? onFavoriteTap;- const DeviceListTile({required this.device, this.info, this.progress, this.onTap});+ const DeviceListTile({+ required this.device,+ this.isFavorite = false,+ this.info,+ this.progress,+ this.onTap,+ this.onFavoriteTap,+ });@overrideWidget build(BuildContext context) {@@ -19,6 +28,12 @@ class DeviceListTile extends StatelessWidget {return CustomListTile(icon: Icon(device.deviceType.icon, size: 46),title: Text(device.alias, style: const TextStyle(fontSize: 20)),+ trailing: onFavoriteTap != null+ ? IconButton(+ icon: Icon(isFavorite ? Icons.favorite : Icons.favorite_border),+ onPressed: onFavoriteTap,+ )+ : null,subTitle: Wrap(runSpacing: 10,spacing: 10,