diff --git a/lib/i18n/strings.g.dart b/lib/i18n/strings.g.dart index 9ee15fa..cc589ab 100644 --- a/lib/i18n/strings.g.dart +++ b/lib/i18n/strings.g.dart @@ -4,9 +4,9 @@ /// To regenerate, run: `dart run slang` /// /// 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 // ignore_for_file: type=lint @@ -365,6 +365,7 @@ class _StringsBookmarksAddBookmarkEn { String get leaveEmptyUseWebsiteDescription => 'Leave empty to use the website\'s description.'; String get share => 'Share'; 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 @@ -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 share => 'Compartir'; @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 @@ -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 share => 'Share'; @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 @@ -1446,6 +1449,7 @@ extension on Translations { case 'bookmarks.addBookmark.leaveEmptyUseWebsiteDescription': return 'Leave empty to use the website\'s description.'; case 'bookmarks.addBookmark.share': return 'Share'; 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.clearSearch': return 'Clear search'; 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.share': return 'Compartir'; 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.clearSearch': return 'Limpiar 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.share': return 'Share'; 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.clearSearch': return 'Aramayı temizle'; case 'bookmarks.search.inputSearchTerm': return 'Bir arama terimi girin'; diff --git a/lib/i18n/strings_en.i18n.json b/lib/i18n/strings_en.i18n.json index c72e346..e4ae755 100644 --- a/lib/i18n/strings_en.i18n.json +++ b/lib/i18n/strings_en.i18n.json @@ -94,7 +94,8 @@ "leaveEmptyUseWebsiteTitle": "Leave empty to use the website's title.", "leaveEmptyUseWebsiteDescription": "Leave empty to use the website's description.", "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": { "searchBookmarks": "Search bookmarks", diff --git a/lib/i18n/strings_es.i18n.json b/lib/i18n/strings_es.i18n.json index 8a28ff6..e07164a 100644 --- a/lib/i18n/strings_es.i18n.json +++ b/lib/i18n/strings_es.i18n.json @@ -94,7 +94,8 @@ "leaveEmptyUseWebsiteTitle": "Dejar vacío para usar el título del sitio web.", "leaveEmptyUseWebsiteDescription": "Dejar vacío para usar la descripción del sitio web.", "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": { "searchBookmarks": "Buscar marcadores", diff --git a/lib/i18n/strings_tr.i18n.json b/lib/i18n/strings_tr.i18n.json index 0ecb6cd..380970b 100644 --- a/lib/i18n/strings_tr.i18n.json +++ b/lib/i18n/strings_tr.i18n.json @@ -94,7 +94,8 @@ "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.", "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": { "searchBookmarks": "Yer işaretlerini ara", diff --git a/lib/screens/bookmarks/model/bookmark_form.model.dart b/lib/screens/bookmarks/model/bookmark_form.model.dart index 7d0fcb9..dcfaa9c 100644 --- a/lib/screens/bookmarks/model/bookmark_form.model.dart +++ b/lib/screens/bookmarks/model/bookmark_form.model.dart @@ -16,6 +16,7 @@ class BookmarkFormModel { final TextEditingController notesController; int? editBookmarkId; bool share; + bool bookmarkExists = false; BookmarkFormModel({ required this.urlController, diff --git a/lib/screens/bookmarks/provider/bookmark_form.provider.dart b/lib/screens/bookmarks/provider/bookmark_form.provider.dart index 06dc62f..21f6e7b 100644 --- a/lib/screens/bookmarks/provider/bookmark_form.provider.dart +++ b/lib/screens/bookmarks/provider/bookmark_form.provider.dart @@ -92,8 +92,18 @@ class BookmarkForm extends _$BookmarkForm { } final result = await ref.read(checkBookmarkProvider(state.urlController.text).future); if (result.successful == true) { - state.titleController.text = result.content?.metadata?.title ?? ""; - state.descriptionController.text = result.content?.metadata?.description ?? ""; + if (result.content?.bookmark != null) { + 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.checkBookmarkLoadStatus = LoadStatus.loaded; } else { diff --git a/lib/screens/bookmarks/ui/bookmark_form_modal.dart b/lib/screens/bookmarks/ui/bookmark_form_modal.dart index fa2f277..cb71381 100644 --- a/lib/screens/bookmarks/ui/bookmark_form_modal.dart +++ b/lib/screens/bookmarks/ui/bookmark_form_modal.dart @@ -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( label: t.bookmarks.addBookmark.bookmarkDetails, padding: const EdgeInsets.symmetric(