Merge pull request #662 from ericszimmermann/ez_bookmark
Add Bookmark functionality
This commit is contained in:
46 files changed
+2439
-28
No files matched your search
@@ -31,7 +31,7 @@ QuickSwitchBar tab 1 (middle) from any main screen.
|
||||
- Unread badge (if messages are unread)
|
||||
- Drag handle (when manual sort is active)
|
||||
- **"+" FAB** to add a new channel
|
||||
- **Overflow menu**: Disconnect, Manage Communities, Settings
|
||||
- **Overflow menu**: Disconnect, Bookmarks, Manage Communities, Settings
|
||||
|
||||
If no channels exist, an empty state with an "Add Public Channel" shortcut is shown. If a search produces no results, a separate "no results" empty state with a search-off icon is shown.
|
||||
|
||||
@@ -79,6 +79,7 @@ Tap a channel card to open the channel chat screen.
|
||||
- Tap the title or landscape icon to select a region; see [Regions](regions.md)
|
||||
- Overflow menu (⋮) → **Notifications**: choose all messages, mentions only or muted for this channel. The row shows the current mode
|
||||
- Overflow menu (⋮) → **Edit channel** and **Delete channel**: the same sheet and confirmation as a long-press in the channel list
|
||||
- Overflow menu (⋮) → **Show bookmarks** toggles the channel's bookmarked-message filter; the bookmark icon is filled while active and outlined while inactive.
|
||||
- Overflow menu (⋮) → **Chat background**: a color or picture, with a fade slider, behind this channel only. See [Chat backgrounds](themes.md#chat-backgrounds). Holiday greetings in new messages play a short animation, as in [direct chat](chat-and-messaging.md#message-list)
|
||||
|
||||
### Message Display
|
||||
@@ -87,6 +88,7 @@ Tap a channel card to open the channel chat screen.
|
||||
- **Incoming messages**: Colored avatar with sender's initial (or first emoji if name starts with one; color is deterministic from sender name hash), sender name in primary color, message bubble
|
||||
- **Outgoing messages**: Primary container color bubble with a small status icon: pending (clock), sent (checkmark), or failed (red error circle)
|
||||
- Automatic older-message loading on scroll-to-top
|
||||
- Long-press a message and choose **Bookmark** to mark it with a yellow icon. Bookmarks are stored separately from channel history and remain available after a channel is deleted.
|
||||
- Jump-to-bottom button when scrolled up
|
||||
- **Pinch-to-zoom**: Two-finger zoom (0.8x–1.8x) and double-tap to reset text size
|
||||
- **Message tracing mode** (when enabled in App Settings): Each bubble additionally shows path prefix bytes (`via XX,YY,...`), a timestamp, and a repeat count icon
|
||||
|
||||
@@ -29,6 +29,7 @@ From the Contacts screen, tap any Chat-type contact to open the ChatScreen.
|
||||
- **Holiday animations**: A new message with a holiday greeting ("Happy Halloween", "Merry Christmas", and so on, in any app language) plays a short animation. Turn off in App Settings → Appearance; see [Holiday message animations](themes.md#holiday-message-animations)
|
||||
- **Outgoing messages**: Right-aligned, primary color background. **Failed messages** change to a red-toned error container background
|
||||
- **Incoming messages**: Left-aligned, grey background with a colored avatar (initial letter or first emoji of sender name; color is deterministic from a hash of the sender name)
|
||||
- Long-press a message and choose **Bookmark** to show a yellow bookmark on the bubble. **Show bookmarks** in the chat menu toggles a filter for bookmarked messages; use **Bookmarks** in the Channels screen menu to browse saved messages, including those from deleted contacts or channels. From the bookmarks list, copy a message with its copy button. It is ordered oldest-to-newest and opens at the newest message. The Export screen can save or share a dated Markdown file, grouped by contact and then channel, with linked URLs and URL-image embeds. Links remain tappable, and supported URL-image previews are shown when **Load images from links** is enabled in App Settings.
|
||||
- Bubble width capped at 72% of screen width
|
||||
- Hyperlinks rendered as tappable green underlined text
|
||||
- Message text follows the system font size (Android/iOS accessibility text size); pinch-to-zoom scales on top of it
|
||||
|
||||
@@ -12,6 +12,7 @@ import 'package:flutter_blue_plus_platform_interface/flutter_blue_plus_platform_
|
||||
import '../utils/advert_signature.dart';
|
||||
import '../models/channel.dart';
|
||||
import '../models/channel_message.dart';
|
||||
import '../models/bookmarked_message.dart';
|
||||
import '../models/companion_radio_stats.dart';
|
||||
import '../models/contact.dart';
|
||||
import '../models/message_filter.dart';
|
||||
@@ -53,6 +54,7 @@ import '../services/notification_reply.dart';
|
||||
import '../services/notification_service.dart';
|
||||
import 'meshcore_connector_usb.dart';
|
||||
import 'meshcore_connector_tcp.dart';
|
||||
import '../storage/bookmark_store.dart';
|
||||
import '../storage/channel_message_store.dart';
|
||||
import '../storage/channel_order_store.dart';
|
||||
import '../storage/channel_settings_store.dart';
|
||||
@@ -517,6 +519,7 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
// batched here; see [CoalescedWrites].
|
||||
final CoalescedWrites _coalescedWrites = CoalescedWrites();
|
||||
final MessageStore _messageStore = MessageStore();
|
||||
final BookmarkStore _bookmarkStore = BookmarkStore();
|
||||
final ChannelOrderStore _channelOrderStore = ChannelOrderStore();
|
||||
final ChannelSettingsStore _channelSettingsStore = ChannelSettingsStore();
|
||||
final ChannelRegionStore _channelRegionStore = ChannelRegionStore();
|
||||
@@ -964,6 +967,66 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
return _conversations[contact.publicKeyHex] ?? [];
|
||||
}
|
||||
|
||||
Future<List<BookmarkedMessage>> loadBookmarkedMessages() =>
|
||||
_bookmarkStore.loadBookmarks();
|
||||
|
||||
Future<void> setBookmarkedMessage(
|
||||
BookmarkedMessage bookmark, {
|
||||
required bool isBookmarked,
|
||||
}) async {
|
||||
if (_bookmarkStore.publicKeyHex.isEmpty) return;
|
||||
if (isBookmarked) {
|
||||
await _bookmarkStore.saveBookmark(bookmark);
|
||||
} else {
|
||||
await _bookmarkStore.removeBookmark(bookmark);
|
||||
}
|
||||
|
||||
if (bookmark.sourceType == BookmarkSourceType.contact) {
|
||||
final messages = _conversations[bookmark.sourceId];
|
||||
final index = messages?.indexWhere(
|
||||
(message) => message.messageId == bookmark.messageId,
|
||||
);
|
||||
if (messages != null && index != null && index >= 0) {
|
||||
messages[index] = messages[index].copyWith(isBookmarked: isBookmarked);
|
||||
await _coalescedWrites.flush();
|
||||
await _messageStore.saveMessages(bookmark.sourceId, messages);
|
||||
}
|
||||
await _messageStore.updateBookmarkFlag(
|
||||
bookmark.sourceId,
|
||||
bookmark.messageId,
|
||||
isBookmarked,
|
||||
);
|
||||
} else {
|
||||
final mappedSlot = _slotForChannelId(bookmark.sourceId);
|
||||
final slot =
|
||||
mappedSlot ??
|
||||
(bookmark.sourceId.startsWith('slot:')
|
||||
? int.tryParse(bookmark.sourceId.substring(5))
|
||||
: null);
|
||||
if (slot != null) {
|
||||
final canonicalSlot = _canonicalSlot(slot);
|
||||
final messages = _channelMessages[canonicalSlot];
|
||||
final index = messages?.indexWhere(
|
||||
(message) => message.messageId == bookmark.messageId,
|
||||
);
|
||||
if (messages != null && index != null && index >= 0) {
|
||||
messages[index] = messages[index].copyWith(
|
||||
isBookmarked: isBookmarked,
|
||||
);
|
||||
await _saveChannelMessages(canonicalSlot, messages);
|
||||
}
|
||||
}
|
||||
if (!bookmark.sourceId.startsWith('slot:')) {
|
||||
await _channelMessageStore.updateBookmarkFlag(
|
||||
bookmark.sourceId,
|
||||
bookmark.messageId,
|
||||
isBookmarked,
|
||||
);
|
||||
}
|
||||
}
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<void> deleteMessage(Message message) async {
|
||||
final contactKeyHex = message.senderKeyHex;
|
||||
final messages = _conversations[contactKeyHex];
|
||||
@@ -9795,6 +9858,7 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
unawaited(_unreadStore.flush());
|
||||
_channelMessageStore.setPublicKeyHex = keyHex;
|
||||
_messageStore.setPublicKeyHex = keyHex;
|
||||
_bookmarkStore.setPublicKeyHex = keyHex;
|
||||
_channelOrderStore.setPublicKeyHex = keyHex;
|
||||
_channelSettingsStore.setPublicKeyHex = keyHex;
|
||||
_channelRegionStore.setPublicKeyHex = keyHex;
|
||||
|
||||
@@ -66,8 +66,9 @@ class MessageUrlImageHelper {
|
||||
static Future<String?> parse(
|
||||
String text, {
|
||||
String publicGateway = AppSettings.defaultPublicIpfsGateway,
|
||||
bool respectLoadSetting = true,
|
||||
}) async {
|
||||
if (!loadLinkImages.value) return null;
|
||||
if (respectLoadSetting && !loadLinkImages.value) return null;
|
||||
final trimmed = text.trim();
|
||||
if (trimmed.isEmpty) return null;
|
||||
|
||||
|
||||
@@ -229,6 +229,7 @@
|
||||
"backupRestore_contactsDescription": "Contacts, per-contact filters and settings, groups, and message history",
|
||||
"backupRestore_discoveredContacts": "Discovered Contacts",
|
||||
"backupRestore_discoveredContactsDescription": "Discovered contacts and their saved details",
|
||||
"backupRestore_bookmarks": "Bookmarks",
|
||||
"backupRestore_channels": "Channels",
|
||||
"backupRestore_channelsDescription": "Channels, channel filters, communities, and message history",
|
||||
"backupRestore_backup": "Create Backup",
|
||||
@@ -1128,6 +1129,14 @@
|
||||
},
|
||||
"chat_messageCopied": "Message copied",
|
||||
"chat_messageDeleted": "Message deleted",
|
||||
"chat_bookmark": "Bookmark",
|
||||
"chat_removeBookmark": "Remove bookmark",
|
||||
"chat_showBookmarks": "Show bookmarks",
|
||||
"bookmarks_title": "Bookmarks",
|
||||
"bookmarks_empty": "No bookmarked messages",
|
||||
"bookmarks_channel": "Channel",
|
||||
"bookmarks_contact": "Contact",
|
||||
"bookmarks_remove": "Remove bookmark",
|
||||
"chat_selectMessages": "Select messages",
|
||||
"chat_selectedCount": "{count} selected",
|
||||
"@chat_selectedCount": {
|
||||
@@ -3141,6 +3150,10 @@
|
||||
"notification_replyUnavailable": "This conversation is no longer on the connected radio.",
|
||||
"notification_replySendFailed": "Your reply may not have been sent. Check in MeshCore Open and try again.",
|
||||
"notification_replyAppNotRunning": "MeshCore Open isn't running. Open it and send your reply again.",
|
||||
"settings_exportBookmarks": "Export bookmarks to Markdown",
|
||||
"settings_exportBookmarksSubtitle": "Share or save bookmarked messages as a Markdown file.",
|
||||
"settings_exportBookmarksSuccess": "Bookmarks exported.",
|
||||
"settings_exportBookmarksNoBookmarks": "No bookmarks to export.",
|
||||
"settings_gpxExportRepeaters": "Export repeaters / room server to GPX",
|
||||
"settings_gpxExportRepeatersSubtitle": "Exports repeaters / roomserver with a location to GPX file.",
|
||||
"settings_gpxExportContacts": "Export companions to GPX",
|
||||
|
||||
@@ -1051,6 +1051,12 @@ abstract class AppLocalizations {
|
||||
/// **'Discovered contacts and their saved details'**
|
||||
String get backupRestore_discoveredContactsDescription;
|
||||
|
||||
/// No description provided for @backupRestore_bookmarks.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Bookmarks'**
|
||||
String get backupRestore_bookmarks;
|
||||
|
||||
/// No description provided for @backupRestore_channels.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
@@ -4039,6 +4045,54 @@ abstract class AppLocalizations {
|
||||
/// **'Message deleted'**
|
||||
String get chat_messageDeleted;
|
||||
|
||||
/// No description provided for @chat_bookmark.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Bookmark'**
|
||||
String get chat_bookmark;
|
||||
|
||||
/// No description provided for @chat_removeBookmark.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Remove bookmark'**
|
||||
String get chat_removeBookmark;
|
||||
|
||||
/// No description provided for @chat_showBookmarks.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Show bookmarks'**
|
||||
String get chat_showBookmarks;
|
||||
|
||||
/// No description provided for @bookmarks_title.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Bookmarks'**
|
||||
String get bookmarks_title;
|
||||
|
||||
/// No description provided for @bookmarks_empty.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'No bookmarked messages'**
|
||||
String get bookmarks_empty;
|
||||
|
||||
/// No description provided for @bookmarks_channel.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Channel'**
|
||||
String get bookmarks_channel;
|
||||
|
||||
/// No description provided for @bookmarks_contact.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Contact'**
|
||||
String get bookmarks_contact;
|
||||
|
||||
/// No description provided for @bookmarks_remove.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Remove bookmark'**
|
||||
String get bookmarks_remove;
|
||||
|
||||
/// No description provided for @chat_selectMessages.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
@@ -9497,6 +9551,30 @@ abstract class AppLocalizations {
|
||||
/// **'MeshCore Open isn\'t running. Open it and send your reply again.'**
|
||||
String get notification_replyAppNotRunning;
|
||||
|
||||
/// No description provided for @settings_exportBookmarks.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Export bookmarks to Markdown'**
|
||||
String get settings_exportBookmarks;
|
||||
|
||||
/// No description provided for @settings_exportBookmarksSubtitle.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Share or save bookmarked messages as a Markdown file.'**
|
||||
String get settings_exportBookmarksSubtitle;
|
||||
|
||||
/// No description provided for @settings_exportBookmarksSuccess.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Bookmarks exported.'**
|
||||
String get settings_exportBookmarksSuccess;
|
||||
|
||||
/// No description provided for @settings_exportBookmarksNoBookmarks.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'No bookmarks to export.'**
|
||||
String get settings_exportBookmarksNoBookmarks;
|
||||
|
||||
/// No description provided for @settings_gpxExportRepeaters.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
|
||||
@@ -529,6 +529,9 @@ class AppLocalizationsBg extends AppLocalizations {
|
||||
String get backupRestore_discoveredContactsDescription =>
|
||||
'Открити контакти и запазените им данни';
|
||||
|
||||
@override
|
||||
String get backupRestore_bookmarks => 'Bookmarks';
|
||||
|
||||
@override
|
||||
String get backupRestore_channels => 'Канали';
|
||||
|
||||
@@ -2280,6 +2283,30 @@ class AppLocalizationsBg extends AppLocalizations {
|
||||
@override
|
||||
String get chat_messageDeleted => 'Съобщението е изтрито';
|
||||
|
||||
@override
|
||||
String get chat_bookmark => 'Bookmark';
|
||||
|
||||
@override
|
||||
String get chat_removeBookmark => 'Remove bookmark';
|
||||
|
||||
@override
|
||||
String get chat_showBookmarks => 'Show bookmarks';
|
||||
|
||||
@override
|
||||
String get bookmarks_title => 'Bookmarks';
|
||||
|
||||
@override
|
||||
String get bookmarks_empty => 'No bookmarked messages';
|
||||
|
||||
@override
|
||||
String get bookmarks_channel => 'Channel';
|
||||
|
||||
@override
|
||||
String get bookmarks_contact => 'Contact';
|
||||
|
||||
@override
|
||||
String get bookmarks_remove => 'Remove bookmark';
|
||||
|
||||
@override
|
||||
String get chat_selectMessages => 'Избор на съобщения';
|
||||
|
||||
@@ -5590,6 +5617,19 @@ class AppLocalizationsBg extends AppLocalizations {
|
||||
String get notification_replyAppNotRunning =>
|
||||
'MeshCore Open не работи. Отворете го и изпратете отговора си повторно.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarks => 'Export bookmarks to Markdown';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksSubtitle =>
|
||||
'Share or save bookmarked messages as a Markdown file.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksSuccess => 'Bookmarks exported.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksNoBookmarks => 'No bookmarks to export.';
|
||||
|
||||
@override
|
||||
String get settings_gpxExportRepeaters =>
|
||||
'Експортиране на повтарящи се устройства / сървър на стаята до GPX';
|
||||
|
||||
@@ -524,6 +524,9 @@ class AppLocalizationsCs extends AppLocalizations {
|
||||
String get backupRestore_discoveredContactsDescription =>
|
||||
'Objevené kontakty a jejich uložené údaje';
|
||||
|
||||
@override
|
||||
String get backupRestore_bookmarks => 'Bookmarks';
|
||||
|
||||
@override
|
||||
String get backupRestore_channels => 'Kanály';
|
||||
|
||||
@@ -2264,6 +2267,30 @@ class AppLocalizationsCs extends AppLocalizations {
|
||||
@override
|
||||
String get chat_messageDeleted => 'Zpráva smazána';
|
||||
|
||||
@override
|
||||
String get chat_bookmark => 'Bookmark';
|
||||
|
||||
@override
|
||||
String get chat_removeBookmark => 'Remove bookmark';
|
||||
|
||||
@override
|
||||
String get chat_showBookmarks => 'Show bookmarks';
|
||||
|
||||
@override
|
||||
String get bookmarks_title => 'Bookmarks';
|
||||
|
||||
@override
|
||||
String get bookmarks_empty => 'No bookmarked messages';
|
||||
|
||||
@override
|
||||
String get bookmarks_channel => 'Channel';
|
||||
|
||||
@override
|
||||
String get bookmarks_contact => 'Contact';
|
||||
|
||||
@override
|
||||
String get bookmarks_remove => 'Remove bookmark';
|
||||
|
||||
@override
|
||||
String get chat_selectMessages => 'Vybrat zprávy';
|
||||
|
||||
@@ -5569,6 +5596,19 @@ class AppLocalizationsCs extends AppLocalizations {
|
||||
String get notification_replyAppNotRunning =>
|
||||
'MeshCore Open neběží. Otevřete ji a odešlete odpověď znovu.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarks => 'Export bookmarks to Markdown';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksSubtitle =>
|
||||
'Share or save bookmarked messages as a Markdown file.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksSuccess => 'Bookmarks exported.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksNoBookmarks => 'No bookmarks to export.';
|
||||
|
||||
@override
|
||||
String get settings_gpxExportRepeaters =>
|
||||
'Exportovat opakovače / room servery do GPX';
|
||||
|
||||
@@ -531,6 +531,9 @@ class AppLocalizationsDe extends AppLocalizations {
|
||||
String get backupRestore_discoveredContactsDescription =>
|
||||
'Entdeckte Kontakte und ihre gespeicherten Details';
|
||||
|
||||
@override
|
||||
String get backupRestore_bookmarks => 'Bookmarks';
|
||||
|
||||
@override
|
||||
String get backupRestore_channels => 'Kanäle';
|
||||
|
||||
@@ -2284,6 +2287,30 @@ class AppLocalizationsDe extends AppLocalizations {
|
||||
@override
|
||||
String get chat_messageDeleted => 'Nachricht gelöscht';
|
||||
|
||||
@override
|
||||
String get chat_bookmark => 'Bookmark';
|
||||
|
||||
@override
|
||||
String get chat_removeBookmark => 'Remove bookmark';
|
||||
|
||||
@override
|
||||
String get chat_showBookmarks => 'Show bookmarks';
|
||||
|
||||
@override
|
||||
String get bookmarks_title => 'Bookmarks';
|
||||
|
||||
@override
|
||||
String get bookmarks_empty => 'No bookmarked messages';
|
||||
|
||||
@override
|
||||
String get bookmarks_channel => 'Channel';
|
||||
|
||||
@override
|
||||
String get bookmarks_contact => 'Contact';
|
||||
|
||||
@override
|
||||
String get bookmarks_remove => 'Remove bookmark';
|
||||
|
||||
@override
|
||||
String get chat_selectMessages => 'Nachrichten auswählen';
|
||||
|
||||
@@ -5604,6 +5631,19 @@ class AppLocalizationsDe extends AppLocalizations {
|
||||
String get notification_replyAppNotRunning =>
|
||||
'MeshCore Open wird nicht ausgeführt. Öffnen Sie die App und senden Sie Ihre Antwort erneut.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarks => 'Export bookmarks to Markdown';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksSubtitle =>
|
||||
'Share or save bookmarked messages as a Markdown file.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksSuccess => 'Bookmarks exported.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksNoBookmarks => 'No bookmarks to export.';
|
||||
|
||||
@override
|
||||
String get settings_gpxExportRepeaters =>
|
||||
'Repeater und Raumserver als GPX exportieren';
|
||||
|
||||
@@ -520,6 +520,9 @@ class AppLocalizationsEn extends AppLocalizations {
|
||||
String get backupRestore_discoveredContactsDescription =>
|
||||
'Discovered contacts and their saved details';
|
||||
|
||||
@override
|
||||
String get backupRestore_bookmarks => 'Bookmarks';
|
||||
|
||||
@override
|
||||
String get backupRestore_channels => 'Channels';
|
||||
|
||||
@@ -2239,6 +2242,30 @@ class AppLocalizationsEn extends AppLocalizations {
|
||||
@override
|
||||
String get chat_messageDeleted => 'Message deleted';
|
||||
|
||||
@override
|
||||
String get chat_bookmark => 'Bookmark';
|
||||
|
||||
@override
|
||||
String get chat_removeBookmark => 'Remove bookmark';
|
||||
|
||||
@override
|
||||
String get chat_showBookmarks => 'Show bookmarks';
|
||||
|
||||
@override
|
||||
String get bookmarks_title => 'Bookmarks';
|
||||
|
||||
@override
|
||||
String get bookmarks_empty => 'No bookmarked messages';
|
||||
|
||||
@override
|
||||
String get bookmarks_channel => 'Channel';
|
||||
|
||||
@override
|
||||
String get bookmarks_contact => 'Contact';
|
||||
|
||||
@override
|
||||
String get bookmarks_remove => 'Remove bookmark';
|
||||
|
||||
@override
|
||||
String get chat_selectMessages => 'Select messages';
|
||||
|
||||
@@ -5515,6 +5542,19 @@ class AppLocalizationsEn extends AppLocalizations {
|
||||
String get notification_replyAppNotRunning =>
|
||||
'MeshCore Open isn\'t running. Open it and send your reply again.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarks => 'Export bookmarks to Markdown';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksSubtitle =>
|
||||
'Share or save bookmarked messages as a Markdown file.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksSuccess => 'Bookmarks exported.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksNoBookmarks => 'No bookmarks to export.';
|
||||
|
||||
@override
|
||||
String get settings_gpxExportRepeaters =>
|
||||
'Export repeaters / room server to GPX';
|
||||
|
||||
@@ -529,6 +529,9 @@ class AppLocalizationsEs extends AppLocalizations {
|
||||
String get backupRestore_discoveredContactsDescription =>
|
||||
'Contactos descubiertos y sus detalles guardados';
|
||||
|
||||
@override
|
||||
String get backupRestore_bookmarks => 'Bookmarks';
|
||||
|
||||
@override
|
||||
String get backupRestore_channels => 'Canales';
|
||||
|
||||
@@ -2274,6 +2277,30 @@ class AppLocalizationsEs extends AppLocalizations {
|
||||
@override
|
||||
String get chat_messageDeleted => 'Mensaje borrado';
|
||||
|
||||
@override
|
||||
String get chat_bookmark => 'Bookmark';
|
||||
|
||||
@override
|
||||
String get chat_removeBookmark => 'Remove bookmark';
|
||||
|
||||
@override
|
||||
String get chat_showBookmarks => 'Show bookmarks';
|
||||
|
||||
@override
|
||||
String get bookmarks_title => 'Bookmarks';
|
||||
|
||||
@override
|
||||
String get bookmarks_empty => 'No bookmarked messages';
|
||||
|
||||
@override
|
||||
String get bookmarks_channel => 'Channel';
|
||||
|
||||
@override
|
||||
String get bookmarks_contact => 'Contact';
|
||||
|
||||
@override
|
||||
String get bookmarks_remove => 'Remove bookmark';
|
||||
|
||||
@override
|
||||
String get chat_selectMessages => 'Seleccionar mensajes';
|
||||
|
||||
@@ -5588,6 +5615,19 @@ class AppLocalizationsEs extends AppLocalizations {
|
||||
String get notification_replyAppNotRunning =>
|
||||
'MeshCore Open no está en ejecución. Ábrelo y envía tu respuesta de nuevo.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarks => 'Export bookmarks to Markdown';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksSubtitle =>
|
||||
'Share or save bookmarked messages as a Markdown file.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksSuccess => 'Bookmarks exported.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksNoBookmarks => 'No bookmarks to export.';
|
||||
|
||||
@override
|
||||
String get settings_gpxExportRepeaters =>
|
||||
'Exportar repetidores / servidores de sala a GPX';
|
||||
|
||||
@@ -529,6 +529,9 @@ class AppLocalizationsFr extends AppLocalizations {
|
||||
String get backupRestore_discoveredContactsDescription =>
|
||||
'Contacts découverts et leurs détails enregistrés';
|
||||
|
||||
@override
|
||||
String get backupRestore_bookmarks => 'Bookmarks';
|
||||
|
||||
@override
|
||||
String get backupRestore_channels => 'Canaux';
|
||||
|
||||
@@ -2279,6 +2282,30 @@ class AppLocalizationsFr extends AppLocalizations {
|
||||
@override
|
||||
String get chat_messageDeleted => 'Message supprimé';
|
||||
|
||||
@override
|
||||
String get chat_bookmark => 'Bookmark';
|
||||
|
||||
@override
|
||||
String get chat_removeBookmark => 'Remove bookmark';
|
||||
|
||||
@override
|
||||
String get chat_showBookmarks => 'Show bookmarks';
|
||||
|
||||
@override
|
||||
String get bookmarks_title => 'Bookmarks';
|
||||
|
||||
@override
|
||||
String get bookmarks_empty => 'No bookmarked messages';
|
||||
|
||||
@override
|
||||
String get bookmarks_channel => 'Channel';
|
||||
|
||||
@override
|
||||
String get bookmarks_contact => 'Contact';
|
||||
|
||||
@override
|
||||
String get bookmarks_remove => 'Remove bookmark';
|
||||
|
||||
@override
|
||||
String get chat_selectMessages => 'Sélectionner des messages';
|
||||
|
||||
@@ -5606,6 +5633,19 @@ class AppLocalizationsFr extends AppLocalizations {
|
||||
String get notification_replyAppNotRunning =>
|
||||
'MeshCore Open n\'est pas actif. Ouvrez l\'application et renvoyez votre réponse.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarks => 'Export bookmarks to Markdown';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksSubtitle =>
|
||||
'Share or save bookmarked messages as a Markdown file.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksSuccess => 'Bookmarks exported.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksNoBookmarks => 'No bookmarks to export.';
|
||||
|
||||
@override
|
||||
String get settings_gpxExportRepeaters =>
|
||||
'Exporter les répéteurs / room servers au format GPX';
|
||||
|
||||
@@ -524,6 +524,9 @@ class AppLocalizationsHu extends AppLocalizations {
|
||||
String get backupRestore_discoveredContactsDescription =>
|
||||
'Felfedezett névjegyek és mentett adataik';
|
||||
|
||||
@override
|
||||
String get backupRestore_bookmarks => 'Bookmarks';
|
||||
|
||||
@override
|
||||
String get backupRestore_channels => 'Csatornák';
|
||||
|
||||
@@ -2272,6 +2275,30 @@ class AppLocalizationsHu extends AppLocalizations {
|
||||
@override
|
||||
String get chat_messageDeleted => 'Üzenet törölve';
|
||||
|
||||
@override
|
||||
String get chat_bookmark => 'Bookmark';
|
||||
|
||||
@override
|
||||
String get chat_removeBookmark => 'Remove bookmark';
|
||||
|
||||
@override
|
||||
String get chat_showBookmarks => 'Show bookmarks';
|
||||
|
||||
@override
|
||||
String get bookmarks_title => 'Bookmarks';
|
||||
|
||||
@override
|
||||
String get bookmarks_empty => 'No bookmarked messages';
|
||||
|
||||
@override
|
||||
String get bookmarks_channel => 'Channel';
|
||||
|
||||
@override
|
||||
String get bookmarks_contact => 'Contact';
|
||||
|
||||
@override
|
||||
String get bookmarks_remove => 'Remove bookmark';
|
||||
|
||||
@override
|
||||
String get chat_selectMessages => 'Üzenetek kijelölése';
|
||||
|
||||
@@ -5591,6 +5618,19 @@ class AppLocalizationsHu extends AppLocalizations {
|
||||
String get notification_replyAppNotRunning =>
|
||||
'A MeshCore Open nem fut. Nyissa meg, és küldje el a választ újra.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarks => 'Export bookmarks to Markdown';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksSubtitle =>
|
||||
'Share or save bookmarked messages as a Markdown file.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksSuccess => 'Bookmarks exported.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksNoBookmarks => 'No bookmarks to export.';
|
||||
|
||||
@override
|
||||
String get settings_gpxExportRepeaters =>
|
||||
'Ismétlők / szobaszerver exportálása GPX-be';
|
||||
|
||||
@@ -529,6 +529,9 @@ class AppLocalizationsIt extends AppLocalizations {
|
||||
String get backupRestore_discoveredContactsDescription =>
|
||||
'Contatti scoperti e relativi dettagli salvati';
|
||||
|
||||
@override
|
||||
String get backupRestore_bookmarks => 'Bookmarks';
|
||||
|
||||
@override
|
||||
String get backupRestore_channels => 'Canali';
|
||||
|
||||
@@ -2276,6 +2279,30 @@ class AppLocalizationsIt extends AppLocalizations {
|
||||
@override
|
||||
String get chat_messageDeleted => 'Messaggio eliminato';
|
||||
|
||||
@override
|
||||
String get chat_bookmark => 'Bookmark';
|
||||
|
||||
@override
|
||||
String get chat_removeBookmark => 'Remove bookmark';
|
||||
|
||||
@override
|
||||
String get chat_showBookmarks => 'Show bookmarks';
|
||||
|
||||
@override
|
||||
String get bookmarks_title => 'Bookmarks';
|
||||
|
||||
@override
|
||||
String get bookmarks_empty => 'No bookmarked messages';
|
||||
|
||||
@override
|
||||
String get bookmarks_channel => 'Channel';
|
||||
|
||||
@override
|
||||
String get bookmarks_contact => 'Contact';
|
||||
|
||||
@override
|
||||
String get bookmarks_remove => 'Remove bookmark';
|
||||
|
||||
@override
|
||||
String get chat_selectMessages => 'Seleziona messaggi';
|
||||
|
||||
@@ -5593,6 +5620,19 @@ class AppLocalizationsIt extends AppLocalizations {
|
||||
String get notification_replyAppNotRunning =>
|
||||
'MeshCore Open non è in esecuzione. Aprila e invia di nuovo la risposta.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarks => 'Export bookmarks to Markdown';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksSubtitle =>
|
||||
'Share or save bookmarked messages as a Markdown file.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksSuccess => 'Bookmarks exported.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksNoBookmarks => 'No bookmarks to export.';
|
||||
|
||||
@override
|
||||
String get settings_gpxExportRepeaters =>
|
||||
'Esporta ripetitori / server di stanza in GPX';
|
||||
|
||||
@@ -504,6 +504,9 @@ class AppLocalizationsJa extends AppLocalizations {
|
||||
@override
|
||||
String get backupRestore_discoveredContactsDescription => '検出された連絡先と保存済みの詳細';
|
||||
|
||||
@override
|
||||
String get backupRestore_bookmarks => 'Bookmarks';
|
||||
|
||||
@override
|
||||
String get backupRestore_channels => 'チャンネル';
|
||||
|
||||
@@ -2166,6 +2169,30 @@ class AppLocalizationsJa extends AppLocalizations {
|
||||
@override
|
||||
String get chat_messageDeleted => 'メッセージは削除されました';
|
||||
|
||||
@override
|
||||
String get chat_bookmark => 'Bookmark';
|
||||
|
||||
@override
|
||||
String get chat_removeBookmark => 'Remove bookmark';
|
||||
|
||||
@override
|
||||
String get chat_showBookmarks => 'Show bookmarks';
|
||||
|
||||
@override
|
||||
String get bookmarks_title => 'Bookmarks';
|
||||
|
||||
@override
|
||||
String get bookmarks_empty => 'No bookmarked messages';
|
||||
|
||||
@override
|
||||
String get bookmarks_channel => 'Channel';
|
||||
|
||||
@override
|
||||
String get bookmarks_contact => 'Contact';
|
||||
|
||||
@override
|
||||
String get bookmarks_remove => 'Remove bookmark';
|
||||
|
||||
@override
|
||||
String get chat_selectMessages => 'メッセージを選択';
|
||||
|
||||
@@ -5322,6 +5349,19 @@ class AppLocalizationsJa extends AppLocalizations {
|
||||
String get notification_replyAppNotRunning =>
|
||||
'MeshCore Open が起動していません。起動してから、もう一度返信を送信してください。';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarks => 'Export bookmarks to Markdown';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksSubtitle =>
|
||||
'Share or save bookmarked messages as a Markdown file.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksSuccess => 'Bookmarks exported.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksNoBookmarks => 'No bookmarks to export.';
|
||||
|
||||
@override
|
||||
String get settings_gpxExportRepeaters => 'GPX へのエクスポート用リピータ/ルームサーバー';
|
||||
|
||||
|
||||
@@ -505,6 +505,9 @@ class AppLocalizationsKo extends AppLocalizations {
|
||||
String get backupRestore_discoveredContactsDescription =>
|
||||
'발견된 연락처와 저장된 세부 정보';
|
||||
|
||||
@override
|
||||
String get backupRestore_bookmarks => 'Bookmarks';
|
||||
|
||||
@override
|
||||
String get backupRestore_channels => '채널';
|
||||
|
||||
@@ -2170,6 +2173,30 @@ class AppLocalizationsKo extends AppLocalizations {
|
||||
@override
|
||||
String get chat_messageDeleted => '메시지가 삭제되었습니다.';
|
||||
|
||||
@override
|
||||
String get chat_bookmark => 'Bookmark';
|
||||
|
||||
@override
|
||||
String get chat_removeBookmark => 'Remove bookmark';
|
||||
|
||||
@override
|
||||
String get chat_showBookmarks => 'Show bookmarks';
|
||||
|
||||
@override
|
||||
String get bookmarks_title => 'Bookmarks';
|
||||
|
||||
@override
|
||||
String get bookmarks_empty => 'No bookmarked messages';
|
||||
|
||||
@override
|
||||
String get bookmarks_channel => 'Channel';
|
||||
|
||||
@override
|
||||
String get bookmarks_contact => 'Contact';
|
||||
|
||||
@override
|
||||
String get bookmarks_remove => 'Remove bookmark';
|
||||
|
||||
@override
|
||||
String get chat_selectMessages => '메시지 선택';
|
||||
|
||||
@@ -5338,6 +5365,19 @@ class AppLocalizationsKo extends AppLocalizations {
|
||||
String get notification_replyAppNotRunning =>
|
||||
'MeshCore Open이 실행 중이 아닙니다. 앱을 연 뒤 답장을 다시 보내세요.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarks => 'Export bookmarks to Markdown';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksSubtitle =>
|
||||
'Share or save bookmarked messages as a Markdown file.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksSuccess => 'Bookmarks exported.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksNoBookmarks => 'No bookmarks to export.';
|
||||
|
||||
@override
|
||||
String get settings_gpxExportRepeaters => 'GPX로 전송/방 관리 서버';
|
||||
|
||||
|
||||
@@ -525,6 +525,9 @@ class AppLocalizationsNl extends AppLocalizations {
|
||||
String get backupRestore_discoveredContactsDescription =>
|
||||
'Ontdekte contacten en hun opgeslagen gegevens';
|
||||
|
||||
@override
|
||||
String get backupRestore_bookmarks => 'Bookmarks';
|
||||
|
||||
@override
|
||||
String get backupRestore_channels => 'Kanalen';
|
||||
|
||||
@@ -2263,6 +2266,30 @@ class AppLocalizationsNl extends AppLocalizations {
|
||||
@override
|
||||
String get chat_messageDeleted => 'Bericht verwijderd';
|
||||
|
||||
@override
|
||||
String get chat_bookmark => 'Bookmark';
|
||||
|
||||
@override
|
||||
String get chat_removeBookmark => 'Remove bookmark';
|
||||
|
||||
@override
|
||||
String get chat_showBookmarks => 'Show bookmarks';
|
||||
|
||||
@override
|
||||
String get bookmarks_title => 'Bookmarks';
|
||||
|
||||
@override
|
||||
String get bookmarks_empty => 'No bookmarked messages';
|
||||
|
||||
@override
|
||||
String get bookmarks_channel => 'Channel';
|
||||
|
||||
@override
|
||||
String get bookmarks_contact => 'Contact';
|
||||
|
||||
@override
|
||||
String get bookmarks_remove => 'Remove bookmark';
|
||||
|
||||
@override
|
||||
String get chat_selectMessages => 'Berichten selecteren';
|
||||
|
||||
@@ -5565,6 +5592,19 @@ class AppLocalizationsNl extends AppLocalizations {
|
||||
String get notification_replyAppNotRunning =>
|
||||
'MeshCore Open is niet actief. Open de app en verzend je antwoord opnieuw.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarks => 'Export bookmarks to Markdown';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksSubtitle =>
|
||||
'Share or save bookmarked messages as a Markdown file.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksSuccess => 'Bookmarks exported.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksNoBookmarks => 'No bookmarks to export.';
|
||||
|
||||
@override
|
||||
String get settings_gpxExportRepeaters =>
|
||||
'Exporteer repeaters / roomserver naar GPX';
|
||||
|
||||
@@ -532,6 +532,9 @@ class AppLocalizationsPl extends AppLocalizations {
|
||||
String get backupRestore_discoveredContactsDescription =>
|
||||
'Wykryte kontakty i ich zapisane dane';
|
||||
|
||||
@override
|
||||
String get backupRestore_bookmarks => 'Bookmarks';
|
||||
|
||||
@override
|
||||
String get backupRestore_channels => 'Kanały';
|
||||
|
||||
@@ -2292,6 +2295,30 @@ class AppLocalizationsPl extends AppLocalizations {
|
||||
@override
|
||||
String get chat_messageDeleted => 'Wiadomość usunięta';
|
||||
|
||||
@override
|
||||
String get chat_bookmark => 'Bookmark';
|
||||
|
||||
@override
|
||||
String get chat_removeBookmark => 'Remove bookmark';
|
||||
|
||||
@override
|
||||
String get chat_showBookmarks => 'Show bookmarks';
|
||||
|
||||
@override
|
||||
String get bookmarks_title => 'Bookmarks';
|
||||
|
||||
@override
|
||||
String get bookmarks_empty => 'No bookmarked messages';
|
||||
|
||||
@override
|
||||
String get bookmarks_channel => 'Channel';
|
||||
|
||||
@override
|
||||
String get bookmarks_contact => 'Contact';
|
||||
|
||||
@override
|
||||
String get bookmarks_remove => 'Remove bookmark';
|
||||
|
||||
@override
|
||||
String get chat_selectMessages => 'Wybierz wiadomości';
|
||||
|
||||
@@ -5629,6 +5656,19 @@ class AppLocalizationsPl extends AppLocalizations {
|
||||
String get notification_replyAppNotRunning =>
|
||||
'MeshCore Open nie jest uruchomiony. Otwórz go i wyślij odpowiedź jeszcze raz.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarks => 'Export bookmarks to Markdown';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksSubtitle =>
|
||||
'Share or save bookmarked messages as a Markdown file.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksSuccess => 'Bookmarks exported.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksNoBookmarks => 'No bookmarks to export.';
|
||||
|
||||
@override
|
||||
String get settings_gpxExportRepeaters =>
|
||||
'Eksportuj przekaźniki / roomservery do GPX';
|
||||
|
||||
@@ -530,6 +530,9 @@ class AppLocalizationsPt extends AppLocalizations {
|
||||
String get backupRestore_discoveredContactsDescription =>
|
||||
'Contatos descobertos e seus detalhes salvos';
|
||||
|
||||
@override
|
||||
String get backupRestore_bookmarks => 'Bookmarks';
|
||||
|
||||
@override
|
||||
String get backupRestore_channels => 'Canais';
|
||||
|
||||
@@ -2273,6 +2276,30 @@ class AppLocalizationsPt extends AppLocalizations {
|
||||
@override
|
||||
String get chat_messageDeleted => 'Mensagem excluída';
|
||||
|
||||
@override
|
||||
String get chat_bookmark => 'Bookmark';
|
||||
|
||||
@override
|
||||
String get chat_removeBookmark => 'Remove bookmark';
|
||||
|
||||
@override
|
||||
String get chat_showBookmarks => 'Show bookmarks';
|
||||
|
||||
@override
|
||||
String get bookmarks_title => 'Bookmarks';
|
||||
|
||||
@override
|
||||
String get bookmarks_empty => 'No bookmarked messages';
|
||||
|
||||
@override
|
||||
String get bookmarks_channel => 'Channel';
|
||||
|
||||
@override
|
||||
String get bookmarks_contact => 'Contact';
|
||||
|
||||
@override
|
||||
String get bookmarks_remove => 'Remove bookmark';
|
||||
|
||||
@override
|
||||
String get chat_selectMessages => 'Selecionar mensagens';
|
||||
|
||||
@@ -5587,6 +5614,19 @@ class AppLocalizationsPt extends AppLocalizations {
|
||||
String get notification_replyAppNotRunning =>
|
||||
'O MeshCore Open não está em execução. Abra-o e envie a sua resposta novamente.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarks => 'Export bookmarks to Markdown';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksSubtitle =>
|
||||
'Share or save bookmarked messages as a Markdown file.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksSuccess => 'Bookmarks exported.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksNoBookmarks => 'No bookmarks to export.';
|
||||
|
||||
@override
|
||||
String get settings_gpxExportRepeaters =>
|
||||
'Exportar repetidores / servidor de sala para GPX';
|
||||
|
||||
@@ -527,6 +527,9 @@ class AppLocalizationsRu extends AppLocalizations {
|
||||
String get backupRestore_discoveredContactsDescription =>
|
||||
'Обнаруженные контакты и их сохранённые данные';
|
||||
|
||||
@override
|
||||
String get backupRestore_bookmarks => 'Bookmarks';
|
||||
|
||||
@override
|
||||
String get backupRestore_channels => 'Каналы';
|
||||
|
||||
@@ -2273,6 +2276,30 @@ class AppLocalizationsRu extends AppLocalizations {
|
||||
@override
|
||||
String get chat_messageDeleted => 'Сообщение удалено';
|
||||
|
||||
@override
|
||||
String get chat_bookmark => 'Bookmark';
|
||||
|
||||
@override
|
||||
String get chat_removeBookmark => 'Remove bookmark';
|
||||
|
||||
@override
|
||||
String get chat_showBookmarks => 'Show bookmarks';
|
||||
|
||||
@override
|
||||
String get bookmarks_title => 'Bookmarks';
|
||||
|
||||
@override
|
||||
String get bookmarks_empty => 'No bookmarked messages';
|
||||
|
||||
@override
|
||||
String get bookmarks_channel => 'Channel';
|
||||
|
||||
@override
|
||||
String get bookmarks_contact => 'Contact';
|
||||
|
||||
@override
|
||||
String get bookmarks_remove => 'Remove bookmark';
|
||||
|
||||
@override
|
||||
String get chat_selectMessages => 'Выбрать сообщения';
|
||||
|
||||
@@ -5606,6 +5633,19 @@ class AppLocalizationsRu extends AppLocalizations {
|
||||
String get notification_replyAppNotRunning =>
|
||||
'MeshCore Open не запущен. Откройте его и отправьте ответ снова.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarks => 'Export bookmarks to Markdown';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksSubtitle =>
|
||||
'Share or save bookmarked messages as a Markdown file.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksSuccess => 'Bookmarks exported.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksNoBookmarks => 'No bookmarks to export.';
|
||||
|
||||
@override
|
||||
String get settings_gpxExportRepeaters =>
|
||||
'Экспортировать рипитеры / сервер комнаты в GPX';
|
||||
|
||||
@@ -528,6 +528,9 @@ class AppLocalizationsSk extends AppLocalizations {
|
||||
String get backupRestore_discoveredContactsDescription =>
|
||||
'Objavené kontakty a ich uložené údaje';
|
||||
|
||||
@override
|
||||
String get backupRestore_bookmarks => 'Bookmarks';
|
||||
|
||||
@override
|
||||
String get backupRestore_channels => 'Kanály';
|
||||
|
||||
@@ -2266,6 +2269,30 @@ class AppLocalizationsSk extends AppLocalizations {
|
||||
@override
|
||||
String get chat_messageDeleted => 'Správa odstránená';
|
||||
|
||||
@override
|
||||
String get chat_bookmark => 'Bookmark';
|
||||
|
||||
@override
|
||||
String get chat_removeBookmark => 'Remove bookmark';
|
||||
|
||||
@override
|
||||
String get chat_showBookmarks => 'Show bookmarks';
|
||||
|
||||
@override
|
||||
String get bookmarks_title => 'Bookmarks';
|
||||
|
||||
@override
|
||||
String get bookmarks_empty => 'No bookmarked messages';
|
||||
|
||||
@override
|
||||
String get bookmarks_channel => 'Channel';
|
||||
|
||||
@override
|
||||
String get bookmarks_contact => 'Contact';
|
||||
|
||||
@override
|
||||
String get bookmarks_remove => 'Remove bookmark';
|
||||
|
||||
@override
|
||||
String get chat_selectMessages => 'Vybrať správy';
|
||||
|
||||
@@ -5585,6 +5612,19 @@ class AppLocalizationsSk extends AppLocalizations {
|
||||
String get notification_replyAppNotRunning =>
|
||||
'MeshCore Open nebeží. Otvorte ho a odošlite odpoveď ešte raz.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarks => 'Export bookmarks to Markdown';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksSubtitle =>
|
||||
'Share or save bookmarked messages as a Markdown file.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksSuccess => 'Bookmarks exported.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksNoBookmarks => 'No bookmarks to export.';
|
||||
|
||||
@override
|
||||
String get settings_gpxExportRepeaters =>
|
||||
'Exportovať repeater / server miestnosti do GPX';
|
||||
|
||||
@@ -526,6 +526,9 @@ class AppLocalizationsSl extends AppLocalizations {
|
||||
String get backupRestore_discoveredContactsDescription =>
|
||||
'Odkriti kontakti in njihovi shranjeni podatki';
|
||||
|
||||
@override
|
||||
String get backupRestore_bookmarks => 'Bookmarks';
|
||||
|
||||
@override
|
||||
String get backupRestore_channels => 'Kanali';
|
||||
|
||||
@@ -2266,6 +2269,30 @@ class AppLocalizationsSl extends AppLocalizations {
|
||||
@override
|
||||
String get chat_messageDeleted => 'Sporočilo izbrisano';
|
||||
|
||||
@override
|
||||
String get chat_bookmark => 'Bookmark';
|
||||
|
||||
@override
|
||||
String get chat_removeBookmark => 'Remove bookmark';
|
||||
|
||||
@override
|
||||
String get chat_showBookmarks => 'Show bookmarks';
|
||||
|
||||
@override
|
||||
String get bookmarks_title => 'Bookmarks';
|
||||
|
||||
@override
|
||||
String get bookmarks_empty => 'No bookmarked messages';
|
||||
|
||||
@override
|
||||
String get bookmarks_channel => 'Channel';
|
||||
|
||||
@override
|
||||
String get bookmarks_contact => 'Contact';
|
||||
|
||||
@override
|
||||
String get bookmarks_remove => 'Remove bookmark';
|
||||
|
||||
@override
|
||||
String get chat_selectMessages => 'Izberi sporočila';
|
||||
|
||||
@@ -5575,6 +5602,19 @@ class AppLocalizationsSl extends AppLocalizations {
|
||||
String get notification_replyAppNotRunning =>
|
||||
'MeshCore Open ne teče. Odprite ga in ponovno pošite odgovor.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarks => 'Export bookmarks to Markdown';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksSubtitle =>
|
||||
'Share or save bookmarked messages as a Markdown file.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksSuccess => 'Bookmarks exported.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksNoBookmarks => 'No bookmarks to export.';
|
||||
|
||||
@override
|
||||
String get settings_gpxExportRepeaters =>
|
||||
'Izvoz ponoviteljev / strežnika sobe v GPX';
|
||||
|
||||
@@ -526,6 +526,9 @@ class AppLocalizationsSv extends AppLocalizations {
|
||||
String get backupRestore_discoveredContactsDescription =>
|
||||
'Upptäckta kontakter och deras sparade uppgifter';
|
||||
|
||||
@override
|
||||
String get backupRestore_bookmarks => 'Bookmarks';
|
||||
|
||||
@override
|
||||
String get backupRestore_channels => 'Kanaler';
|
||||
|
||||
@@ -2252,6 +2255,30 @@ class AppLocalizationsSv extends AppLocalizations {
|
||||
@override
|
||||
String get chat_messageDeleted => 'Meddelandet raderat';
|
||||
|
||||
@override
|
||||
String get chat_bookmark => 'Bookmark';
|
||||
|
||||
@override
|
||||
String get chat_removeBookmark => 'Remove bookmark';
|
||||
|
||||
@override
|
||||
String get chat_showBookmarks => 'Show bookmarks';
|
||||
|
||||
@override
|
||||
String get bookmarks_title => 'Bookmarks';
|
||||
|
||||
@override
|
||||
String get bookmarks_empty => 'No bookmarked messages';
|
||||
|
||||
@override
|
||||
String get bookmarks_channel => 'Channel';
|
||||
|
||||
@override
|
||||
String get bookmarks_contact => 'Contact';
|
||||
|
||||
@override
|
||||
String get bookmarks_remove => 'Remove bookmark';
|
||||
|
||||
@override
|
||||
String get chat_selectMessages => 'Markera meddelanden';
|
||||
|
||||
@@ -5545,6 +5572,19 @@ class AppLocalizationsSv extends AppLocalizations {
|
||||
String get notification_replyAppNotRunning =>
|
||||
'MeshCore Open är inte igång. Öppna appen och skicka ditt svar igen.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarks => 'Export bookmarks to Markdown';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksSubtitle =>
|
||||
'Share or save bookmarked messages as a Markdown file.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksSuccess => 'Bookmarks exported.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksNoBookmarks => 'No bookmarks to export.';
|
||||
|
||||
@override
|
||||
String get settings_gpxExportRepeaters =>
|
||||
'Exportera repeatrar/rumsservrar till GPX';
|
||||
|
||||
@@ -526,6 +526,9 @@ class AppLocalizationsUk extends AppLocalizations {
|
||||
String get backupRestore_discoveredContactsDescription =>
|
||||
'Виявлені контакти та їхні збережені дані';
|
||||
|
||||
@override
|
||||
String get backupRestore_bookmarks => 'Bookmarks';
|
||||
|
||||
@override
|
||||
String get backupRestore_channels => 'Канали';
|
||||
|
||||
@@ -2269,6 +2272,30 @@ class AppLocalizationsUk extends AppLocalizations {
|
||||
@override
|
||||
String get chat_messageDeleted => 'Повідомлення видалено';
|
||||
|
||||
@override
|
||||
String get chat_bookmark => 'Bookmark';
|
||||
|
||||
@override
|
||||
String get chat_removeBookmark => 'Remove bookmark';
|
||||
|
||||
@override
|
||||
String get chat_showBookmarks => 'Show bookmarks';
|
||||
|
||||
@override
|
||||
String get bookmarks_title => 'Bookmarks';
|
||||
|
||||
@override
|
||||
String get bookmarks_empty => 'No bookmarked messages';
|
||||
|
||||
@override
|
||||
String get bookmarks_channel => 'Channel';
|
||||
|
||||
@override
|
||||
String get bookmarks_contact => 'Contact';
|
||||
|
||||
@override
|
||||
String get bookmarks_remove => 'Remove bookmark';
|
||||
|
||||
@override
|
||||
String get chat_selectMessages => 'Вибрати повідомлення';
|
||||
|
||||
@@ -5610,6 +5637,19 @@ class AppLocalizationsUk extends AppLocalizations {
|
||||
String get notification_replyAppNotRunning =>
|
||||
'MeshCore Open не запущено. Відкрийте його та надішліть відповідь ще раз.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarks => 'Export bookmarks to Markdown';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksSubtitle =>
|
||||
'Share or save bookmarked messages as a Markdown file.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksSuccess => 'Bookmarks exported.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksNoBookmarks => 'No bookmarks to export.';
|
||||
|
||||
@override
|
||||
String get settings_gpxExportRepeaters =>
|
||||
'Експорт ретрансляторів і серверів кімнат у GPX';
|
||||
|
||||
@@ -495,6 +495,9 @@ class AppLocalizationsZh extends AppLocalizations {
|
||||
@override
|
||||
String get backupRestore_discoveredContactsDescription => '已发现的联系人及其保存的详细信息';
|
||||
|
||||
@override
|
||||
String get backupRestore_bookmarks => 'Bookmarks';
|
||||
|
||||
@override
|
||||
String get backupRestore_channels => '频道';
|
||||
|
||||
@@ -2138,6 +2141,30 @@ class AppLocalizationsZh extends AppLocalizations {
|
||||
@override
|
||||
String get chat_messageDeleted => '消息已删除';
|
||||
|
||||
@override
|
||||
String get chat_bookmark => 'Bookmark';
|
||||
|
||||
@override
|
||||
String get chat_removeBookmark => 'Remove bookmark';
|
||||
|
||||
@override
|
||||
String get chat_showBookmarks => 'Show bookmarks';
|
||||
|
||||
@override
|
||||
String get bookmarks_title => 'Bookmarks';
|
||||
|
||||
@override
|
||||
String get bookmarks_empty => 'No bookmarked messages';
|
||||
|
||||
@override
|
||||
String get bookmarks_channel => 'Channel';
|
||||
|
||||
@override
|
||||
String get bookmarks_contact => 'Contact';
|
||||
|
||||
@override
|
||||
String get bookmarks_remove => 'Remove bookmark';
|
||||
|
||||
@override
|
||||
String get chat_selectMessages => '选择消息';
|
||||
|
||||
@@ -5199,6 +5226,19 @@ class AppLocalizationsZh extends AppLocalizations {
|
||||
String get notification_replyAppNotRunning =>
|
||||
'MeshCore Open 未在运行。请打开它并再次发送回复。';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarks => 'Export bookmarks to Markdown';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksSubtitle =>
|
||||
'Share or save bookmarked messages as a Markdown file.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksSuccess => 'Bookmarks exported.';
|
||||
|
||||
@override
|
||||
String get settings_exportBookmarksNoBookmarks => 'No bookmarks to export.';
|
||||
|
||||
@override
|
||||
String get settings_gpxExportRepeaters => '导出转发节点/房间服务器到 GPX';
|
||||
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
import 'channel_message.dart';
|
||||
import 'message.dart';
|
||||
|
||||
enum BookmarkSourceType { contact, channel }
|
||||
|
||||
@immutable
|
||||
class BookmarkedMessage {
|
||||
final BookmarkSourceType sourceType;
|
||||
final String sourceId;
|
||||
final String sourceName;
|
||||
final String messageId;
|
||||
final String senderName;
|
||||
final String text;
|
||||
final String? translatedText;
|
||||
final DateTime timestamp;
|
||||
final DateTime receivedAt;
|
||||
final bool isOutgoing;
|
||||
|
||||
const BookmarkedMessage({
|
||||
required this.sourceType,
|
||||
required this.sourceId,
|
||||
required this.sourceName,
|
||||
required this.messageId,
|
||||
required this.senderName,
|
||||
required this.text,
|
||||
required this.timestamp,
|
||||
required this.receivedAt,
|
||||
required this.isOutgoing,
|
||||
this.translatedText,
|
||||
});
|
||||
|
||||
factory BookmarkedMessage.fromContact({
|
||||
required Message message,
|
||||
required String contactKey,
|
||||
required String contactName,
|
||||
required String senderName,
|
||||
}) => BookmarkedMessage(
|
||||
sourceType: BookmarkSourceType.contact,
|
||||
sourceId: contactKey,
|
||||
sourceName: contactName,
|
||||
messageId: message.messageId,
|
||||
senderName: senderName,
|
||||
text: message.text,
|
||||
translatedText: message.translatedText,
|
||||
timestamp: message.timestamp,
|
||||
receivedAt: message.receivedAt,
|
||||
isOutgoing: message.isOutgoing,
|
||||
);
|
||||
|
||||
factory BookmarkedMessage.fromChannel({
|
||||
required ChannelMessage message,
|
||||
required String channelId,
|
||||
required String channelName,
|
||||
required String senderName,
|
||||
}) => BookmarkedMessage(
|
||||
sourceType: BookmarkSourceType.channel,
|
||||
sourceId: channelId,
|
||||
sourceName: channelName,
|
||||
messageId: message.messageId,
|
||||
senderName: senderName,
|
||||
text: message.text,
|
||||
translatedText: message.translatedText,
|
||||
timestamp: message.timestamp,
|
||||
receivedAt: message.receivedAt,
|
||||
isOutgoing: message.isOutgoing,
|
||||
);
|
||||
|
||||
String get storageId => storageIdFor(sourceType, sourceId, messageId);
|
||||
|
||||
static String storageIdFor(
|
||||
BookmarkSourceType sourceType,
|
||||
String sourceId,
|
||||
String messageId,
|
||||
) => '${sourceType.name}:$sourceId:$messageId';
|
||||
|
||||
Map<String, Object?> toJson() => {
|
||||
'sourceType': sourceType.name,
|
||||
'sourceId': sourceId,
|
||||
'sourceName': sourceName,
|
||||
'messageId': messageId,
|
||||
'senderName': senderName,
|
||||
'text': text,
|
||||
'translatedText': translatedText,
|
||||
'timestamp': timestamp.millisecondsSinceEpoch,
|
||||
'receivedAt': receivedAt.millisecondsSinceEpoch,
|
||||
'isOutgoing': isOutgoing,
|
||||
};
|
||||
|
||||
factory BookmarkedMessage.fromJson(Map<String, dynamic> json) {
|
||||
final type = BookmarkSourceType.values.firstWhere(
|
||||
(value) => value.name == json['sourceType'],
|
||||
);
|
||||
return BookmarkedMessage(
|
||||
sourceType: type,
|
||||
sourceId: json['sourceId'] as String,
|
||||
sourceName: json['sourceName'] as String,
|
||||
messageId: json['messageId'] as String,
|
||||
senderName: json['senderName'] as String,
|
||||
text: json['text'] as String,
|
||||
translatedText: json['translatedText'] as String?,
|
||||
timestamp: DateTime.fromMillisecondsSinceEpoch(json['timestamp'] as int),
|
||||
receivedAt: DateTime.fromMillisecondsSinceEpoch(
|
||||
json['receivedAt'] as int? ?? json['timestamp'] as int,
|
||||
),
|
||||
isOutgoing: json['isOutgoing'] as bool? ?? false,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -43,6 +43,7 @@ class ChannelMessage {
|
||||
/// to the bottom; [timestamp] stays the sender's identity time.
|
||||
final DateTime receivedAt;
|
||||
final bool isOutgoing;
|
||||
final bool isBookmarked;
|
||||
final ChannelMessageStatus status;
|
||||
final List<Repeat> repeats;
|
||||
final int repeatCount;
|
||||
@@ -77,6 +78,7 @@ class ChannelMessage {
|
||||
required this.timestamp,
|
||||
DateTime? receivedAt,
|
||||
required this.isOutgoing,
|
||||
this.isBookmarked = false,
|
||||
this.status = ChannelMessageStatus.pending,
|
||||
this.repeats = const [],
|
||||
this.repeatCount = 0,
|
||||
@@ -117,6 +119,7 @@ class ChannelMessage {
|
||||
|
||||
ChannelMessage copyWith({
|
||||
ChannelMessageStatus? status,
|
||||
bool? isBookmarked,
|
||||
List<Repeat>? repeats,
|
||||
int? repeatCount,
|
||||
int? pathLength,
|
||||
@@ -159,6 +162,7 @@ class ChannelMessage {
|
||||
timestamp: timestamp,
|
||||
receivedAt: receivedAt,
|
||||
isOutgoing: isOutgoing,
|
||||
isBookmarked: isBookmarked ?? this.isBookmarked,
|
||||
status: status ?? this.status,
|
||||
repeats: repeats ?? this.repeats,
|
||||
repeatCount: repeatCount ?? this.repeatCount,
|
||||
|
||||
@@ -34,6 +34,7 @@ class Message {
|
||||
/// to the bottom; [timestamp] stays the sender's identity time.
|
||||
final DateTime receivedAt;
|
||||
final bool isOutgoing;
|
||||
final bool isBookmarked;
|
||||
final bool isCli;
|
||||
final MessageStatus status;
|
||||
final String? originalText;
|
||||
@@ -62,6 +63,7 @@ class Message {
|
||||
required this.timestamp,
|
||||
DateTime? receivedAt,
|
||||
required this.isOutgoing,
|
||||
this.isBookmarked = false,
|
||||
this.isCli = false,
|
||||
this.status = MessageStatus.pending,
|
||||
String? messageId,
|
||||
@@ -108,6 +110,7 @@ class Message {
|
||||
int? pathLength,
|
||||
Uint8List? pathBytes,
|
||||
bool? isCli,
|
||||
bool? isBookmarked,
|
||||
Object? originalText = _unset,
|
||||
Object? translatedText = _unset,
|
||||
Object? translatedLanguageCode = _unset,
|
||||
@@ -123,6 +126,7 @@ class Message {
|
||||
timestamp: timestamp,
|
||||
receivedAt: receivedAt,
|
||||
isOutgoing: isOutgoing,
|
||||
isBookmarked: isBookmarked ?? this.isBookmarked,
|
||||
isCli: isCli ?? this.isCli,
|
||||
status: status ?? this.status,
|
||||
messageId: messageId,
|
||||
|
||||
@@ -202,6 +202,11 @@ class _BackupRestoreScreenState extends State<BackupRestoreScreen> {
|
||||
l10n.backupRestore_discoveredContacts,
|
||||
Icons.person_search_outlined,
|
||||
),
|
||||
_itemTile(
|
||||
BackupItem.bookmarks,
|
||||
l10n.backupRestore_bookmarks,
|
||||
Icons.bookmark_border,
|
||||
),
|
||||
const Divider(height: 1, indent: 16),
|
||||
_groupTile(
|
||||
title: l10n.backupRestore_channels,
|
||||
|
||||
@@ -0,0 +1,184 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../connector/meshcore_connector.dart';
|
||||
import '../helpers/message_url_image_helper.dart';
|
||||
import '../l10n/l10n.dart';
|
||||
import '../models/bookmarked_message.dart';
|
||||
import '../services/app_settings_service.dart';
|
||||
import '../widgets/chat_send_pipeline.dart';
|
||||
import '../widgets/empty_state.dart';
|
||||
import '../widgets/translated_message_content.dart';
|
||||
|
||||
class BookmarksScreen extends StatefulWidget {
|
||||
const BookmarksScreen({super.key});
|
||||
|
||||
@override
|
||||
State<BookmarksScreen> createState() => _BookmarksScreenState();
|
||||
}
|
||||
|
||||
class _BookmarksScreenState extends State<BookmarksScreen> {
|
||||
late Future<List<BookmarkedMessage>> _bookmarks;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_bookmarks = context.read<MeshCoreConnector>().loadBookmarkedMessages();
|
||||
}
|
||||
|
||||
void _reload() {
|
||||
setState(() {
|
||||
_bookmarks = context.read<MeshCoreConnector>().loadBookmarkedMessages();
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _remove(BookmarkedMessage bookmark) async {
|
||||
await context.read<MeshCoreConnector>().setBookmarkedMessage(
|
||||
bookmark,
|
||||
isBookmarked: false,
|
||||
);
|
||||
if (mounted) _reload();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = context.l10n;
|
||||
final publicIpfsGateway = context
|
||||
.watch<AppSettingsService>()
|
||||
.settings
|
||||
.publicIpfsGateway;
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: Text(l10n.bookmarks_title), centerTitle: true),
|
||||
body: FutureBuilder<List<BookmarkedMessage>>(
|
||||
future: _bookmarks,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState != ConnectionState.done) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
final bookmarks = snapshot.data ?? const <BookmarkedMessage>[];
|
||||
if (bookmarks.isEmpty) {
|
||||
return EmptyState(
|
||||
icon: Icons.bookmark_border,
|
||||
title: l10n.bookmarks_empty,
|
||||
);
|
||||
}
|
||||
bookmarks.sort((a, b) => a.receivedAt.compareTo(b.receivedAt));
|
||||
return ListView.builder(
|
||||
reverse: true,
|
||||
padding: const EdgeInsets.all(12),
|
||||
itemCount: bookmarks.length,
|
||||
itemBuilder: (context, index) {
|
||||
final bookmark = bookmarks[bookmarks.length - 1 - index];
|
||||
final sourceType =
|
||||
bookmark.sourceType == BookmarkSourceType.channel
|
||||
? l10n.bookmarks_channel
|
||||
: l10n.bookmarks_contact;
|
||||
final receivedAt = bookmark.receivedAt.toLocal();
|
||||
final localizations = MaterialLocalizations.of(context);
|
||||
final time = localizations.formatTimeOfDay(
|
||||
TimeOfDay.fromDateTime(receivedAt),
|
||||
alwaysUse24HourFormat: MediaQuery.alwaysUse24HourFormatOf(
|
||||
context,
|
||||
),
|
||||
);
|
||||
final dateTime =
|
||||
'${localizations.formatShortDate(receivedAt)} $time';
|
||||
final translation = bookmark.translatedText?.trim();
|
||||
final displayText = translation?.isNotEmpty == true
|
||||
? translation!
|
||||
: bookmark.text;
|
||||
final textStyle =
|
||||
Theme.of(context).textTheme.bodyMedium ?? const TextStyle();
|
||||
final textContent = TranslatedMessageContent(
|
||||
displayText: displayText,
|
||||
originalText: displayText == bookmark.text
|
||||
? null
|
||||
: bookmark.text,
|
||||
style: textStyle,
|
||||
originalStyle: textStyle.copyWith(fontStyle: FontStyle.italic),
|
||||
);
|
||||
return Card(
|
||||
margin: const EdgeInsets.only(bottom: 10),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 12, 8, 12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(top: 2, right: 8),
|
||||
child: Icon(
|
||||
Icons.bookmark,
|
||||
size: 20,
|
||||
color: Color(0xFFFFE54A),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'$sourceType · ${bookmark.sourceName}',
|
||||
style: Theme.of(context).textTheme.titleSmall,
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
'${bookmark.senderName} · $dateTime',
|
||||
style: Theme.of(context).textTheme.bodySmall,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
tooltip: l10n.common_copy,
|
||||
onPressed: () =>
|
||||
copyChatMessageText(context, bookmark.text),
|
||||
icon: const Icon(Icons.copy),
|
||||
),
|
||||
IconButton(
|
||||
tooltip: l10n.bookmarks_remove,
|
||||
onPressed: () => _remove(bookmark),
|
||||
icon: const Icon(Icons.bookmark_remove_outlined),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
if (MessageUrlImageHelper.hasPotentialImageUrl(
|
||||
bookmark.text,
|
||||
))
|
||||
MessageUrlImageFutureBuilder(
|
||||
messageId: bookmark.messageId,
|
||||
text: bookmark.text,
|
||||
publicGateway: publicIpfsGateway,
|
||||
builder: (context, snapshot) {
|
||||
final imageUrl = snapshot.data;
|
||||
if (imageUrl == null) return textContent;
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 8),
|
||||
child: MessageUrlImagePreview(
|
||||
imageUrl: imageUrl,
|
||||
),
|
||||
),
|
||||
textContent,
|
||||
],
|
||||
);
|
||||
},
|
||||
)
|
||||
else
|
||||
textContent,
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,7 @@ import '../helpers/snack_bar_builder.dart';
|
||||
import '../l10n/l10n.dart';
|
||||
import '../models/channel.dart';
|
||||
import '../models/channel_message.dart';
|
||||
import '../models/bookmarked_message.dart';
|
||||
import '../models/image_codec_support.dart' show aeicRatePointForUi;
|
||||
import '../models/message_filter.dart';
|
||||
import '../services/app_settings_service.dart' show AppSettingsService;
|
||||
@@ -165,6 +166,7 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
||||
/// Message ids picked for a bulk action. Non-empty means selection mode:
|
||||
/// taps toggle messages and the app bar shows the bulk actions.
|
||||
final Set<String> _selectedIds = <String>{};
|
||||
bool _showBookmarkedOnly = false;
|
||||
bool get _selecting => _selectedIds.isNotEmpty;
|
||||
|
||||
@override
|
||||
@@ -574,6 +576,11 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
||||
widget.channel,
|
||||
onSaved: _onChannelEdited,
|
||||
);
|
||||
case 'showBookmarks':
|
||||
setState(() {
|
||||
_showBookmarkedOnly = !_showBookmarkedOnly;
|
||||
_selectedIds.clear();
|
||||
});
|
||||
case 'background':
|
||||
showChatBackgroundSheet(
|
||||
context,
|
||||
@@ -629,6 +636,14 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
||||
enabled: !readOnly,
|
||||
child: _menuRow(Icons.settings, context.l10n.channels_editChannel),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: 'showBookmarks',
|
||||
child: _menuRow(
|
||||
_showBookmarkedOnly ? Icons.bookmark : Icons.bookmark_border,
|
||||
context.l10n.chat_showBookmarks,
|
||||
color: _showBookmarkedOnly ? const Color(0xFFFFE54A) : null,
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: 'background',
|
||||
child: _menuRow(Icons.wallpaper, context.l10n.chatBackground_title),
|
||||
@@ -856,13 +871,22 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
||||
final layout = _transcriptLayoutFor(
|
||||
context,
|
||||
messages,
|
||||
showBookmarkedOnly: _showBookmarkedOnly,
|
||||
);
|
||||
// Fewer entries than messages means the filter hid or
|
||||
// collapsed some; make sure older history stays reachable.
|
||||
final hidesMessages = layout.length < messages.length;
|
||||
// Fewer entries than messages means the message filter
|
||||
// hid or collapsed some; bookmark filtering is deliberate.
|
||||
final hidesMessages =
|
||||
!_showBookmarkedOnly &&
|
||||
layout.length < messages.length;
|
||||
if (hidesMessages) _scheduleHiddenHistoryBackfill();
|
||||
|
||||
if (layout.length == 0) {
|
||||
if (_showBookmarkedOnly) {
|
||||
return EmptyState(
|
||||
icon: Icons.bookmark_border,
|
||||
title: context.l10n.bookmarks_empty,
|
||||
);
|
||||
}
|
||||
final canLoadOlder =
|
||||
hidesMessages && !_olderHistoryExhausted;
|
||||
return EmptyState(
|
||||
@@ -1167,6 +1191,7 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
||||
: null,
|
||||
child: MessageBubbleFrame(
|
||||
isOutgoing: isOutgoing,
|
||||
isBookmarked: message.isBookmarked || _showBookmarkedOnly,
|
||||
compact: gifId != null,
|
||||
maxWidth: constraints.maxWidth,
|
||||
child: Column(
|
||||
@@ -2200,8 +2225,9 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
||||
/// `State`'s) — `watch` asserts on that.
|
||||
_TranscriptLayout _transcriptLayoutFor(
|
||||
BuildContext context,
|
||||
List<ChannelMessage> messages,
|
||||
) {
|
||||
List<ChannelMessage> messages, {
|
||||
bool showBookmarkedOnly = false,
|
||||
}) {
|
||||
ReceivedImageStore? store;
|
||||
try {
|
||||
store = context.watch<ReceivedImageStore>();
|
||||
@@ -2230,10 +2256,17 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
||||
displayMode,
|
||||
filterActive,
|
||||
_revealVersion,
|
||||
showBookmarkedOnly,
|
||||
_filteredMessagesSignature(messages),
|
||||
Object.hashAll(
|
||||
messages
|
||||
.where((message) => message.isBookmarked)
|
||||
.map((message) => message.messageId),
|
||||
),
|
||||
);
|
||||
final cached = _transcriptLayout;
|
||||
if (cached != null &&
|
||||
if (!showBookmarkedOnly &&
|
||||
cached != null &&
|
||||
cached.matches(
|
||||
messages,
|
||||
_imageStoreVersion,
|
||||
@@ -2242,11 +2275,14 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
||||
)) {
|
||||
return cached;
|
||||
}
|
||||
final images = store == null
|
||||
final displayedMessages = showBookmarkedOnly
|
||||
? messages.where((message) => message.isBookmarked).toList()
|
||||
: messages;
|
||||
final images = store == null || showBookmarkedOnly
|
||||
? const <ReceivedImageEntry>[]
|
||||
: store.entriesForChannel(widget.channel.storageId);
|
||||
final layout = _TranscriptLayout.build(
|
||||
messages: messages,
|
||||
messages: displayedMessages,
|
||||
images: images,
|
||||
imageVersion: _imageStoreVersion,
|
||||
channelIndex: widget.channel.index,
|
||||
@@ -3039,6 +3075,38 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
||||
_markAsUnread(message);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
message.isBookmarked
|
||||
? Icons.bookmark_remove_outlined
|
||||
: Icons.bookmark_add_outlined,
|
||||
),
|
||||
title: Text(
|
||||
message.isBookmarked
|
||||
? context.l10n.chat_removeBookmark
|
||||
: context.l10n.chat_bookmark,
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
final bookmark = BookmarkedMessage.fromChannel(
|
||||
message: message,
|
||||
channelId:
|
||||
widget.channel.storageId ??
|
||||
'slot:${widget.channel.index}',
|
||||
channelName: widget.channel.name,
|
||||
senderName: message.isOutgoing
|
||||
? (context.read<MeshCoreConnector>().selfName ??
|
||||
context.l10n.chat_me)
|
||||
: message.senderName,
|
||||
);
|
||||
unawaited(
|
||||
context.read<MeshCoreConnector>().setBookmarkedMessage(
|
||||
bookmark,
|
||||
isBookmarked: !message.isBookmarked,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
if (showFilterActions) ...[
|
||||
const Divider(height: 1),
|
||||
if (message.isFiltered)
|
||||
@@ -3139,9 +3207,10 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
||||
final filterActive = _transcriptLayout?.filterActive ?? true;
|
||||
return [
|
||||
for (final m in messages)
|
||||
if (!(filterActive &&
|
||||
m.isFiltered &&
|
||||
!_revealedFilteredIds.contains(m.messageId)))
|
||||
if ((!_showBookmarkedOnly || m.isBookmarked) &&
|
||||
!(filterActive &&
|
||||
m.isFiltered &&
|
||||
!_revealedFilteredIds.contains(m.messageId)))
|
||||
m,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ import '../helpers/contact_share_message.dart';
|
||||
import '../helpers/gif_helper.dart';
|
||||
import '../helpers/snack_bar_builder.dart';
|
||||
import '../helpers/utf8_length_limiter.dart';
|
||||
import 'bookmarks_screen.dart';
|
||||
import 'channel_chat_screen.dart';
|
||||
import 'community_qr_scanner_screen.dart';
|
||||
import 'contacts_screen.dart';
|
||||
@@ -128,6 +129,16 @@ class _ChannelsScreenState extends State<ChannelsScreen> {
|
||||
// context, which is deactivated by then.
|
||||
itemBuilder: (menuContext) => [
|
||||
connectionMenuItem(context, menuContext),
|
||||
PopupMenuItem(
|
||||
child: MeshMenuItemRow(
|
||||
icon: Icons.bookmark_border,
|
||||
label: menuContext.l10n.bookmarks_title,
|
||||
),
|
||||
onTap: () => Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (_) => const BookmarksScreen()),
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
child: MeshMenuItemRow(
|
||||
icon: Icons.groups,
|
||||
|
||||
@@ -28,6 +28,7 @@ import '../helpers/marker_message.dart';
|
||||
import '../helpers/message_search.dart';
|
||||
import '../widgets/chat_search_results.dart';
|
||||
import '../models/channel_message.dart';
|
||||
import '../models/bookmarked_message.dart';
|
||||
import '../models/contact.dart';
|
||||
import '../l10n/contact_localization.dart';
|
||||
import '../models/message.dart';
|
||||
@@ -96,6 +97,7 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
final _textFieldFocusNode = FocusNode();
|
||||
final GlobalKey _unreadScrollKey = GlobalKey();
|
||||
bool _isLoadingOlder = false;
|
||||
bool _showBookmarkedOnly = false;
|
||||
MeshCoreConnector? _connector;
|
||||
Message? _pendingUnreadScrollTarget;
|
||||
String? _unreadDividerMessageId;
|
||||
@@ -484,6 +486,10 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
_showContactInfo(context);
|
||||
case 'settings':
|
||||
_showContactSettings(context);
|
||||
case 'showBookmarks':
|
||||
setState(
|
||||
() => _showBookmarkedOnly = !_showBookmarkedOnly,
|
||||
);
|
||||
case 'background':
|
||||
showChatBackgroundSheet(
|
||||
context,
|
||||
@@ -551,6 +557,18 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
label: context.l10n.contact_settings,
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: 'showBookmarks',
|
||||
child: MeshMenuItemRow(
|
||||
icon: _showBookmarkedOnly
|
||||
? Icons.bookmark
|
||||
: Icons.bookmark_border,
|
||||
label: context.l10n.chat_showBookmarks,
|
||||
color: _showBookmarkedOnly
|
||||
? const Color(0xFFFFE54A)
|
||||
: null,
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: 'background',
|
||||
child: MeshMenuItemRow(
|
||||
@@ -631,6 +649,7 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
}
|
||||
|
||||
Widget _buildEmptyState() {
|
||||
if (_showBookmarkedOnly) return _buildBookmarkEmptyState();
|
||||
return EmptyState(
|
||||
icon: Icons.chat_bubble_outline,
|
||||
title: context.l10n.chat_noMessages,
|
||||
@@ -640,12 +659,23 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBookmarkEmptyState() => EmptyState(
|
||||
icon: Icons.bookmark_border,
|
||||
title: context.l10n.bookmarks_empty,
|
||||
);
|
||||
|
||||
Widget _buildMessageList(
|
||||
List<Message> messages,
|
||||
MeshCoreConnector connector,
|
||||
) {
|
||||
final visibleMessages = _showBookmarkedOnly
|
||||
? messages.where((message) => message.isBookmarked).toList()
|
||||
: messages;
|
||||
if (_showBookmarkedOnly && visibleMessages.isEmpty) {
|
||||
return _buildBookmarkEmptyState();
|
||||
}
|
||||
// Reverse messages so newest appear at bottom with reverse: true
|
||||
final reversedMessages = messages.reversed.toList();
|
||||
final reversedMessages = visibleMessages.reversed.toList();
|
||||
final itemCount = reversedMessages.length + (_isLoadingOlder ? 1 : 0);
|
||||
|
||||
// Auto-scroll to bottom if user is already at bottom
|
||||
@@ -713,6 +743,7 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
: contact.name,
|
||||
sourceId: widget.contact.publicKeyHex,
|
||||
textScale: textScale,
|
||||
isBookmarked: message.isBookmarked || _showBookmarkedOnly,
|
||||
onLongPress: () => _showMessageActions(message, contact),
|
||||
onRetryReaction: (msg, emoji) =>
|
||||
_sendReaction(msg, contact, emoji),
|
||||
@@ -1457,6 +1488,36 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
_markAsUnread(message);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
message.isBookmarked
|
||||
? Icons.bookmark_remove_outlined
|
||||
: Icons.bookmark_add_outlined,
|
||||
),
|
||||
title: Text(
|
||||
message.isBookmarked
|
||||
? context.l10n.chat_removeBookmark
|
||||
: context.l10n.chat_bookmark,
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
final bookmark = BookmarkedMessage.fromContact(
|
||||
message: message,
|
||||
contactKey: widget.contact.publicKeyHex,
|
||||
contactName: widget.contact.name,
|
||||
senderName: message.isOutgoing
|
||||
? (context.read<MeshCoreConnector>().selfName ??
|
||||
context.l10n.chat_me)
|
||||
: contact.name,
|
||||
);
|
||||
unawaited(
|
||||
context.read<MeshCoreConnector>().setBookmarkedMessage(
|
||||
bookmark,
|
||||
isBookmarked: !message.isBookmarked,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
if (message.isOutgoing && message.status == MessageStatus.failed)
|
||||
ListTile(
|
||||
enabled: !readOnly,
|
||||
@@ -1567,12 +1628,14 @@ class _MessageBubble extends StatelessWidget {
|
||||
final void Function(Message message, String emoji)? onRetryReaction;
|
||||
final double textScale;
|
||||
final String sourceId;
|
||||
final bool isBookmarked;
|
||||
|
||||
const _MessageBubble({
|
||||
required this.message,
|
||||
required this.senderName,
|
||||
required this.sourceId,
|
||||
required this.textScale,
|
||||
required this.isBookmarked,
|
||||
this.onLongPress,
|
||||
this.onRetryReaction,
|
||||
});
|
||||
@@ -1664,6 +1727,7 @@ class _MessageBubble extends StatelessWidget {
|
||||
child: MessageBubbleFrame(
|
||||
isOutgoing: isOutgoing,
|
||||
isFailed: isFailed,
|
||||
isBookmarked: isBookmarked,
|
||||
compact: gifId != null,
|
||||
maxWidth: constraints.maxWidth,
|
||||
child: Column(
|
||||
|
||||
@@ -1,10 +1,18 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:file_selector/file_selector.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:meshcore_open/utils/gpx_export.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
|
||||
import '../connector/meshcore_connector.dart';
|
||||
import '../helpers/snack_bar_builder.dart';
|
||||
import '../l10n/l10n.dart';
|
||||
import '../services/app_settings_service.dart';
|
||||
import '../utils/bookmark_markdown_export.dart';
|
||||
import '../utils/platform_info.dart';
|
||||
import '../utils/share_origin.dart';
|
||||
import '../widgets/app_bar.dart';
|
||||
import '../widgets/mesh_ui.dart';
|
||||
@@ -12,6 +20,12 @@ import '../widgets/mesh_nav_tile.dart';
|
||||
import '../widgets/sync_progress_overlay.dart';
|
||||
|
||||
class ExportScreen extends StatelessWidget {
|
||||
static const _markdownFileType = XTypeGroup(
|
||||
label: 'Markdown',
|
||||
extensions: ['md'],
|
||||
mimeTypes: ['text/markdown'],
|
||||
);
|
||||
|
||||
const ExportScreen({super.key});
|
||||
|
||||
@override
|
||||
@@ -34,6 +48,16 @@ class ExportScreen extends StatelessWidget {
|
||||
padding: const EdgeInsets.fromLTRB(0, 8, 0, 24),
|
||||
children: [
|
||||
SectionHeader(l10n.settings_export),
|
||||
MeshCard(
|
||||
padding: EdgeInsets.zero,
|
||||
child: MeshNavTile(
|
||||
icon: Icons.bookmark_border,
|
||||
title: l10n.settings_exportBookmarks,
|
||||
subtitle: l10n.settings_exportBookmarksSubtitle,
|
||||
onTap: () => _exportBookmarks(context),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
MeshCard(
|
||||
padding: EdgeInsets.zero,
|
||||
child: Column(
|
||||
@@ -94,6 +118,78 @@ class ExportScreen extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _exportBookmarks(BuildContext context) async {
|
||||
final l10n = context.l10n;
|
||||
try {
|
||||
final bookmarks = await context
|
||||
.read<MeshCoreConnector>()
|
||||
.loadBookmarkedMessages();
|
||||
if (!context.mounted) return;
|
||||
if (bookmarks.isEmpty) {
|
||||
showDismissibleSnackBar(
|
||||
context,
|
||||
content: Text(l10n.settings_exportBookmarksNoBookmarks),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
final exportedAt = DateTime.now();
|
||||
final markdown = await buildBookmarksMarkdown(
|
||||
bookmarks,
|
||||
publicGateway: context
|
||||
.read<AppSettingsService>()
|
||||
.settings
|
||||
.publicIpfsGateway,
|
||||
exportedAt: exportedAt,
|
||||
);
|
||||
if (!context.mounted) return;
|
||||
final date =
|
||||
'${exportedAt.year.toString().padLeft(4, '0')}'
|
||||
'-${exportedAt.month.toString().padLeft(2, '0')}'
|
||||
'-${exportedAt.day.toString().padLeft(2, '0')}';
|
||||
final filename = 'meshcore-open-bookmarks_$date.md';
|
||||
final file = XFile.fromData(
|
||||
Uint8List.fromList(utf8.encode(markdown)),
|
||||
name: filename,
|
||||
mimeType: 'text/markdown',
|
||||
);
|
||||
|
||||
if (PlatformInfo.isWeb) {
|
||||
await file.saveTo(filename);
|
||||
} else if (PlatformInfo.isDesktop) {
|
||||
final location = await getSaveLocation(
|
||||
suggestedName: filename,
|
||||
acceptedTypeGroups: const [_markdownFileType],
|
||||
);
|
||||
if (location == null || !context.mounted) return;
|
||||
await file.saveTo(location.path);
|
||||
} else {
|
||||
final result = await SharePlus.instance.share(
|
||||
ShareParams(
|
||||
subject: l10n.settings_exportBookmarks,
|
||||
files: [file],
|
||||
fileNameOverrides: [filename],
|
||||
sharePositionOrigin: shareOriginOf(context),
|
||||
),
|
||||
);
|
||||
if (result.status == ShareResultStatus.dismissed) return;
|
||||
}
|
||||
if (context.mounted) {
|
||||
showDismissibleSnackBar(
|
||||
context,
|
||||
content: Text(l10n.settings_exportBookmarksSuccess),
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
if (context.mounted) {
|
||||
showDismissibleSnackBar(
|
||||
context,
|
||||
content: Text('${l10n.settings_gpxExportError} $error'),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _gpxExport(
|
||||
BuildContext context,
|
||||
GpxExport exporter,
|
||||
|
||||
@@ -49,6 +49,7 @@ const List<String> _scopedPreferencePrefixes = [
|
||||
..._contactPreferencePrefixes,
|
||||
..._channelPreferencePrefixes,
|
||||
'discovered_contacts',
|
||||
'message_bookmarks_',
|
||||
];
|
||||
|
||||
enum BackupSection {
|
||||
@@ -75,6 +76,7 @@ enum BackupItem {
|
||||
contactGroups,
|
||||
contactHistory,
|
||||
discoveredContacts,
|
||||
bookmarks,
|
||||
channels,
|
||||
channelFilters,
|
||||
ipfsKey,
|
||||
@@ -1061,7 +1063,8 @@ class BackupService {
|
||||
BackupItem.perContactSettings ||
|
||||
BackupItem.contactGroups ||
|
||||
BackupItem.contactHistory => BackupSection.contacts,
|
||||
BackupItem.discoveredContacts => BackupSection.discoveredContacts,
|
||||
BackupItem.discoveredContacts ||
|
||||
BackupItem.bookmarks => BackupSection.discoveredContacts,
|
||||
BackupItem.channels ||
|
||||
BackupItem.channelFilters ||
|
||||
BackupItem.channelSettings ||
|
||||
@@ -1114,6 +1117,10 @@ class BackupService {
|
||||
key.startsWith('discovered_contacts$devicePrefix')) {
|
||||
return true;
|
||||
}
|
||||
if (items.contains(BackupItem.bookmarks) &&
|
||||
key.startsWith('message_bookmarks_$devicePrefix')) {
|
||||
return true;
|
||||
}
|
||||
if (items.contains(BackupItem.channels) &&
|
||||
(key.startsWith('channels$devicePrefix') ||
|
||||
key.startsWith('channel_slot_ids_$devicePrefix'))) {
|
||||
@@ -1162,6 +1169,7 @@ class BackupService {
|
||||
case BackupSection.discoveredContacts:
|
||||
return _startsWithScopedPrefix(key, const [
|
||||
'discovered_contacts',
|
||||
'message_bookmarks_',
|
||||
], devicePrefix);
|
||||
case BackupSection.channels:
|
||||
return key.startsWith('message_filter_') ||
|
||||
@@ -1354,7 +1362,10 @@ class BackupService {
|
||||
if (sourcePrefix.isEmpty || destinationPrefix.isEmpty) return key;
|
||||
final prefixes = switch (section) {
|
||||
BackupSection.contacts => _contactPreferencePrefixes,
|
||||
BackupSection.discoveredContacts => const ['discovered_contacts'],
|
||||
BackupSection.discoveredContacts => const [
|
||||
'discovered_contacts',
|
||||
'message_bookmarks_',
|
||||
],
|
||||
BackupSection.channels => _channelPreferencePrefixes,
|
||||
_ => const <String>[],
|
||||
};
|
||||
@@ -1379,7 +1390,10 @@ class BackupService {
|
||||
if (devicePrefix.isEmpty) return false;
|
||||
final prefixes = switch (section) {
|
||||
BackupSection.contacts => _contactPreferencePrefixes,
|
||||
BackupSection.discoveredContacts => const ['discovered_contacts'],
|
||||
BackupSection.discoveredContacts => const [
|
||||
'discovered_contacts',
|
||||
'message_bookmarks_',
|
||||
],
|
||||
BackupSection.channels => _channelPreferencePrefixes,
|
||||
_ => const <String>[],
|
||||
};
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import '../models/bookmarked_message.dart';
|
||||
import '../utils/app_logger.dart';
|
||||
import 'prefs_manager.dart';
|
||||
|
||||
class BookmarkStore {
|
||||
static const String _keyPrefix = 'message_bookmarks_';
|
||||
|
||||
String publicKeyHex = '';
|
||||
set setPublicKeyHex(String value) =>
|
||||
publicKeyHex = value.length > 10 ? value.substring(0, 10) : '';
|
||||
|
||||
String get keyFor => '$_keyPrefix$publicKeyHex';
|
||||
|
||||
Future<void> _pendingWrites = Future<void>.value();
|
||||
|
||||
Future<List<BookmarkedMessage>> loadBookmarks() async {
|
||||
final writes = _pendingWrites;
|
||||
await writes;
|
||||
return _readBookmarks(keyFor);
|
||||
}
|
||||
|
||||
Future<void> saveBookmark(BookmarkedMessage bookmark) {
|
||||
if (publicKeyHex.isEmpty) return Future<void>.value();
|
||||
final key = keyFor;
|
||||
return _enqueue(() async {
|
||||
final bookmarks = await _readBookmarks(key);
|
||||
bookmarks.removeWhere(
|
||||
(existing) => existing.storageId == bookmark.storageId,
|
||||
);
|
||||
bookmarks.add(bookmark);
|
||||
await _writeBookmarks(key, bookmarks);
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> removeBookmark(BookmarkedMessage bookmark) {
|
||||
if (publicKeyHex.isEmpty) return Future<void>.value();
|
||||
final key = keyFor;
|
||||
return _enqueue(() async {
|
||||
final bookmarks = await _readBookmarks(key);
|
||||
bookmarks.removeWhere(
|
||||
(existing) => existing.storageId == bookmark.storageId,
|
||||
);
|
||||
await _writeBookmarks(key, bookmarks);
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _enqueue(Future<void> Function() operation) {
|
||||
final next = _pendingWrites.then((_) => operation());
|
||||
_pendingWrites = next.then<void>(
|
||||
(_) {},
|
||||
onError: (Object _, StackTrace _) {},
|
||||
);
|
||||
return next;
|
||||
}
|
||||
|
||||
Future<List<BookmarkedMessage>> _readBookmarks(String key) async {
|
||||
if (key == _keyPrefix) return [];
|
||||
final raw = PrefsManager.instance.getString(key);
|
||||
if (raw == null || raw.isEmpty) return [];
|
||||
try {
|
||||
final decoded = jsonDecode(raw);
|
||||
if (decoded is! List) return [];
|
||||
final bookmarks = <BookmarkedMessage>[];
|
||||
for (final value in decoded) {
|
||||
if (value is! Map<String, dynamic>) continue;
|
||||
try {
|
||||
bookmarks.add(BookmarkedMessage.fromJson(value));
|
||||
} on Object catch (error) {
|
||||
appLogger.warn('Skipping malformed bookmark: $error');
|
||||
}
|
||||
}
|
||||
return bookmarks;
|
||||
} on FormatException catch (error) {
|
||||
appLogger.warn('Stored bookmarks are unreadable: $error');
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _writeBookmarks(
|
||||
String key,
|
||||
List<BookmarkedMessage> bookmarks,
|
||||
) async {
|
||||
if (!await PrefsManager.instance.setString(
|
||||
key,
|
||||
jsonEncode(bookmarks.map((bookmark) => bookmark.toJson()).toList()),
|
||||
)) {
|
||||
throw StateError('Could not save bookmarks');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -123,6 +123,16 @@ class ChannelMessageStore {
|
||||
return messages;
|
||||
}
|
||||
|
||||
Future<void> updateBookmarkFlag(
|
||||
String channelId,
|
||||
String messageId,
|
||||
bool isBookmarked,
|
||||
) => _archive.updateBookmarkFlag(
|
||||
_keyForChannel(channelId),
|
||||
messageId,
|
||||
isBookmarked,
|
||||
);
|
||||
|
||||
Future<void> clearChannelMessages(String channelId) =>
|
||||
_archive.clear(HistoryStore.instance, _keyForChannel(channelId));
|
||||
|
||||
@@ -149,6 +159,7 @@ class ChannelMessageStore {
|
||||
'timestamp': msg.timestamp.millisecondsSinceEpoch,
|
||||
'receivedAt': msg.receivedAt.millisecondsSinceEpoch,
|
||||
'isOutgoing': msg.isOutgoing,
|
||||
'isBookmarked': msg.isBookmarked,
|
||||
'status': msg.status.index,
|
||||
'channelIndex': msg.channelIndex,
|
||||
'region': msg.region,
|
||||
@@ -226,6 +237,7 @@ class ChannelMessageStore {
|
||||
timestamp: DateTime.fromMillisecondsSinceEpoch(json['timestamp'] as int),
|
||||
receivedAt: legacyAwareReceivedAt(json),
|
||||
isOutgoing: json['isOutgoing'] as bool? ?? false,
|
||||
isBookmarked: json['isBookmarked'] as bool? ?? false,
|
||||
status: _statusAt(json['status']) ?? ChannelMessageStatus.failed,
|
||||
repeatCount: (json['repeatCount'] as int?) ?? 0,
|
||||
pathLength: decodedPathLength,
|
||||
|
||||
@@ -121,6 +121,51 @@ class HistoryArchive {
|
||||
(_archives[HistoryStore.instance] ??= {})[key] = _ArchiveState(count);
|
||||
}
|
||||
|
||||
Future<void> updateBookmarkFlag(
|
||||
String key,
|
||||
String messageId,
|
||||
bool isBookmarked,
|
||||
) {
|
||||
final store = HistoryStore.instance;
|
||||
final state = _stateFor(store, key);
|
||||
return _serialize(store, key, () async {
|
||||
String? update(String raw) {
|
||||
try {
|
||||
final decoded = jsonDecode(raw);
|
||||
if (decoded is! Map<String, dynamic> ||
|
||||
mergeKey(decoded) != 'id:$messageId') {
|
||||
return null;
|
||||
}
|
||||
decoded['isBookmarked'] = isBookmarked;
|
||||
return jsonEncode(decoded);
|
||||
} on FormatException {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < state.pending.length; i++) {
|
||||
final entry = state.pending[i];
|
||||
final replacement = update(entry.$2);
|
||||
if (replacement != null) state.pending[i] = (entry.$1, replacement);
|
||||
}
|
||||
final entries = await store.readEntries(key);
|
||||
var changed = false;
|
||||
final updated = <String>[];
|
||||
for (final entry in entries) {
|
||||
final replacement = update(entry);
|
||||
updated.add(replacement ?? entry);
|
||||
changed = changed || replacement != null;
|
||||
}
|
||||
if (changed &&
|
||||
!await store.setString(
|
||||
key,
|
||||
jsonEncode(updated.map(jsonDecode).toList()),
|
||||
)) {
|
||||
throw StateError('Could not update message bookmark flag');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// Only entries trimmed since the last successful save need buffering.
|
||||
void archive(String key, Iterable<String> entries) {
|
||||
final state = _stateFor(HistoryStore.instance, key);
|
||||
|
||||
@@ -175,6 +175,19 @@ class MessageStore {
|
||||
return messages;
|
||||
}
|
||||
|
||||
Future<void> updateBookmarkFlag(
|
||||
String contactKeyHex,
|
||||
String messageId,
|
||||
bool isBookmarked,
|
||||
) {
|
||||
if (publicKeyHex.isEmpty) return Future<void>.value();
|
||||
return _archive.updateBookmarkFlag(
|
||||
'$keyFor$contactKeyHex',
|
||||
messageId,
|
||||
isBookmarked,
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> clearMessages(String contactKeyHex) {
|
||||
if (publicKeyHex.isEmpty) return Future<void>.value();
|
||||
return _archive.clear(HistoryStore.instance, '$keyFor$contactKeyHex');
|
||||
@@ -187,6 +200,7 @@ class MessageStore {
|
||||
'timestamp': msg.timestamp.millisecondsSinceEpoch,
|
||||
'receivedAt': msg.receivedAt.millisecondsSinceEpoch,
|
||||
'isOutgoing': msg.isOutgoing,
|
||||
'isBookmarked': msg.isBookmarked,
|
||||
'isCli': msg.isCli,
|
||||
'status': msg.status.index,
|
||||
'messageId': msg.messageId,
|
||||
@@ -257,6 +271,7 @@ class MessageStore {
|
||||
timestamp: DateTime.fromMillisecondsSinceEpoch(json['timestamp'] as int),
|
||||
receivedAt: legacyAwareReceivedAt(json),
|
||||
isOutgoing: json['isOutgoing'] as bool? ?? false,
|
||||
isBookmarked: json['isBookmarked'] as bool? ?? false,
|
||||
isCli: isCli,
|
||||
status: _statusAt(json['status']) ?? MessageStatus.failed,
|
||||
messageId: json['messageId'] as String?,
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
import '../helpers/message_url_image_helper.dart';
|
||||
import '../models/bookmarked_message.dart';
|
||||
|
||||
Future<String> buildBookmarksMarkdown(
|
||||
List<BookmarkedMessage> bookmarks, {
|
||||
required String publicGateway,
|
||||
DateTime? exportedAt,
|
||||
}) async {
|
||||
final date = (exportedAt ?? DateTime.now()).toLocal();
|
||||
final output = StringBuffer()
|
||||
..writeln('# MeshCore-Open Bookmarks')
|
||||
..writeln()
|
||||
..writeln('Exported: ${_date(date)}')
|
||||
..writeln();
|
||||
|
||||
final contacts = _groupBySource(
|
||||
bookmarks.where(
|
||||
(bookmark) => bookmark.sourceType == BookmarkSourceType.contact,
|
||||
),
|
||||
);
|
||||
if (contacts.isNotEmpty) {
|
||||
output.writeln('## Contacts');
|
||||
for (final group in contacts) {
|
||||
output
|
||||
..writeln()
|
||||
..writeln('### ${_safeHeading(group.first.sourceName)}')
|
||||
..writeln();
|
||||
await _writeGroup(output, group, publicGateway: publicGateway);
|
||||
}
|
||||
}
|
||||
|
||||
final channels = _groupBySource(
|
||||
bookmarks.where(
|
||||
(bookmark) => bookmark.sourceType == BookmarkSourceType.channel,
|
||||
),
|
||||
);
|
||||
if (channels.isNotEmpty) {
|
||||
if (contacts.isNotEmpty) output.writeln();
|
||||
output.writeln('## Channels');
|
||||
for (final group in channels) {
|
||||
final name = _singleLine(group.first.sourceName);
|
||||
output
|
||||
..writeln()
|
||||
..writeln('### $name')
|
||||
..writeln();
|
||||
await _writeGroup(output, group, publicGateway: publicGateway);
|
||||
}
|
||||
}
|
||||
|
||||
return '${output.toString().trimRight()}\n';
|
||||
}
|
||||
|
||||
List<List<BookmarkedMessage>> _groupBySource(
|
||||
Iterable<BookmarkedMessage> bookmarks,
|
||||
) {
|
||||
final bySource = <String, List<BookmarkedMessage>>{};
|
||||
for (final bookmark in bookmarks) {
|
||||
bySource.putIfAbsent(bookmark.sourceId, () => []).add(bookmark);
|
||||
}
|
||||
final groups = bySource.values.toList();
|
||||
for (final group in groups) {
|
||||
group.sort((a, b) => a.receivedAt.compareTo(b.receivedAt));
|
||||
}
|
||||
groups.sort((a, b) {
|
||||
final byName = a.first.sourceName.compareTo(b.first.sourceName);
|
||||
return byName != 0 ? byName : a.first.sourceId.compareTo(b.first.sourceId);
|
||||
});
|
||||
return groups;
|
||||
}
|
||||
|
||||
Future<void> _writeGroup(
|
||||
StringBuffer output,
|
||||
List<BookmarkedMessage> bookmarks, {
|
||||
required String publicGateway,
|
||||
}) async {
|
||||
for (var i = 0; i < bookmarks.length; i++) {
|
||||
final bookmark = bookmarks[i];
|
||||
output
|
||||
..writeln(
|
||||
'**${_safeInline(bookmark.senderName)} · ${_dateTime(bookmark.receivedAt)}**',
|
||||
)
|
||||
..writeln();
|
||||
|
||||
final translation = bookmark.translatedText?.trim();
|
||||
if (translation != null &&
|
||||
translation.isNotEmpty &&
|
||||
translation != bookmark.text) {
|
||||
output
|
||||
..write('*${_markdownLinks(bookmark.text)}*')
|
||||
..writeln()
|
||||
..writeln(_markdownLinks(translation));
|
||||
} else {
|
||||
output.writeln(_markdownLinks(bookmark.text));
|
||||
}
|
||||
|
||||
final imageUrl = await MessageUrlImageHelper.parse(
|
||||
bookmark.text,
|
||||
publicGateway: publicGateway,
|
||||
respectLoadSetting: false,
|
||||
);
|
||||
if (imageUrl != null) {
|
||||
final destination = _markdownDestination(imageUrl);
|
||||
output
|
||||
..writeln()
|
||||
..writeln('')
|
||||
..writeln()
|
||||
..writeln('[Image URL]($destination)');
|
||||
}
|
||||
|
||||
if (i < bookmarks.length - 1) output.writeln();
|
||||
}
|
||||
}
|
||||
|
||||
String _singleLine(String value) =>
|
||||
value.replaceAll(RegExp(r'[\r\n]+'), ' ').trim();
|
||||
|
||||
String _markdownLinks(String text) {
|
||||
final urls = RegExp(
|
||||
r'''(?:https?://|ipfs:(?:/{0,2}))[\w\-._~:/?#\[\]@!$&'()*+,;=%]+''',
|
||||
caseSensitive: false,
|
||||
);
|
||||
final linked = text.trim().replaceAllMapped(urls, (match) {
|
||||
final raw = match.group(0)!;
|
||||
var url = raw;
|
||||
while (url.isNotEmpty && RegExp(r'[.,!?;:]$').hasMatch(url)) {
|
||||
url = url.substring(0, url.length - 1);
|
||||
}
|
||||
while (url.endsWith(')') &&
|
||||
'('.allMatches(url).length < ')'.allMatches(url).length) {
|
||||
url = url.substring(0, url.length - 1);
|
||||
}
|
||||
if (url.isEmpty) return raw;
|
||||
final suffix = raw.substring(url.length);
|
||||
final label = url.replaceAll('[', r'\[').replaceAll(']', r'\]');
|
||||
return '[$label](${_markdownDestination(url)})$suffix';
|
||||
});
|
||||
return linked
|
||||
.replaceFirst(RegExp(r'^\*+'), '')
|
||||
.replaceFirst(RegExp(r'\*+$'), '')
|
||||
.trim();
|
||||
}
|
||||
|
||||
String _markdownDestination(String url) => url
|
||||
.replaceAll('<', '%3C')
|
||||
.replaceAll('>', '%3E')
|
||||
.replaceAll(' ', '%20')
|
||||
.replaceAll('(', '%28')
|
||||
.replaceAll(')', '%29');
|
||||
|
||||
String _safeHeading(String value) =>
|
||||
value.replaceAll(RegExp(r'[\r\n]+'), ' ').replaceAll('#', r'\#');
|
||||
|
||||
String _safeInline(String value) => value
|
||||
.replaceAll(RegExp(r'[\r\n]+'), ' ')
|
||||
.replaceAll('*', r'\*')
|
||||
.replaceAll('_', r'\_');
|
||||
|
||||
String _date(DateTime date) =>
|
||||
'${date.year.toString().padLeft(4, '0')}-'
|
||||
'${date.month.toString().padLeft(2, '0')}-'
|
||||
'${date.day.toString().padLeft(2, '0')}';
|
||||
|
||||
String _dateTime(DateTime date) =>
|
||||
'${_date(date)} ${date.hour.toString().padLeft(2, '0')}:'
|
||||
'${date.minute.toString().padLeft(2, '0')}';
|
||||
@@ -93,6 +93,7 @@ Color senderNameColor(String name) {
|
||||
class MessageBubbleFrame extends StatelessWidget {
|
||||
final bool isOutgoing;
|
||||
final bool isFailed;
|
||||
final bool isBookmarked;
|
||||
|
||||
/// Tighter padding for media (GIF) content.
|
||||
final bool compact;
|
||||
@@ -105,6 +106,7 @@ class MessageBubbleFrame extends StatelessWidget {
|
||||
required this.maxWidth,
|
||||
required this.child,
|
||||
this.isFailed = false,
|
||||
this.isBookmarked = false,
|
||||
this.compact = false,
|
||||
});
|
||||
|
||||
@@ -115,17 +117,35 @@ class MessageBubbleFrame extends StatelessWidget {
|
||||
isOutgoing: isOutgoing,
|
||||
isFailed: isFailed,
|
||||
);
|
||||
return Container(
|
||||
padding: compact
|
||||
? const EdgeInsets.all(4)
|
||||
: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
constraints: BoxConstraints(maxWidth: maxWidth * 0.72),
|
||||
decoration: BoxDecoration(
|
||||
color: colors.background,
|
||||
borderRadius: messageBubbleRadius(isOutgoing: isOutgoing),
|
||||
border: Border.all(color: colors.border, width: 1),
|
||||
),
|
||||
child: child,
|
||||
final contentPadding = compact
|
||||
? const EdgeInsets.all(4)
|
||||
: const EdgeInsets.symmetric(horizontal: 12, vertical: 8);
|
||||
return Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
Container(
|
||||
constraints: BoxConstraints(maxWidth: maxWidth * 0.72),
|
||||
decoration: BoxDecoration(
|
||||
color: colors.background,
|
||||
borderRadius: messageBubbleRadius(isOutgoing: isOutgoing),
|
||||
border: Border.all(color: colors.border, width: 1),
|
||||
),
|
||||
child: Padding(
|
||||
padding: isBookmarked
|
||||
? contentPadding.add(
|
||||
EdgeInsets.only(top: compact ? 18 : 14, right: 14),
|
||||
)
|
||||
: contentPadding,
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
if (isBookmarked)
|
||||
const Positioned(
|
||||
top: -2,
|
||||
right: 12,
|
||||
child: Icon(Icons.bookmark, size: 22, color: Color(0xFFFFE54A)),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -407,6 +407,7 @@ void main() {
|
||||
BackupItem.contactGroups,
|
||||
BackupItem.contactHistory,
|
||||
BackupItem.discoveredContacts,
|
||||
BackupItem.bookmarks,
|
||||
BackupItem.channelFilters,
|
||||
BackupItem.channelSettings,
|
||||
BackupItem.communities,
|
||||
@@ -465,4 +466,57 @@ void main() {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
test(
|
||||
'backs up and restores bookmarks separately from discovered contacts',
|
||||
() async {
|
||||
SharedPreferences.setMockInitialValues({});
|
||||
PrefsManager.reset();
|
||||
await PrefsManager.initialize();
|
||||
addTearDown(PrefsManager.reset);
|
||||
final connector = MeshCoreConnector();
|
||||
addTearDown(connector.dispose);
|
||||
await connector.connectReview();
|
||||
final settingsService = AppSettingsService();
|
||||
addTearDown(settingsService.dispose);
|
||||
final prefix = connector.selfPublicKeyHex.substring(0, 10);
|
||||
final bookmarkKey = 'message_bookmarks_$prefix';
|
||||
final discoveredKey = 'discovered_contacts_$prefix';
|
||||
final bookmarks = [
|
||||
{'messageId': 'saved', 'text': 'saved message'},
|
||||
];
|
||||
await PrefsManager.instance.setString(bookmarkKey, jsonEncode(bookmarks));
|
||||
await PrefsManager.instance.setString(discoveredKey, 'keep discovered');
|
||||
|
||||
final backup = await const BackupService().createBackup(
|
||||
items: {BackupItem.bookmarks},
|
||||
connector: connector,
|
||||
settings: settingsService.settings,
|
||||
password: '',
|
||||
);
|
||||
final payload = jsonDecode(backup) as Map<String, dynamic>;
|
||||
expect(payload['items'], [BackupItem.bookmarks.name]);
|
||||
final discoveredSection =
|
||||
(payload['sections'] as Map<String, dynamic>)['discoveredContacts']
|
||||
as Map<String, dynamic>;
|
||||
final preferences =
|
||||
discoveredSection['preferences'] as Map<String, dynamic>;
|
||||
expect(preferences[bookmarkKey], bookmarks);
|
||||
expect(preferences, isNot(contains(discoveredKey)));
|
||||
|
||||
await PrefsManager.instance.setString(bookmarkKey, '[]');
|
||||
await const BackupService().restoreBackup(
|
||||
contents: backup,
|
||||
password: '',
|
||||
items: {BackupItem.bookmarks},
|
||||
connector: connector,
|
||||
appSettingsService: settingsService,
|
||||
);
|
||||
expect(
|
||||
jsonDecode(PrefsManager.instance.getString(bookmarkKey)!),
|
||||
bookmarks,
|
||||
);
|
||||
expect(PrefsManager.instance.getString(discoveredKey), 'keep discovered');
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:meshcore_open/models/bookmarked_message.dart';
|
||||
import 'package:meshcore_open/models/channel_message.dart';
|
||||
import 'package:meshcore_open/storage/bookmark_store.dart';
|
||||
import 'package:meshcore_open/storage/channel_message_store.dart';
|
||||
import 'package:meshcore_open/storage/prefs_manager.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
const _deviceKey = 'abcdef012345';
|
||||
const _channelId = 'channel-psk-id';
|
||||
|
||||
BookmarkedMessage _bookmark(
|
||||
String id, {
|
||||
BookmarkSourceType type = BookmarkSourceType.contact,
|
||||
}) => BookmarkedMessage(
|
||||
sourceType: type,
|
||||
sourceId: type == BookmarkSourceType.channel ? _channelId : 'contact-key',
|
||||
sourceName: type == BookmarkSourceType.channel ? 'Channel' : 'Contact',
|
||||
messageId: id,
|
||||
senderName: 'Alice',
|
||||
text: 'saved text $id',
|
||||
timestamp: DateTime.fromMillisecondsSinceEpoch(1000),
|
||||
receivedAt: DateTime.fromMillisecondsSinceEpoch(2000),
|
||||
isOutgoing: false,
|
||||
);
|
||||
|
||||
Future<void> _init() async {
|
||||
SharedPreferences.setMockInitialValues({});
|
||||
PrefsManager.reset();
|
||||
await PrefsManager.initialize();
|
||||
}
|
||||
|
||||
void main() {
|
||||
test('bookmarks persist independently of channel history', () async {
|
||||
await _init();
|
||||
final bookmarks = BookmarkStore()..setPublicKeyHex = _deviceKey;
|
||||
final channelHistory = ChannelMessageStore()..setPublicKeyHex = _deviceKey;
|
||||
await bookmarks.saveBookmark(
|
||||
_bookmark('message-1', type: BookmarkSourceType.channel),
|
||||
);
|
||||
await channelHistory.saveChannelMessages(_channelId, [
|
||||
ChannelMessage(
|
||||
senderName: 'Alice',
|
||||
text: 'saved text message-1',
|
||||
timestamp: DateTime.fromMillisecondsSinceEpoch(1000),
|
||||
isOutgoing: false,
|
||||
messageId: 'message-1',
|
||||
),
|
||||
]);
|
||||
|
||||
await channelHistory.clearChannelMessages(_channelId);
|
||||
|
||||
final loaded = await bookmarks.loadBookmarks();
|
||||
expect(loaded, hasLength(1));
|
||||
expect(loaded.single.text, 'saved text message-1');
|
||||
expect(loaded.single.sourceName, 'Channel');
|
||||
});
|
||||
|
||||
test('bookmarks are isolated by radio and can be removed', () async {
|
||||
await _init();
|
||||
final store = BookmarkStore()..setPublicKeyHex = _deviceKey;
|
||||
final bookmark = _bookmark('message-1');
|
||||
await store.saveBookmark(bookmark);
|
||||
|
||||
store.setPublicKeyHex = '123456789abc';
|
||||
expect(await store.loadBookmarks(), isEmpty);
|
||||
|
||||
store.setPublicKeyHex = _deviceKey;
|
||||
await store.removeBookmark(bookmark);
|
||||
expect(await store.loadBookmarks(), isEmpty);
|
||||
});
|
||||
|
||||
test('queued saves retain bookmarks added together', () async {
|
||||
await _init();
|
||||
final store = BookmarkStore()..setPublicKeyHex = _deviceKey;
|
||||
|
||||
await Future.wait([
|
||||
store.saveBookmark(_bookmark('one')),
|
||||
store.saveBookmark(_bookmark('two')),
|
||||
]);
|
||||
|
||||
expect(
|
||||
(await store.loadBookmarks()).map((bookmark) => bookmark.messageId),
|
||||
['one', 'two'],
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -191,6 +191,19 @@ void main() {
|
||||
expect(reloaded.single.text, 'hi');
|
||||
expect(reloaded.single.reactionStatuses, {'😀': MessageStatus.values[1]});
|
||||
});
|
||||
|
||||
test('bookmark flags update in archived contact history', () async {
|
||||
await _init();
|
||||
final store = _messageStore();
|
||||
await store.saveMessages(_contact, [_dm(0)]);
|
||||
store.setArchivedCount(_contact, 1);
|
||||
|
||||
await store.updateBookmarkFlag(_contact, 'id0', true);
|
||||
expect((await store.loadMessages(_contact)).single.isBookmarked, isTrue);
|
||||
|
||||
await store.updateBookmarkFlag(_contact, 'id0', false);
|
||||
expect((await store.loadMessages(_contact)).single.isBookmarked, isFalse);
|
||||
});
|
||||
});
|
||||
|
||||
group('ChannelMessageStore window persistence', () {
|
||||
@@ -224,6 +237,25 @@ void main() {
|
||||
final reloaded = await store.loadChannelMessages(_channelId);
|
||||
expect(reloaded.map((m) => m.text), ['c3']);
|
||||
});
|
||||
|
||||
test('bookmark flags update in archived channel history', () async {
|
||||
await _init();
|
||||
final store = ChannelMessageStore()..setPublicKeyHex = _device;
|
||||
await store.saveChannelMessages(_channelId, [_ch(0)]);
|
||||
store.setArchivedCount(_channelId, 1);
|
||||
|
||||
await store.updateBookmarkFlag(_channelId, 'cid0', true);
|
||||
expect(
|
||||
(await store.loadChannelMessages(_channelId)).single.isBookmarked,
|
||||
isTrue,
|
||||
);
|
||||
|
||||
await store.updateBookmarkFlag(_channelId, 'cid0', false);
|
||||
expect(
|
||||
(await store.loadChannelMessages(_channelId)).single.isBookmarked,
|
||||
isFalse,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
group('Smaz.tryDecodePrefixed', () {
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:meshcore_open/helpers/message_url_image_helper.dart';
|
||||
import 'package:meshcore_open/models/bookmarked_message.dart';
|
||||
import 'package:meshcore_open/utils/bookmark_markdown_export.dart';
|
||||
|
||||
BookmarkedMessage _bookmark({
|
||||
required BookmarkSourceType type,
|
||||
required String sourceId,
|
||||
required String sourceName,
|
||||
required String id,
|
||||
required String text,
|
||||
required int hour,
|
||||
String? translatedText,
|
||||
}) {
|
||||
final date = DateTime(2026, 11, 12, hour);
|
||||
return BookmarkedMessage(
|
||||
sourceType: type,
|
||||
sourceId: sourceId,
|
||||
sourceName: sourceName,
|
||||
messageId: id,
|
||||
senderName: 'Alex',
|
||||
text: text,
|
||||
translatedText: translatedText,
|
||||
timestamp: date,
|
||||
receivedAt: date,
|
||||
isOutgoing: false,
|
||||
);
|
||||
}
|
||||
|
||||
void main() {
|
||||
test('exports grouped bookmarks oldest-to-newest with valid links', () async {
|
||||
final previousSetting = MessageUrlImageHelper.loadLinkImages.value;
|
||||
MessageUrlImageHelper.loadLinkImages.value = false;
|
||||
addTearDown(() {
|
||||
MessageUrlImageHelper.loadLinkImages.value = previousSetting;
|
||||
});
|
||||
|
||||
final markdown = await buildBookmarksMarkdown(
|
||||
[
|
||||
_bookmark(
|
||||
type: BookmarkSourceType.channel,
|
||||
sourceId: 'channel-1',
|
||||
sourceName: '#flachwitze',
|
||||
id: 'channel-image',
|
||||
text: 'See https://example.com/info and ipfs://bafyimage',
|
||||
hour: 15,
|
||||
),
|
||||
_bookmark(
|
||||
type: BookmarkSourceType.contact,
|
||||
sourceId: 'contact-b',
|
||||
sourceName: 'Bob',
|
||||
id: 'bob',
|
||||
text: 'Bob message',
|
||||
hour: 13,
|
||||
),
|
||||
_bookmark(
|
||||
type: BookmarkSourceType.contact,
|
||||
sourceId: 'contact-a',
|
||||
sourceName: 'Alice',
|
||||
id: 'alice-new',
|
||||
text: 'Contact newest',
|
||||
hour: 14,
|
||||
),
|
||||
_bookmark(
|
||||
type: BookmarkSourceType.contact,
|
||||
sourceId: 'contact-a',
|
||||
sourceName: 'Alice',
|
||||
id: 'alice-old',
|
||||
text: ' *Contact oldest* ',
|
||||
hour: 12,
|
||||
translatedText: 'Oldest translation',
|
||||
),
|
||||
],
|
||||
publicGateway: 'https://gateway.example/ipfs/',
|
||||
exportedAt: DateTime(2026, 11, 13, 15, 20),
|
||||
);
|
||||
|
||||
expect(markdown, contains('# MeshCore-Open Bookmarks'));
|
||||
expect(markdown, contains('Exported: 2026-11-13'));
|
||||
expect(markdown, contains('## Contacts'));
|
||||
expect(markdown, contains('## Channels'));
|
||||
expect(markdown, contains('### #flachwitze'));
|
||||
expect(
|
||||
markdown,
|
||||
contains('[https://example.com/info](https://example.com/info)'),
|
||||
);
|
||||
expect(
|
||||
markdown,
|
||||
contains(''),
|
||||
);
|
||||
expect(
|
||||
markdown,
|
||||
contains('[Image URL](https://gateway.example/ipfs/bafyimage)'),
|
||||
);
|
||||
expect(markdown, isNot(contains('<https://')));
|
||||
expect(markdown, contains('*Contact oldest*\nOldest translation'));
|
||||
expect(markdown, isNot(contains('*Contact oldest* ')));
|
||||
expect(markdown, isNot(contains('Translation:')));
|
||||
expect(
|
||||
markdown.indexOf('Contact oldest'),
|
||||
lessThan(markdown.indexOf('Contact newest')),
|
||||
);
|
||||
expect(
|
||||
markdown.indexOf('## Contacts'),
|
||||
lessThan(markdown.indexOf('## Channels')),
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -1,5 +1,306 @@
|
||||
{
|
||||
"bg": [
|
||||
"backupRestore_bookmarks",
|
||||
"chat_bookmark",
|
||||
"chat_removeBookmark",
|
||||
"chat_showBookmarks",
|
||||
"bookmarks_title",
|
||||
"bookmarks_empty",
|
||||
"bookmarks_channel",
|
||||
"bookmarks_contact",
|
||||
"bookmarks_remove",
|
||||
"settings_exportBookmarks",
|
||||
"settings_exportBookmarksSubtitle",
|
||||
"settings_exportBookmarksSuccess",
|
||||
"settings_exportBookmarksNoBookmarks"
|
||||
],
|
||||
|
||||
"cs": [
|
||||
"backupRestore_bookmarks",
|
||||
"chat_bookmark",
|
||||
"chat_removeBookmark",
|
||||
"chat_showBookmarks",
|
||||
"bookmarks_title",
|
||||
"bookmarks_empty",
|
||||
"bookmarks_channel",
|
||||
"bookmarks_contact",
|
||||
"bookmarks_remove",
|
||||
"settings_exportBookmarks",
|
||||
"settings_exportBookmarksSubtitle",
|
||||
"settings_exportBookmarksSuccess",
|
||||
"settings_exportBookmarksNoBookmarks"
|
||||
],
|
||||
|
||||
"de": [
|
||||
"backupRestore_bookmarks",
|
||||
"chat_bookmark",
|
||||
"chat_removeBookmark",
|
||||
"chat_showBookmarks",
|
||||
"bookmarks_title",
|
||||
"bookmarks_empty",
|
||||
"bookmarks_channel",
|
||||
"bookmarks_contact",
|
||||
"bookmarks_remove",
|
||||
"settings_exportBookmarks",
|
||||
"settings_exportBookmarksSubtitle",
|
||||
"settings_exportBookmarksSuccess",
|
||||
"settings_exportBookmarksNoBookmarks"
|
||||
],
|
||||
|
||||
"es": [
|
||||
"backupRestore_bookmarks",
|
||||
"chat_bookmark",
|
||||
"chat_removeBookmark",
|
||||
"chat_showBookmarks",
|
||||
"bookmarks_title",
|
||||
"bookmarks_empty",
|
||||
"bookmarks_channel",
|
||||
"bookmarks_contact",
|
||||
"bookmarks_remove",
|
||||
"settings_exportBookmarks",
|
||||
"settings_exportBookmarksSubtitle",
|
||||
"settings_exportBookmarksSuccess",
|
||||
"settings_exportBookmarksNoBookmarks"
|
||||
],
|
||||
|
||||
"fr": [
|
||||
"backupRestore_bookmarks",
|
||||
"chat_bookmark",
|
||||
"chat_removeBookmark",
|
||||
"chat_showBookmarks",
|
||||
"bookmarks_title",
|
||||
"bookmarks_empty",
|
||||
"bookmarks_channel",
|
||||
"bookmarks_contact",
|
||||
"bookmarks_remove",
|
||||
"settings_exportBookmarks",
|
||||
"settings_exportBookmarksSubtitle",
|
||||
"settings_exportBookmarksSuccess",
|
||||
"settings_exportBookmarksNoBookmarks"
|
||||
],
|
||||
|
||||
"hu": [
|
||||
"backupRestore_bookmarks",
|
||||
"chat_bookmark",
|
||||
"chat_removeBookmark",
|
||||
"chat_showBookmarks",
|
||||
"bookmarks_title",
|
||||
"bookmarks_empty",
|
||||
"bookmarks_channel",
|
||||
"bookmarks_contact",
|
||||
"bookmarks_remove",
|
||||
"settings_exportBookmarks",
|
||||
"settings_exportBookmarksSubtitle",
|
||||
"settings_exportBookmarksSuccess",
|
||||
"settings_exportBookmarksNoBookmarks"
|
||||
],
|
||||
|
||||
"it": [
|
||||
"backupRestore_bookmarks",
|
||||
"chat_bookmark",
|
||||
"chat_removeBookmark",
|
||||
"chat_showBookmarks",
|
||||
"bookmarks_title",
|
||||
"bookmarks_empty",
|
||||
"bookmarks_channel",
|
||||
"bookmarks_contact",
|
||||
"bookmarks_remove",
|
||||
"settings_exportBookmarks",
|
||||
"settings_exportBookmarksSubtitle",
|
||||
"settings_exportBookmarksSuccess",
|
||||
"settings_exportBookmarksNoBookmarks"
|
||||
],
|
||||
|
||||
"ja": [
|
||||
"backupRestore_bookmarks",
|
||||
"chat_bookmark",
|
||||
"chat_removeBookmark",
|
||||
"chat_showBookmarks",
|
||||
"bookmarks_title",
|
||||
"bookmarks_empty",
|
||||
"bookmarks_channel",
|
||||
"bookmarks_contact",
|
||||
"bookmarks_remove",
|
||||
"settings_exportBookmarks",
|
||||
"settings_exportBookmarksSubtitle",
|
||||
"settings_exportBookmarksSuccess",
|
||||
"settings_exportBookmarksNoBookmarks"
|
||||
],
|
||||
|
||||
"ko": [
|
||||
"backupRestore_bookmarks",
|
||||
"chat_bookmark",
|
||||
"chat_removeBookmark",
|
||||
"chat_showBookmarks",
|
||||
"bookmarks_title",
|
||||
"bookmarks_empty",
|
||||
"bookmarks_channel",
|
||||
"bookmarks_contact",
|
||||
"bookmarks_remove",
|
||||
"settings_exportBookmarks",
|
||||
"settings_exportBookmarksSubtitle",
|
||||
"settings_exportBookmarksSuccess",
|
||||
"settings_exportBookmarksNoBookmarks"
|
||||
],
|
||||
|
||||
"nl": [
|
||||
"backupRestore_bookmarks",
|
||||
"chat_bookmark",
|
||||
"chat_removeBookmark",
|
||||
"chat_showBookmarks",
|
||||
"bookmarks_title",
|
||||
"bookmarks_empty",
|
||||
"bookmarks_channel",
|
||||
"bookmarks_contact",
|
||||
"bookmarks_remove",
|
||||
"settings_exportBookmarks",
|
||||
"settings_exportBookmarksSubtitle",
|
||||
"settings_exportBookmarksSuccess",
|
||||
"settings_exportBookmarksNoBookmarks"
|
||||
],
|
||||
|
||||
"pl": [
|
||||
"backupRestore_bookmarks",
|
||||
"chat_bookmark",
|
||||
"chat_removeBookmark",
|
||||
"chat_showBookmarks",
|
||||
"bookmarks_title",
|
||||
"bookmarks_empty",
|
||||
"bookmarks_channel",
|
||||
"bookmarks_contact",
|
||||
"bookmarks_remove",
|
||||
"settings_exportBookmarks",
|
||||
"settings_exportBookmarksSubtitle",
|
||||
"settings_exportBookmarksSuccess",
|
||||
"settings_exportBookmarksNoBookmarks"
|
||||
],
|
||||
|
||||
"pt": [
|
||||
"backupRestore_bookmarks",
|
||||
"chat_bookmark",
|
||||
"chat_removeBookmark",
|
||||
"chat_showBookmarks",
|
||||
"bookmarks_title",
|
||||
"bookmarks_empty",
|
||||
"bookmarks_channel",
|
||||
"bookmarks_contact",
|
||||
"bookmarks_remove",
|
||||
"settings_exportBookmarks",
|
||||
"settings_exportBookmarksSubtitle",
|
||||
"settings_exportBookmarksSuccess",
|
||||
"settings_exportBookmarksNoBookmarks"
|
||||
],
|
||||
|
||||
"pt_PT": [
|
||||
"backupRestore_bookmarks",
|
||||
"chat_bookmark",
|
||||
"chat_removeBookmark",
|
||||
"chat_showBookmarks",
|
||||
"bookmarks_title",
|
||||
"bookmarks_empty",
|
||||
"bookmarks_channel",
|
||||
"bookmarks_contact",
|
||||
"bookmarks_remove",
|
||||
"settings_exportBookmarks",
|
||||
"settings_exportBookmarksSubtitle",
|
||||
"settings_exportBookmarksSuccess",
|
||||
"settings_exportBookmarksNoBookmarks"
|
||||
],
|
||||
|
||||
"ru": [
|
||||
"backupRestore_bookmarks",
|
||||
"chat_bookmark",
|
||||
"chat_removeBookmark",
|
||||
"chat_showBookmarks",
|
||||
"bookmarks_title",
|
||||
"bookmarks_empty",
|
||||
"bookmarks_channel",
|
||||
"bookmarks_contact",
|
||||
"bookmarks_remove",
|
||||
"settings_exportBookmarks",
|
||||
"settings_exportBookmarksSubtitle",
|
||||
"settings_exportBookmarksSuccess",
|
||||
"settings_exportBookmarksNoBookmarks"
|
||||
],
|
||||
|
||||
"sk": [
|
||||
"backupRestore_bookmarks",
|
||||
"chat_bookmark",
|
||||
"chat_removeBookmark",
|
||||
"chat_showBookmarks",
|
||||
"bookmarks_title",
|
||||
"bookmarks_empty",
|
||||
"bookmarks_channel",
|
||||
"bookmarks_contact",
|
||||
"bookmarks_remove",
|
||||
"settings_exportBookmarks",
|
||||
"settings_exportBookmarksSubtitle",
|
||||
"settings_exportBookmarksSuccess",
|
||||
"settings_exportBookmarksNoBookmarks"
|
||||
],
|
||||
|
||||
"sl": [
|
||||
"backupRestore_bookmarks",
|
||||
"chat_bookmark",
|
||||
"chat_removeBookmark",
|
||||
"chat_showBookmarks",
|
||||
"bookmarks_title",
|
||||
"bookmarks_empty",
|
||||
"bookmarks_channel",
|
||||
"bookmarks_contact",
|
||||
"bookmarks_remove",
|
||||
"settings_exportBookmarks",
|
||||
"settings_exportBookmarksSubtitle",
|
||||
"settings_exportBookmarksSuccess",
|
||||
"settings_exportBookmarksNoBookmarks"
|
||||
],
|
||||
|
||||
"sv": [
|
||||
"backupRestore_bookmarks",
|
||||
"chat_bookmark",
|
||||
"chat_removeBookmark",
|
||||
"chat_showBookmarks",
|
||||
"bookmarks_title",
|
||||
"bookmarks_empty",
|
||||
"bookmarks_channel",
|
||||
"bookmarks_contact",
|
||||
"bookmarks_remove",
|
||||
"settings_exportBookmarks",
|
||||
"settings_exportBookmarksSubtitle",
|
||||
"settings_exportBookmarksSuccess",
|
||||
"settings_exportBookmarksNoBookmarks"
|
||||
],
|
||||
|
||||
"uk": [
|
||||
"backupRestore_bookmarks",
|
||||
"chat_bookmark",
|
||||
"chat_removeBookmark",
|
||||
"chat_showBookmarks",
|
||||
"bookmarks_title",
|
||||
"bookmarks_empty",
|
||||
"bookmarks_channel",
|
||||
"bookmarks_contact",
|
||||
"bookmarks_remove",
|
||||
"settings_exportBookmarks",
|
||||
"settings_exportBookmarksSubtitle",
|
||||
"settings_exportBookmarksSuccess",
|
||||
"settings_exportBookmarksNoBookmarks"
|
||||
],
|
||||
|
||||
"zh": [
|
||||
"backupRestore_bookmarks",
|
||||
"chat_bookmark",
|
||||
"chat_removeBookmark",
|
||||
"chat_showBookmarks",
|
||||
"bookmarks_title",
|
||||
"bookmarks_empty",
|
||||
"bookmarks_channel",
|
||||
"bookmarks_contact",
|
||||
"bookmarks_remove",
|
||||
"settings_exportBookmarks",
|
||||
"settings_exportBookmarksSubtitle",
|
||||
"settings_exportBookmarksSuccess",
|
||||
"settings_exportBookmarksNoBookmarks"
|
||||
"receivedImage_packetEchoes",
|
||||
"receivedImage_recoveryPacketEchoes",
|
||||
"imageSend_preparingPreview",
|
||||
|
||||
Reference in new issue
Block a user