Handle existing urls
This commit is contained in:
@@ -4,9 +4,9 @@
|
|||||||
/// To regenerate, run: `dart run slang`
|
/// To regenerate, run: `dart run slang`
|
||||||
///
|
///
|
||||||
/// Locales: 3
|
/// Locales: 3
|
||||||
/// Strings: 609 (203 per locale)
|
/// Strings: 612 (204 per locale)
|
||||||
///
|
///
|
||||||
/// Built on 2024-06-11 at 20:02 UTC
|
/// Built on 2024-07-18 at 17:32 UTC
|
||||||
|
|
||||||
// coverage:ignore-file
|
// coverage:ignore-file
|
||||||
// ignore_for_file: type=lint
|
// ignore_for_file: type=lint
|
||||||
@@ -365,6 +365,7 @@ class _StringsBookmarksAddBookmarkEn {
|
|||||||
String get leaveEmptyUseWebsiteDescription => 'Leave empty to use the website\'s description.';
|
String get leaveEmptyUseWebsiteDescription => 'Leave empty to use the website\'s description.';
|
||||||
String get share => 'Share';
|
String get share => 'Share';
|
||||||
String get shareDescription => 'Share this bookmark with other registered users and anonymous users.';
|
String get shareDescription => 'Share this bookmark with other registered users and anonymous users.';
|
||||||
|
String get urlAlreadyBookmarked => 'This URL is already bookmarked. The form has been pre-filled with the existing bookmark, and saving the form will update the existing bookmark.';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Path: bookmarks.search
|
// Path: bookmarks.search
|
||||||
@@ -774,6 +775,7 @@ class _StringsBookmarksAddBookmarkEs implements _StringsBookmarksAddBookmarkEn {
|
|||||||
@override String get leaveEmptyUseWebsiteDescription => 'Dejar vacío para usar la descripción del sitio web.';
|
@override String get leaveEmptyUseWebsiteDescription => 'Dejar vacío para usar la descripción del sitio web.';
|
||||||
@override String get share => 'Compartir';
|
@override String get share => 'Compartir';
|
||||||
@override String get shareDescription => 'Comparte este marcador con otros usuarios registrados y usuarios anónimos.';
|
@override String get shareDescription => 'Comparte este marcador con otros usuarios registrados y usuarios anónimos.';
|
||||||
|
@override String get urlAlreadyBookmarked => 'Esta URL ya está marcada como favorita. El formulario se ha rellenado previamente con el marcador existente, y al guardar el formulario se actualizará el marcador existente.';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Path: bookmarks.search
|
// Path: bookmarks.search
|
||||||
@@ -1183,6 +1185,7 @@ class _StringsBookmarksAddBookmarkTr implements _StringsBookmarksAddBookmarkEn {
|
|||||||
@override String get leaveEmptyUseWebsiteDescription => 'Web sitesinin açıklamasını kullanmak için boş bırakın.';
|
@override String get leaveEmptyUseWebsiteDescription => 'Web sitesinin açıklamasını kullanmak için boş bırakın.';
|
||||||
@override String get share => 'Share';
|
@override String get share => 'Share';
|
||||||
@override String get shareDescription => 'Share this bookmark with other registered users and anonymous users.';
|
@override String get shareDescription => 'Share this bookmark with other registered users and anonymous users.';
|
||||||
|
@override String get urlAlreadyBookmarked => 'This URL is already bookmarked. The form has been pre-filled with the existing bookmark, and saving the form will update the existing bookmark.';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Path: bookmarks.search
|
// Path: bookmarks.search
|
||||||
@@ -1446,6 +1449,7 @@ extension on Translations {
|
|||||||
case 'bookmarks.addBookmark.leaveEmptyUseWebsiteDescription': return 'Leave empty to use the website\'s description.';
|
case 'bookmarks.addBookmark.leaveEmptyUseWebsiteDescription': return 'Leave empty to use the website\'s description.';
|
||||||
case 'bookmarks.addBookmark.share': return 'Share';
|
case 'bookmarks.addBookmark.share': return 'Share';
|
||||||
case 'bookmarks.addBookmark.shareDescription': return 'Share this bookmark with other registered users and anonymous users.';
|
case 'bookmarks.addBookmark.shareDescription': return 'Share this bookmark with other registered users and anonymous users.';
|
||||||
|
case 'bookmarks.addBookmark.urlAlreadyBookmarked': return 'This URL is already bookmarked. The form has been pre-filled with the existing bookmark, and saving the form will update the existing bookmark.';
|
||||||
case 'bookmarks.search.searchBookmarks': return 'Search bookmarks';
|
case 'bookmarks.search.searchBookmarks': return 'Search bookmarks';
|
||||||
case 'bookmarks.search.clearSearch': return 'Clear search';
|
case 'bookmarks.search.clearSearch': return 'Clear search';
|
||||||
case 'bookmarks.search.inputSearchTerm': return 'Input a search term';
|
case 'bookmarks.search.inputSearchTerm': return 'Input a search term';
|
||||||
@@ -1657,6 +1661,7 @@ extension on _StringsEs {
|
|||||||
case 'bookmarks.addBookmark.leaveEmptyUseWebsiteDescription': return 'Dejar vacío para usar la descripción del sitio web.';
|
case 'bookmarks.addBookmark.leaveEmptyUseWebsiteDescription': return 'Dejar vacío para usar la descripción del sitio web.';
|
||||||
case 'bookmarks.addBookmark.share': return 'Compartir';
|
case 'bookmarks.addBookmark.share': return 'Compartir';
|
||||||
case 'bookmarks.addBookmark.shareDescription': return 'Comparte este marcador con otros usuarios registrados y usuarios anónimos.';
|
case 'bookmarks.addBookmark.shareDescription': return 'Comparte este marcador con otros usuarios registrados y usuarios anónimos.';
|
||||||
|
case 'bookmarks.addBookmark.urlAlreadyBookmarked': return 'Esta URL ya está marcada como favorita. El formulario se ha rellenado previamente con el marcador existente, y al guardar el formulario se actualizará el marcador existente.';
|
||||||
case 'bookmarks.search.searchBookmarks': return 'Buscar marcadores';
|
case 'bookmarks.search.searchBookmarks': return 'Buscar marcadores';
|
||||||
case 'bookmarks.search.clearSearch': return 'Limpiar búsqueda';
|
case 'bookmarks.search.clearSearch': return 'Limpiar búsqueda';
|
||||||
case 'bookmarks.search.inputSearchTerm': return 'Introduce un término de búsqueda';
|
case 'bookmarks.search.inputSearchTerm': return 'Introduce un término de búsqueda';
|
||||||
@@ -1868,6 +1873,7 @@ extension on _StringsTr {
|
|||||||
case 'bookmarks.addBookmark.leaveEmptyUseWebsiteDescription': return 'Web sitesinin açıklamasını kullanmak için boş bırakın.';
|
case 'bookmarks.addBookmark.leaveEmptyUseWebsiteDescription': return 'Web sitesinin açıklamasını kullanmak için boş bırakın.';
|
||||||
case 'bookmarks.addBookmark.share': return 'Share';
|
case 'bookmarks.addBookmark.share': return 'Share';
|
||||||
case 'bookmarks.addBookmark.shareDescription': return 'Share this bookmark with other registered users and anonymous users.';
|
case 'bookmarks.addBookmark.shareDescription': return 'Share this bookmark with other registered users and anonymous users.';
|
||||||
|
case 'bookmarks.addBookmark.urlAlreadyBookmarked': return 'This URL is already bookmarked. The form has been pre-filled with the existing bookmark, and saving the form will update the existing bookmark.';
|
||||||
case 'bookmarks.search.searchBookmarks': return 'Yer işaretlerini ara';
|
case 'bookmarks.search.searchBookmarks': return 'Yer işaretlerini ara';
|
||||||
case 'bookmarks.search.clearSearch': return 'Aramayı temizle';
|
case 'bookmarks.search.clearSearch': return 'Aramayı temizle';
|
||||||
case 'bookmarks.search.inputSearchTerm': return 'Bir arama terimi girin';
|
case 'bookmarks.search.inputSearchTerm': return 'Bir arama terimi girin';
|
||||||
|
|||||||
@@ -94,7 +94,8 @@
|
|||||||
"leaveEmptyUseWebsiteTitle": "Leave empty to use the website's title.",
|
"leaveEmptyUseWebsiteTitle": "Leave empty to use the website's title.",
|
||||||
"leaveEmptyUseWebsiteDescription": "Leave empty to use the website's description.",
|
"leaveEmptyUseWebsiteDescription": "Leave empty to use the website's description.",
|
||||||
"share": "Share",
|
"share": "Share",
|
||||||
"shareDescription": "Share this bookmark with other registered users and anonymous users."
|
"shareDescription": "Share this bookmark with other registered users and anonymous users.",
|
||||||
|
"urlAlreadyBookmarked": "This URL is already bookmarked. The form has been pre-filled with the existing bookmark, and saving the form will update the existing bookmark."
|
||||||
},
|
},
|
||||||
"search": {
|
"search": {
|
||||||
"searchBookmarks": "Search bookmarks",
|
"searchBookmarks": "Search bookmarks",
|
||||||
|
|||||||
@@ -94,7 +94,8 @@
|
|||||||
"leaveEmptyUseWebsiteTitle": "Dejar vacío para usar el título del sitio web.",
|
"leaveEmptyUseWebsiteTitle": "Dejar vacío para usar el título del sitio web.",
|
||||||
"leaveEmptyUseWebsiteDescription": "Dejar vacío para usar la descripción del sitio web.",
|
"leaveEmptyUseWebsiteDescription": "Dejar vacío para usar la descripción del sitio web.",
|
||||||
"share": "Compartir",
|
"share": "Compartir",
|
||||||
"shareDescription": "Comparte este marcador con otros usuarios registrados y usuarios anónimos."
|
"shareDescription": "Comparte este marcador con otros usuarios registrados y usuarios anónimos.",
|
||||||
|
"urlAlreadyBookmarked": "Esta URL ya está marcada como favorita. El formulario se ha rellenado previamente con el marcador existente, y al guardar el formulario se actualizará el marcador existente."
|
||||||
},
|
},
|
||||||
"search": {
|
"search": {
|
||||||
"searchBookmarks": "Buscar marcadores",
|
"searchBookmarks": "Buscar marcadores",
|
||||||
|
|||||||
@@ -94,7 +94,8 @@
|
|||||||
"leaveEmptyUseWebsiteTitle": "Web sitesinin başlığını kullanmak için boş bırakın.",
|
"leaveEmptyUseWebsiteTitle": "Web sitesinin başlığını kullanmak için boş bırakın.",
|
||||||
"leaveEmptyUseWebsiteDescription": "Web sitesinin açıklamasını kullanmak için boş bırakın.",
|
"leaveEmptyUseWebsiteDescription": "Web sitesinin açıklamasını kullanmak için boş bırakın.",
|
||||||
"share": "Share",
|
"share": "Share",
|
||||||
"shareDescription": "Share this bookmark with other registered users and anonymous users."
|
"shareDescription": "Share this bookmark with other registered users and anonymous users.",
|
||||||
|
"urlAlreadyBookmarked": "This URL is already bookmarked. The form has been pre-filled with the existing bookmark, and saving the form will update the existing bookmark."
|
||||||
},
|
},
|
||||||
"search": {
|
"search": {
|
||||||
"searchBookmarks": "Yer işaretlerini ara",
|
"searchBookmarks": "Yer işaretlerini ara",
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ class BookmarkFormModel {
|
|||||||
final TextEditingController notesController;
|
final TextEditingController notesController;
|
||||||
int? editBookmarkId;
|
int? editBookmarkId;
|
||||||
bool share;
|
bool share;
|
||||||
|
bool bookmarkExists = false;
|
||||||
|
|
||||||
BookmarkFormModel({
|
BookmarkFormModel({
|
||||||
required this.urlController,
|
required this.urlController,
|
||||||
|
|||||||
@@ -92,8 +92,18 @@ class BookmarkForm extends _$BookmarkForm {
|
|||||||
}
|
}
|
||||||
final result = await ref.read(checkBookmarkProvider(state.urlController.text).future);
|
final result = await ref.read(checkBookmarkProvider(state.urlController.text).future);
|
||||||
if (result.successful == true) {
|
if (result.successful == true) {
|
||||||
state.titleController.text = result.content?.metadata?.title ?? "";
|
if (result.content?.bookmark != null) {
|
||||||
state.descriptionController.text = result.content?.metadata?.description ?? "";
|
state.titleController.text = result.content?.bookmark?.title ?? "";
|
||||||
|
state.descriptionController.text = result.content?.metadata?.description ?? "";
|
||||||
|
state.tags = result.content?.bookmark?.tagNames ?? [];
|
||||||
|
state.notesController.text = result.content?.bookmark?.notes ?? "";
|
||||||
|
state.markAsUnread = result.content?.bookmark?.unread ?? false;
|
||||||
|
state.share = result.content?.bookmark?.shared ?? false;
|
||||||
|
state.bookmarkExists = true;
|
||||||
|
} else {
|
||||||
|
state.titleController.text = result.content?.metadata?.title ?? "";
|
||||||
|
state.descriptionController.text = result.content?.metadata?.description ?? "";
|
||||||
|
}
|
||||||
state.bookmarkValid = true;
|
state.bookmarkValid = true;
|
||||||
state.checkBookmarkLoadStatus = LoadStatus.loaded;
|
state.checkBookmarkLoadStatus = LoadStatus.loaded;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -248,6 +248,20 @@ class _ModalContent extends ConsumerWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
if (provider.bookmarkExists == true)
|
||||||
|
Card(
|
||||||
|
margin: const EdgeInsets.all(16),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(12),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
const Icon(Icons.info_rounded),
|
||||||
|
const SizedBox(width: 16),
|
||||||
|
Flexible(child: Text(t.bookmarks.addBookmark.urlAlreadyBookmarked)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
SectionLabel(
|
SectionLabel(
|
||||||
label: t.bookmarks.addBookmark.bookmarkDetails,
|
label: t.bookmarks.addBookmark.bookmarkDetails,
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
|
|||||||
Reference in New Issue
Block a user