From aae2bf6d6062020bb14bc251a4ed2db2f33e9e12 Mon Sep 17 00:00:00 2001 From: ericz Date: Sun, 8 Nov 2026 00:40:23 +0100 Subject: [PATCH 01/16] Backup&Restore --- documentation/README.md | 2 +- documentation/settings.md | 16 +- lib/connector/meshcore_connector.dart | 30 + lib/connector/meshcore_protocol.dart | 14 + lib/connector/pending_command_replies.dart | 16 + lib/l10n/app_en.arb | 35 ++ lib/l10n/app_localizations.dart | 180 ++++++ lib/l10n/app_localizations_bg.dart | 103 ++++ lib/l10n/app_localizations_de.dart | 103 ++++ lib/l10n/app_localizations_en.dart | 103 ++++ lib/l10n/app_localizations_es.dart | 103 ++++ lib/l10n/app_localizations_fr.dart | 103 ++++ lib/l10n/app_localizations_hu.dart | 103 ++++ lib/l10n/app_localizations_it.dart | 103 ++++ lib/l10n/app_localizations_ja.dart | 103 ++++ lib/l10n/app_localizations_ko.dart | 103 ++++ lib/l10n/app_localizations_nl.dart | 103 ++++ lib/l10n/app_localizations_pl.dart | 103 ++++ lib/l10n/app_localizations_pt.dart | 103 ++++ lib/l10n/app_localizations_ru.dart | 103 ++++ lib/l10n/app_localizations_sk.dart | 103 ++++ lib/l10n/app_localizations_sl.dart | 103 ++++ lib/l10n/app_localizations_sv.dart | 103 ++++ lib/l10n/app_localizations_uk.dart | 103 ++++ lib/l10n/app_localizations_zh.dart | 103 ++++ lib/screens/settings_screen.dart | 144 +---- .../meshcore_protocol_strings_test.dart | 20 + .../pending_command_replies_test.dart | 15 + untranslated.json | 563 +++++++++++++++++- 29 files changed, 2769 insertions(+), 120 deletions(-) diff --git a/documentation/README.md b/documentation/README.md index 683894b9..1cb54c80 100644 --- a/documentation/README.md +++ b/documentation/README.md @@ -17,7 +17,7 @@ MeshCore Open is an open-source Flutter client for MeshCore LoRa mesh networking 4. [Chat & Messaging](chat-and-messaging.md) - Direct messages, location sharing, message status, reactions, and retries 5. [Channels](channels.md) - Broadcast channels, communities, channel chat, and auto-resend 6. [Map & Location](map-and-location.md) - Node map, shared pins, path tracing, line-of-sight, and offline caching -7. [Settings](settings.md) - Device settings, app settings, radio configuration, and exports +7. [Settings](settings.md) - Device settings, app settings, radio configuration, backup/restore, and exports 8. [Notifications](notifications.md) - System notifications, replies from watches and Android Auto, unread badges, and notification preferences 9. [Repeater Management](repeater-management.md) - Repeater hub, status, CLI, telemetry, and neighbors 10. [Additional Features](additional-features.md) - GIF picker, localization, debug logs, SMAZ compression, and more diff --git a/documentation/settings.md b/documentation/settings.md index 76fc4f9e..406663c2 100644 --- a/documentation/settings.md +++ b/documentation/settings.md @@ -16,7 +16,7 @@ The settings screen is a scrollable list of cards: 3. [Location](#location) 4. [App Settings](#app-settings) (link to sub-screen) 5. [Actions](#actions) -6. [Export](#export) +6. [Backup & Restore and Export](#export) 7. [Debug](#debug) 8. [About](#about) @@ -206,7 +206,19 @@ One-tap device operations: --- -## Export +## Backup & Restore and Export + +The settings card links to **Backup & Restore** and **Export** subpages. + +### Backup & Restore + +Choose which information to include or restore: node name, identity, radio settings and regions; location, contact and privacy settings; app preferences; contacts and their filters and settings, groups, direct-message and route history; discovered contacts; and channels, filters, communities, settings and history. A radio connection is required to back up or restore radio settings and contact or channel lists. Contact and channel lists are restored to the connected radio; message history and groups are restored in the app. + +Node Settings includes the radio's identity and private key. Some radio firmware does not allow identity backup or restore; the app will let you know if this feature is unavailable. Restoring Node Settings replaces the connected radio's identity after confirmation. + +A password protects the backup file. Leave the password blank to create an unprotected file. Backups may contain your radio's private key, channel keys, messages and saved passwords, so store them carefully. Downloaded models, received image files and cached map tiles are not included. + +### GPX Export Three GPX export options (not available on web): diff --git a/lib/connector/meshcore_connector.dart b/lib/connector/meshcore_connector.dart index 0b8ff9f8..f2f3a132 100644 --- a/lib/connector/meshcore_connector.dart +++ b/lib/connector/meshcore_connector.dart @@ -4334,6 +4334,36 @@ class MeshCoreConnector extends ChangeNotifier { } catch (_) {} } + Future exportPrivateKey() async { + if (!isConnected) throw StateError('Not connected to a MeshCore device'); + final response = Completer(); + final subscription = receivedFrames.listen((frame) { + if (frame.isNotEmpty && + frame[0] == respCodePrivateKey && + !response.isCompleted) { + response.complete(Uint8List.fromList(frame)); + } + }); + try { + await sendFrame(buildExportPrivateKeyFrame(), waitForGenericAck: true); + final frame = await response.future.timeout(const Duration(seconds: 1)); + if (frame.length != 65) { + throw FormatException('Firmware returned an invalid private-key frame'); + } + return Uint8List.fromList(frame.sublist(1)); + } finally { + await subscription.cancel(); + } + } + + Future importPrivateKey(Uint8List keyData) async { + if (!isConnected) throw StateError('Not connected to a MeshCore device'); + await sendFrame( + buildImportPrivateKeyFrame(keyData), + waitForGenericAck: true, + ); + } + /// Sends CMD_SET_RADIO_PARAMS (same arguments as [buildSetRadioParamsFrame]) /// and waits for the reply. Returns false when the firmware rejects it with /// ERR_ILLEGAL_ARG (values out of range, or [clientRepeat] on a frequency diff --git a/lib/connector/meshcore_protocol.dart b/lib/connector/meshcore_protocol.dart index 22476f63..9f14c789 100644 --- a/lib/connector/meshcore_protocol.dart +++ b/lib/connector/meshcore_protocol.dart @@ -195,6 +195,8 @@ const int cmdImportContact = 18; const int cmdReboot = 19; const int cmdGetBattAndStorage = 20; const int cmdDeviceQuery = 22; +const int cmdExportPrivateKey = 23; +const int cmdImportPrivateKey = 24; const int cmdSendLogin = 26; const int cmdSendStatusReq = 27; const int cmdGetContactByKey = 30; @@ -259,6 +261,8 @@ const int respCodeNoMoreMessages = 10; const int respCodeExportContact = 11; const int respCodeBattAndStorage = 12; const int respCodeDeviceInfo = 13; +const int respCodePrivateKey = 14; +const int respCodeDisabled = 15; const int respCodeContactMsgRecvV3 = 16; const int respCodeChannelMsgRecvV3 = 17; const int respCodeChannelInfo = 18; @@ -1087,6 +1091,16 @@ Uint8List buildTraceReq(int tag, int auth, int flag, {Uint8List? payload}) { return writer.toBytes(); } +Uint8List buildExportPrivateKeyFrame() => + Uint8List.fromList([cmdExportPrivateKey]); + +Uint8List buildImportPrivateKeyFrame(Uint8List keyData) { + if (keyData.length != 64) { + throw ArgumentError.value(keyData.length, 'keyData.length', 'must be 64'); + } + return Uint8List.fromList([cmdImportPrivateKey, ...keyData]); +} + // Build a export contact frame // [cmd][pub_key x32 / if empty exports your contact info] Uint8List buildExportContactFrame(Uint8List pubKey) { diff --git a/lib/connector/pending_command_replies.dart b/lib/connector/pending_command_replies.dart index 094846e2..7a11a519 100644 --- a/lib/connector/pending_command_replies.dart +++ b/lib/connector/pending_command_replies.dart @@ -63,6 +63,7 @@ int? replyCodeForCommand(Uint8List data) { case cmdRemoveContact: case cmdShareContact: case cmdImportContact: + case cmdImportPrivateKey: case cmdSetChannel: case cmdSetOtherParams: case cmdSetCustomVar: @@ -95,6 +96,8 @@ int? replyCodeForCommand(Uint8List data) { return respCodeCurrTime; case cmdExportContact: return respCodeExportContact; + case cmdExportPrivateKey: + return respCodePrivateKey; case cmdGetBattAndStorage: return respCodeBattAndStorage; case cmdGetChannel: @@ -180,6 +183,19 @@ class PendingCommandReplies { if (frame.isEmpty) return false; _pruneStale(); final code = frame[0]; + if (code == respCodeDisabled) { + final index = _queue.indexWhere( + (pending) => + pending.commandCode == cmdExportPrivateKey || + pending.commandCode == cmdImportPrivateKey, + ); + if (index < 0) return false; + final pending = _queue.removeAt(index); + pending.completer?.completeError( + UnsupportedError('Private-key transfer is disabled by firmware'), + ); + return true; + } if (code == respCodeOk || code == respCodeErr) return false; final key = code == respCodeContact && frame.length >= 1 + pubKeySize ? frame.sublist(1, 1 + pubKeySize) diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 0d4cbf92..f69db281 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -190,6 +190,41 @@ "settings_deviceInfo": "Device Info", "settings_appSettings": "App Settings", "settings_appSettingsSubtitle": "Notifications, messaging, and map preferences", + "settings_export": "Export", + "settings_exportSubtitle": "Export contacts and repeaters as GPX", + "backupRestore_title": "Backup & Restore", + "backupRestore_subtitle": "Save or restore app data and radio settings", + "backupRestore_import": "Import", + "backupRestore_selectImportFile": "Import File", + "backupRestore_password": "Password (optional)", + "backupRestore_passwordHelp": "A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.", + "backupRestore_items": "Backup and restore items", + "backupRestore_nodeSettings": "Node Settings", + "backupRestore_nodeSettingsDescription": "Device name, private and public keys, radio settings, and regions", + "backupRestore_locationSettings": "Location Settings", + "backupRestore_locationSettingsDescription": "Location, contact settings, and privacy settings", + "backupRestore_appSettings": "App Settings", + "backupRestore_appSettingsDescription": "App preferences and appearance settings", + "backupRestore_contacts": "Contacts", + "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_channels": "Channels", + "backupRestore_channelsDescription": "Channels, channel filters, communities, and message history", + "backupRestore_backup": "Create Backup", + "backupRestore_restore": "Restore Selected", + "backupRestore_backupComplete": "Backup file created.", + "backupRestore_restoreComplete": "Restore complete. Reconnect the radio to refresh its data.", + "backupRestore_failed": "Backup operation failed: {error}", + "@backupRestore_failed": { + "placeholders": { + "error": {"type": "String"} + } + }, + "backupRestore_fileTooLarge": "Backup file is larger than the 100 MB limit.", + "backupRestore_selectAtLeastOne": "Select at least one item.", + "backupRestore_replaceIdentityTitle": "Replace radio identity?", + "backupRestore_replaceIdentityMessage": "Restoring Node Settings replaces the connected radio's private key and changes its identity. Continue only if this is intended.", "settings_nodeSettings": "Node Settings", "settings_nodeName": "Node Name", "settings_nodeNameNotSet": "Not set", diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart index 9f3e8f9f..4b7b8e08 100644 --- a/lib/l10n/app_localizations.dart +++ b/lib/l10n/app_localizations.dart @@ -814,6 +814,186 @@ abstract class AppLocalizations { /// **'Notifications, messaging, and map preferences'** String get settings_appSettingsSubtitle; + /// No description provided for @settings_export. + /// + /// In en, this message translates to: + /// **'Export'** + String get settings_export; + + /// No description provided for @settings_exportSubtitle. + /// + /// In en, this message translates to: + /// **'Export contacts and repeaters as GPX'** + String get settings_exportSubtitle; + + /// No description provided for @backupRestore_title. + /// + /// In en, this message translates to: + /// **'Backup & Restore'** + String get backupRestore_title; + + /// No description provided for @backupRestore_subtitle. + /// + /// In en, this message translates to: + /// **'Save or restore app data and radio settings'** + String get backupRestore_subtitle; + + /// No description provided for @backupRestore_import. + /// + /// In en, this message translates to: + /// **'Import'** + String get backupRestore_import; + + /// No description provided for @backupRestore_selectImportFile. + /// + /// In en, this message translates to: + /// **'Import File'** + String get backupRestore_selectImportFile; + + /// No description provided for @backupRestore_password. + /// + /// In en, this message translates to: + /// **'Password (optional)'** + String get backupRestore_password; + + /// No description provided for @backupRestore_passwordHelp. + /// + /// In en, this message translates to: + /// **'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'** + String get backupRestore_passwordHelp; + + /// No description provided for @backupRestore_items. + /// + /// In en, this message translates to: + /// **'Backup and restore items'** + String get backupRestore_items; + + /// No description provided for @backupRestore_nodeSettings. + /// + /// In en, this message translates to: + /// **'Node Settings'** + String get backupRestore_nodeSettings; + + /// No description provided for @backupRestore_nodeSettingsDescription. + /// + /// In en, this message translates to: + /// **'Device name, private and public keys, radio settings, and regions'** + String get backupRestore_nodeSettingsDescription; + + /// No description provided for @backupRestore_locationSettings. + /// + /// In en, this message translates to: + /// **'Location Settings'** + String get backupRestore_locationSettings; + + /// No description provided for @backupRestore_locationSettingsDescription. + /// + /// In en, this message translates to: + /// **'Location, contact settings, and privacy settings'** + String get backupRestore_locationSettingsDescription; + + /// No description provided for @backupRestore_appSettings. + /// + /// In en, this message translates to: + /// **'App Settings'** + String get backupRestore_appSettings; + + /// No description provided for @backupRestore_appSettingsDescription. + /// + /// In en, this message translates to: + /// **'App preferences and appearance settings'** + String get backupRestore_appSettingsDescription; + + /// No description provided for @backupRestore_contacts. + /// + /// In en, this message translates to: + /// **'Contacts'** + String get backupRestore_contacts; + + /// No description provided for @backupRestore_contactsDescription. + /// + /// In en, this message translates to: + /// **'Contacts, per-contact filters and settings, groups, and message history'** + String get backupRestore_contactsDescription; + + /// No description provided for @backupRestore_discoveredContacts. + /// + /// In en, this message translates to: + /// **'Discovered Contacts'** + String get backupRestore_discoveredContacts; + + /// No description provided for @backupRestore_discoveredContactsDescription. + /// + /// In en, this message translates to: + /// **'Discovered contacts and their saved details'** + String get backupRestore_discoveredContactsDescription; + + /// No description provided for @backupRestore_channels. + /// + /// In en, this message translates to: + /// **'Channels'** + String get backupRestore_channels; + + /// No description provided for @backupRestore_channelsDescription. + /// + /// In en, this message translates to: + /// **'Channels, channel filters, communities, and message history'** + String get backupRestore_channelsDescription; + + /// No description provided for @backupRestore_backup. + /// + /// In en, this message translates to: + /// **'Create Backup'** + String get backupRestore_backup; + + /// No description provided for @backupRestore_restore. + /// + /// In en, this message translates to: + /// **'Restore Selected'** + String get backupRestore_restore; + + /// No description provided for @backupRestore_backupComplete. + /// + /// In en, this message translates to: + /// **'Backup file created.'** + String get backupRestore_backupComplete; + + /// No description provided for @backupRestore_restoreComplete. + /// + /// In en, this message translates to: + /// **'Restore complete. Reconnect the radio to refresh its data.'** + String get backupRestore_restoreComplete; + + /// No description provided for @backupRestore_failed. + /// + /// In en, this message translates to: + /// **'Backup operation failed: {error}'** + String backupRestore_failed(String error); + + /// No description provided for @backupRestore_fileTooLarge. + /// + /// In en, this message translates to: + /// **'Backup file is larger than the 100 MB limit.'** + String get backupRestore_fileTooLarge; + + /// No description provided for @backupRestore_selectAtLeastOne. + /// + /// In en, this message translates to: + /// **'Select at least one item.'** + String get backupRestore_selectAtLeastOne; + + /// No description provided for @backupRestore_replaceIdentityTitle. + /// + /// In en, this message translates to: + /// **'Replace radio identity?'** + String get backupRestore_replaceIdentityTitle; + + /// No description provided for @backupRestore_replaceIdentityMessage. + /// + /// In en, this message translates to: + /// **'Restoring Node Settings replaces the connected radio\'s private key and changes its identity. Continue only if this is intended.'** + String get backupRestore_replaceIdentityMessage; + /// No description provided for @settings_nodeSettings. /// /// In en, this message translates to: diff --git a/lib/l10n/app_localizations_bg.dart b/lib/l10n/app_localizations_bg.dart index 435c6fdf..1c6f29f0 100644 --- a/lib/l10n/app_localizations_bg.dart +++ b/lib/l10n/app_localizations_bg.dart @@ -399,6 +399,109 @@ class AppLocalizationsBg extends AppLocalizations { String get settings_appSettingsSubtitle => 'Уведомления, съобщения и предпочитания за карта'; + @override + String get settings_export => 'Export'; + + @override + String get settings_exportSubtitle => 'Export contacts and repeaters as GPX'; + + @override + String get backupRestore_title => 'Backup & Restore'; + + @override + String get backupRestore_subtitle => + 'Save or restore app data and radio settings'; + + @override + String get backupRestore_import => 'Import'; + + @override + String get backupRestore_selectImportFile => 'Import File'; + + @override + String get backupRestore_password => 'Password (optional)'; + + @override + String get backupRestore_passwordHelp => + 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + + @override + String get backupRestore_items => 'Backup and restore items'; + + @override + String get backupRestore_nodeSettings => 'Node Settings'; + + @override + String get backupRestore_nodeSettingsDescription => + 'Device name, private and public keys, radio settings, and regions'; + + @override + String get backupRestore_locationSettings => 'Location Settings'; + + @override + String get backupRestore_locationSettingsDescription => + 'Location, contact settings, and privacy settings'; + + @override + String get backupRestore_appSettings => 'App Settings'; + + @override + String get backupRestore_appSettingsDescription => + 'App preferences and appearance settings'; + + @override + String get backupRestore_contacts => 'Contacts'; + + @override + String get backupRestore_contactsDescription => + 'Contacts, per-contact filters and settings, groups, and message history'; + + @override + String get backupRestore_discoveredContacts => 'Discovered Contacts'; + + @override + String get backupRestore_discoveredContactsDescription => + 'Discovered contacts and their saved details'; + + @override + String get backupRestore_channels => 'Channels'; + + @override + String get backupRestore_channelsDescription => + 'Channels, channel filters, communities, and message history'; + + @override + String get backupRestore_backup => 'Create Backup'; + + @override + String get backupRestore_restore => 'Restore Selected'; + + @override + String get backupRestore_backupComplete => 'Backup file created.'; + + @override + String get backupRestore_restoreComplete => + 'Restore complete. Reconnect the radio to refresh its data.'; + + @override + String backupRestore_failed(String error) { + return 'Backup operation failed: $error'; + } + + @override + String get backupRestore_fileTooLarge => + 'Backup file is larger than the 100 MB limit.'; + + @override + String get backupRestore_selectAtLeastOne => 'Select at least one item.'; + + @override + String get backupRestore_replaceIdentityTitle => 'Replace radio identity?'; + + @override + String get backupRestore_replaceIdentityMessage => + 'Restoring Node Settings replaces the connected radio\'s private key and changes its identity. Continue only if this is intended.'; + @override String get settings_nodeSettings => 'Настройки на възела'; diff --git a/lib/l10n/app_localizations_de.dart b/lib/l10n/app_localizations_de.dart index c0a36e3d..93d4740c 100644 --- a/lib/l10n/app_localizations_de.dart +++ b/lib/l10n/app_localizations_de.dart @@ -402,6 +402,109 @@ class AppLocalizationsDe extends AppLocalizations { String get settings_appSettingsSubtitle => 'Benachrichtigungen, Nachrichten und Karten-Einstellungen'; + @override + String get settings_export => 'Export'; + + @override + String get settings_exportSubtitle => 'Export contacts and repeaters as GPX'; + + @override + String get backupRestore_title => 'Backup & Restore'; + + @override + String get backupRestore_subtitle => + 'Save or restore app data and radio settings'; + + @override + String get backupRestore_import => 'Import'; + + @override + String get backupRestore_selectImportFile => 'Import File'; + + @override + String get backupRestore_password => 'Password (optional)'; + + @override + String get backupRestore_passwordHelp => + 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + + @override + String get backupRestore_items => 'Backup and restore items'; + + @override + String get backupRestore_nodeSettings => 'Node Settings'; + + @override + String get backupRestore_nodeSettingsDescription => + 'Device name, private and public keys, radio settings, and regions'; + + @override + String get backupRestore_locationSettings => 'Location Settings'; + + @override + String get backupRestore_locationSettingsDescription => + 'Location, contact settings, and privacy settings'; + + @override + String get backupRestore_appSettings => 'App Settings'; + + @override + String get backupRestore_appSettingsDescription => + 'App preferences and appearance settings'; + + @override + String get backupRestore_contacts => 'Contacts'; + + @override + String get backupRestore_contactsDescription => + 'Contacts, per-contact filters and settings, groups, and message history'; + + @override + String get backupRestore_discoveredContacts => 'Discovered Contacts'; + + @override + String get backupRestore_discoveredContactsDescription => + 'Discovered contacts and their saved details'; + + @override + String get backupRestore_channels => 'Channels'; + + @override + String get backupRestore_channelsDescription => + 'Channels, channel filters, communities, and message history'; + + @override + String get backupRestore_backup => 'Create Backup'; + + @override + String get backupRestore_restore => 'Restore Selected'; + + @override + String get backupRestore_backupComplete => 'Backup file created.'; + + @override + String get backupRestore_restoreComplete => + 'Restore complete. Reconnect the radio to refresh its data.'; + + @override + String backupRestore_failed(String error) { + return 'Backup operation failed: $error'; + } + + @override + String get backupRestore_fileTooLarge => + 'Backup file is larger than the 100 MB limit.'; + + @override + String get backupRestore_selectAtLeastOne => 'Select at least one item.'; + + @override + String get backupRestore_replaceIdentityTitle => 'Replace radio identity?'; + + @override + String get backupRestore_replaceIdentityMessage => + 'Restoring Node Settings replaces the connected radio\'s private key and changes its identity. Continue only if this is intended.'; + @override String get settings_nodeSettings => 'Knoteneinstellungen'; diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart index 8ff30407..398c66dc 100644 --- a/lib/l10n/app_localizations_en.dart +++ b/lib/l10n/app_localizations_en.dart @@ -395,6 +395,109 @@ class AppLocalizationsEn extends AppLocalizations { String get settings_appSettingsSubtitle => 'Notifications, messaging, and map preferences'; + @override + String get settings_export => 'Export'; + + @override + String get settings_exportSubtitle => 'Export contacts and repeaters as GPX'; + + @override + String get backupRestore_title => 'Backup & Restore'; + + @override + String get backupRestore_subtitle => + 'Save or restore app data and radio settings'; + + @override + String get backupRestore_import => 'Import'; + + @override + String get backupRestore_selectImportFile => 'Import File'; + + @override + String get backupRestore_password => 'Password (optional)'; + + @override + String get backupRestore_passwordHelp => + 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + + @override + String get backupRestore_items => 'Backup and restore items'; + + @override + String get backupRestore_nodeSettings => 'Node Settings'; + + @override + String get backupRestore_nodeSettingsDescription => + 'Device name, private and public keys, radio settings, and regions'; + + @override + String get backupRestore_locationSettings => 'Location Settings'; + + @override + String get backupRestore_locationSettingsDescription => + 'Location, contact settings, and privacy settings'; + + @override + String get backupRestore_appSettings => 'App Settings'; + + @override + String get backupRestore_appSettingsDescription => + 'App preferences and appearance settings'; + + @override + String get backupRestore_contacts => 'Contacts'; + + @override + String get backupRestore_contactsDescription => + 'Contacts, per-contact filters and settings, groups, and message history'; + + @override + String get backupRestore_discoveredContacts => 'Discovered Contacts'; + + @override + String get backupRestore_discoveredContactsDescription => + 'Discovered contacts and their saved details'; + + @override + String get backupRestore_channels => 'Channels'; + + @override + String get backupRestore_channelsDescription => + 'Channels, channel filters, communities, and message history'; + + @override + String get backupRestore_backup => 'Create Backup'; + + @override + String get backupRestore_restore => 'Restore Selected'; + + @override + String get backupRestore_backupComplete => 'Backup file created.'; + + @override + String get backupRestore_restoreComplete => + 'Restore complete. Reconnect the radio to refresh its data.'; + + @override + String backupRestore_failed(String error) { + return 'Backup operation failed: $error'; + } + + @override + String get backupRestore_fileTooLarge => + 'Backup file is larger than the 100 MB limit.'; + + @override + String get backupRestore_selectAtLeastOne => 'Select at least one item.'; + + @override + String get backupRestore_replaceIdentityTitle => 'Replace radio identity?'; + + @override + String get backupRestore_replaceIdentityMessage => + 'Restoring Node Settings replaces the connected radio\'s private key and changes its identity. Continue only if this is intended.'; + @override String get settings_nodeSettings => 'Node Settings'; diff --git a/lib/l10n/app_localizations_es.dart b/lib/l10n/app_localizations_es.dart index ed0cdfb7..a6762562 100644 --- a/lib/l10n/app_localizations_es.dart +++ b/lib/l10n/app_localizations_es.dart @@ -400,6 +400,109 @@ class AppLocalizationsEs extends AppLocalizations { String get settings_appSettingsSubtitle => 'Notificaciones, mensajes y preferencias de mapa'; + @override + String get settings_export => 'Export'; + + @override + String get settings_exportSubtitle => 'Export contacts and repeaters as GPX'; + + @override + String get backupRestore_title => 'Backup & Restore'; + + @override + String get backupRestore_subtitle => + 'Save or restore app data and radio settings'; + + @override + String get backupRestore_import => 'Import'; + + @override + String get backupRestore_selectImportFile => 'Import File'; + + @override + String get backupRestore_password => 'Password (optional)'; + + @override + String get backupRestore_passwordHelp => + 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + + @override + String get backupRestore_items => 'Backup and restore items'; + + @override + String get backupRestore_nodeSettings => 'Node Settings'; + + @override + String get backupRestore_nodeSettingsDescription => + 'Device name, private and public keys, radio settings, and regions'; + + @override + String get backupRestore_locationSettings => 'Location Settings'; + + @override + String get backupRestore_locationSettingsDescription => + 'Location, contact settings, and privacy settings'; + + @override + String get backupRestore_appSettings => 'App Settings'; + + @override + String get backupRestore_appSettingsDescription => + 'App preferences and appearance settings'; + + @override + String get backupRestore_contacts => 'Contacts'; + + @override + String get backupRestore_contactsDescription => + 'Contacts, per-contact filters and settings, groups, and message history'; + + @override + String get backupRestore_discoveredContacts => 'Discovered Contacts'; + + @override + String get backupRestore_discoveredContactsDescription => + 'Discovered contacts and their saved details'; + + @override + String get backupRestore_channels => 'Channels'; + + @override + String get backupRestore_channelsDescription => + 'Channels, channel filters, communities, and message history'; + + @override + String get backupRestore_backup => 'Create Backup'; + + @override + String get backupRestore_restore => 'Restore Selected'; + + @override + String get backupRestore_backupComplete => 'Backup file created.'; + + @override + String get backupRestore_restoreComplete => + 'Restore complete. Reconnect the radio to refresh its data.'; + + @override + String backupRestore_failed(String error) { + return 'Backup operation failed: $error'; + } + + @override + String get backupRestore_fileTooLarge => + 'Backup file is larger than the 100 MB limit.'; + + @override + String get backupRestore_selectAtLeastOne => 'Select at least one item.'; + + @override + String get backupRestore_replaceIdentityTitle => 'Replace radio identity?'; + + @override + String get backupRestore_replaceIdentityMessage => + 'Restoring Node Settings replaces the connected radio\'s private key and changes its identity. Continue only if this is intended.'; + @override String get settings_nodeSettings => 'Configuración del Nodo'; diff --git a/lib/l10n/app_localizations_fr.dart b/lib/l10n/app_localizations_fr.dart index a8fcec54..06b802f3 100644 --- a/lib/l10n/app_localizations_fr.dart +++ b/lib/l10n/app_localizations_fr.dart @@ -402,6 +402,109 @@ class AppLocalizationsFr extends AppLocalizations { String get settings_appSettingsSubtitle => 'Notifications, messagerie et préférences de carte'; + @override + String get settings_export => 'Export'; + + @override + String get settings_exportSubtitle => 'Export contacts and repeaters as GPX'; + + @override + String get backupRestore_title => 'Backup & Restore'; + + @override + String get backupRestore_subtitle => + 'Save or restore app data and radio settings'; + + @override + String get backupRestore_import => 'Import'; + + @override + String get backupRestore_selectImportFile => 'Import File'; + + @override + String get backupRestore_password => 'Password (optional)'; + + @override + String get backupRestore_passwordHelp => + 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + + @override + String get backupRestore_items => 'Backup and restore items'; + + @override + String get backupRestore_nodeSettings => 'Node Settings'; + + @override + String get backupRestore_nodeSettingsDescription => + 'Device name, private and public keys, radio settings, and regions'; + + @override + String get backupRestore_locationSettings => 'Location Settings'; + + @override + String get backupRestore_locationSettingsDescription => + 'Location, contact settings, and privacy settings'; + + @override + String get backupRestore_appSettings => 'App Settings'; + + @override + String get backupRestore_appSettingsDescription => + 'App preferences and appearance settings'; + + @override + String get backupRestore_contacts => 'Contacts'; + + @override + String get backupRestore_contactsDescription => + 'Contacts, per-contact filters and settings, groups, and message history'; + + @override + String get backupRestore_discoveredContacts => 'Discovered Contacts'; + + @override + String get backupRestore_discoveredContactsDescription => + 'Discovered contacts and their saved details'; + + @override + String get backupRestore_channels => 'Channels'; + + @override + String get backupRestore_channelsDescription => + 'Channels, channel filters, communities, and message history'; + + @override + String get backupRestore_backup => 'Create Backup'; + + @override + String get backupRestore_restore => 'Restore Selected'; + + @override + String get backupRestore_backupComplete => 'Backup file created.'; + + @override + String get backupRestore_restoreComplete => + 'Restore complete. Reconnect the radio to refresh its data.'; + + @override + String backupRestore_failed(String error) { + return 'Backup operation failed: $error'; + } + + @override + String get backupRestore_fileTooLarge => + 'Backup file is larger than the 100 MB limit.'; + + @override + String get backupRestore_selectAtLeastOne => 'Select at least one item.'; + + @override + String get backupRestore_replaceIdentityTitle => 'Replace radio identity?'; + + @override + String get backupRestore_replaceIdentityMessage => + 'Restoring Node Settings replaces the connected radio\'s private key and changes its identity. Continue only if this is intended.'; + @override String get settings_nodeSettings => 'Paramètres du nœud'; diff --git a/lib/l10n/app_localizations_hu.dart b/lib/l10n/app_localizations_hu.dart index c5fbbbaa..c05ff030 100644 --- a/lib/l10n/app_localizations_hu.dart +++ b/lib/l10n/app_localizations_hu.dart @@ -398,6 +398,109 @@ class AppLocalizationsHu extends AppLocalizations { String get settings_appSettingsSubtitle => 'Értesítések, üzenetküldés és térképbeállítások'; + @override + String get settings_export => 'Export'; + + @override + String get settings_exportSubtitle => 'Export contacts and repeaters as GPX'; + + @override + String get backupRestore_title => 'Backup & Restore'; + + @override + String get backupRestore_subtitle => + 'Save or restore app data and radio settings'; + + @override + String get backupRestore_import => 'Import'; + + @override + String get backupRestore_selectImportFile => 'Import File'; + + @override + String get backupRestore_password => 'Password (optional)'; + + @override + String get backupRestore_passwordHelp => + 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + + @override + String get backupRestore_items => 'Backup and restore items'; + + @override + String get backupRestore_nodeSettings => 'Node Settings'; + + @override + String get backupRestore_nodeSettingsDescription => + 'Device name, private and public keys, radio settings, and regions'; + + @override + String get backupRestore_locationSettings => 'Location Settings'; + + @override + String get backupRestore_locationSettingsDescription => + 'Location, contact settings, and privacy settings'; + + @override + String get backupRestore_appSettings => 'App Settings'; + + @override + String get backupRestore_appSettingsDescription => + 'App preferences and appearance settings'; + + @override + String get backupRestore_contacts => 'Contacts'; + + @override + String get backupRestore_contactsDescription => + 'Contacts, per-contact filters and settings, groups, and message history'; + + @override + String get backupRestore_discoveredContacts => 'Discovered Contacts'; + + @override + String get backupRestore_discoveredContactsDescription => + 'Discovered contacts and their saved details'; + + @override + String get backupRestore_channels => 'Channels'; + + @override + String get backupRestore_channelsDescription => + 'Channels, channel filters, communities, and message history'; + + @override + String get backupRestore_backup => 'Create Backup'; + + @override + String get backupRestore_restore => 'Restore Selected'; + + @override + String get backupRestore_backupComplete => 'Backup file created.'; + + @override + String get backupRestore_restoreComplete => + 'Restore complete. Reconnect the radio to refresh its data.'; + + @override + String backupRestore_failed(String error) { + return 'Backup operation failed: $error'; + } + + @override + String get backupRestore_fileTooLarge => + 'Backup file is larger than the 100 MB limit.'; + + @override + String get backupRestore_selectAtLeastOne => 'Select at least one item.'; + + @override + String get backupRestore_replaceIdentityTitle => 'Replace radio identity?'; + + @override + String get backupRestore_replaceIdentityMessage => + 'Restoring Node Settings replaces the connected radio\'s private key and changes its identity. Continue only if this is intended.'; + @override String get settings_nodeSettings => 'Csomópont beállításai'; diff --git a/lib/l10n/app_localizations_it.dart b/lib/l10n/app_localizations_it.dart index 31cf6cbb..5c712f66 100644 --- a/lib/l10n/app_localizations_it.dart +++ b/lib/l10n/app_localizations_it.dart @@ -402,6 +402,109 @@ class AppLocalizationsIt extends AppLocalizations { String get settings_appSettingsSubtitle => 'Notifiche, messaggi e preferenze della mappa'; + @override + String get settings_export => 'Export'; + + @override + String get settings_exportSubtitle => 'Export contacts and repeaters as GPX'; + + @override + String get backupRestore_title => 'Backup & Restore'; + + @override + String get backupRestore_subtitle => + 'Save or restore app data and radio settings'; + + @override + String get backupRestore_import => 'Import'; + + @override + String get backupRestore_selectImportFile => 'Import File'; + + @override + String get backupRestore_password => 'Password (optional)'; + + @override + String get backupRestore_passwordHelp => + 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + + @override + String get backupRestore_items => 'Backup and restore items'; + + @override + String get backupRestore_nodeSettings => 'Node Settings'; + + @override + String get backupRestore_nodeSettingsDescription => + 'Device name, private and public keys, radio settings, and regions'; + + @override + String get backupRestore_locationSettings => 'Location Settings'; + + @override + String get backupRestore_locationSettingsDescription => + 'Location, contact settings, and privacy settings'; + + @override + String get backupRestore_appSettings => 'App Settings'; + + @override + String get backupRestore_appSettingsDescription => + 'App preferences and appearance settings'; + + @override + String get backupRestore_contacts => 'Contacts'; + + @override + String get backupRestore_contactsDescription => + 'Contacts, per-contact filters and settings, groups, and message history'; + + @override + String get backupRestore_discoveredContacts => 'Discovered Contacts'; + + @override + String get backupRestore_discoveredContactsDescription => + 'Discovered contacts and their saved details'; + + @override + String get backupRestore_channels => 'Channels'; + + @override + String get backupRestore_channelsDescription => + 'Channels, channel filters, communities, and message history'; + + @override + String get backupRestore_backup => 'Create Backup'; + + @override + String get backupRestore_restore => 'Restore Selected'; + + @override + String get backupRestore_backupComplete => 'Backup file created.'; + + @override + String get backupRestore_restoreComplete => + 'Restore complete. Reconnect the radio to refresh its data.'; + + @override + String backupRestore_failed(String error) { + return 'Backup operation failed: $error'; + } + + @override + String get backupRestore_fileTooLarge => + 'Backup file is larger than the 100 MB limit.'; + + @override + String get backupRestore_selectAtLeastOne => 'Select at least one item.'; + + @override + String get backupRestore_replaceIdentityTitle => 'Replace radio identity?'; + + @override + String get backupRestore_replaceIdentityMessage => + 'Restoring Node Settings replaces the connected radio\'s private key and changes its identity. Continue only if this is intended.'; + @override String get settings_nodeSettings => 'Impostazioni Nodo'; diff --git a/lib/l10n/app_localizations_ja.dart b/lib/l10n/app_localizations_ja.dart index e2d696c2..676b9c1b 100644 --- a/lib/l10n/app_localizations_ja.dart +++ b/lib/l10n/app_localizations_ja.dart @@ -383,6 +383,109 @@ class AppLocalizationsJa extends AppLocalizations { @override String get settings_appSettingsSubtitle => '通知、メッセージング、および地図の表示設定'; + @override + String get settings_export => 'Export'; + + @override + String get settings_exportSubtitle => 'Export contacts and repeaters as GPX'; + + @override + String get backupRestore_title => 'Backup & Restore'; + + @override + String get backupRestore_subtitle => + 'Save or restore app data and radio settings'; + + @override + String get backupRestore_import => 'Import'; + + @override + String get backupRestore_selectImportFile => 'Import File'; + + @override + String get backupRestore_password => 'Password (optional)'; + + @override + String get backupRestore_passwordHelp => + 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + + @override + String get backupRestore_items => 'Backup and restore items'; + + @override + String get backupRestore_nodeSettings => 'Node Settings'; + + @override + String get backupRestore_nodeSettingsDescription => + 'Device name, private and public keys, radio settings, and regions'; + + @override + String get backupRestore_locationSettings => 'Location Settings'; + + @override + String get backupRestore_locationSettingsDescription => + 'Location, contact settings, and privacy settings'; + + @override + String get backupRestore_appSettings => 'App Settings'; + + @override + String get backupRestore_appSettingsDescription => + 'App preferences and appearance settings'; + + @override + String get backupRestore_contacts => 'Contacts'; + + @override + String get backupRestore_contactsDescription => + 'Contacts, per-contact filters and settings, groups, and message history'; + + @override + String get backupRestore_discoveredContacts => 'Discovered Contacts'; + + @override + String get backupRestore_discoveredContactsDescription => + 'Discovered contacts and their saved details'; + + @override + String get backupRestore_channels => 'Channels'; + + @override + String get backupRestore_channelsDescription => + 'Channels, channel filters, communities, and message history'; + + @override + String get backupRestore_backup => 'Create Backup'; + + @override + String get backupRestore_restore => 'Restore Selected'; + + @override + String get backupRestore_backupComplete => 'Backup file created.'; + + @override + String get backupRestore_restoreComplete => + 'Restore complete. Reconnect the radio to refresh its data.'; + + @override + String backupRestore_failed(String error) { + return 'Backup operation failed: $error'; + } + + @override + String get backupRestore_fileTooLarge => + 'Backup file is larger than the 100 MB limit.'; + + @override + String get backupRestore_selectAtLeastOne => 'Select at least one item.'; + + @override + String get backupRestore_replaceIdentityTitle => 'Replace radio identity?'; + + @override + String get backupRestore_replaceIdentityMessage => + 'Restoring Node Settings replaces the connected radio\'s private key and changes its identity. Continue only if this is intended.'; + @override String get settings_nodeSettings => 'ノード設定'; diff --git a/lib/l10n/app_localizations_ko.dart b/lib/l10n/app_localizations_ko.dart index 0a347c7a..a1f61083 100644 --- a/lib/l10n/app_localizations_ko.dart +++ b/lib/l10n/app_localizations_ko.dart @@ -383,6 +383,109 @@ class AppLocalizationsKo extends AppLocalizations { @override String get settings_appSettingsSubtitle => '알림, 메시징, 지도 설정'; + @override + String get settings_export => 'Export'; + + @override + String get settings_exportSubtitle => 'Export contacts and repeaters as GPX'; + + @override + String get backupRestore_title => 'Backup & Restore'; + + @override + String get backupRestore_subtitle => + 'Save or restore app data and radio settings'; + + @override + String get backupRestore_import => 'Import'; + + @override + String get backupRestore_selectImportFile => 'Import File'; + + @override + String get backupRestore_password => 'Password (optional)'; + + @override + String get backupRestore_passwordHelp => + 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + + @override + String get backupRestore_items => 'Backup and restore items'; + + @override + String get backupRestore_nodeSettings => 'Node Settings'; + + @override + String get backupRestore_nodeSettingsDescription => + 'Device name, private and public keys, radio settings, and regions'; + + @override + String get backupRestore_locationSettings => 'Location Settings'; + + @override + String get backupRestore_locationSettingsDescription => + 'Location, contact settings, and privacy settings'; + + @override + String get backupRestore_appSettings => 'App Settings'; + + @override + String get backupRestore_appSettingsDescription => + 'App preferences and appearance settings'; + + @override + String get backupRestore_contacts => 'Contacts'; + + @override + String get backupRestore_contactsDescription => + 'Contacts, per-contact filters and settings, groups, and message history'; + + @override + String get backupRestore_discoveredContacts => 'Discovered Contacts'; + + @override + String get backupRestore_discoveredContactsDescription => + 'Discovered contacts and their saved details'; + + @override + String get backupRestore_channels => 'Channels'; + + @override + String get backupRestore_channelsDescription => + 'Channels, channel filters, communities, and message history'; + + @override + String get backupRestore_backup => 'Create Backup'; + + @override + String get backupRestore_restore => 'Restore Selected'; + + @override + String get backupRestore_backupComplete => 'Backup file created.'; + + @override + String get backupRestore_restoreComplete => + 'Restore complete. Reconnect the radio to refresh its data.'; + + @override + String backupRestore_failed(String error) { + return 'Backup operation failed: $error'; + } + + @override + String get backupRestore_fileTooLarge => + 'Backup file is larger than the 100 MB limit.'; + + @override + String get backupRestore_selectAtLeastOne => 'Select at least one item.'; + + @override + String get backupRestore_replaceIdentityTitle => 'Replace radio identity?'; + + @override + String get backupRestore_replaceIdentityMessage => + 'Restoring Node Settings replaces the connected radio\'s private key and changes its identity. Continue only if this is intended.'; + @override String get settings_nodeSettings => '노드 설정'; diff --git a/lib/l10n/app_localizations_nl.dart b/lib/l10n/app_localizations_nl.dart index b0c52ee1..2eb8d6d2 100644 --- a/lib/l10n/app_localizations_nl.dart +++ b/lib/l10n/app_localizations_nl.dart @@ -398,6 +398,109 @@ class AppLocalizationsNl extends AppLocalizations { String get settings_appSettingsSubtitle => 'Notificaties, berichten en kaartinstellingen'; + @override + String get settings_export => 'Export'; + + @override + String get settings_exportSubtitle => 'Export contacts and repeaters as GPX'; + + @override + String get backupRestore_title => 'Backup & Restore'; + + @override + String get backupRestore_subtitle => + 'Save or restore app data and radio settings'; + + @override + String get backupRestore_import => 'Import'; + + @override + String get backupRestore_selectImportFile => 'Import File'; + + @override + String get backupRestore_password => 'Password (optional)'; + + @override + String get backupRestore_passwordHelp => + 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + + @override + String get backupRestore_items => 'Backup and restore items'; + + @override + String get backupRestore_nodeSettings => 'Node Settings'; + + @override + String get backupRestore_nodeSettingsDescription => + 'Device name, private and public keys, radio settings, and regions'; + + @override + String get backupRestore_locationSettings => 'Location Settings'; + + @override + String get backupRestore_locationSettingsDescription => + 'Location, contact settings, and privacy settings'; + + @override + String get backupRestore_appSettings => 'App Settings'; + + @override + String get backupRestore_appSettingsDescription => + 'App preferences and appearance settings'; + + @override + String get backupRestore_contacts => 'Contacts'; + + @override + String get backupRestore_contactsDescription => + 'Contacts, per-contact filters and settings, groups, and message history'; + + @override + String get backupRestore_discoveredContacts => 'Discovered Contacts'; + + @override + String get backupRestore_discoveredContactsDescription => + 'Discovered contacts and their saved details'; + + @override + String get backupRestore_channels => 'Channels'; + + @override + String get backupRestore_channelsDescription => + 'Channels, channel filters, communities, and message history'; + + @override + String get backupRestore_backup => 'Create Backup'; + + @override + String get backupRestore_restore => 'Restore Selected'; + + @override + String get backupRestore_backupComplete => 'Backup file created.'; + + @override + String get backupRestore_restoreComplete => + 'Restore complete. Reconnect the radio to refresh its data.'; + + @override + String backupRestore_failed(String error) { + return 'Backup operation failed: $error'; + } + + @override + String get backupRestore_fileTooLarge => + 'Backup file is larger than the 100 MB limit.'; + + @override + String get backupRestore_selectAtLeastOne => 'Select at least one item.'; + + @override + String get backupRestore_replaceIdentityTitle => 'Replace radio identity?'; + + @override + String get backupRestore_replaceIdentityMessage => + 'Restoring Node Settings replaces the connected radio\'s private key and changes its identity. Continue only if this is intended.'; + @override String get settings_nodeSettings => 'Node Instellingen'; diff --git a/lib/l10n/app_localizations_pl.dart b/lib/l10n/app_localizations_pl.dart index 1784cfb4..43790915 100644 --- a/lib/l10n/app_localizations_pl.dart +++ b/lib/l10n/app_localizations_pl.dart @@ -405,6 +405,109 @@ class AppLocalizationsPl extends AppLocalizations { String get settings_appSettingsSubtitle => 'Powiadomienia, wiadomości i preferencje mapy'; + @override + String get settings_export => 'Export'; + + @override + String get settings_exportSubtitle => 'Export contacts and repeaters as GPX'; + + @override + String get backupRestore_title => 'Backup & Restore'; + + @override + String get backupRestore_subtitle => + 'Save or restore app data and radio settings'; + + @override + String get backupRestore_import => 'Import'; + + @override + String get backupRestore_selectImportFile => 'Import File'; + + @override + String get backupRestore_password => 'Password (optional)'; + + @override + String get backupRestore_passwordHelp => + 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + + @override + String get backupRestore_items => 'Backup and restore items'; + + @override + String get backupRestore_nodeSettings => 'Node Settings'; + + @override + String get backupRestore_nodeSettingsDescription => + 'Device name, private and public keys, radio settings, and regions'; + + @override + String get backupRestore_locationSettings => 'Location Settings'; + + @override + String get backupRestore_locationSettingsDescription => + 'Location, contact settings, and privacy settings'; + + @override + String get backupRestore_appSettings => 'App Settings'; + + @override + String get backupRestore_appSettingsDescription => + 'App preferences and appearance settings'; + + @override + String get backupRestore_contacts => 'Contacts'; + + @override + String get backupRestore_contactsDescription => + 'Contacts, per-contact filters and settings, groups, and message history'; + + @override + String get backupRestore_discoveredContacts => 'Discovered Contacts'; + + @override + String get backupRestore_discoveredContactsDescription => + 'Discovered contacts and their saved details'; + + @override + String get backupRestore_channels => 'Channels'; + + @override + String get backupRestore_channelsDescription => + 'Channels, channel filters, communities, and message history'; + + @override + String get backupRestore_backup => 'Create Backup'; + + @override + String get backupRestore_restore => 'Restore Selected'; + + @override + String get backupRestore_backupComplete => 'Backup file created.'; + + @override + String get backupRestore_restoreComplete => + 'Restore complete. Reconnect the radio to refresh its data.'; + + @override + String backupRestore_failed(String error) { + return 'Backup operation failed: $error'; + } + + @override + String get backupRestore_fileTooLarge => + 'Backup file is larger than the 100 MB limit.'; + + @override + String get backupRestore_selectAtLeastOne => 'Select at least one item.'; + + @override + String get backupRestore_replaceIdentityTitle => 'Replace radio identity?'; + + @override + String get backupRestore_replaceIdentityMessage => + 'Restoring Node Settings replaces the connected radio\'s private key and changes its identity. Continue only if this is intended.'; + @override String get settings_nodeSettings => 'Ustawienia węzła'; diff --git a/lib/l10n/app_localizations_pt.dart b/lib/l10n/app_localizations_pt.dart index e9ccc7c7..2a70fb29 100644 --- a/lib/l10n/app_localizations_pt.dart +++ b/lib/l10n/app_localizations_pt.dart @@ -401,6 +401,109 @@ class AppLocalizationsPt extends AppLocalizations { String get settings_appSettingsSubtitle => 'Notificações, mensagens e preferências de mapa'; + @override + String get settings_export => 'Export'; + + @override + String get settings_exportSubtitle => 'Export contacts and repeaters as GPX'; + + @override + String get backupRestore_title => 'Backup & Restore'; + + @override + String get backupRestore_subtitle => + 'Save or restore app data and radio settings'; + + @override + String get backupRestore_import => 'Import'; + + @override + String get backupRestore_selectImportFile => 'Import File'; + + @override + String get backupRestore_password => 'Password (optional)'; + + @override + String get backupRestore_passwordHelp => + 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + + @override + String get backupRestore_items => 'Backup and restore items'; + + @override + String get backupRestore_nodeSettings => 'Node Settings'; + + @override + String get backupRestore_nodeSettingsDescription => + 'Device name, private and public keys, radio settings, and regions'; + + @override + String get backupRestore_locationSettings => 'Location Settings'; + + @override + String get backupRestore_locationSettingsDescription => + 'Location, contact settings, and privacy settings'; + + @override + String get backupRestore_appSettings => 'App Settings'; + + @override + String get backupRestore_appSettingsDescription => + 'App preferences and appearance settings'; + + @override + String get backupRestore_contacts => 'Contacts'; + + @override + String get backupRestore_contactsDescription => + 'Contacts, per-contact filters and settings, groups, and message history'; + + @override + String get backupRestore_discoveredContacts => 'Discovered Contacts'; + + @override + String get backupRestore_discoveredContactsDescription => + 'Discovered contacts and their saved details'; + + @override + String get backupRestore_channels => 'Channels'; + + @override + String get backupRestore_channelsDescription => + 'Channels, channel filters, communities, and message history'; + + @override + String get backupRestore_backup => 'Create Backup'; + + @override + String get backupRestore_restore => 'Restore Selected'; + + @override + String get backupRestore_backupComplete => 'Backup file created.'; + + @override + String get backupRestore_restoreComplete => + 'Restore complete. Reconnect the radio to refresh its data.'; + + @override + String backupRestore_failed(String error) { + return 'Backup operation failed: $error'; + } + + @override + String get backupRestore_fileTooLarge => + 'Backup file is larger than the 100 MB limit.'; + + @override + String get backupRestore_selectAtLeastOne => 'Select at least one item.'; + + @override + String get backupRestore_replaceIdentityTitle => 'Replace radio identity?'; + + @override + String get backupRestore_replaceIdentityMessage => + 'Restoring Node Settings replaces the connected radio\'s private key and changes its identity. Continue only if this is intended.'; + @override String get settings_nodeSettings => 'Configurações do Nó'; diff --git a/lib/l10n/app_localizations_ru.dart b/lib/l10n/app_localizations_ru.dart index b00cc8fc..224d80a0 100644 --- a/lib/l10n/app_localizations_ru.dart +++ b/lib/l10n/app_localizations_ru.dart @@ -401,6 +401,109 @@ class AppLocalizationsRu extends AppLocalizations { String get settings_appSettingsSubtitle => 'Уведомления, сообщения и настройки карты'; + @override + String get settings_export => 'Export'; + + @override + String get settings_exportSubtitle => 'Export contacts and repeaters as GPX'; + + @override + String get backupRestore_title => 'Backup & Restore'; + + @override + String get backupRestore_subtitle => + 'Save or restore app data and radio settings'; + + @override + String get backupRestore_import => 'Import'; + + @override + String get backupRestore_selectImportFile => 'Import File'; + + @override + String get backupRestore_password => 'Password (optional)'; + + @override + String get backupRestore_passwordHelp => + 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + + @override + String get backupRestore_items => 'Backup and restore items'; + + @override + String get backupRestore_nodeSettings => 'Node Settings'; + + @override + String get backupRestore_nodeSettingsDescription => + 'Device name, private and public keys, radio settings, and regions'; + + @override + String get backupRestore_locationSettings => 'Location Settings'; + + @override + String get backupRestore_locationSettingsDescription => + 'Location, contact settings, and privacy settings'; + + @override + String get backupRestore_appSettings => 'App Settings'; + + @override + String get backupRestore_appSettingsDescription => + 'App preferences and appearance settings'; + + @override + String get backupRestore_contacts => 'Contacts'; + + @override + String get backupRestore_contactsDescription => + 'Contacts, per-contact filters and settings, groups, and message history'; + + @override + String get backupRestore_discoveredContacts => 'Discovered Contacts'; + + @override + String get backupRestore_discoveredContactsDescription => + 'Discovered contacts and their saved details'; + + @override + String get backupRestore_channels => 'Channels'; + + @override + String get backupRestore_channelsDescription => + 'Channels, channel filters, communities, and message history'; + + @override + String get backupRestore_backup => 'Create Backup'; + + @override + String get backupRestore_restore => 'Restore Selected'; + + @override + String get backupRestore_backupComplete => 'Backup file created.'; + + @override + String get backupRestore_restoreComplete => + 'Restore complete. Reconnect the radio to refresh its data.'; + + @override + String backupRestore_failed(String error) { + return 'Backup operation failed: $error'; + } + + @override + String get backupRestore_fileTooLarge => + 'Backup file is larger than the 100 MB limit.'; + + @override + String get backupRestore_selectAtLeastOne => 'Select at least one item.'; + + @override + String get backupRestore_replaceIdentityTitle => 'Replace radio identity?'; + + @override + String get backupRestore_replaceIdentityMessage => + 'Restoring Node Settings replaces the connected radio\'s private key and changes its identity. Continue only if this is intended.'; + @override String get settings_nodeSettings => 'Настройки ноды'; diff --git a/lib/l10n/app_localizations_sk.dart b/lib/l10n/app_localizations_sk.dart index 751efb15..f52aab24 100644 --- a/lib/l10n/app_localizations_sk.dart +++ b/lib/l10n/app_localizations_sk.dart @@ -401,6 +401,109 @@ class AppLocalizationsSk extends AppLocalizations { String get settings_appSettingsSubtitle => 'Upozornenia, správy a nastavenia mapy'; + @override + String get settings_export => 'Export'; + + @override + String get settings_exportSubtitle => 'Export contacts and repeaters as GPX'; + + @override + String get backupRestore_title => 'Backup & Restore'; + + @override + String get backupRestore_subtitle => + 'Save or restore app data and radio settings'; + + @override + String get backupRestore_import => 'Import'; + + @override + String get backupRestore_selectImportFile => 'Import File'; + + @override + String get backupRestore_password => 'Password (optional)'; + + @override + String get backupRestore_passwordHelp => + 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + + @override + String get backupRestore_items => 'Backup and restore items'; + + @override + String get backupRestore_nodeSettings => 'Node Settings'; + + @override + String get backupRestore_nodeSettingsDescription => + 'Device name, private and public keys, radio settings, and regions'; + + @override + String get backupRestore_locationSettings => 'Location Settings'; + + @override + String get backupRestore_locationSettingsDescription => + 'Location, contact settings, and privacy settings'; + + @override + String get backupRestore_appSettings => 'App Settings'; + + @override + String get backupRestore_appSettingsDescription => + 'App preferences and appearance settings'; + + @override + String get backupRestore_contacts => 'Contacts'; + + @override + String get backupRestore_contactsDescription => + 'Contacts, per-contact filters and settings, groups, and message history'; + + @override + String get backupRestore_discoveredContacts => 'Discovered Contacts'; + + @override + String get backupRestore_discoveredContactsDescription => + 'Discovered contacts and their saved details'; + + @override + String get backupRestore_channels => 'Channels'; + + @override + String get backupRestore_channelsDescription => + 'Channels, channel filters, communities, and message history'; + + @override + String get backupRestore_backup => 'Create Backup'; + + @override + String get backupRestore_restore => 'Restore Selected'; + + @override + String get backupRestore_backupComplete => 'Backup file created.'; + + @override + String get backupRestore_restoreComplete => + 'Restore complete. Reconnect the radio to refresh its data.'; + + @override + String backupRestore_failed(String error) { + return 'Backup operation failed: $error'; + } + + @override + String get backupRestore_fileTooLarge => + 'Backup file is larger than the 100 MB limit.'; + + @override + String get backupRestore_selectAtLeastOne => 'Select at least one item.'; + + @override + String get backupRestore_replaceIdentityTitle => 'Replace radio identity?'; + + @override + String get backupRestore_replaceIdentityMessage => + 'Restoring Node Settings replaces the connected radio\'s private key and changes its identity. Continue only if this is intended.'; + @override String get settings_nodeSettings => 'Nastavenia uzla'; diff --git a/lib/l10n/app_localizations_sl.dart b/lib/l10n/app_localizations_sl.dart index 71ddd940..5fdc42f9 100644 --- a/lib/l10n/app_localizations_sl.dart +++ b/lib/l10n/app_localizations_sl.dart @@ -400,6 +400,109 @@ class AppLocalizationsSl extends AppLocalizations { String get settings_appSettingsSubtitle => 'Obveščanja, sporoščanje in zemljevidi.'; + @override + String get settings_export => 'Export'; + + @override + String get settings_exportSubtitle => 'Export contacts and repeaters as GPX'; + + @override + String get backupRestore_title => 'Backup & Restore'; + + @override + String get backupRestore_subtitle => + 'Save or restore app data and radio settings'; + + @override + String get backupRestore_import => 'Import'; + + @override + String get backupRestore_selectImportFile => 'Import File'; + + @override + String get backupRestore_password => 'Password (optional)'; + + @override + String get backupRestore_passwordHelp => + 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + + @override + String get backupRestore_items => 'Backup and restore items'; + + @override + String get backupRestore_nodeSettings => 'Node Settings'; + + @override + String get backupRestore_nodeSettingsDescription => + 'Device name, private and public keys, radio settings, and regions'; + + @override + String get backupRestore_locationSettings => 'Location Settings'; + + @override + String get backupRestore_locationSettingsDescription => + 'Location, contact settings, and privacy settings'; + + @override + String get backupRestore_appSettings => 'App Settings'; + + @override + String get backupRestore_appSettingsDescription => + 'App preferences and appearance settings'; + + @override + String get backupRestore_contacts => 'Contacts'; + + @override + String get backupRestore_contactsDescription => + 'Contacts, per-contact filters and settings, groups, and message history'; + + @override + String get backupRestore_discoveredContacts => 'Discovered Contacts'; + + @override + String get backupRestore_discoveredContactsDescription => + 'Discovered contacts and their saved details'; + + @override + String get backupRestore_channels => 'Channels'; + + @override + String get backupRestore_channelsDescription => + 'Channels, channel filters, communities, and message history'; + + @override + String get backupRestore_backup => 'Create Backup'; + + @override + String get backupRestore_restore => 'Restore Selected'; + + @override + String get backupRestore_backupComplete => 'Backup file created.'; + + @override + String get backupRestore_restoreComplete => + 'Restore complete. Reconnect the radio to refresh its data.'; + + @override + String backupRestore_failed(String error) { + return 'Backup operation failed: $error'; + } + + @override + String get backupRestore_fileTooLarge => + 'Backup file is larger than the 100 MB limit.'; + + @override + String get backupRestore_selectAtLeastOne => 'Select at least one item.'; + + @override + String get backupRestore_replaceIdentityTitle => 'Replace radio identity?'; + + @override + String get backupRestore_replaceIdentityMessage => + 'Restoring Node Settings replaces the connected radio\'s private key and changes its identity. Continue only if this is intended.'; + @override String get settings_nodeSettings => 'Nastavitev časa'; diff --git a/lib/l10n/app_localizations_sv.dart b/lib/l10n/app_localizations_sv.dart index 4a4bc187..4723c8f2 100644 --- a/lib/l10n/app_localizations_sv.dart +++ b/lib/l10n/app_localizations_sv.dart @@ -396,6 +396,109 @@ class AppLocalizationsSv extends AppLocalizations { String get settings_appSettingsSubtitle => 'Notifieringar, meddelanden och kartinställningar'; + @override + String get settings_export => 'Export'; + + @override + String get settings_exportSubtitle => 'Export contacts and repeaters as GPX'; + + @override + String get backupRestore_title => 'Backup & Restore'; + + @override + String get backupRestore_subtitle => + 'Save or restore app data and radio settings'; + + @override + String get backupRestore_import => 'Import'; + + @override + String get backupRestore_selectImportFile => 'Import File'; + + @override + String get backupRestore_password => 'Password (optional)'; + + @override + String get backupRestore_passwordHelp => + 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + + @override + String get backupRestore_items => 'Backup and restore items'; + + @override + String get backupRestore_nodeSettings => 'Node Settings'; + + @override + String get backupRestore_nodeSettingsDescription => + 'Device name, private and public keys, radio settings, and regions'; + + @override + String get backupRestore_locationSettings => 'Location Settings'; + + @override + String get backupRestore_locationSettingsDescription => + 'Location, contact settings, and privacy settings'; + + @override + String get backupRestore_appSettings => 'App Settings'; + + @override + String get backupRestore_appSettingsDescription => + 'App preferences and appearance settings'; + + @override + String get backupRestore_contacts => 'Contacts'; + + @override + String get backupRestore_contactsDescription => + 'Contacts, per-contact filters and settings, groups, and message history'; + + @override + String get backupRestore_discoveredContacts => 'Discovered Contacts'; + + @override + String get backupRestore_discoveredContactsDescription => + 'Discovered contacts and their saved details'; + + @override + String get backupRestore_channels => 'Channels'; + + @override + String get backupRestore_channelsDescription => + 'Channels, channel filters, communities, and message history'; + + @override + String get backupRestore_backup => 'Create Backup'; + + @override + String get backupRestore_restore => 'Restore Selected'; + + @override + String get backupRestore_backupComplete => 'Backup file created.'; + + @override + String get backupRestore_restoreComplete => + 'Restore complete. Reconnect the radio to refresh its data.'; + + @override + String backupRestore_failed(String error) { + return 'Backup operation failed: $error'; + } + + @override + String get backupRestore_fileTooLarge => + 'Backup file is larger than the 100 MB limit.'; + + @override + String get backupRestore_selectAtLeastOne => 'Select at least one item.'; + + @override + String get backupRestore_replaceIdentityTitle => 'Replace radio identity?'; + + @override + String get backupRestore_replaceIdentityMessage => + 'Restoring Node Settings replaces the connected radio\'s private key and changes its identity. Continue only if this is intended.'; + @override String get settings_nodeSettings => 'Nodinställningar'; diff --git a/lib/l10n/app_localizations_uk.dart b/lib/l10n/app_localizations_uk.dart index b9a6c535..8c15697e 100644 --- a/lib/l10n/app_localizations_uk.dart +++ b/lib/l10n/app_localizations_uk.dart @@ -400,6 +400,109 @@ class AppLocalizationsUk extends AppLocalizations { String get settings_appSettingsSubtitle => 'Сповіщення, повідомлення та налаштування карти'; + @override + String get settings_export => 'Export'; + + @override + String get settings_exportSubtitle => 'Export contacts and repeaters as GPX'; + + @override + String get backupRestore_title => 'Backup & Restore'; + + @override + String get backupRestore_subtitle => + 'Save or restore app data and radio settings'; + + @override + String get backupRestore_import => 'Import'; + + @override + String get backupRestore_selectImportFile => 'Import File'; + + @override + String get backupRestore_password => 'Password (optional)'; + + @override + String get backupRestore_passwordHelp => + 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + + @override + String get backupRestore_items => 'Backup and restore items'; + + @override + String get backupRestore_nodeSettings => 'Node Settings'; + + @override + String get backupRestore_nodeSettingsDescription => + 'Device name, private and public keys, radio settings, and regions'; + + @override + String get backupRestore_locationSettings => 'Location Settings'; + + @override + String get backupRestore_locationSettingsDescription => + 'Location, contact settings, and privacy settings'; + + @override + String get backupRestore_appSettings => 'App Settings'; + + @override + String get backupRestore_appSettingsDescription => + 'App preferences and appearance settings'; + + @override + String get backupRestore_contacts => 'Contacts'; + + @override + String get backupRestore_contactsDescription => + 'Contacts, per-contact filters and settings, groups, and message history'; + + @override + String get backupRestore_discoveredContacts => 'Discovered Contacts'; + + @override + String get backupRestore_discoveredContactsDescription => + 'Discovered contacts and their saved details'; + + @override + String get backupRestore_channels => 'Channels'; + + @override + String get backupRestore_channelsDescription => + 'Channels, channel filters, communities, and message history'; + + @override + String get backupRestore_backup => 'Create Backup'; + + @override + String get backupRestore_restore => 'Restore Selected'; + + @override + String get backupRestore_backupComplete => 'Backup file created.'; + + @override + String get backupRestore_restoreComplete => + 'Restore complete. Reconnect the radio to refresh its data.'; + + @override + String backupRestore_failed(String error) { + return 'Backup operation failed: $error'; + } + + @override + String get backupRestore_fileTooLarge => + 'Backup file is larger than the 100 MB limit.'; + + @override + String get backupRestore_selectAtLeastOne => 'Select at least one item.'; + + @override + String get backupRestore_replaceIdentityTitle => 'Replace radio identity?'; + + @override + String get backupRestore_replaceIdentityMessage => + 'Restoring Node Settings replaces the connected radio\'s private key and changes its identity. Continue only if this is intended.'; + @override String get settings_nodeSettings => 'Налаштування вузла'; diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dart index ef525c93..6e95a003 100644 --- a/lib/l10n/app_localizations_zh.dart +++ b/lib/l10n/app_localizations_zh.dart @@ -377,6 +377,109 @@ class AppLocalizationsZh extends AppLocalizations { @override String get settings_appSettingsSubtitle => '通知、消息和地图偏好'; + @override + String get settings_export => 'Export'; + + @override + String get settings_exportSubtitle => 'Export contacts and repeaters as GPX'; + + @override + String get backupRestore_title => 'Backup & Restore'; + + @override + String get backupRestore_subtitle => + 'Save or restore app data and radio settings'; + + @override + String get backupRestore_import => 'Import'; + + @override + String get backupRestore_selectImportFile => 'Import File'; + + @override + String get backupRestore_password => 'Password (optional)'; + + @override + String get backupRestore_passwordHelp => + 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + + @override + String get backupRestore_items => 'Backup and restore items'; + + @override + String get backupRestore_nodeSettings => 'Node Settings'; + + @override + String get backupRestore_nodeSettingsDescription => + 'Device name, private and public keys, radio settings, and regions'; + + @override + String get backupRestore_locationSettings => 'Location Settings'; + + @override + String get backupRestore_locationSettingsDescription => + 'Location, contact settings, and privacy settings'; + + @override + String get backupRestore_appSettings => 'App Settings'; + + @override + String get backupRestore_appSettingsDescription => + 'App preferences and appearance settings'; + + @override + String get backupRestore_contacts => 'Contacts'; + + @override + String get backupRestore_contactsDescription => + 'Contacts, per-contact filters and settings, groups, and message history'; + + @override + String get backupRestore_discoveredContacts => 'Discovered Contacts'; + + @override + String get backupRestore_discoveredContactsDescription => + 'Discovered contacts and their saved details'; + + @override + String get backupRestore_channels => 'Channels'; + + @override + String get backupRestore_channelsDescription => + 'Channels, channel filters, communities, and message history'; + + @override + String get backupRestore_backup => 'Create Backup'; + + @override + String get backupRestore_restore => 'Restore Selected'; + + @override + String get backupRestore_backupComplete => 'Backup file created.'; + + @override + String get backupRestore_restoreComplete => + 'Restore complete. Reconnect the radio to refresh its data.'; + + @override + String backupRestore_failed(String error) { + return 'Backup operation failed: $error'; + } + + @override + String get backupRestore_fileTooLarge => + 'Backup file is larger than the 100 MB limit.'; + + @override + String get backupRestore_selectAtLeastOne => 'Select at least one item.'; + + @override + String get backupRestore_replaceIdentityTitle => 'Replace radio identity?'; + + @override + String get backupRestore_replaceIdentityMessage => + 'Restoring Node Settings replaces the connected radio\'s private key and changes its identity. Continue only if this is intended.'; + @override String get settings_nodeSettings => '节点设置'; diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dart index adcd9919..733038eb 100644 --- a/lib/screens/settings_screen.dart +++ b/lib/screens/settings_screen.dart @@ -1,6 +1,5 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:meshcore_open/utils/gpx_export.dart'; import 'package:meshcore_open/widgets/elements_ui.dart'; import 'package:provider/provider.dart'; import 'package:package_info_plus/package_info_plus.dart'; @@ -24,7 +23,8 @@ import '../widgets/radio_stats_entry.dart'; import 'telemetry_screen.dart'; import '../widgets/sync_progress_overlay.dart'; import 'region_management_screen.dart'; -import '../utils/share_origin.dart'; +import 'backup_restore_screen.dart'; +import 'export_screen.dart'; class SettingsScreen extends StatefulWidget { const SettingsScreen({super.key}); @@ -164,13 +164,34 @@ class _SettingsScreenState extends State { ), ), - // EXPORT section - SectionHeader(l10n.settings_gpxExportRepeaters), + // BACKUP AND EXPORT + SectionHeader(l10n.settings_export), MeshCard( padding: EdgeInsets.zero, - child: _buildExportCardContent( - context, - context.read(), + child: Column( + children: [ + MeshNavTile( + icon: Icons.backup_outlined, + title: l10n.backupRestore_title, + subtitle: l10n.backupRestore_subtitle, + onTap: () => Navigator.push( + context, + MaterialPageRoute( + builder: (_) => const BackupRestoreScreen(), + ), + ), + ), + const Divider(height: 1, indent: 16), + MeshNavTile( + icon: Icons.download_outlined, + title: l10n.settings_export, + subtitle: l10n.settings_exportSubtitle, + onTap: () => Navigator.push( + context, + MaterialPageRoute(builder: (_) => const ExportScreen()), + ), + ), + ], ), ), @@ -682,70 +703,6 @@ class _SettingsScreenState extends State { ); } - Widget _buildExportCardContent( - BuildContext context, - MeshCoreConnector connector, - ) { - final l10n = context.l10n; - return Column( - children: [ - MeshNavTile( - icon: Icons.download_outlined, - title: l10n.settings_gpxExportRepeaters, - subtitle: l10n.settings_gpxExportRepeatersSubtitle, - onTap: () async { - final exporter = GpxExport(connector); - exporter.addRepeaters(); - _gpxExport( - exporter, - l10n.map_repeater, - l10n.settings_gpxExportRepeatersRoom, - 'meshcore_repeaters_', - l10n.settings_gpxExportShareText, - l10n.settings_gpxExportShareSubject, - ); - }, - ), - const Divider(height: 1, indent: 16), - MeshNavTile( - icon: Icons.download_outlined, - title: l10n.settings_gpxExportContacts, - subtitle: l10n.settings_gpxExportContactsSubtitle, - onTap: () async { - final exporter = GpxExport(connector); - exporter.addContacts(); - _gpxExport( - exporter, - l10n.map_repeater, - l10n.settings_gpxExportChat, - 'meshcore_contacts_', - l10n.settings_gpxExportShareText, - l10n.settings_gpxExportShareSubject, - ); - }, - ), - const Divider(height: 1, indent: 16), - MeshNavTile( - icon: Icons.download_outlined, - title: l10n.settings_gpxExportAll, - subtitle: l10n.settings_gpxExportAllSubtitle, - onTap: () async { - final exporter = GpxExport(connector); - exporter.addAll(); - _gpxExport( - exporter, - l10n.map_repeater, - l10n.settings_gpxExportAllContacts, - 'meshcore_all_', - l10n.settings_gpxExportShareText, - l10n.settings_gpxExportShareSubject, - ); - }, - ), - ], - ); - } - Widget _buildDebugCardContent(BuildContext context) { final l10n = context.l10n; return Column( @@ -1066,51 +1023,6 @@ class _SettingsScreenState extends State { ); } - Future _gpxExport( - GpxExport exporter, - String name, - String description, - String filename, - String shareText, - String subject, - ) async { - final l10n = context.l10n; - final result = await exporter.exportGPX( - name, - description, - filename, - shareText, - subject, - sharePositionOrigin: shareOriginOf(context), - ); - if (!mounted) return; - switch (result) { - case gpxExportSuccess: - showDismissibleSnackBar( - context, - content: Text(l10n.settings_gpxExportSuccess), - ); - case gpxExportNoContacts: - showDismissibleSnackBar( - context, - content: Text(l10n.settings_gpxExportNoContacts), - ); - break; - case gpxExportNotAvailable: - showDismissibleSnackBar( - context, - content: Text(l10n.settings_gpxExportNotAvailable), - ); - break; - case gpxExportFailed: - showDismissibleSnackBar( - context, - content: Text(l10n.settings_gpxExportError), - ); - break; - } - } - void _editAutoAddConfig(BuildContext context, MeshCoreConnector connector) { final l10n = context.l10n; // The dialog's context is gone once it pops; report through the screen. diff --git a/test/connector/meshcore_protocol_strings_test.dart b/test/connector/meshcore_protocol_strings_test.dart index 8219b58e..85d05f76 100644 --- a/test/connector/meshcore_protocol_strings_test.dart +++ b/test/connector/meshcore_protocol_strings_test.dart @@ -38,6 +38,26 @@ void main() { }); }); + group('private-key backup frames', () { + test('uses the firmware command codes and 64-byte identity payload', () { + final keyData = Uint8List.fromList(List.generate(64, (index) => index)); + expect(buildExportPrivateKeyFrame(), [cmdExportPrivateKey]); + final frame = buildImportPrivateKeyFrame(keyData); + expect(frame.length, 65); + expect(frame.first, cmdImportPrivateKey); + expect(frame.sublist(1), keyData); + expect(respCodePrivateKey, 14); + expect(respCodeDisabled, 15); + }); + + test('rejects identity data with the wrong length', () { + expect( + () => buildImportPrivateKeyFrame(Uint8List(63)), + throwsArgumentError, + ); + }); + }); + group('BufferWriter.writeCString', () { test('NUL-terminates and truncates on a character boundary', () { final writer = BufferWriter()..writeCString('#${'ё' * 20}', 32); diff --git a/test/connector/pending_command_replies_test.dart b/test/connector/pending_command_replies_test.dart index b9b116c9..d64eb316 100644 --- a/test/connector/pending_command_replies_test.dart +++ b/test/connector/pending_command_replies_test.dart @@ -51,6 +51,21 @@ void main() { expect(queue.length, 0); }); + test('firmware-disabled private-key transfer fails its waiter', () async { + final queue = newQueue(); + final pending = queue.track( + buildExportPrivateKeyFrame(), + waitForReply: true, + ); + + expect(queue.completeReply(frame([respCodeDisabled])), isTrue); + await expectLater( + pending!.completer!.future, + throwsA(isA()), + ); + expect(queue.length, 0); + }); + test('untracked commands are not enrolled', () { final queue = newQueue(); expect(queue.track(buildSyncNextMessageFrame()), isNull); diff --git a/untranslated.json b/untranslated.json index 9e26dfee..c7b11627 100644 --- a/untranslated.json +++ b/untranslated.json @@ -1 +1,562 @@ -{} \ No newline at end of file +{ + "bg": [ + "settings_export", + "settings_exportSubtitle", + "backupRestore_title", + "backupRestore_subtitle", + "backupRestore_import", + "backupRestore_selectImportFile", + "backupRestore_password", + "backupRestore_passwordHelp", + "backupRestore_items", + "backupRestore_nodeSettings", + "backupRestore_nodeSettingsDescription", + "backupRestore_locationSettings", + "backupRestore_locationSettingsDescription", + "backupRestore_appSettings", + "backupRestore_appSettingsDescription", + "backupRestore_contacts", + "backupRestore_contactsDescription", + "backupRestore_discoveredContacts", + "backupRestore_discoveredContactsDescription", + "backupRestore_channels", + "backupRestore_channelsDescription", + "backupRestore_backup", + "backupRestore_restore", + "backupRestore_backupComplete", + "backupRestore_restoreComplete", + "backupRestore_failed", + "backupRestore_fileTooLarge", + "backupRestore_selectAtLeastOne", + "backupRestore_replaceIdentityTitle", + "backupRestore_replaceIdentityMessage" + ], + + "de": [ + "settings_export", + "settings_exportSubtitle", + "backupRestore_title", + "backupRestore_subtitle", + "backupRestore_import", + "backupRestore_selectImportFile", + "backupRestore_password", + "backupRestore_passwordHelp", + "backupRestore_items", + "backupRestore_nodeSettings", + "backupRestore_nodeSettingsDescription", + "backupRestore_locationSettings", + "backupRestore_locationSettingsDescription", + "backupRestore_appSettings", + "backupRestore_appSettingsDescription", + "backupRestore_contacts", + "backupRestore_contactsDescription", + "backupRestore_discoveredContacts", + "backupRestore_discoveredContactsDescription", + "backupRestore_channels", + "backupRestore_channelsDescription", + "backupRestore_backup", + "backupRestore_restore", + "backupRestore_backupComplete", + "backupRestore_restoreComplete", + "backupRestore_failed", + "backupRestore_fileTooLarge", + "backupRestore_selectAtLeastOne", + "backupRestore_replaceIdentityTitle", + "backupRestore_replaceIdentityMessage" + ], + + "es": [ + "settings_export", + "settings_exportSubtitle", + "backupRestore_title", + "backupRestore_subtitle", + "backupRestore_import", + "backupRestore_selectImportFile", + "backupRestore_password", + "backupRestore_passwordHelp", + "backupRestore_items", + "backupRestore_nodeSettings", + "backupRestore_nodeSettingsDescription", + "backupRestore_locationSettings", + "backupRestore_locationSettingsDescription", + "backupRestore_appSettings", + "backupRestore_appSettingsDescription", + "backupRestore_contacts", + "backupRestore_contactsDescription", + "backupRestore_discoveredContacts", + "backupRestore_discoveredContactsDescription", + "backupRestore_channels", + "backupRestore_channelsDescription", + "backupRestore_backup", + "backupRestore_restore", + "backupRestore_backupComplete", + "backupRestore_restoreComplete", + "backupRestore_failed", + "backupRestore_fileTooLarge", + "backupRestore_selectAtLeastOne", + "backupRestore_replaceIdentityTitle", + "backupRestore_replaceIdentityMessage" + ], + + "fr": [ + "settings_export", + "settings_exportSubtitle", + "backupRestore_title", + "backupRestore_subtitle", + "backupRestore_import", + "backupRestore_selectImportFile", + "backupRestore_password", + "backupRestore_passwordHelp", + "backupRestore_items", + "backupRestore_nodeSettings", + "backupRestore_nodeSettingsDescription", + "backupRestore_locationSettings", + "backupRestore_locationSettingsDescription", + "backupRestore_appSettings", + "backupRestore_appSettingsDescription", + "backupRestore_contacts", + "backupRestore_contactsDescription", + "backupRestore_discoveredContacts", + "backupRestore_discoveredContactsDescription", + "backupRestore_channels", + "backupRestore_channelsDescription", + "backupRestore_backup", + "backupRestore_restore", + "backupRestore_backupComplete", + "backupRestore_restoreComplete", + "backupRestore_failed", + "backupRestore_fileTooLarge", + "backupRestore_selectAtLeastOne", + "backupRestore_replaceIdentityTitle", + "backupRestore_replaceIdentityMessage" + ], + + "hu": [ + "settings_export", + "settings_exportSubtitle", + "backupRestore_title", + "backupRestore_subtitle", + "backupRestore_import", + "backupRestore_selectImportFile", + "backupRestore_password", + "backupRestore_passwordHelp", + "backupRestore_items", + "backupRestore_nodeSettings", + "backupRestore_nodeSettingsDescription", + "backupRestore_locationSettings", + "backupRestore_locationSettingsDescription", + "backupRestore_appSettings", + "backupRestore_appSettingsDescription", + "backupRestore_contacts", + "backupRestore_contactsDescription", + "backupRestore_discoveredContacts", + "backupRestore_discoveredContactsDescription", + "backupRestore_channels", + "backupRestore_channelsDescription", + "backupRestore_backup", + "backupRestore_restore", + "backupRestore_backupComplete", + "backupRestore_restoreComplete", + "backupRestore_failed", + "backupRestore_fileTooLarge", + "backupRestore_selectAtLeastOne", + "backupRestore_replaceIdentityTitle", + "backupRestore_replaceIdentityMessage" + ], + + "it": [ + "settings_export", + "settings_exportSubtitle", + "backupRestore_title", + "backupRestore_subtitle", + "backupRestore_import", + "backupRestore_selectImportFile", + "backupRestore_password", + "backupRestore_passwordHelp", + "backupRestore_items", + "backupRestore_nodeSettings", + "backupRestore_nodeSettingsDescription", + "backupRestore_locationSettings", + "backupRestore_locationSettingsDescription", + "backupRestore_appSettings", + "backupRestore_appSettingsDescription", + "backupRestore_contacts", + "backupRestore_contactsDescription", + "backupRestore_discoveredContacts", + "backupRestore_discoveredContactsDescription", + "backupRestore_channels", + "backupRestore_channelsDescription", + "backupRestore_backup", + "backupRestore_restore", + "backupRestore_backupComplete", + "backupRestore_restoreComplete", + "backupRestore_failed", + "backupRestore_fileTooLarge", + "backupRestore_selectAtLeastOne", + "backupRestore_replaceIdentityTitle", + "backupRestore_replaceIdentityMessage" + ], + + "ja": [ + "settings_export", + "settings_exportSubtitle", + "backupRestore_title", + "backupRestore_subtitle", + "backupRestore_import", + "backupRestore_selectImportFile", + "backupRestore_password", + "backupRestore_passwordHelp", + "backupRestore_items", + "backupRestore_nodeSettings", + "backupRestore_nodeSettingsDescription", + "backupRestore_locationSettings", + "backupRestore_locationSettingsDescription", + "backupRestore_appSettings", + "backupRestore_appSettingsDescription", + "backupRestore_contacts", + "backupRestore_contactsDescription", + "backupRestore_discoveredContacts", + "backupRestore_discoveredContactsDescription", + "backupRestore_channels", + "backupRestore_channelsDescription", + "backupRestore_backup", + "backupRestore_restore", + "backupRestore_backupComplete", + "backupRestore_restoreComplete", + "backupRestore_failed", + "backupRestore_fileTooLarge", + "backupRestore_selectAtLeastOne", + "backupRestore_replaceIdentityTitle", + "backupRestore_replaceIdentityMessage" + ], + + "ko": [ + "settings_export", + "settings_exportSubtitle", + "backupRestore_title", + "backupRestore_subtitle", + "backupRestore_import", + "backupRestore_selectImportFile", + "backupRestore_password", + "backupRestore_passwordHelp", + "backupRestore_items", + "backupRestore_nodeSettings", + "backupRestore_nodeSettingsDescription", + "backupRestore_locationSettings", + "backupRestore_locationSettingsDescription", + "backupRestore_appSettings", + "backupRestore_appSettingsDescription", + "backupRestore_contacts", + "backupRestore_contactsDescription", + "backupRestore_discoveredContacts", + "backupRestore_discoveredContactsDescription", + "backupRestore_channels", + "backupRestore_channelsDescription", + "backupRestore_backup", + "backupRestore_restore", + "backupRestore_backupComplete", + "backupRestore_restoreComplete", + "backupRestore_failed", + "backupRestore_fileTooLarge", + "backupRestore_selectAtLeastOne", + "backupRestore_replaceIdentityTitle", + "backupRestore_replaceIdentityMessage" + ], + + "nl": [ + "settings_export", + "settings_exportSubtitle", + "backupRestore_title", + "backupRestore_subtitle", + "backupRestore_import", + "backupRestore_selectImportFile", + "backupRestore_password", + "backupRestore_passwordHelp", + "backupRestore_items", + "backupRestore_nodeSettings", + "backupRestore_nodeSettingsDescription", + "backupRestore_locationSettings", + "backupRestore_locationSettingsDescription", + "backupRestore_appSettings", + "backupRestore_appSettingsDescription", + "backupRestore_contacts", + "backupRestore_contactsDescription", + "backupRestore_discoveredContacts", + "backupRestore_discoveredContactsDescription", + "backupRestore_channels", + "backupRestore_channelsDescription", + "backupRestore_backup", + "backupRestore_restore", + "backupRestore_backupComplete", + "backupRestore_restoreComplete", + "backupRestore_failed", + "backupRestore_fileTooLarge", + "backupRestore_selectAtLeastOne", + "backupRestore_replaceIdentityTitle", + "backupRestore_replaceIdentityMessage" + ], + + "pl": [ + "settings_export", + "settings_exportSubtitle", + "backupRestore_title", + "backupRestore_subtitle", + "backupRestore_import", + "backupRestore_selectImportFile", + "backupRestore_password", + "backupRestore_passwordHelp", + "backupRestore_items", + "backupRestore_nodeSettings", + "backupRestore_nodeSettingsDescription", + "backupRestore_locationSettings", + "backupRestore_locationSettingsDescription", + "backupRestore_appSettings", + "backupRestore_appSettingsDescription", + "backupRestore_contacts", + "backupRestore_contactsDescription", + "backupRestore_discoveredContacts", + "backupRestore_discoveredContactsDescription", + "backupRestore_channels", + "backupRestore_channelsDescription", + "backupRestore_backup", + "backupRestore_restore", + "backupRestore_backupComplete", + "backupRestore_restoreComplete", + "backupRestore_failed", + "backupRestore_fileTooLarge", + "backupRestore_selectAtLeastOne", + "backupRestore_replaceIdentityTitle", + "backupRestore_replaceIdentityMessage" + ], + + "pt": [ + "settings_export", + "settings_exportSubtitle", + "backupRestore_title", + "backupRestore_subtitle", + "backupRestore_import", + "backupRestore_selectImportFile", + "backupRestore_password", + "backupRestore_passwordHelp", + "backupRestore_items", + "backupRestore_nodeSettings", + "backupRestore_nodeSettingsDescription", + "backupRestore_locationSettings", + "backupRestore_locationSettingsDescription", + "backupRestore_appSettings", + "backupRestore_appSettingsDescription", + "backupRestore_contacts", + "backupRestore_contactsDescription", + "backupRestore_discoveredContacts", + "backupRestore_discoveredContactsDescription", + "backupRestore_channels", + "backupRestore_channelsDescription", + "backupRestore_backup", + "backupRestore_restore", + "backupRestore_backupComplete", + "backupRestore_restoreComplete", + "backupRestore_failed", + "backupRestore_fileTooLarge", + "backupRestore_selectAtLeastOne", + "backupRestore_replaceIdentityTitle", + "backupRestore_replaceIdentityMessage" + ], + + "ru": [ + "settings_export", + "settings_exportSubtitle", + "backupRestore_title", + "backupRestore_subtitle", + "backupRestore_import", + "backupRestore_selectImportFile", + "backupRestore_password", + "backupRestore_passwordHelp", + "backupRestore_items", + "backupRestore_nodeSettings", + "backupRestore_nodeSettingsDescription", + "backupRestore_locationSettings", + "backupRestore_locationSettingsDescription", + "backupRestore_appSettings", + "backupRestore_appSettingsDescription", + "backupRestore_contacts", + "backupRestore_contactsDescription", + "backupRestore_discoveredContacts", + "backupRestore_discoveredContactsDescription", + "backupRestore_channels", + "backupRestore_channelsDescription", + "backupRestore_backup", + "backupRestore_restore", + "backupRestore_backupComplete", + "backupRestore_restoreComplete", + "backupRestore_failed", + "backupRestore_fileTooLarge", + "backupRestore_selectAtLeastOne", + "backupRestore_replaceIdentityTitle", + "backupRestore_replaceIdentityMessage" + ], + + "sk": [ + "settings_export", + "settings_exportSubtitle", + "backupRestore_title", + "backupRestore_subtitle", + "backupRestore_import", + "backupRestore_selectImportFile", + "backupRestore_password", + "backupRestore_passwordHelp", + "backupRestore_items", + "backupRestore_nodeSettings", + "backupRestore_nodeSettingsDescription", + "backupRestore_locationSettings", + "backupRestore_locationSettingsDescription", + "backupRestore_appSettings", + "backupRestore_appSettingsDescription", + "backupRestore_contacts", + "backupRestore_contactsDescription", + "backupRestore_discoveredContacts", + "backupRestore_discoveredContactsDescription", + "backupRestore_channels", + "backupRestore_channelsDescription", + "backupRestore_backup", + "backupRestore_restore", + "backupRestore_backupComplete", + "backupRestore_restoreComplete", + "backupRestore_failed", + "backupRestore_fileTooLarge", + "backupRestore_selectAtLeastOne", + "backupRestore_replaceIdentityTitle", + "backupRestore_replaceIdentityMessage" + ], + + "sl": [ + "settings_export", + "settings_exportSubtitle", + "backupRestore_title", + "backupRestore_subtitle", + "backupRestore_import", + "backupRestore_selectImportFile", + "backupRestore_password", + "backupRestore_passwordHelp", + "backupRestore_items", + "backupRestore_nodeSettings", + "backupRestore_nodeSettingsDescription", + "backupRestore_locationSettings", + "backupRestore_locationSettingsDescription", + "backupRestore_appSettings", + "backupRestore_appSettingsDescription", + "backupRestore_contacts", + "backupRestore_contactsDescription", + "backupRestore_discoveredContacts", + "backupRestore_discoveredContactsDescription", + "backupRestore_channels", + "backupRestore_channelsDescription", + "backupRestore_backup", + "backupRestore_restore", + "backupRestore_backupComplete", + "backupRestore_restoreComplete", + "backupRestore_failed", + "backupRestore_fileTooLarge", + "backupRestore_selectAtLeastOne", + "backupRestore_replaceIdentityTitle", + "backupRestore_replaceIdentityMessage" + ], + + "sv": [ + "settings_export", + "settings_exportSubtitle", + "backupRestore_title", + "backupRestore_subtitle", + "backupRestore_import", + "backupRestore_selectImportFile", + "backupRestore_password", + "backupRestore_passwordHelp", + "backupRestore_items", + "backupRestore_nodeSettings", + "backupRestore_nodeSettingsDescription", + "backupRestore_locationSettings", + "backupRestore_locationSettingsDescription", + "backupRestore_appSettings", + "backupRestore_appSettingsDescription", + "backupRestore_contacts", + "backupRestore_contactsDescription", + "backupRestore_discoveredContacts", + "backupRestore_discoveredContactsDescription", + "backupRestore_channels", + "backupRestore_channelsDescription", + "backupRestore_backup", + "backupRestore_restore", + "backupRestore_backupComplete", + "backupRestore_restoreComplete", + "backupRestore_failed", + "backupRestore_fileTooLarge", + "backupRestore_selectAtLeastOne", + "backupRestore_replaceIdentityTitle", + "backupRestore_replaceIdentityMessage" + ], + + "uk": [ + "settings_export", + "settings_exportSubtitle", + "backupRestore_title", + "backupRestore_subtitle", + "backupRestore_import", + "backupRestore_selectImportFile", + "backupRestore_password", + "backupRestore_passwordHelp", + "backupRestore_items", + "backupRestore_nodeSettings", + "backupRestore_nodeSettingsDescription", + "backupRestore_locationSettings", + "backupRestore_locationSettingsDescription", + "backupRestore_appSettings", + "backupRestore_appSettingsDescription", + "backupRestore_contacts", + "backupRestore_contactsDescription", + "backupRestore_discoveredContacts", + "backupRestore_discoveredContactsDescription", + "backupRestore_channels", + "backupRestore_channelsDescription", + "backupRestore_backup", + "backupRestore_restore", + "backupRestore_backupComplete", + "backupRestore_restoreComplete", + "backupRestore_failed", + "backupRestore_fileTooLarge", + "backupRestore_selectAtLeastOne", + "backupRestore_replaceIdentityTitle", + "backupRestore_replaceIdentityMessage" + ], + + "zh": [ + "settings_export", + "settings_exportSubtitle", + "backupRestore_title", + "backupRestore_subtitle", + "backupRestore_import", + "backupRestore_selectImportFile", + "backupRestore_password", + "backupRestore_passwordHelp", + "backupRestore_items", + "backupRestore_nodeSettings", + "backupRestore_nodeSettingsDescription", + "backupRestore_locationSettings", + "backupRestore_locationSettingsDescription", + "backupRestore_appSettings", + "backupRestore_appSettingsDescription", + "backupRestore_contacts", + "backupRestore_contactsDescription", + "backupRestore_discoveredContacts", + "backupRestore_discoveredContactsDescription", + "backupRestore_channels", + "backupRestore_channelsDescription", + "backupRestore_backup", + "backupRestore_restore", + "backupRestore_backupComplete", + "backupRestore_restoreComplete", + "backupRestore_failed", + "backupRestore_fileTooLarge", + "backupRestore_selectAtLeastOne", + "backupRestore_replaceIdentityTitle", + "backupRestore_replaceIdentityMessage" + ] +} From 79109c2c5ce3b713ab529b98e0d71ae83a71e0b4 Mon Sep 17 00:00:00 2001 From: ericz Date: Sun, 8 Nov 2026 02:47:34 +0100 Subject: [PATCH 02/16] more granular selection and import of official meshcore file. --- documentation/settings.md | 4 +- lib/l10n/app_en.arb | 20 + lib/l10n/app_localizations.dart | 120 +++ lib/l10n/app_localizations_bg.dart | 61 ++ lib/l10n/app_localizations_de.dart | 61 ++ lib/l10n/app_localizations_en.dart | 61 ++ lib/l10n/app_localizations_es.dart | 61 ++ lib/l10n/app_localizations_fr.dart | 61 ++ lib/l10n/app_localizations_hu.dart | 61 ++ lib/l10n/app_localizations_it.dart | 61 ++ lib/l10n/app_localizations_ja.dart | 61 ++ lib/l10n/app_localizations_ko.dart | 61 ++ lib/l10n/app_localizations_nl.dart | 61 ++ lib/l10n/app_localizations_pl.dart | 61 ++ lib/l10n/app_localizations_pt.dart | 61 ++ lib/l10n/app_localizations_ru.dart | 61 ++ lib/l10n/app_localizations_sk.dart | 61 ++ lib/l10n/app_localizations_sl.dart | 61 ++ lib/l10n/app_localizations_sv.dart | 61 ++ lib/l10n/app_localizations_uk.dart | 61 ++ lib/l10n/app_localizations_zh.dart | 61 ++ lib/screens/backup_restore_screen.dart | 497 +++++++++ lib/screens/export_screen.dart | 123 +++ lib/screens/settings_screen.dart | 112 -- lib/services/backup_service.dart | 1334 ++++++++++++++++++++++++ test/services/backup_service_test.dart | 305 ++++++ untranslated.json | 340 ++++++ 27 files changed, 3839 insertions(+), 114 deletions(-) create mode 100644 lib/screens/backup_restore_screen.dart create mode 100644 lib/screens/export_screen.dart create mode 100644 lib/services/backup_service.dart create mode 100644 test/services/backup_service_test.dart diff --git a/documentation/settings.md b/documentation/settings.md index 406663c2..628fd35c 100644 --- a/documentation/settings.md +++ b/documentation/settings.md @@ -212,9 +212,9 @@ The settings card links to **Backup & Restore** and **Export** subpages. ### Backup & Restore -Choose which information to include or restore: node name, identity, radio settings and regions; location, contact and privacy settings; app preferences; contacts and their filters and settings, groups, direct-message and route history; discovered contacts; and channels, filters, communities, settings and history. A radio connection is required to back up or restore radio settings and contact or channel lists. Contact and channel lists are restored to the connected radio; message history and groups are restored in the app. +Choose individual items to include in a backup or restore. Location settings include the saved coordinates, GPS enable state and interval, contact discovery options, and privacy/adverts settings. When importing, only items found in the selected file can be selected. Backups from the official MeshCore app are supported; those files do not include app preferences, groups, filters, or message history, so those choices are unavailable. A radio connection is required to restore radio settings and contact or channel lists. Contact and channel lists are restored to the connected radio; message history and groups are restored in the app. -Node Settings includes the radio's identity and private key. Some radio firmware does not allow identity backup or restore; the app will let you know if this feature is unavailable. Restoring Node Settings replaces the connected radio's identity after confirmation. +The private-key option is off by default because it changes the radio's identity. Select it only when you intend to restore that identity; the app asks for confirmation before proceeding. Some radios do not allow identity backup or restore, and the app will let you know if this feature is unavailable. A password protects the backup file. Leave the password blank to create an unprotected file. Backups may contain your radio's private key, channel keys, messages and saved passwords, so store them carefully. Downloaded models, received image files and cached map tiles are not included. diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index f69db281..b345cc1f 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -198,13 +198,33 @@ "backupRestore_selectImportFile": "Import File", "backupRestore_password": "Password (optional)", "backupRestore_passwordHelp": "A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.", + "backupRestore_importUnavailable": "Check the password or choose a supported backup file.", "backupRestore_items": "Backup and restore items", "backupRestore_nodeSettings": "Node Settings", "backupRestore_nodeSettingsDescription": "Device name, private and public keys, radio settings, and regions", + "backupRestore_deviceName": "Device Name", + "backupRestore_privateKey": "Private Key (sensitive)", + "backupRestore_publicKey": "Public Key", + "backupRestore_radioSettings": "Radio Settings", + "backupRestore_regions": "Regions", + "backupRestore_location": "Location", + "backupRestore_contactSettings": "Contact Settings", + "backupRestore_privacySettings": "Privacy Settings", + "backupRestore_contactsData": "Contacts", + "backupRestore_perContactSettings": "Contact Settings and Filters", + "backupRestore_contactGroups": "Contact Groups", + "backupRestore_contactHistory": "Contact History", + "backupRestore_channelsData": "Channels", + "backupRestore_channelFilters": "Message Filter Settings", + "backupRestore_channelSettings": "Channel Settings", + "backupRestore_communities": "Communities", + "backupRestore_channelHistory": "Channel History", "backupRestore_locationSettings": "Location Settings", "backupRestore_locationSettingsDescription": "Location, contact settings, and privacy settings", "backupRestore_appSettings": "App Settings", "backupRestore_appSettingsDescription": "App preferences and appearance settings", + "backupRestore_ipfsKey": "IPFS API Key (sensitive)", + "backupRestore_stadiaMapKey": "Stadia Maps API Key (sensitive)", "backupRestore_contacts": "Contacts", "backupRestore_contactsDescription": "Contacts, per-contact filters and settings, groups, and message history", "backupRestore_discoveredContacts": "Discovered Contacts", diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart index 4b7b8e08..6c42cc51 100644 --- a/lib/l10n/app_localizations.dart +++ b/lib/l10n/app_localizations.dart @@ -862,6 +862,12 @@ abstract class AppLocalizations { /// **'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'** String get backupRestore_passwordHelp; + /// No description provided for @backupRestore_importUnavailable. + /// + /// In en, this message translates to: + /// **'Check the password or choose a supported backup file.'** + String get backupRestore_importUnavailable; + /// No description provided for @backupRestore_items. /// /// In en, this message translates to: @@ -880,6 +886,108 @@ abstract class AppLocalizations { /// **'Device name, private and public keys, radio settings, and regions'** String get backupRestore_nodeSettingsDescription; + /// No description provided for @backupRestore_deviceName. + /// + /// In en, this message translates to: + /// **'Device Name'** + String get backupRestore_deviceName; + + /// No description provided for @backupRestore_privateKey. + /// + /// In en, this message translates to: + /// **'Private Key (sensitive)'** + String get backupRestore_privateKey; + + /// No description provided for @backupRestore_publicKey. + /// + /// In en, this message translates to: + /// **'Public Key'** + String get backupRestore_publicKey; + + /// No description provided for @backupRestore_radioSettings. + /// + /// In en, this message translates to: + /// **'Radio Settings'** + String get backupRestore_radioSettings; + + /// No description provided for @backupRestore_regions. + /// + /// In en, this message translates to: + /// **'Regions'** + String get backupRestore_regions; + + /// No description provided for @backupRestore_location. + /// + /// In en, this message translates to: + /// **'Location'** + String get backupRestore_location; + + /// No description provided for @backupRestore_contactSettings. + /// + /// In en, this message translates to: + /// **'Contact Settings'** + String get backupRestore_contactSettings; + + /// No description provided for @backupRestore_privacySettings. + /// + /// In en, this message translates to: + /// **'Privacy Settings'** + String get backupRestore_privacySettings; + + /// No description provided for @backupRestore_contactsData. + /// + /// In en, this message translates to: + /// **'Contacts'** + String get backupRestore_contactsData; + + /// No description provided for @backupRestore_perContactSettings. + /// + /// In en, this message translates to: + /// **'Contact Settings and Filters'** + String get backupRestore_perContactSettings; + + /// No description provided for @backupRestore_contactGroups. + /// + /// In en, this message translates to: + /// **'Contact Groups'** + String get backupRestore_contactGroups; + + /// No description provided for @backupRestore_contactHistory. + /// + /// In en, this message translates to: + /// **'Contact History'** + String get backupRestore_contactHistory; + + /// No description provided for @backupRestore_channelsData. + /// + /// In en, this message translates to: + /// **'Channels'** + String get backupRestore_channelsData; + + /// No description provided for @backupRestore_channelFilters. + /// + /// In en, this message translates to: + /// **'Message Filter Settings'** + String get backupRestore_channelFilters; + + /// No description provided for @backupRestore_channelSettings. + /// + /// In en, this message translates to: + /// **'Channel Settings'** + String get backupRestore_channelSettings; + + /// No description provided for @backupRestore_communities. + /// + /// In en, this message translates to: + /// **'Communities'** + String get backupRestore_communities; + + /// No description provided for @backupRestore_channelHistory. + /// + /// In en, this message translates to: + /// **'Channel History'** + String get backupRestore_channelHistory; + /// No description provided for @backupRestore_locationSettings. /// /// In en, this message translates to: @@ -904,6 +1012,18 @@ abstract class AppLocalizations { /// **'App preferences and appearance settings'** String get backupRestore_appSettingsDescription; + /// No description provided for @backupRestore_ipfsKey. + /// + /// In en, this message translates to: + /// **'IPFS API Key (sensitive)'** + String get backupRestore_ipfsKey; + + /// No description provided for @backupRestore_stadiaMapKey. + /// + /// In en, this message translates to: + /// **'Stadia Maps API Key (sensitive)'** + String get backupRestore_stadiaMapKey; + /// No description provided for @backupRestore_contacts. /// /// In en, this message translates to: diff --git a/lib/l10n/app_localizations_bg.dart b/lib/l10n/app_localizations_bg.dart index 1c6f29f0..1525fd45 100644 --- a/lib/l10n/app_localizations_bg.dart +++ b/lib/l10n/app_localizations_bg.dart @@ -425,6 +425,10 @@ class AppLocalizationsBg extends AppLocalizations { String get backupRestore_passwordHelp => 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + @override + String get backupRestore_importUnavailable => + 'Check the password or choose a supported backup file.'; + @override String get backupRestore_items => 'Backup and restore items'; @@ -435,6 +439,57 @@ class AppLocalizationsBg extends AppLocalizations { String get backupRestore_nodeSettingsDescription => 'Device name, private and public keys, radio settings, and regions'; + @override + String get backupRestore_deviceName => 'Device Name'; + + @override + String get backupRestore_privateKey => 'Private Key (sensitive)'; + + @override + String get backupRestore_publicKey => 'Public Key'; + + @override + String get backupRestore_radioSettings => 'Radio Settings'; + + @override + String get backupRestore_regions => 'Regions'; + + @override + String get backupRestore_location => 'Location'; + + @override + String get backupRestore_contactSettings => 'Contact Settings'; + + @override + String get backupRestore_privacySettings => 'Privacy Settings'; + + @override + String get backupRestore_contactsData => 'Contacts'; + + @override + String get backupRestore_perContactSettings => 'Contact Settings and Filters'; + + @override + String get backupRestore_contactGroups => 'Contact Groups'; + + @override + String get backupRestore_contactHistory => 'Contact History'; + + @override + String get backupRestore_channelsData => 'Channels'; + + @override + String get backupRestore_channelFilters => 'Message Filter Settings'; + + @override + String get backupRestore_channelSettings => 'Channel Settings'; + + @override + String get backupRestore_communities => 'Communities'; + + @override + String get backupRestore_channelHistory => 'Channel History'; + @override String get backupRestore_locationSettings => 'Location Settings'; @@ -449,6 +504,12 @@ class AppLocalizationsBg extends AppLocalizations { String get backupRestore_appSettingsDescription => 'App preferences and appearance settings'; + @override + String get backupRestore_ipfsKey => 'IPFS API Key (sensitive)'; + + @override + String get backupRestore_stadiaMapKey => 'Stadia Maps API Key (sensitive)'; + @override String get backupRestore_contacts => 'Contacts'; diff --git a/lib/l10n/app_localizations_de.dart b/lib/l10n/app_localizations_de.dart index 93d4740c..7a98cc9a 100644 --- a/lib/l10n/app_localizations_de.dart +++ b/lib/l10n/app_localizations_de.dart @@ -428,6 +428,10 @@ class AppLocalizationsDe extends AppLocalizations { String get backupRestore_passwordHelp => 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + @override + String get backupRestore_importUnavailable => + 'Check the password or choose a supported backup file.'; + @override String get backupRestore_items => 'Backup and restore items'; @@ -438,6 +442,57 @@ class AppLocalizationsDe extends AppLocalizations { String get backupRestore_nodeSettingsDescription => 'Device name, private and public keys, radio settings, and regions'; + @override + String get backupRestore_deviceName => 'Device Name'; + + @override + String get backupRestore_privateKey => 'Private Key (sensitive)'; + + @override + String get backupRestore_publicKey => 'Public Key'; + + @override + String get backupRestore_radioSettings => 'Radio Settings'; + + @override + String get backupRestore_regions => 'Regions'; + + @override + String get backupRestore_location => 'Location'; + + @override + String get backupRestore_contactSettings => 'Contact Settings'; + + @override + String get backupRestore_privacySettings => 'Privacy Settings'; + + @override + String get backupRestore_contactsData => 'Contacts'; + + @override + String get backupRestore_perContactSettings => 'Contact Settings and Filters'; + + @override + String get backupRestore_contactGroups => 'Contact Groups'; + + @override + String get backupRestore_contactHistory => 'Contact History'; + + @override + String get backupRestore_channelsData => 'Channels'; + + @override + String get backupRestore_channelFilters => 'Message Filter Settings'; + + @override + String get backupRestore_channelSettings => 'Channel Settings'; + + @override + String get backupRestore_communities => 'Communities'; + + @override + String get backupRestore_channelHistory => 'Channel History'; + @override String get backupRestore_locationSettings => 'Location Settings'; @@ -452,6 +507,12 @@ class AppLocalizationsDe extends AppLocalizations { String get backupRestore_appSettingsDescription => 'App preferences and appearance settings'; + @override + String get backupRestore_ipfsKey => 'IPFS API Key (sensitive)'; + + @override + String get backupRestore_stadiaMapKey => 'Stadia Maps API Key (sensitive)'; + @override String get backupRestore_contacts => 'Contacts'; diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart index 398c66dc..741c6a86 100644 --- a/lib/l10n/app_localizations_en.dart +++ b/lib/l10n/app_localizations_en.dart @@ -421,6 +421,10 @@ class AppLocalizationsEn extends AppLocalizations { String get backupRestore_passwordHelp => 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + @override + String get backupRestore_importUnavailable => + 'Check the password or choose a supported backup file.'; + @override String get backupRestore_items => 'Backup and restore items'; @@ -431,6 +435,57 @@ class AppLocalizationsEn extends AppLocalizations { String get backupRestore_nodeSettingsDescription => 'Device name, private and public keys, radio settings, and regions'; + @override + String get backupRestore_deviceName => 'Device Name'; + + @override + String get backupRestore_privateKey => 'Private Key (sensitive)'; + + @override + String get backupRestore_publicKey => 'Public Key'; + + @override + String get backupRestore_radioSettings => 'Radio Settings'; + + @override + String get backupRestore_regions => 'Regions'; + + @override + String get backupRestore_location => 'Location'; + + @override + String get backupRestore_contactSettings => 'Contact Settings'; + + @override + String get backupRestore_privacySettings => 'Privacy Settings'; + + @override + String get backupRestore_contactsData => 'Contacts'; + + @override + String get backupRestore_perContactSettings => 'Contact Settings and Filters'; + + @override + String get backupRestore_contactGroups => 'Contact Groups'; + + @override + String get backupRestore_contactHistory => 'Contact History'; + + @override + String get backupRestore_channelsData => 'Channels'; + + @override + String get backupRestore_channelFilters => 'Message Filter Settings'; + + @override + String get backupRestore_channelSettings => 'Channel Settings'; + + @override + String get backupRestore_communities => 'Communities'; + + @override + String get backupRestore_channelHistory => 'Channel History'; + @override String get backupRestore_locationSettings => 'Location Settings'; @@ -445,6 +500,12 @@ class AppLocalizationsEn extends AppLocalizations { String get backupRestore_appSettingsDescription => 'App preferences and appearance settings'; + @override + String get backupRestore_ipfsKey => 'IPFS API Key (sensitive)'; + + @override + String get backupRestore_stadiaMapKey => 'Stadia Maps API Key (sensitive)'; + @override String get backupRestore_contacts => 'Contacts'; diff --git a/lib/l10n/app_localizations_es.dart b/lib/l10n/app_localizations_es.dart index a6762562..8249dd75 100644 --- a/lib/l10n/app_localizations_es.dart +++ b/lib/l10n/app_localizations_es.dart @@ -426,6 +426,10 @@ class AppLocalizationsEs extends AppLocalizations { String get backupRestore_passwordHelp => 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + @override + String get backupRestore_importUnavailable => + 'Check the password or choose a supported backup file.'; + @override String get backupRestore_items => 'Backup and restore items'; @@ -436,6 +440,57 @@ class AppLocalizationsEs extends AppLocalizations { String get backupRestore_nodeSettingsDescription => 'Device name, private and public keys, radio settings, and regions'; + @override + String get backupRestore_deviceName => 'Device Name'; + + @override + String get backupRestore_privateKey => 'Private Key (sensitive)'; + + @override + String get backupRestore_publicKey => 'Public Key'; + + @override + String get backupRestore_radioSettings => 'Radio Settings'; + + @override + String get backupRestore_regions => 'Regions'; + + @override + String get backupRestore_location => 'Location'; + + @override + String get backupRestore_contactSettings => 'Contact Settings'; + + @override + String get backupRestore_privacySettings => 'Privacy Settings'; + + @override + String get backupRestore_contactsData => 'Contacts'; + + @override + String get backupRestore_perContactSettings => 'Contact Settings and Filters'; + + @override + String get backupRestore_contactGroups => 'Contact Groups'; + + @override + String get backupRestore_contactHistory => 'Contact History'; + + @override + String get backupRestore_channelsData => 'Channels'; + + @override + String get backupRestore_channelFilters => 'Message Filter Settings'; + + @override + String get backupRestore_channelSettings => 'Channel Settings'; + + @override + String get backupRestore_communities => 'Communities'; + + @override + String get backupRestore_channelHistory => 'Channel History'; + @override String get backupRestore_locationSettings => 'Location Settings'; @@ -450,6 +505,12 @@ class AppLocalizationsEs extends AppLocalizations { String get backupRestore_appSettingsDescription => 'App preferences and appearance settings'; + @override + String get backupRestore_ipfsKey => 'IPFS API Key (sensitive)'; + + @override + String get backupRestore_stadiaMapKey => 'Stadia Maps API Key (sensitive)'; + @override String get backupRestore_contacts => 'Contacts'; diff --git a/lib/l10n/app_localizations_fr.dart b/lib/l10n/app_localizations_fr.dart index 06b802f3..efae49c7 100644 --- a/lib/l10n/app_localizations_fr.dart +++ b/lib/l10n/app_localizations_fr.dart @@ -428,6 +428,10 @@ class AppLocalizationsFr extends AppLocalizations { String get backupRestore_passwordHelp => 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + @override + String get backupRestore_importUnavailable => + 'Check the password or choose a supported backup file.'; + @override String get backupRestore_items => 'Backup and restore items'; @@ -438,6 +442,57 @@ class AppLocalizationsFr extends AppLocalizations { String get backupRestore_nodeSettingsDescription => 'Device name, private and public keys, radio settings, and regions'; + @override + String get backupRestore_deviceName => 'Device Name'; + + @override + String get backupRestore_privateKey => 'Private Key (sensitive)'; + + @override + String get backupRestore_publicKey => 'Public Key'; + + @override + String get backupRestore_radioSettings => 'Radio Settings'; + + @override + String get backupRestore_regions => 'Regions'; + + @override + String get backupRestore_location => 'Location'; + + @override + String get backupRestore_contactSettings => 'Contact Settings'; + + @override + String get backupRestore_privacySettings => 'Privacy Settings'; + + @override + String get backupRestore_contactsData => 'Contacts'; + + @override + String get backupRestore_perContactSettings => 'Contact Settings and Filters'; + + @override + String get backupRestore_contactGroups => 'Contact Groups'; + + @override + String get backupRestore_contactHistory => 'Contact History'; + + @override + String get backupRestore_channelsData => 'Channels'; + + @override + String get backupRestore_channelFilters => 'Message Filter Settings'; + + @override + String get backupRestore_channelSettings => 'Channel Settings'; + + @override + String get backupRestore_communities => 'Communities'; + + @override + String get backupRestore_channelHistory => 'Channel History'; + @override String get backupRestore_locationSettings => 'Location Settings'; @@ -452,6 +507,12 @@ class AppLocalizationsFr extends AppLocalizations { String get backupRestore_appSettingsDescription => 'App preferences and appearance settings'; + @override + String get backupRestore_ipfsKey => 'IPFS API Key (sensitive)'; + + @override + String get backupRestore_stadiaMapKey => 'Stadia Maps API Key (sensitive)'; + @override String get backupRestore_contacts => 'Contacts'; diff --git a/lib/l10n/app_localizations_hu.dart b/lib/l10n/app_localizations_hu.dart index c05ff030..64420984 100644 --- a/lib/l10n/app_localizations_hu.dart +++ b/lib/l10n/app_localizations_hu.dart @@ -424,6 +424,10 @@ class AppLocalizationsHu extends AppLocalizations { String get backupRestore_passwordHelp => 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + @override + String get backupRestore_importUnavailable => + 'Check the password or choose a supported backup file.'; + @override String get backupRestore_items => 'Backup and restore items'; @@ -434,6 +438,57 @@ class AppLocalizationsHu extends AppLocalizations { String get backupRestore_nodeSettingsDescription => 'Device name, private and public keys, radio settings, and regions'; + @override + String get backupRestore_deviceName => 'Device Name'; + + @override + String get backupRestore_privateKey => 'Private Key (sensitive)'; + + @override + String get backupRestore_publicKey => 'Public Key'; + + @override + String get backupRestore_radioSettings => 'Radio Settings'; + + @override + String get backupRestore_regions => 'Regions'; + + @override + String get backupRestore_location => 'Location'; + + @override + String get backupRestore_contactSettings => 'Contact Settings'; + + @override + String get backupRestore_privacySettings => 'Privacy Settings'; + + @override + String get backupRestore_contactsData => 'Contacts'; + + @override + String get backupRestore_perContactSettings => 'Contact Settings and Filters'; + + @override + String get backupRestore_contactGroups => 'Contact Groups'; + + @override + String get backupRestore_contactHistory => 'Contact History'; + + @override + String get backupRestore_channelsData => 'Channels'; + + @override + String get backupRestore_channelFilters => 'Message Filter Settings'; + + @override + String get backupRestore_channelSettings => 'Channel Settings'; + + @override + String get backupRestore_communities => 'Communities'; + + @override + String get backupRestore_channelHistory => 'Channel History'; + @override String get backupRestore_locationSettings => 'Location Settings'; @@ -448,6 +503,12 @@ class AppLocalizationsHu extends AppLocalizations { String get backupRestore_appSettingsDescription => 'App preferences and appearance settings'; + @override + String get backupRestore_ipfsKey => 'IPFS API Key (sensitive)'; + + @override + String get backupRestore_stadiaMapKey => 'Stadia Maps API Key (sensitive)'; + @override String get backupRestore_contacts => 'Contacts'; diff --git a/lib/l10n/app_localizations_it.dart b/lib/l10n/app_localizations_it.dart index 5c712f66..998e97c0 100644 --- a/lib/l10n/app_localizations_it.dart +++ b/lib/l10n/app_localizations_it.dart @@ -428,6 +428,10 @@ class AppLocalizationsIt extends AppLocalizations { String get backupRestore_passwordHelp => 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + @override + String get backupRestore_importUnavailable => + 'Check the password or choose a supported backup file.'; + @override String get backupRestore_items => 'Backup and restore items'; @@ -438,6 +442,57 @@ class AppLocalizationsIt extends AppLocalizations { String get backupRestore_nodeSettingsDescription => 'Device name, private and public keys, radio settings, and regions'; + @override + String get backupRestore_deviceName => 'Device Name'; + + @override + String get backupRestore_privateKey => 'Private Key (sensitive)'; + + @override + String get backupRestore_publicKey => 'Public Key'; + + @override + String get backupRestore_radioSettings => 'Radio Settings'; + + @override + String get backupRestore_regions => 'Regions'; + + @override + String get backupRestore_location => 'Location'; + + @override + String get backupRestore_contactSettings => 'Contact Settings'; + + @override + String get backupRestore_privacySettings => 'Privacy Settings'; + + @override + String get backupRestore_contactsData => 'Contacts'; + + @override + String get backupRestore_perContactSettings => 'Contact Settings and Filters'; + + @override + String get backupRestore_contactGroups => 'Contact Groups'; + + @override + String get backupRestore_contactHistory => 'Contact History'; + + @override + String get backupRestore_channelsData => 'Channels'; + + @override + String get backupRestore_channelFilters => 'Message Filter Settings'; + + @override + String get backupRestore_channelSettings => 'Channel Settings'; + + @override + String get backupRestore_communities => 'Communities'; + + @override + String get backupRestore_channelHistory => 'Channel History'; + @override String get backupRestore_locationSettings => 'Location Settings'; @@ -452,6 +507,12 @@ class AppLocalizationsIt extends AppLocalizations { String get backupRestore_appSettingsDescription => 'App preferences and appearance settings'; + @override + String get backupRestore_ipfsKey => 'IPFS API Key (sensitive)'; + + @override + String get backupRestore_stadiaMapKey => 'Stadia Maps API Key (sensitive)'; + @override String get backupRestore_contacts => 'Contacts'; diff --git a/lib/l10n/app_localizations_ja.dart b/lib/l10n/app_localizations_ja.dart index 676b9c1b..50eeb3d6 100644 --- a/lib/l10n/app_localizations_ja.dart +++ b/lib/l10n/app_localizations_ja.dart @@ -409,6 +409,10 @@ class AppLocalizationsJa extends AppLocalizations { String get backupRestore_passwordHelp => 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + @override + String get backupRestore_importUnavailable => + 'Check the password or choose a supported backup file.'; + @override String get backupRestore_items => 'Backup and restore items'; @@ -419,6 +423,57 @@ class AppLocalizationsJa extends AppLocalizations { String get backupRestore_nodeSettingsDescription => 'Device name, private and public keys, radio settings, and regions'; + @override + String get backupRestore_deviceName => 'Device Name'; + + @override + String get backupRestore_privateKey => 'Private Key (sensitive)'; + + @override + String get backupRestore_publicKey => 'Public Key'; + + @override + String get backupRestore_radioSettings => 'Radio Settings'; + + @override + String get backupRestore_regions => 'Regions'; + + @override + String get backupRestore_location => 'Location'; + + @override + String get backupRestore_contactSettings => 'Contact Settings'; + + @override + String get backupRestore_privacySettings => 'Privacy Settings'; + + @override + String get backupRestore_contactsData => 'Contacts'; + + @override + String get backupRestore_perContactSettings => 'Contact Settings and Filters'; + + @override + String get backupRestore_contactGroups => 'Contact Groups'; + + @override + String get backupRestore_contactHistory => 'Contact History'; + + @override + String get backupRestore_channelsData => 'Channels'; + + @override + String get backupRestore_channelFilters => 'Message Filter Settings'; + + @override + String get backupRestore_channelSettings => 'Channel Settings'; + + @override + String get backupRestore_communities => 'Communities'; + + @override + String get backupRestore_channelHistory => 'Channel History'; + @override String get backupRestore_locationSettings => 'Location Settings'; @@ -433,6 +488,12 @@ class AppLocalizationsJa extends AppLocalizations { String get backupRestore_appSettingsDescription => 'App preferences and appearance settings'; + @override + String get backupRestore_ipfsKey => 'IPFS API Key (sensitive)'; + + @override + String get backupRestore_stadiaMapKey => 'Stadia Maps API Key (sensitive)'; + @override String get backupRestore_contacts => 'Contacts'; diff --git a/lib/l10n/app_localizations_ko.dart b/lib/l10n/app_localizations_ko.dart index a1f61083..11acc5bc 100644 --- a/lib/l10n/app_localizations_ko.dart +++ b/lib/l10n/app_localizations_ko.dart @@ -409,6 +409,10 @@ class AppLocalizationsKo extends AppLocalizations { String get backupRestore_passwordHelp => 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + @override + String get backupRestore_importUnavailable => + 'Check the password or choose a supported backup file.'; + @override String get backupRestore_items => 'Backup and restore items'; @@ -419,6 +423,57 @@ class AppLocalizationsKo extends AppLocalizations { String get backupRestore_nodeSettingsDescription => 'Device name, private and public keys, radio settings, and regions'; + @override + String get backupRestore_deviceName => 'Device Name'; + + @override + String get backupRestore_privateKey => 'Private Key (sensitive)'; + + @override + String get backupRestore_publicKey => 'Public Key'; + + @override + String get backupRestore_radioSettings => 'Radio Settings'; + + @override + String get backupRestore_regions => 'Regions'; + + @override + String get backupRestore_location => 'Location'; + + @override + String get backupRestore_contactSettings => 'Contact Settings'; + + @override + String get backupRestore_privacySettings => 'Privacy Settings'; + + @override + String get backupRestore_contactsData => 'Contacts'; + + @override + String get backupRestore_perContactSettings => 'Contact Settings and Filters'; + + @override + String get backupRestore_contactGroups => 'Contact Groups'; + + @override + String get backupRestore_contactHistory => 'Contact History'; + + @override + String get backupRestore_channelsData => 'Channels'; + + @override + String get backupRestore_channelFilters => 'Message Filter Settings'; + + @override + String get backupRestore_channelSettings => 'Channel Settings'; + + @override + String get backupRestore_communities => 'Communities'; + + @override + String get backupRestore_channelHistory => 'Channel History'; + @override String get backupRestore_locationSettings => 'Location Settings'; @@ -433,6 +488,12 @@ class AppLocalizationsKo extends AppLocalizations { String get backupRestore_appSettingsDescription => 'App preferences and appearance settings'; + @override + String get backupRestore_ipfsKey => 'IPFS API Key (sensitive)'; + + @override + String get backupRestore_stadiaMapKey => 'Stadia Maps API Key (sensitive)'; + @override String get backupRestore_contacts => 'Contacts'; diff --git a/lib/l10n/app_localizations_nl.dart b/lib/l10n/app_localizations_nl.dart index 2eb8d6d2..0da21c09 100644 --- a/lib/l10n/app_localizations_nl.dart +++ b/lib/l10n/app_localizations_nl.dart @@ -424,6 +424,10 @@ class AppLocalizationsNl extends AppLocalizations { String get backupRestore_passwordHelp => 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + @override + String get backupRestore_importUnavailable => + 'Check the password or choose a supported backup file.'; + @override String get backupRestore_items => 'Backup and restore items'; @@ -434,6 +438,57 @@ class AppLocalizationsNl extends AppLocalizations { String get backupRestore_nodeSettingsDescription => 'Device name, private and public keys, radio settings, and regions'; + @override + String get backupRestore_deviceName => 'Device Name'; + + @override + String get backupRestore_privateKey => 'Private Key (sensitive)'; + + @override + String get backupRestore_publicKey => 'Public Key'; + + @override + String get backupRestore_radioSettings => 'Radio Settings'; + + @override + String get backupRestore_regions => 'Regions'; + + @override + String get backupRestore_location => 'Location'; + + @override + String get backupRestore_contactSettings => 'Contact Settings'; + + @override + String get backupRestore_privacySettings => 'Privacy Settings'; + + @override + String get backupRestore_contactsData => 'Contacts'; + + @override + String get backupRestore_perContactSettings => 'Contact Settings and Filters'; + + @override + String get backupRestore_contactGroups => 'Contact Groups'; + + @override + String get backupRestore_contactHistory => 'Contact History'; + + @override + String get backupRestore_channelsData => 'Channels'; + + @override + String get backupRestore_channelFilters => 'Message Filter Settings'; + + @override + String get backupRestore_channelSettings => 'Channel Settings'; + + @override + String get backupRestore_communities => 'Communities'; + + @override + String get backupRestore_channelHistory => 'Channel History'; + @override String get backupRestore_locationSettings => 'Location Settings'; @@ -448,6 +503,12 @@ class AppLocalizationsNl extends AppLocalizations { String get backupRestore_appSettingsDescription => 'App preferences and appearance settings'; + @override + String get backupRestore_ipfsKey => 'IPFS API Key (sensitive)'; + + @override + String get backupRestore_stadiaMapKey => 'Stadia Maps API Key (sensitive)'; + @override String get backupRestore_contacts => 'Contacts'; diff --git a/lib/l10n/app_localizations_pl.dart b/lib/l10n/app_localizations_pl.dart index 43790915..ab7bd293 100644 --- a/lib/l10n/app_localizations_pl.dart +++ b/lib/l10n/app_localizations_pl.dart @@ -431,6 +431,10 @@ class AppLocalizationsPl extends AppLocalizations { String get backupRestore_passwordHelp => 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + @override + String get backupRestore_importUnavailable => + 'Check the password or choose a supported backup file.'; + @override String get backupRestore_items => 'Backup and restore items'; @@ -441,6 +445,57 @@ class AppLocalizationsPl extends AppLocalizations { String get backupRestore_nodeSettingsDescription => 'Device name, private and public keys, radio settings, and regions'; + @override + String get backupRestore_deviceName => 'Device Name'; + + @override + String get backupRestore_privateKey => 'Private Key (sensitive)'; + + @override + String get backupRestore_publicKey => 'Public Key'; + + @override + String get backupRestore_radioSettings => 'Radio Settings'; + + @override + String get backupRestore_regions => 'Regions'; + + @override + String get backupRestore_location => 'Location'; + + @override + String get backupRestore_contactSettings => 'Contact Settings'; + + @override + String get backupRestore_privacySettings => 'Privacy Settings'; + + @override + String get backupRestore_contactsData => 'Contacts'; + + @override + String get backupRestore_perContactSettings => 'Contact Settings and Filters'; + + @override + String get backupRestore_contactGroups => 'Contact Groups'; + + @override + String get backupRestore_contactHistory => 'Contact History'; + + @override + String get backupRestore_channelsData => 'Channels'; + + @override + String get backupRestore_channelFilters => 'Message Filter Settings'; + + @override + String get backupRestore_channelSettings => 'Channel Settings'; + + @override + String get backupRestore_communities => 'Communities'; + + @override + String get backupRestore_channelHistory => 'Channel History'; + @override String get backupRestore_locationSettings => 'Location Settings'; @@ -455,6 +510,12 @@ class AppLocalizationsPl extends AppLocalizations { String get backupRestore_appSettingsDescription => 'App preferences and appearance settings'; + @override + String get backupRestore_ipfsKey => 'IPFS API Key (sensitive)'; + + @override + String get backupRestore_stadiaMapKey => 'Stadia Maps API Key (sensitive)'; + @override String get backupRestore_contacts => 'Contacts'; diff --git a/lib/l10n/app_localizations_pt.dart b/lib/l10n/app_localizations_pt.dart index 2a70fb29..9f8f4943 100644 --- a/lib/l10n/app_localizations_pt.dart +++ b/lib/l10n/app_localizations_pt.dart @@ -427,6 +427,10 @@ class AppLocalizationsPt extends AppLocalizations { String get backupRestore_passwordHelp => 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + @override + String get backupRestore_importUnavailable => + 'Check the password or choose a supported backup file.'; + @override String get backupRestore_items => 'Backup and restore items'; @@ -437,6 +441,57 @@ class AppLocalizationsPt extends AppLocalizations { String get backupRestore_nodeSettingsDescription => 'Device name, private and public keys, radio settings, and regions'; + @override + String get backupRestore_deviceName => 'Device Name'; + + @override + String get backupRestore_privateKey => 'Private Key (sensitive)'; + + @override + String get backupRestore_publicKey => 'Public Key'; + + @override + String get backupRestore_radioSettings => 'Radio Settings'; + + @override + String get backupRestore_regions => 'Regions'; + + @override + String get backupRestore_location => 'Location'; + + @override + String get backupRestore_contactSettings => 'Contact Settings'; + + @override + String get backupRestore_privacySettings => 'Privacy Settings'; + + @override + String get backupRestore_contactsData => 'Contacts'; + + @override + String get backupRestore_perContactSettings => 'Contact Settings and Filters'; + + @override + String get backupRestore_contactGroups => 'Contact Groups'; + + @override + String get backupRestore_contactHistory => 'Contact History'; + + @override + String get backupRestore_channelsData => 'Channels'; + + @override + String get backupRestore_channelFilters => 'Message Filter Settings'; + + @override + String get backupRestore_channelSettings => 'Channel Settings'; + + @override + String get backupRestore_communities => 'Communities'; + + @override + String get backupRestore_channelHistory => 'Channel History'; + @override String get backupRestore_locationSettings => 'Location Settings'; @@ -451,6 +506,12 @@ class AppLocalizationsPt extends AppLocalizations { String get backupRestore_appSettingsDescription => 'App preferences and appearance settings'; + @override + String get backupRestore_ipfsKey => 'IPFS API Key (sensitive)'; + + @override + String get backupRestore_stadiaMapKey => 'Stadia Maps API Key (sensitive)'; + @override String get backupRestore_contacts => 'Contacts'; diff --git a/lib/l10n/app_localizations_ru.dart b/lib/l10n/app_localizations_ru.dart index 224d80a0..c0534b20 100644 --- a/lib/l10n/app_localizations_ru.dart +++ b/lib/l10n/app_localizations_ru.dart @@ -427,6 +427,10 @@ class AppLocalizationsRu extends AppLocalizations { String get backupRestore_passwordHelp => 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + @override + String get backupRestore_importUnavailable => + 'Check the password or choose a supported backup file.'; + @override String get backupRestore_items => 'Backup and restore items'; @@ -437,6 +441,57 @@ class AppLocalizationsRu extends AppLocalizations { String get backupRestore_nodeSettingsDescription => 'Device name, private and public keys, radio settings, and regions'; + @override + String get backupRestore_deviceName => 'Device Name'; + + @override + String get backupRestore_privateKey => 'Private Key (sensitive)'; + + @override + String get backupRestore_publicKey => 'Public Key'; + + @override + String get backupRestore_radioSettings => 'Radio Settings'; + + @override + String get backupRestore_regions => 'Regions'; + + @override + String get backupRestore_location => 'Location'; + + @override + String get backupRestore_contactSettings => 'Contact Settings'; + + @override + String get backupRestore_privacySettings => 'Privacy Settings'; + + @override + String get backupRestore_contactsData => 'Contacts'; + + @override + String get backupRestore_perContactSettings => 'Contact Settings and Filters'; + + @override + String get backupRestore_contactGroups => 'Contact Groups'; + + @override + String get backupRestore_contactHistory => 'Contact History'; + + @override + String get backupRestore_channelsData => 'Channels'; + + @override + String get backupRestore_channelFilters => 'Message Filter Settings'; + + @override + String get backupRestore_channelSettings => 'Channel Settings'; + + @override + String get backupRestore_communities => 'Communities'; + + @override + String get backupRestore_channelHistory => 'Channel History'; + @override String get backupRestore_locationSettings => 'Location Settings'; @@ -451,6 +506,12 @@ class AppLocalizationsRu extends AppLocalizations { String get backupRestore_appSettingsDescription => 'App preferences and appearance settings'; + @override + String get backupRestore_ipfsKey => 'IPFS API Key (sensitive)'; + + @override + String get backupRestore_stadiaMapKey => 'Stadia Maps API Key (sensitive)'; + @override String get backupRestore_contacts => 'Contacts'; diff --git a/lib/l10n/app_localizations_sk.dart b/lib/l10n/app_localizations_sk.dart index f52aab24..35263c5b 100644 --- a/lib/l10n/app_localizations_sk.dart +++ b/lib/l10n/app_localizations_sk.dart @@ -427,6 +427,10 @@ class AppLocalizationsSk extends AppLocalizations { String get backupRestore_passwordHelp => 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + @override + String get backupRestore_importUnavailable => + 'Check the password or choose a supported backup file.'; + @override String get backupRestore_items => 'Backup and restore items'; @@ -437,6 +441,57 @@ class AppLocalizationsSk extends AppLocalizations { String get backupRestore_nodeSettingsDescription => 'Device name, private and public keys, radio settings, and regions'; + @override + String get backupRestore_deviceName => 'Device Name'; + + @override + String get backupRestore_privateKey => 'Private Key (sensitive)'; + + @override + String get backupRestore_publicKey => 'Public Key'; + + @override + String get backupRestore_radioSettings => 'Radio Settings'; + + @override + String get backupRestore_regions => 'Regions'; + + @override + String get backupRestore_location => 'Location'; + + @override + String get backupRestore_contactSettings => 'Contact Settings'; + + @override + String get backupRestore_privacySettings => 'Privacy Settings'; + + @override + String get backupRestore_contactsData => 'Contacts'; + + @override + String get backupRestore_perContactSettings => 'Contact Settings and Filters'; + + @override + String get backupRestore_contactGroups => 'Contact Groups'; + + @override + String get backupRestore_contactHistory => 'Contact History'; + + @override + String get backupRestore_channelsData => 'Channels'; + + @override + String get backupRestore_channelFilters => 'Message Filter Settings'; + + @override + String get backupRestore_channelSettings => 'Channel Settings'; + + @override + String get backupRestore_communities => 'Communities'; + + @override + String get backupRestore_channelHistory => 'Channel History'; + @override String get backupRestore_locationSettings => 'Location Settings'; @@ -451,6 +506,12 @@ class AppLocalizationsSk extends AppLocalizations { String get backupRestore_appSettingsDescription => 'App preferences and appearance settings'; + @override + String get backupRestore_ipfsKey => 'IPFS API Key (sensitive)'; + + @override + String get backupRestore_stadiaMapKey => 'Stadia Maps API Key (sensitive)'; + @override String get backupRestore_contacts => 'Contacts'; diff --git a/lib/l10n/app_localizations_sl.dart b/lib/l10n/app_localizations_sl.dart index 5fdc42f9..95e03d47 100644 --- a/lib/l10n/app_localizations_sl.dart +++ b/lib/l10n/app_localizations_sl.dart @@ -426,6 +426,10 @@ class AppLocalizationsSl extends AppLocalizations { String get backupRestore_passwordHelp => 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + @override + String get backupRestore_importUnavailable => + 'Check the password or choose a supported backup file.'; + @override String get backupRestore_items => 'Backup and restore items'; @@ -436,6 +440,57 @@ class AppLocalizationsSl extends AppLocalizations { String get backupRestore_nodeSettingsDescription => 'Device name, private and public keys, radio settings, and regions'; + @override + String get backupRestore_deviceName => 'Device Name'; + + @override + String get backupRestore_privateKey => 'Private Key (sensitive)'; + + @override + String get backupRestore_publicKey => 'Public Key'; + + @override + String get backupRestore_radioSettings => 'Radio Settings'; + + @override + String get backupRestore_regions => 'Regions'; + + @override + String get backupRestore_location => 'Location'; + + @override + String get backupRestore_contactSettings => 'Contact Settings'; + + @override + String get backupRestore_privacySettings => 'Privacy Settings'; + + @override + String get backupRestore_contactsData => 'Contacts'; + + @override + String get backupRestore_perContactSettings => 'Contact Settings and Filters'; + + @override + String get backupRestore_contactGroups => 'Contact Groups'; + + @override + String get backupRestore_contactHistory => 'Contact History'; + + @override + String get backupRestore_channelsData => 'Channels'; + + @override + String get backupRestore_channelFilters => 'Message Filter Settings'; + + @override + String get backupRestore_channelSettings => 'Channel Settings'; + + @override + String get backupRestore_communities => 'Communities'; + + @override + String get backupRestore_channelHistory => 'Channel History'; + @override String get backupRestore_locationSettings => 'Location Settings'; @@ -450,6 +505,12 @@ class AppLocalizationsSl extends AppLocalizations { String get backupRestore_appSettingsDescription => 'App preferences and appearance settings'; + @override + String get backupRestore_ipfsKey => 'IPFS API Key (sensitive)'; + + @override + String get backupRestore_stadiaMapKey => 'Stadia Maps API Key (sensitive)'; + @override String get backupRestore_contacts => 'Contacts'; diff --git a/lib/l10n/app_localizations_sv.dart b/lib/l10n/app_localizations_sv.dart index 4723c8f2..9be4b142 100644 --- a/lib/l10n/app_localizations_sv.dart +++ b/lib/l10n/app_localizations_sv.dart @@ -422,6 +422,10 @@ class AppLocalizationsSv extends AppLocalizations { String get backupRestore_passwordHelp => 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + @override + String get backupRestore_importUnavailable => + 'Check the password or choose a supported backup file.'; + @override String get backupRestore_items => 'Backup and restore items'; @@ -432,6 +436,57 @@ class AppLocalizationsSv extends AppLocalizations { String get backupRestore_nodeSettingsDescription => 'Device name, private and public keys, radio settings, and regions'; + @override + String get backupRestore_deviceName => 'Device Name'; + + @override + String get backupRestore_privateKey => 'Private Key (sensitive)'; + + @override + String get backupRestore_publicKey => 'Public Key'; + + @override + String get backupRestore_radioSettings => 'Radio Settings'; + + @override + String get backupRestore_regions => 'Regions'; + + @override + String get backupRestore_location => 'Location'; + + @override + String get backupRestore_contactSettings => 'Contact Settings'; + + @override + String get backupRestore_privacySettings => 'Privacy Settings'; + + @override + String get backupRestore_contactsData => 'Contacts'; + + @override + String get backupRestore_perContactSettings => 'Contact Settings and Filters'; + + @override + String get backupRestore_contactGroups => 'Contact Groups'; + + @override + String get backupRestore_contactHistory => 'Contact History'; + + @override + String get backupRestore_channelsData => 'Channels'; + + @override + String get backupRestore_channelFilters => 'Message Filter Settings'; + + @override + String get backupRestore_channelSettings => 'Channel Settings'; + + @override + String get backupRestore_communities => 'Communities'; + + @override + String get backupRestore_channelHistory => 'Channel History'; + @override String get backupRestore_locationSettings => 'Location Settings'; @@ -446,6 +501,12 @@ class AppLocalizationsSv extends AppLocalizations { String get backupRestore_appSettingsDescription => 'App preferences and appearance settings'; + @override + String get backupRestore_ipfsKey => 'IPFS API Key (sensitive)'; + + @override + String get backupRestore_stadiaMapKey => 'Stadia Maps API Key (sensitive)'; + @override String get backupRestore_contacts => 'Contacts'; diff --git a/lib/l10n/app_localizations_uk.dart b/lib/l10n/app_localizations_uk.dart index 8c15697e..a87c8d27 100644 --- a/lib/l10n/app_localizations_uk.dart +++ b/lib/l10n/app_localizations_uk.dart @@ -426,6 +426,10 @@ class AppLocalizationsUk extends AppLocalizations { String get backupRestore_passwordHelp => 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + @override + String get backupRestore_importUnavailable => + 'Check the password or choose a supported backup file.'; + @override String get backupRestore_items => 'Backup and restore items'; @@ -436,6 +440,57 @@ class AppLocalizationsUk extends AppLocalizations { String get backupRestore_nodeSettingsDescription => 'Device name, private and public keys, radio settings, and regions'; + @override + String get backupRestore_deviceName => 'Device Name'; + + @override + String get backupRestore_privateKey => 'Private Key (sensitive)'; + + @override + String get backupRestore_publicKey => 'Public Key'; + + @override + String get backupRestore_radioSettings => 'Radio Settings'; + + @override + String get backupRestore_regions => 'Regions'; + + @override + String get backupRestore_location => 'Location'; + + @override + String get backupRestore_contactSettings => 'Contact Settings'; + + @override + String get backupRestore_privacySettings => 'Privacy Settings'; + + @override + String get backupRestore_contactsData => 'Contacts'; + + @override + String get backupRestore_perContactSettings => 'Contact Settings and Filters'; + + @override + String get backupRestore_contactGroups => 'Contact Groups'; + + @override + String get backupRestore_contactHistory => 'Contact History'; + + @override + String get backupRestore_channelsData => 'Channels'; + + @override + String get backupRestore_channelFilters => 'Message Filter Settings'; + + @override + String get backupRestore_channelSettings => 'Channel Settings'; + + @override + String get backupRestore_communities => 'Communities'; + + @override + String get backupRestore_channelHistory => 'Channel History'; + @override String get backupRestore_locationSettings => 'Location Settings'; @@ -450,6 +505,12 @@ class AppLocalizationsUk extends AppLocalizations { String get backupRestore_appSettingsDescription => 'App preferences and appearance settings'; + @override + String get backupRestore_ipfsKey => 'IPFS API Key (sensitive)'; + + @override + String get backupRestore_stadiaMapKey => 'Stadia Maps API Key (sensitive)'; + @override String get backupRestore_contacts => 'Contacts'; diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dart index 6e95a003..5c09fbb1 100644 --- a/lib/l10n/app_localizations_zh.dart +++ b/lib/l10n/app_localizations_zh.dart @@ -403,6 +403,10 @@ class AppLocalizationsZh extends AppLocalizations { String get backupRestore_passwordHelp => 'A password encrypts the file. Blank saves plaintext that may include private/channel keys, history, and credentials.'; + @override + String get backupRestore_importUnavailable => + 'Check the password or choose a supported backup file.'; + @override String get backupRestore_items => 'Backup and restore items'; @@ -413,6 +417,57 @@ class AppLocalizationsZh extends AppLocalizations { String get backupRestore_nodeSettingsDescription => 'Device name, private and public keys, radio settings, and regions'; + @override + String get backupRestore_deviceName => 'Device Name'; + + @override + String get backupRestore_privateKey => 'Private Key (sensitive)'; + + @override + String get backupRestore_publicKey => 'Public Key'; + + @override + String get backupRestore_radioSettings => 'Radio Settings'; + + @override + String get backupRestore_regions => 'Regions'; + + @override + String get backupRestore_location => 'Location'; + + @override + String get backupRestore_contactSettings => 'Contact Settings'; + + @override + String get backupRestore_privacySettings => 'Privacy Settings'; + + @override + String get backupRestore_contactsData => 'Contacts'; + + @override + String get backupRestore_perContactSettings => 'Contact Settings and Filters'; + + @override + String get backupRestore_contactGroups => 'Contact Groups'; + + @override + String get backupRestore_contactHistory => 'Contact History'; + + @override + String get backupRestore_channelsData => 'Channels'; + + @override + String get backupRestore_channelFilters => 'Message Filter Settings'; + + @override + String get backupRestore_channelSettings => 'Channel Settings'; + + @override + String get backupRestore_communities => 'Communities'; + + @override + String get backupRestore_channelHistory => 'Channel History'; + @override String get backupRestore_locationSettings => 'Location Settings'; @@ -427,6 +482,12 @@ class AppLocalizationsZh extends AppLocalizations { String get backupRestore_appSettingsDescription => 'App preferences and appearance settings'; + @override + String get backupRestore_ipfsKey => 'IPFS API Key (sensitive)'; + + @override + String get backupRestore_stadiaMapKey => 'Stadia Maps API Key (sensitive)'; + @override String get backupRestore_contacts => 'Contacts'; diff --git a/lib/screens/backup_restore_screen.dart b/lib/screens/backup_restore_screen.dart new file mode 100644 index 00000000..f6d50833 --- /dev/null +++ b/lib/screens/backup_restore_screen.dart @@ -0,0 +1,497 @@ +import 'dart:async'; +import 'dart:convert'; +import 'dart:typed_data'; + +import 'package:file_selector/file_selector.dart'; +import 'package:flutter/material.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 '../services/backup_service.dart'; +import '../services/message_filter/message_filter_service.dart'; +import '../utils/platform_info.dart'; +import '../utils/share_origin.dart'; +import '../widgets/app_bar.dart'; +import '../widgets/mesh_ui.dart'; +import '../widgets/sync_progress_overlay.dart'; + +class BackupRestoreScreen extends StatefulWidget { + const BackupRestoreScreen({super.key}); + + @override + State createState() => _BackupRestoreScreenState(); +} + +class _BackupRestoreScreenState extends State { + static const int _maxImportBytes = 100 * 1024 * 1024; + static const _backupService = BackupService(); + static const _fileType = XTypeGroup( + label: 'MeshCore backup', + extensions: ['json'], + mimeTypes: ['application/json'], + ); + static const Set _defaultUncheckedItems = { + BackupItem.privateKey, + BackupItem.ipfsKey, + BackupItem.stadiaMapKey, + }; + static const Set _deviceStoredItems = { + BackupItem.deviceName, + BackupItem.publicKey, + BackupItem.radioSettings, + BackupItem.location, + BackupItem.contactSettings, + BackupItem.privacySettings, + }; + static const Set _defaultUncheckedOnRestore = { + ..._defaultUncheckedItems, + ..._deviceStoredItems, + }; + final _passwordController = TextEditingController(); + final Set _selectedItems = BackupItem.values + .where((item) => !_defaultUncheckedItems.contains(item)) + .toSet(); + Set? _availableItems; + String? _importContents; + String? _importFileName; + Timer? _inspectionTimer; + int _inspectionGeneration = 0; + bool _hasInitializedImportSelection = false; + bool _busy = false; + + @override + void dispose() { + _inspectionTimer?.cancel(); + _passwordController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + final l10n = context.l10n; + return Scaffold( + appBar: AppBar( + title: AppBarTitle( + l10n.backupRestore_title, + indicators: false, + subtitle: false, + ), + centerTitle: true, + bottom: const SyncProgressAppBarBottom(), + ), + body: SafeArea( + top: false, + child: ListView( + padding: const EdgeInsets.fromLTRB(0, 8, 0, 24), + children: [ + SectionHeader(l10n.backupRestore_import), + MeshCard( + padding: const EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + OutlinedButton.icon( + onPressed: _busy ? null : _selectImportFile, + icon: const Icon(Icons.upload_file_outlined), + label: Text( + _importFileName ?? l10n.backupRestore_selectImportFile, + ), + ), + const SizedBox(height: 12), + TextField( + controller: _passwordController, + obscureText: true, + autocorrect: false, + enableSuggestions: false, + onChanged: (_) => _scheduleImportInspection(), + decoration: InputDecoration( + labelText: l10n.backupRestore_password, + helperText: + _importContents != null && + _availableItems?.isEmpty == true + ? l10n.backupRestore_importUnavailable + : l10n.backupRestore_passwordHelp, + border: const OutlineInputBorder(), + ), + ), + ], + ), + ), + SectionHeader(l10n.backupRestore_items), + MeshCard( + padding: EdgeInsets.zero, + child: Column( + children: [ + _groupTile( + title: l10n.backupRestore_nodeSettings, + icon: Icons.router_outlined, + items: [ + (BackupItem.deviceName, l10n.backupRestore_deviceName), + (BackupItem.privateKey, l10n.backupRestore_privateKey), + (BackupItem.publicKey, l10n.backupRestore_publicKey), + ( + BackupItem.radioSettings, + l10n.backupRestore_radioSettings, + ), + (BackupItem.regions, l10n.backupRestore_regions), + ], + ), + const Divider(height: 1, indent: 16), + _groupTile( + title: l10n.backupRestore_locationSettings, + icon: Icons.location_on_outlined, + items: [ + (BackupItem.location, l10n.backupRestore_location), + ( + BackupItem.contactSettings, + l10n.backupRestore_contactSettings, + ), + ( + BackupItem.privacySettings, + l10n.backupRestore_privacySettings, + ), + ], + ), + const Divider(height: 1, indent: 16), + _groupTile( + title: l10n.backupRestore_appSettings, + icon: Icons.settings_outlined, + items: [ + (BackupItem.appSettings, l10n.backupRestore_appSettings), + (BackupItem.ipfsKey, l10n.backupRestore_ipfsKey), + ( + BackupItem.stadiaMapKey, + l10n.backupRestore_stadiaMapKey, + ), + ], + ), + const Divider(height: 1, indent: 16), + _groupTile( + title: l10n.backupRestore_contacts, + icon: Icons.contacts_outlined, + items: [ + (BackupItem.contacts, l10n.backupRestore_contactsData), + ( + BackupItem.perContactSettings, + l10n.backupRestore_perContactSettings, + ), + ( + BackupItem.contactGroups, + l10n.backupRestore_contactGroups, + ), + ( + BackupItem.contactHistory, + l10n.backupRestore_contactHistory, + ), + ], + ), + const Divider(height: 1, indent: 16), + _itemTile( + BackupItem.discoveredContacts, + l10n.backupRestore_discoveredContacts, + Icons.person_search_outlined, + ), + const Divider(height: 1, indent: 16), + _groupTile( + title: l10n.backupRestore_channels, + icon: Icons.forum_outlined, + items: [ + (BackupItem.channels, l10n.backupRestore_channelsData), + ( + BackupItem.channelFilters, + l10n.backupRestore_channelFilters, + ), + ( + BackupItem.channelSettings, + l10n.backupRestore_channelSettings, + ), + (BackupItem.communities, l10n.backupRestore_communities), + ( + BackupItem.channelHistory, + l10n.backupRestore_channelHistory, + ), + ], + ), + ], + ), + ), + Padding( + padding: const EdgeInsets.fromLTRB(16, 16, 16, 0), + child: FilledButton.icon( + onPressed: + _busy || + _selectedItems.isEmpty || + (_importContents != null && _availableItems == null) + ? null + : _runAction, + icon: _busy + ? const SizedBox.square( + dimension: 18, + child: CircularProgressIndicator(strokeWidth: 2), + ) + : Icon( + _importContents == null + ? Icons.backup_outlined + : Icons.restore_outlined, + ), + label: Text( + _importContents == null + ? l10n.backupRestore_backup + : l10n.backupRestore_restore, + ), + ), + ), + ], + ), + ), + ); + } + + Widget _groupTile({ + required String title, + required IconData icon, + required List<(BackupItem, String)> items, + }) { + return ExpansionTile( + leading: Icon(icon), + title: Text(title), + tilePadding: const EdgeInsets.symmetric(horizontal: 16), + childrenPadding: EdgeInsets.zero, + initiallyExpanded: true, + visualDensity: VisualDensity.compact, + children: [for (final item in items) _itemTile(item.$1, item.$2)], + ); + } + + Widget _itemTile(BackupItem item, String title, [IconData? icon]) { + final available = + _availableItems == null || _availableItems!.contains(item); + return CheckboxListTile( + value: _selectedItems.contains(item), + dense: true, + visualDensity: VisualDensity.compact, + onChanged: _busy || !available + ? null + : (selected) => setState(() { + if (selected == true) { + _selectedItems.add(item); + } else { + _selectedItems.remove(item); + } + }), + secondary: icon == null ? null : Icon(icon), + title: Text(title), + controlAffinity: ListTileControlAffinity.trailing, + contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 2), + ); + } + + Future _selectImportFile() async { + final l10n = context.l10n; + try { + final file = await openFile(acceptedTypeGroups: const [_fileType]); + if (file == null) return; + if (await file.length() > _maxImportBytes) { + _showMessage(l10n.backupRestore_fileTooLarge); + return; + } + final contents = utf8.decode(await file.readAsBytes()); + if (!mounted) return; + setState(() { + _importContents = contents; + _importFileName = file.name; + _availableItems = null; + _selectedItems.clear(); + _hasInitializedImportSelection = false; + }); + await _inspectImport(); + } catch (error) { + if (mounted) { + _showMessage(l10n.backupRestore_failed(error.toString())); + } + } + } + + void _scheduleImportInspection() { + _inspectionTimer?.cancel(); + _inspectionTimer = Timer(const Duration(milliseconds: 350), _inspectImport); + } + + Future _inspectImport() async { + final contents = _importContents; + if (contents == null) return; + final generation = ++_inspectionGeneration; + try { + final info = await _backupService.inspectImport( + contents: contents, + password: _passwordController.text, + ); + if (!mounted || generation != _inspectionGeneration) return; + setState(() { + _availableItems = info.availableItems; + if (!_hasInitializedImportSelection) { + _selectedItems + ..clear() + ..addAll( + info.availableItems.where( + (item) => !_defaultUncheckedOnRestore.contains(item), + ), + ); + _hasInitializedImportSelection = true; + } else { + _selectedItems.retainAll(info.availableItems); + } + }); + } catch (_) { + if (!mounted || generation != _inspectionGeneration) return; + setState(() { + _availableItems = {}; + _selectedItems.clear(); + }); + } + } + + Future _runAction() async { + if (_selectedItems.isEmpty) { + _showMessage(context.l10n.backupRestore_selectAtLeastOne); + return; + } + if (_importContents != null) { + await _restore(); + } else { + await _createBackup(); + } + } + + Future _createBackup() async { + final l10n = context.l10n; + final connector = context.read(); + final shareOrigin = shareOriginOf(context); + setState(() => _busy = true); + try { + final contents = await _backupService.createBackup( + items: Set.of(_selectedItems), + connector: connector, + settings: context.read().settings, + password: _passwordController.text, + ); + if (!mounted) return; + final filename = + 'meshcore-open_backup_${DateTime.now().millisecondsSinceEpoch}.json'; + final file = XFile.fromData( + Uint8List.fromList(utf8.encode(contents)), + name: filename, + mimeType: 'application/json', + ); + if (PlatformInfo.isWeb) { + await file.saveTo(filename); + } else if (PlatformInfo.isDesktop) { + final location = await getSaveLocation( + suggestedName: filename, + acceptedTypeGroups: const [_fileType], + ); + if (location == null) return; + await file.saveTo(location.path); + } else { + final result = await SharePlus.instance.share( + ShareParams( + files: [file], + fileNameOverrides: [filename], + sharePositionOrigin: shareOrigin, + ), + ); + if (result.status == ShareResultStatus.dismissed) return; + } + if (mounted) _showMessage(l10n.backupRestore_backupComplete); + } catch (error) { + if (mounted) { + _showMessage(l10n.backupRestore_failed(error.toString())); + } + } finally { + if (mounted) setState(() => _busy = false); + } + } + + Future _restore() async { + final l10n = context.l10n; + final connector = context.read(); + final appSettingsService = context.read(); + final messageFilterService = context.read(); + final needsKeyConfirmation = _selectedItems.contains(BackupItem.privateKey); + if (needsKeyConfirmation && !await _confirmIdentityReplacement()) return; + setState(() => _busy = true); + try { + await _backupService.restoreBackup( + contents: _importContents!, + password: _passwordController.text, + items: Set.of(_selectedItems), + connector: connector, + appSettingsService: appSettingsService, + ); + if (_selectedItems.any( + (item) => + item == BackupItem.appSettings || + item == BackupItem.ipfsKey || + item == BackupItem.stadiaMapKey, + )) { + await appSettingsService.loadSettings(); + } + if (_selectedItems.contains(BackupItem.channelFilters)) { + await messageFilterService.load(); + } + if (mounted) { + _showMessage(l10n.backupRestore_restoreComplete); + setState(() { + _importContents = null; + _importFileName = null; + _availableItems = null; + _selectedItems + ..clear() + ..addAll( + BackupItem.values.where( + (item) => !_defaultUncheckedItems.contains(item), + ), + ); + _hasInitializedImportSelection = false; + }); + } + } catch (error) { + if (mounted) { + _showMessage(l10n.backupRestore_failed(error.toString())); + } + } finally { + if (mounted) setState(() => _busy = false); + } + } + + Future _confirmIdentityReplacement() async { + final l10n = context.l10n; + return await showDialog( + context: context, + builder: (dialogContext) => AlertDialog( + title: Text(l10n.backupRestore_replaceIdentityTitle), + content: Text(l10n.backupRestore_replaceIdentityMessage), + actions: [ + TextButton( + onPressed: () => Navigator.pop(dialogContext, false), + child: Text(l10n.common_cancel), + ), + FilledButton( + onPressed: () => Navigator.pop(dialogContext, true), + child: Text(l10n.backupRestore_restore), + ), + ], + ), + ) ?? + false; + } + + void _showMessage(String message) { + if (!mounted) return; + showDismissibleSnackBar(context, content: Text(message)); + } +} diff --git a/lib/screens/export_screen.dart b/lib/screens/export_screen.dart new file mode 100644 index 00000000..45066a61 --- /dev/null +++ b/lib/screens/export_screen.dart @@ -0,0 +1,123 @@ +import 'package:flutter/material.dart'; +import 'package:meshcore_open/utils/gpx_export.dart'; +import 'package:provider/provider.dart'; + +import '../connector/meshcore_connector.dart'; +import '../helpers/snack_bar_builder.dart'; +import '../l10n/l10n.dart'; +import '../utils/share_origin.dart'; +import '../widgets/app_bar.dart'; +import '../widgets/mesh_ui.dart'; +import '../widgets/mesh_nav_tile.dart'; +import '../widgets/sync_progress_overlay.dart'; + +class ExportScreen extends StatelessWidget { + const ExportScreen({super.key}); + + @override + Widget build(BuildContext context) { + final l10n = context.l10n; + final connector = context.read(); + return Scaffold( + appBar: AppBar( + title: AppBarTitle( + l10n.settings_export, + indicators: false, + subtitle: false, + ), + centerTitle: true, + bottom: const SyncProgressAppBarBottom(), + ), + body: SafeArea( + top: false, + child: ListView( + padding: const EdgeInsets.fromLTRB(0, 8, 0, 24), + children: [ + SectionHeader(l10n.settings_export), + MeshCard( + padding: EdgeInsets.zero, + child: Column( + children: [ + MeshNavTile( + icon: Icons.download_outlined, + title: l10n.settings_gpxExportRepeaters, + subtitle: l10n.settings_gpxExportRepeatersSubtitle, + onTap: () { + final exporter = GpxExport(connector)..addRepeaters(); + _gpxExport( + context, + exporter, + l10n.map_repeater, + l10n.settings_gpxExportRepeatersRoom, + 'meshcore_repeaters_', + ); + }, + ), + const Divider(height: 1, indent: 16), + MeshNavTile( + icon: Icons.download_outlined, + title: l10n.settings_gpxExportContacts, + subtitle: l10n.settings_gpxExportContactsSubtitle, + onTap: () { + final exporter = GpxExport(connector)..addContacts(); + _gpxExport( + context, + exporter, + l10n.map_repeater, + l10n.settings_gpxExportChat, + 'meshcore_contacts_', + ); + }, + ), + const Divider(height: 1, indent: 16), + MeshNavTile( + icon: Icons.download_outlined, + title: l10n.settings_gpxExportAll, + subtitle: l10n.settings_gpxExportAllSubtitle, + onTap: () { + final exporter = GpxExport(connector)..addAll(); + _gpxExport( + context, + exporter, + l10n.map_repeater, + l10n.settings_gpxExportAllContacts, + 'meshcore_all_', + ); + }, + ), + ], + ), + ), + ], + ), + ), + ); + } + + Future _gpxExport( + BuildContext context, + GpxExport exporter, + String name, + String description, + String filename, + ) async { + final l10n = context.l10n; + final result = await exporter.exportGPX( + name, + description, + filename, + l10n.settings_gpxExportShareText, + l10n.settings_gpxExportShareSubject, + sharePositionOrigin: shareOriginOf(context), + ); + if (!context.mounted) return; + final message = switch (result) { + gpxExportSuccess => l10n.settings_gpxExportSuccess, + gpxExportNoContacts => l10n.settings_gpxExportNoContacts, + gpxExportNotAvailable => l10n.settings_gpxExportNotAvailable, + gpxExportFailed => l10n.settings_gpxExportError, + _ => l10n.settings_gpxExportError, + }; + showDismissibleSnackBar(context, content: Text(message)); + } +} diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dart index 733038eb..6b2e2294 100644 --- a/lib/screens/settings_screen.dart +++ b/lib/screens/settings_screen.dart @@ -597,33 +597,10 @@ class _SettingsScreenState extends State { ? () => pushSelfTelemetryScreen(context) : null, ), - const Divider(height: 1, indent: 16), - MeshNavTile( - icon: Icons.route_outlined, - title: l10n.repeater_pathHashMode, - subtitle: !connected - ? offline - : !connector.supportsPathHashMode - ? l10n.settings_requiresFirmware('v1.14') - : _pathHashModeSubtitle(context, connector.pathHashByteWidth), - onTap: connector.isConnected && connector.supportsPathHashMode - ? () => _editPathHashMode(context, connector) - : null, - ), ], ); } - String _pathHashModeSubtitle(BuildContext context, int pathHashByteWidth) { - final l10n = context.l10n; - return switch (pathHashByteWidth.clamp(1, 4).toInt()) { - 1 => l10n.repeater_pathHashModeOption0, - 2 => l10n.repeater_pathHashModeOption1, - 3 => l10n.repeater_pathHashModeOption2, - _ => l10n.repeater_pathHashModeOption3, - }; - } - Widget _buildLocationCardContent( BuildContext context, MeshCoreConnector connector, @@ -773,95 +750,6 @@ class _SettingsScreenState extends State { ); } - void _editPathHashMode(BuildContext context, MeshCoreConnector connector) { - final l10n = context.l10n; - var selectedMode = (connector.pathHashByteWidth - 1).clamp(0, 2).toInt(); - - showDialog( - context: context, - builder: (dialogContext) => StatefulBuilder( - builder: (builderContext, setDialogState) => AlertDialog( - scrollable: true, - title: Text(l10n.repeater_pathHashMode), - content: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - DropdownButtonFormField( - isExpanded: true, - initialValue: selectedMode, - decoration: InputDecoration( - labelText: l10n.repeater_pathHashMode, - border: const OutlineInputBorder(), - ), - items: [ - DropdownMenuItem( - value: 0, - child: Text( - l10n.repeater_pathHashModeOption0, - overflow: TextOverflow.ellipsis, - ), - ), - DropdownMenuItem( - value: 1, - child: Text( - l10n.repeater_pathHashModeOption1, - overflow: TextOverflow.ellipsis, - ), - ), - DropdownMenuItem( - value: 2, - child: Text( - l10n.repeater_pathHashModeOption2, - overflow: TextOverflow.ellipsis, - ), - ), - ], - onChanged: (value) { - if (value == null) return; - setDialogState(() => selectedMode = value); - }, - ), - const SizedBox(height: 12), - Text( - l10n.settings_pathHashModeHelper, - style: Theme.of(builderContext).textTheme.bodyMedium, - ), - ], - ), - actions: [ - TextButton( - onPressed: () => Navigator.pop(dialogContext), - child: Text(l10n.common_cancel), - ), - FilledButton( - onPressed: () async { - Navigator.pop(dialogContext); - if (!_ensureConnected(context, connector)) return; - try { - await connector.setPathHashMode(selectedMode); - await connector.refreshDeviceInfo(); - if (!context.mounted) return; - showDismissibleSnackBar( - context, - content: Text(l10n.repeater_settingsSaved), - ); - } catch (e) { - if (!context.mounted) return; - showDismissibleSnackBar( - context, - content: Text(l10n.settings_error(e.toString())), - ); - } - }, - child: Text(l10n.common_save), - ), - ], - ), - ), - ); - } - Future _editLocation( BuildContext context, MeshCoreConnector connector, diff --git a/lib/services/backup_service.dart b/lib/services/backup_service.dart new file mode 100644 index 00000000..4eb205a2 --- /dev/null +++ b/lib/services/backup_service.dart @@ -0,0 +1,1334 @@ +import 'dart:convert'; +import 'dart:math'; +import 'dart:typed_data'; + +import 'package:cryptography/cryptography.dart'; + +import '../connector/meshcore_connector.dart'; +import '../connector/meshcore_protocol.dart'; +import '../models/app_settings.dart'; +import '../models/contact.dart'; +import 'app_settings_service.dart'; +import '../storage/channel_store.dart'; +import '../storage/contact_store.dart'; +import '../storage/prefs_manager.dart'; + +const int _backupVersion = 1; +const int _pbkdf2Iterations = 310000; +const String _backupFormat = 'meshcore-open-backup'; +const String _encryptedBackupFormat = 'meshcore-open-encrypted-backup'; + +const List _contactPreferencePrefixes = [ + 'contacts', + 'contact_groups', + 'contact_smaz_', + 'contact_cyr2lat_', + 'contact_url_images_', + 'contact_unread_count', + 'messages_', + 'path_history_', +]; + +const List _channelPreferencePrefixes = [ + 'channels', + 'channel_slot_ids_', + 'channel_messages_', + 'channel_order_', + 'channel_smaz_', + 'channel_cyr2lat_', + 'channel_url_images_', + 'channel_region_', + 'default_region_', + 'communities_v1', + 'message_filter_', +]; + +const List _scopedPreferencePrefixes = [ + ..._contactPreferencePrefixes, + ..._channelPreferencePrefixes, + 'discovered_contacts', +]; + +enum BackupSection { + nodeSettings, + locationSettings, + appSettings, + contacts, + discoveredContacts, + channels, +} + +enum BackupItem { + deviceName, + privateKey, + publicKey, + radioSettings, + regions, + location, + contactSettings, + privacySettings, + appSettings, + contacts, + perContactSettings, + contactGroups, + contactHistory, + discoveredContacts, + channels, + channelFilters, + ipfsKey, + stadiaMapKey, + channelSettings, + communities, + channelHistory, +} + +class BackupImportInfo { + const BackupImportInfo({ + required this.availableItems, + required this.isOfficial, + }); + + final Set availableItems; + final bool isOfficial; +} + +class BackupService { + const BackupService(); + + Future inspectImport({ + required String contents, + required String password, + }) async { + final decoded = _decodeJson(contents); + final bool isOfficial = _isOfficialBackup(decoded); + final payload = await _decodeImport(contents, password: password); + return BackupImportInfo( + availableItems: _availableItems(payload), + isOfficial: isOfficial, + ); + } + + Future> _decodeImport( + String contents, { + required String password, + }) async { + final decoded = _decodeJson(contents); + if (decoded is Map && + decoded['format'] == _encryptedBackupFormat) { + return decodeBackup(contents, password: password); + } + if (decoded is Map && decoded['format'] == _backupFormat) { + return _validatePayload(decoded); + } + if (_isOfficialBackup(decoded)) { + return _normalizeOfficialBackup(decoded as Map); + } + throw const FormatException('Invalid or unsupported backup file'); + } + + Future createBackup({ + required Set items, + required MeshCoreConnector connector, + required AppSettings settings, + required String password, + }) async { + if (items.isEmpty) throw StateError('Select at least one backup item'); + final includedItems = Set.of(items); + final customVars = connector.currentCustomVars ?? const {}; + if (includedItems.isEmpty) { + throw StateError('No selected settings are available on this radio'); + } + final publicKey = connector.selfPublicKeyHex; + final devicePrefix = _devicePrefix(publicKey); + if (includedItems.any(_requiresRadioConnection)) { + _requireConnected(connector); + if (devicePrefix.isEmpty) { + throw StateError('Wait for radio identity to finish loading'); + } + } + final sections = {}; + final nodeItems = includedItems + .where((item) => _sectionForItem(item) == BackupSection.nodeSettings) + .toSet(); + if (nodeItems.isNotEmpty) { + final node = {}; + if (includedItems.contains(BackupItem.deviceName)) { + node['name'] = connector.selfName; + } + if (includedItems.contains(BackupItem.publicKey)) { + node['publicKey'] = publicKey; + } + if (includedItems.contains(BackupItem.privateKey)) { + node['privateKey'] = base64Encode(await connector.exportPrivateKey()); + } + if (includedItems.contains(BackupItem.radioSettings)) { + node['radio'] = { + 'frequencyHz': connector.currentFreqHz, + 'bandwidthHz': connector.currentBwHz, + 'spreadingFactor': connector.currentSf, + 'codingRate': connector.currentCr, + 'clientRepeat': connector.clientRepeat, + 'txPowerDbm': connector.currentTxPower, + 'pathHashByteWidth': connector.pathHashByteWidth, + 'defaultFloodScope': connector.defaultFloodScopeName, + }; + } + if (includedItems.contains(BackupItem.regions)) { + node['preferences'] = _snapshotPreferences((key) => key == 'regions'); + } + sections[BackupSection.nodeSettings.name] = node; + } + + final location = {}; + if (includedItems.contains(BackupItem.location)) { + location['location'] = { + 'latitude': connector.selfLatitude, + 'longitude': connector.selfLongitude, + }; + if (customVars.containsKey('gps')) { + location['gpsEnabled'] = customVars['gps'] == '1'; + final deviceInterval = int.tryParse(customVars['gps_interval'] ?? ''); + location['gpsIntervalSeconds'] = + deviceInterval != null && deviceInterval >= 0 + ? deviceInterval + : settings.gpsIntervalSeconds; + } + } + if (includedItems.contains(BackupItem.contactSettings)) { + location['contactSettings'] = { + 'autoAddChat': connector.autoAddUsers, + 'autoAddRepeater': connector.autoAddRepeaters, + 'autoAddRoomServer': connector.autoAddRoomServers, + 'autoAddSensor': connector.autoAddSensors, + 'overwriteOldest': connector.autoAddOverwriteOldest, + 'maxHops': connector.autoAddMaxHops, + 'evictDiscoveredContactsEnabled': + settings.evictDiscoveredContactsEnabled, + }; + } + if (includedItems.contains(BackupItem.privacySettings)) { + final privacySettings = { + 'telemetryBase': connector.telemetryModeBase, + 'telemetryLocation': connector.telemetryModeLoc, + 'telemetryEnvironment': connector.telemetryModeEnv, + 'advertLocation': connector.advertLocationPolicy, + 'multiAcks': connector.multiAcks, + 'autoSendZeroHopAdvertOnGpsUpdate': + settings.autoSendZeroHopAdvertOnGpsUpdate, + }; + final appSettingsJson = settings.toJson(); + if (appSettingsJson.containsKey('auto_send_self_advert_as_flood')) { + privacySettings['autoSendSelfAdvertAsFlood'] = + appSettingsJson['auto_send_self_advert_as_flood']; + } + location['privacySettings'] = privacySettings; + } + if (location.isNotEmpty) { + sections[BackupSection.locationSettings.name] = location; + } + + for (final section in BackupSection.values) { + final sectionItems = includedItems + .where((item) => _sectionForItem(item) == section) + .toSet(); + if (sectionItems.isEmpty || + section == BackupSection.nodeSettings || + section == BackupSection.locationSettings) { + continue; + } + sections[section.name] = { + 'preferences': section == BackupSection.appSettings + ? _snapshotAppSettingsPreferences(sectionItems) + : _snapshotPreferences( + (key) => + _preferenceBelongsToItems(key, sectionItems, devicePrefix), + ), + }; + } + + final payload = { + 'format': _backupFormat, + 'version': _backupVersion, + 'createdAt': DateTime.now().toUtc().toIso8601String(), + 'sourcePublicKey': publicKey, + 'items': includedItems.map((item) => item.name).toList(), + 'sections': sections, + }; + return encodeBackup(payload, password: password); + } + + Future restoreBackup({ + required String contents, + required String password, + required Set items, + required MeshCoreConnector connector, + required AppSettingsService appSettingsService, + }) async { + if (items.isEmpty) throw StateError('Select at least one item to restore'); + final payload = await _decodeImport(contents, password: password); + final sectionData = payload['sections']; + if (sectionData is! Map) throw const FormatException('Missing backup data'); + final sourcePublicKey = _normalizePublicKey( + payload['sourcePublicKey'] as String? ?? '', + ); + final availableItems = _availableItems(payload); + final selectedItems = items.intersection(availableItems); + if (selectedItems.isEmpty) { + throw const FormatException('The backup has none of the selected items'); + } + for (final section in BackupSection.values) { + final sectionItems = selectedItems + .where((item) => _sectionForItem(item) == section) + .toSet(); + if (sectionItems.isEmpty) continue; + final data = _sectionData(sectionData, section); + if (data != null) { + _validatePreferenceSnapshot( + data['preferences'], + section, + _devicePrefix(sourcePublicKey), + ); + } + } + final node = _sectionData(sectionData, BackupSection.nodeSettings); + final location = _sectionData(sectionData, BackupSection.locationSettings); + final importingIdentity = selectedItems.contains(BackupItem.privateKey); + final destinationPublicKey = importingIdentity + ? sourcePublicKey + : _normalizePublicKey(connector.selfPublicKeyHex); + final restoreContacts = selectedItems.any( + (item) => _sectionForItem(item) == BackupSection.contacts, + ); + final restoreChannels = selectedItems.any( + (item) => _sectionForItem(item) == BackupSection.channels, + ); + if (importingIdentity && + (sourcePublicKey.isEmpty || + _normalizePublicKey(node?['publicKey'] as String? ?? '') != + sourcePublicKey)) { + throw const FormatException('Backup radio identity is invalid'); + } + if (selectedItems.any(_requiresRadioConnection)) { + _requireConnected(connector); + if ((restoreContacts || restoreChannels) && + destinationPublicKey.length < 10) { + throw StateError('Wait for radio identity to finish loading'); + } + } + if (node != null) { + final name = node['name']; + if (selectedItems.contains(BackupItem.deviceName) && name is String) { + await connector.setNodeName(name); + } + final radio = _asMap(node['radio']); + if (selectedItems.contains(BackupItem.radioSettings) && radio != null) { + final frequencyHz = radio['frequencyHz']; + final bandwidthHz = radio['bandwidthHz']; + final spreadingFactor = radio['spreadingFactor']; + final codingRate = radio['codingRate']; + if (frequencyHz is int && + bandwidthHz is int && + spreadingFactor is int && + codingRate is int) { + final accepted = await connector.setRadioParams( + frequencyHz, + bandwidthHz, + spreadingFactor, + codingRate, + clientRepeat: + connector.supportsAllowedRepeatFreq && + radio['clientRepeat'] is bool + ? radio['clientRepeat'] as bool + : null, + ); + if (!accepted) throw StateError('The radio rejected its settings'); + } + final txPowerDbm = radio['txPowerDbm']; + if (txPowerDbm is int) { + await connector.sendFrame( + buildSetRadioTxPowerFrame(txPowerDbm), + waitForGenericAck: true, + ); + } + final pathHashByteWidth = radio['pathHashByteWidth']; + if (pathHashByteWidth is int && connector.supportsPathHashMode) { + await connector.setPathHashMode(pathHashByteWidth - 1); + } + final defaultFloodScope = radio['defaultFloodScope']; + if (defaultFloodScope is String && + connector.supportsDefaultFloodScope) { + await connector.setDefaultFloodScope(defaultFloodScope); + } + } + if (selectedItems.contains(BackupItem.privateKey)) { + await connector.importPrivateKey(_decodePrivateKey(node['privateKey'])); + } + if (selectedItems.contains(BackupItem.regions)) { + await _restorePreferences( + node['preferences'], + section: BackupSection.nodeSettings, + items: selectedItems, + sourcePublicKey: sourcePublicKey, + destinationPublicKey: destinationPublicKey, + ); + } + } + + if (location != null) { + final locationData = _asMap(location['location']); + final latitude = locationData?['latitude']; + final longitude = locationData?['longitude']; + if (selectedItems.contains(BackupItem.location)) { + if (latitude is num && longitude is num) { + await connector.setNodeLocation( + lat: latitude.toDouble(), + lon: longitude.toDouble(), + ); + } + final gpsEnabled = location['gpsEnabled']; + if (gpsEnabled is bool) { + await connector.setCustomVar(gpsEnabled ? 'gps:1' : 'gps:0'); + } + final gpsInterval = location['gpsIntervalSeconds']; + if (gpsInterval is int) { + if (gpsInterval < 0 || gpsInterval >= 86400) { + throw const FormatException('Invalid GPS interval in backup'); + } + await appSettingsService.setGpsIntervalSeconds( + gpsInterval, + writeToDevice: (value) => + connector.setCustomVar('gps_interval:$value'), + ); + } + } + final contactSettings = _asMap(location['contactSettings']); + if (selectedItems.contains(BackupItem.contactSettings) && + contactSettings != null) { + if (connector.supportsAutoAddConfig) { + await connector.sendFrame( + buildSetAutoAddConfigFrame( + autoAddChat: contactSettings['autoAddChat'] == true, + autoAddRepeater: contactSettings['autoAddRepeater'] == true, + autoAddRoomServer: contactSettings['autoAddRoomServer'] == true, + autoAddSensor: contactSettings['autoAddSensor'] == true, + overwriteOldest: contactSettings['overwriteOldest'] == true, + maxHops: contactSettings['maxHops'] is int + ? contactSettings['maxHops'] as int + : null, + ), + waitForGenericAck: true, + ); + } + final evict = contactSettings['evictDiscoveredContactsEnabled']; + if (evict is bool) { + await appSettingsService.setEvictDiscoveredContactsEnabled(evict); + } + } + final privacy = _asMap(location['privacySettings']); + if (selectedItems.contains(BackupItem.privacySettings) && + privacy != null) { + await connector.setTelemetryModeBase( + _intOr(privacy['telemetryBase'], connector.telemetryModeBase), + _intOr(privacy['telemetryLocation'], connector.telemetryModeLoc), + _intOr(privacy['telemetryEnvironment'], connector.telemetryModeEnv), + _intOr(privacy['advertLocation'], connector.advertLocationPolicy), + _intOr(privacy['multiAcks'], connector.multiAcks), + ); + final autoZeroHop = privacy['autoSendZeroHopAdvertOnGpsUpdate']; + if (autoZeroHop is bool) { + await appSettingsService.setAutoSendZeroHopAdvertOnGpsUpdate( + autoZeroHop, + ); + } + final autoFlood = privacy['autoSendSelfAdvertAsFlood']; + final appSettingsJson = appSettingsService.settings.toJson(); + if (autoFlood is bool && + appSettingsJson.containsKey('auto_send_self_advert_as_flood')) { + await appSettingsService.updateSettings( + AppSettings.fromJson({ + ...appSettingsJson, + 'auto_send_self_advert_as_flood': autoFlood, + }), + ); + } + } + } + + for (final section in BackupSection.values) { + final sectionItems = selectedItems + .where((item) => _sectionForItem(item) == section) + .toSet(); + if (sectionItems.isEmpty || + section == BackupSection.nodeSettings || + section == BackupSection.locationSettings) { + continue; + } + final data = _sectionData(sectionData, section); + if (data != null) { + await _restorePreferences( + data['preferences'], + section: section, + items: sectionItems, + sourcePublicKey: sourcePublicKey, + destinationPublicKey: destinationPublicKey, + ); + } + } + if (selectedItems.contains(BackupItem.contacts)) { + await _restoreRadioContacts(connector, destinationPublicKey); + } + if (selectedItems.contains(BackupItem.channels)) { + await _restoreRadioChannels(connector, destinationPublicKey); + } + } + + Future _restoreRadioContacts( + MeshCoreConnector connector, + String publicKey, + ) async { + final store = ContactStore()..setPublicKeyHex = publicKey; + final contacts = await store.loadContacts(); + for (final contact in contacts) { + if (contact.publicKeyHex.toUpperCase() == publicKey.toUpperCase()) { + continue; + } + Contact? existing; + for (final candidate in connector.contacts) { + if (candidate.publicKeyHex == contact.publicKeyHex) { + existing = candidate; + break; + } + } + final pathLengthValue = existing?.pathLength ?? contact.pathLength; + final pathHashWidth = existing?.pathHashWidth ?? contact.pathHashWidth; + final pathLength = pathLengthValue < 0 + ? 0xff + : (pathLengthValue & 0x3f) | (((pathHashWidth - 1) & 0x03) << 6); + await connector.sendFrame( + buildUpdateContactPathFrame( + contact.publicKey, + existing?.path ?? contact.path, + pathLength, + type: contact.type, + flags: contact.flags, + name: contact.name, + lat: contact.latitude, + lon: contact.longitude, + lastAdvert: contact.lastSeen, + lastModified: contact.lastModified, + ), + waitForGenericAck: true, + ); + } + } + + Future _restoreRadioChannels( + MeshCoreConnector connector, + String publicKey, + ) async { + final store = ChannelStore()..setPublicKeyHex = publicKey; + final channels = await store.loadChannels(); + for (final channel in channels) { + await connector.sendFrame( + buildSetChannelFrame(channel.index, channel.name, channel.psk), + waitForGenericAck: true, + ); + } + } + + static String _encodePrettyBackup(Object payload) { + final pretty = const JsonEncoder.withIndent(' ').convert(payload); + return pretty.replaceAllMapped( + RegExp(r'("path_bytes"\s*:\s*)\[\s*([0-9,\s]*?)\s*\]'), + (match) { + final values = match[2]! + .split(',') + .map((value) => value.trim()) + .where((value) => value.isNotEmpty); + return '${match[1]}[${values.join(', ')}]'; + }, + ); + } + + static Future encodeBackup( + Map payload, { + required String password, + }) async { + final plainText = jsonEncode(payload); + if (password.isEmpty) { + return _encodePrettyBackup(payload); + } + + final salt = _secureBytes(16); + final nonce = _secureBytes(12); + final key = await _deriveKey(password, salt, _pbkdf2Iterations); + final box = await AesGcm.with256bits().encrypt( + utf8.encode(plainText), + secretKey: key, + nonce: nonce, + ); + return const JsonEncoder.withIndent(' ').convert({ + 'format': _encryptedBackupFormat, + 'version': _backupVersion, + 'kdf': 'PBKDF2-HMAC-SHA256', + 'iterations': _pbkdf2Iterations, + 'cipher': 'AES-256-GCM', + 'salt': base64Encode(salt), + 'nonce': base64Encode(nonce), + 'ciphertext': base64Encode(box.cipherText), + 'tag': base64Encode(box.mac.bytes), + }); + } + + static Future> decodeBackup( + String contents, { + required String password, + }) async { + final decoded = jsonDecode(contents); + if (decoded is! Map) { + throw const FormatException('Invalid backup file'); + } + if (decoded['format'] == _encryptedBackupFormat) { + if (password.isEmpty) throw const FormatException('Password required'); + if (decoded['version'] != _backupVersion || + decoded['kdf'] != 'PBKDF2-HMAC-SHA256' || + decoded['cipher'] != 'AES-256-GCM') { + throw const FormatException('Unsupported encrypted backup format'); + } + final iterations = decoded['iterations']; + if (iterations is! int || iterations < 100000 || iterations > 1000000) { + throw const FormatException('Invalid password derivation settings'); + } + try { + final salt = base64Decode(decoded['salt'] as String); + final nonce = base64Decode(decoded['nonce'] as String); + final ciphertext = base64Decode(decoded['ciphertext'] as String); + final tag = base64Decode(decoded['tag'] as String); + if (salt.length != 16 || nonce.length != 12 || tag.length != 16) { + throw const FormatException('Invalid encrypted backup'); + } + final key = await _deriveKey(password, salt, iterations); + final plaintext = await AesGcm.with256bits().decrypt( + SecretBox(ciphertext, nonce: nonce, mac: Mac(tag)), + secretKey: key, + ); + return _validatePayload(jsonDecode(utf8.decode(plaintext))); + } on FormatException { + rethrow; + } catch (_) { + throw const FormatException('Wrong password or damaged backup'); + } + } + return _validatePayload(decoded); + } + + static Object? _decodeJson(String contents) { + try { + return jsonDecode(contents); + } on FormatException { + final repaired = contents.replaceFirstMapped( + RegExp(r'("name"\s*:\s*"(?:\\.|[^"\\])*"\s*)(?=\s*"public_key"\s*:)'), + (match) => '${match[1]},', + ); + if (repaired == contents) rethrow; + return jsonDecode(repaired); + } + } + + static bool _isOfficialBackup(Object? value) => + value is Map && + value.containsKey('public_key') && + (value.containsKey('private_key') || + value.containsKey('radio_settings') || + value.containsKey('channels') || + value.containsKey('contacts')); + + static Set _availableItems(Map payload) { + final rawItems = payload['items']; + if (rawItems is! List) return {}; + final available = {}; + for (final name in rawItems.whereType()) { + for (final item in BackupItem.values) { + if (item.name == name) available.add(item); + } + } + return available; + } + + static Map _normalizeOfficialBackup( + Map source, + ) { + final publicKey = _normalizePublicKey( + source['public_key'] as String? ?? '', + ); + if (publicKey.isEmpty) throw const FormatException('Invalid public key'); + final devicePrefix = _devicePrefix(publicKey); + final sections = {}; + final items = {}; + + final node = {}; + if (source['name'] is String) { + node['name'] = source['name']; + items.add(BackupItem.deviceName); + } + node['publicKey'] = publicKey; + items.add(BackupItem.publicKey); + final privateKey = _decodeHex(source['private_key'], length: 64); + if (privateKey != null) { + node['privateKey'] = base64Encode(privateKey); + items.add(BackupItem.privateKey); + } + final sourceRadio = _asMap(source['radio_settings']); + if (sourceRadio != null) { + final radio = {}; + final frequency = _asNumber(sourceRadio['frequency']); + final bandwidth = _asNumber(sourceRadio['bandwidth']); + final spreadingFactor = _asNumber(sourceRadio['spreading_factor']); + final codingRate = _asNumber(sourceRadio['coding_rate']); + final txPower = _asNumber(sourceRadio['tx_power']); + if (frequency != null) { + radio['frequencyHz'] = frequency < 10000000 + ? frequency * 1000 + : frequency; + } + if (bandwidth != null) radio['bandwidthHz'] = bandwidth; + if (spreadingFactor != null) radio['spreadingFactor'] = spreadingFactor; + if (codingRate != null) radio['codingRate'] = codingRate; + if (txPower != null) radio['txPowerDbm'] = txPower; + if (radio.isNotEmpty) { + node['radio'] = radio; + items.add(BackupItem.radioSettings); + } + } + if (node.isNotEmpty) sections[BackupSection.nodeSettings.name] = node; + + final position = _asMap(source['position_settings']); + if (position != null) { + final latitude = _asDouble(position['latitude']); + final longitude = _asDouble(position['longitude']); + if (latitude != null && longitude != null) { + sections[BackupSection.locationSettings.name] = { + 'location': { + 'latitude': latitude, + 'longitude': longitude, + }, + }; + items.add(BackupItem.location); + } + } + final autoAdd = _asMap(source['auto_add_settings']); + if (autoAdd != null && autoAdd.isNotEmpty) { + final location = + _asMap(sections[BackupSection.locationSettings.name]) ?? {}; + location['contactSettings'] = { + 'autoAddChat': autoAdd['auto_add_chat'], + 'autoAddRepeater': autoAdd['auto_add_repeater'], + 'autoAddRoomServer': autoAdd['auto_add_room_server'], + 'autoAddSensor': autoAdd['auto_add_sensor'], + 'overwriteOldest': autoAdd['overwrite_oldest'], + 'maxHops': _asNumber(autoAdd['auto_add_max_hops']), + }; + sections[BackupSection.locationSettings.name] = location; + items.add(BackupItem.contactSettings); + } + final other = _asMap(source['other_settings']); + if (other?.containsKey('advert_location_policy') ?? false) { + final location = + _asMap(sections[BackupSection.locationSettings.name]) ?? {}; + location['privacySettings'] = { + 'advertLocation': _asNumber(other!['advert_location_policy']), + }; + sections[BackupSection.locationSettings.name] = location; + items.add(BackupItem.privacySettings); + } + + final channels = source['channels']; + if (channels is List) { + final stored = >[]; + for (var i = 0; i < channels.length; i++) { + final entry = _asMap(channels[i]); + if (entry == null || entry['name'] is! String) continue; + final psk = _decodeHex(entry['secret'], length: 16); + if (psk == null) continue; + stored.add({ + 'index': i, + 'name': entry['name'], + 'psk': base64Encode(psk), + 'unreadCount': 0, + }); + } + sections[BackupSection.channels.name] = { + 'preferences': {'channels$devicePrefix': jsonEncode(stored)}, + }; + items.add(BackupItem.channels); + } + + final contacts = source['contacts']; + if (contacts is List) { + final stored = >[]; + for (final entry in contacts) { + final contact = _asMap(entry); + if (contact == null) continue; + final key = _decodeHex(contact['public_key'], length: 32); + if (key == null) continue; + final path = _parseOfficialPath(contact['out_path_list']); + final advertSeconds = _asNumber(contact['last_advert']) ?? 0; + final modifiedSeconds = _asNumber(contact['last_modified']); + final latitude = _asDouble(contact['latitude']); + final longitude = _asDouble(contact['longitude']); + final name = + contact['custom_name'] is String && + (contact['custom_name'] as String).isNotEmpty + ? contact['custom_name'] as String + : contact['name'] as String? ?? ''; + stored.add({ + 'publicKey': base64Encode(key), + 'name': name, + 'type': _asNumber(contact['type']) ?? 0, + 'flags': _asNumber(contact['flags']) ?? 0, + 'pathLength': path.$2, + 'path': base64Encode(path.$1), + 'pathHashWidth': path.$1.isEmpty ? 1 : 2, + 'pathOverride': null, + 'pathOverrideBytes': null, + 'latitude': latitude, + 'longitude': longitude, + 'lastSeen': advertSeconds * 1000, + 'lastModified': modifiedSeconds == null + ? null + : modifiedSeconds * 1000, + 'lastMessageAt': advertSeconds * 1000, + 'isActive': true, + 'rawPacket': null, + 'telemetryFixAt': null, + }); + } + sections[BackupSection.contacts.name] = { + 'preferences': {'contacts$devicePrefix': jsonEncode(stored)}, + }; + items.add(BackupItem.contacts); + } + + return { + 'format': _backupFormat, + 'version': _backupVersion, + 'sourcePublicKey': publicKey, + 'items': items.map((item) => item.name).toList(), + 'sections': sections, + }; + } + + static Uint8List? _decodeHex(Object? value, {required int length}) { + if (value is! String || + value.length != length * 2 || + !RegExp(r'^[0-9a-fA-F]+$').hasMatch(value)) { + return null; + } + return Uint8List.fromList([ + for (var i = 0; i < value.length; i += 2) + int.parse(value.substring(i, i + 2), radix: 16), + ]); + } + + static (Uint8List, int) _parseOfficialPath(Object? value) { + if (value == null) return (Uint8List(0), -1); + if (value is! String || value.isEmpty) return (Uint8List(0), 0); + final bytes = []; + for (final part in value.split(',')) { + final hash = _decodeHex(part, length: 2); + if (hash == null) return (Uint8List(0), -1); + bytes.addAll(hash); + } + return (Uint8List.fromList(bytes), bytes.length ~/ 2); + } + + static int? _asNumber(Object? value) { + if (value is int) return value; + if (value is num) return value.toInt(); + if (value is String) return num.tryParse(value)?.toInt(); + return null; + } + + static double? _asDouble(Object? value) { + if (value is num) return value.toDouble(); + if (value is String) return double.tryParse(value); + return null; + } + + static Map _validatePayload(Object? value) { + if (value is! Map || + value['format'] != _backupFormat || + value['version'] != _backupVersion || + value['sections'] is! Map || + value['items'] is! List || + !(value['items'] as List).every((item) => item is String)) { + throw const FormatException('Invalid or unsupported backup file'); + } + return value; + } + + static void _requireConnected(MeshCoreConnector connector) { + if (!connector.isConnected) { + throw StateError( + 'Connect to the radio to back up or restore its settings', + ); + } + } + + static Uint8List _decodePrivateKey(Object? value) { + if (value is! String) { + throw const FormatException('Backup has no private key'); + } + final bytes = Uint8List.fromList(base64Decode(value)); + if (bytes.length != 64) throw const FormatException('Invalid private key'); + return bytes; + } + + static Map? _sectionData( + Map sectionData, + BackupSection section, + ) => _asMap(sectionData[section.name]); + + static Map? _asMap(Object? value) => + value is Map ? value : null; + + static Map? _asJsonMapPreference(Object? value) { + final map = _asMap(value); + if (map != null || value is! String) return map; + try { + return _asMap(jsonDecode(value)); + } on FormatException { + return null; + } + } + + static int _intOr(Object? value, int fallback) => + value is int ? value : fallback; + + static Map _snapshotPreferences( + bool Function(String) include, + ) { + final prefs = PrefsManager.instance; + final values = {}; + for (final key in prefs.getKeys()) { + if (!include(key)) continue; + final value = prefs.get(key); + if (value is String) { + values[key] = _expandJsonPreference(value); + } else if (value is bool || value is int || value is double) { + values[key] = value; + } else if (value is List) { + values[key] = value; + } + } + return values; + } + + static Object _expandJsonPreference(String value) { + try { + final decoded = jsonDecode(value); + if (decoded is Map || + (decoded is List && + decoded.isNotEmpty && + decoded.any((item) => item is! String))) { + return _formatBackupJsonValue(decoded)!; + } + } on FormatException { + return value; + } + return value; + } + + static Object? _formatBackupJsonValue(Object? value) { + if (value is Map) { + return { + for (final entry in value.entries) + entry.key.toString(): _formatBackupJsonValue(entry.value), + }; + } + if (value is List) { + return value.map(_formatBackupJsonValue).toList(); + } + return value; + } + + static Map _snapshotAppSettingsPreferences( + Set items, + ) { + final values = _snapshotPreferences( + (key) => _preferenceBelongsToItems(key, items, ''), + ); + final appSettings = _asMap(values['app_settings']); + if (values.containsKey('app_settings') && appSettings == null) { + throw StateError('Cannot safely filter sensitive app settings'); + } + if (appSettings == null) return values; + + final includesAllSettings = items.contains(BackupItem.appSettings); + appSettings.removeWhere((key, _) { + if (key == 'upload_ipfs_api_key') { + return !items.contains(BackupItem.ipfsKey); + } + if (key == 'map_tile_api_key') { + return !items.contains(BackupItem.stadiaMapKey); + } + return !includesAllSettings; + }); + values['app_settings'] = appSettings; + return values; + } + + static BackupSection _sectionForItem(BackupItem item) => switch (item) { + BackupItem.deviceName || + BackupItem.privateKey || + BackupItem.publicKey || + BackupItem.radioSettings || + BackupItem.regions => BackupSection.nodeSettings, + BackupItem.location || + BackupItem.contactSettings || + BackupItem.privacySettings => BackupSection.locationSettings, + BackupItem.appSettings || + BackupItem.ipfsKey || + BackupItem.stadiaMapKey => BackupSection.appSettings, + BackupItem.contacts || + BackupItem.perContactSettings || + BackupItem.contactGroups || + BackupItem.contactHistory => BackupSection.contacts, + BackupItem.discoveredContacts => BackupSection.discoveredContacts, + BackupItem.channels || + BackupItem.channelFilters || + BackupItem.channelSettings || + BackupItem.communities || + BackupItem.channelHistory => BackupSection.channels, + }; + + static bool _requiresRadioConnection(BackupItem item) => + _sectionForItem(item) != BackupSection.appSettings && + item != BackupItem.channelFilters; + + static bool _preferenceBelongsToItems( + String key, + Set items, + String devicePrefix, + ) { + if (items.contains(BackupItem.regions) && key == 'regions') return true; + if (key == 'app_settings' && + (items.contains(BackupItem.appSettings) || + items.contains(BackupItem.ipfsKey) || + items.contains(BackupItem.stadiaMapKey))) { + return true; + } + if (items.contains(BackupItem.appSettings) && + key != 'app_settings' && + _preferenceBelongsToSection(key, BackupSection.appSettings)) { + return true; + } + if (items.contains(BackupItem.contacts) && + key.startsWith('contacts$devicePrefix')) { + return true; + } + if (items.contains(BackupItem.perContactSettings) && + (key.startsWith('contact_smaz_$devicePrefix') || + key.startsWith('contact_cyr2lat_$devicePrefix') || + key.startsWith('contact_url_images_$devicePrefix'))) { + return true; + } + if (items.contains(BackupItem.contactGroups) && + key.startsWith('contact_groups$devicePrefix')) { + return true; + } + if (items.contains(BackupItem.contactHistory) && + (key.startsWith('messages_$devicePrefix') || + key.startsWith('path_history_$devicePrefix') || + key.startsWith('contact_unread_count$devicePrefix'))) { + return true; + } + if (items.contains(BackupItem.discoveredContacts) && + key.startsWith('discovered_contacts$devicePrefix')) { + return true; + } + if (items.contains(BackupItem.channels) && + (key.startsWith('channels$devicePrefix') || + key.startsWith('channel_slot_ids_$devicePrefix'))) { + return true; + } + if (items.contains(BackupItem.channelFilters) && + key.startsWith('message_filter_')) { + return true; + } + if (items.contains(BackupItem.channelSettings) && + (key.startsWith('channel_smaz_$devicePrefix') || + key.startsWith('channel_cyr2lat_$devicePrefix') || + key.startsWith('channel_url_images_$devicePrefix') || + key.startsWith('channel_region_$devicePrefix') || + key.startsWith('default_region_$devicePrefix') || + key.startsWith('channel_order_$devicePrefix'))) { + return true; + } + if (items.contains(BackupItem.communities) && + key.startsWith('communities_v1$devicePrefix')) { + return true; + } + if (items.contains(BackupItem.channelHistory) && + key.startsWith('channel_messages_$devicePrefix')) { + return true; + } + return false; + } + + static bool _preferenceBelongsToSection( + String key, + BackupSection section, { + String devicePrefix = '', + }) { + switch (section) { + case BackupSection.nodeSettings: + return key == 'regions'; + case BackupSection.locationSettings: + return false; + case BackupSection.contacts: + return _startsWithScopedPrefix( + key, + _contactPreferencePrefixes, + devicePrefix, + ); + case BackupSection.discoveredContacts: + return _startsWithScopedPrefix(key, const [ + 'discovered_contacts', + ], devicePrefix); + case BackupSection.channels: + return key.startsWith('message_filter_') || + _startsWithScopedPrefix( + key, + _channelPreferencePrefixes, + devicePrefix, + ); + case BackupSection.appSettings: + return !key.startsWith('flutter.') && + key != 'regions' && + !_startsWithAny(key, _scopedPreferencePrefixes); + } + } + + static bool _startsWithScopedPrefix( + String key, + List prefixes, + String devicePrefix, + ) => + devicePrefix.isNotEmpty && + prefixes.any((prefix) => key.startsWith('$prefix$devicePrefix')); + + static bool _startsWithAny(String value, List prefixes) => + prefixes.any(value.startsWith); + + static bool _isSupportedPreferenceValue(Object? value) => + value is String || + value is bool || + value is int || + value is double || + value is Map || + value is List; + + static void _validatePreferenceSnapshot( + Object? rawValues, + BackupSection section, + String devicePrefix, + ) { + if (rawValues == null) return; + final values = _asMap(rawValues); + if (values == null) { + throw const FormatException('Invalid backup preferences'); + } + for (final entry in values.entries) { + if (!_preferenceBelongsToSection( + entry.key, + section, + devicePrefix: devicePrefix, + )) { + throw FormatException('Backup preference is outside ${section.name}'); + } + if (!_isSupportedPreferenceValue(entry.value)) { + throw FormatException('Invalid preference value for ${entry.key}'); + } + } + } + + static Future _restorePreferences( + Object? rawValues, { + required BackupSection section, + required Set items, + required String sourcePublicKey, + required String destinationPublicKey, + }) async { + _validatePreferenceSnapshot( + rawValues, + section, + _devicePrefix(sourcePublicKey), + ); + final values = _asMap(rawValues); + if (values == null) return; + final prefs = PrefsManager.instance; + final sourcePrefix = _devicePrefix(sourcePublicKey); + final destinationPrefix = _devicePrefix(destinationPublicKey); + final existingAppSettings = _asJsonMapPreference( + prefs.getString('app_settings'), + ); + final matching = prefs.getKeys().where((key) { + if (section == BackupSection.appSettings && + key == 'app_settings' && + !items.contains(BackupItem.appSettings)) { + return false; + } + if (!_preferenceBelongsToSection( + key, + section, + devicePrefix: destinationPrefix, + ) || + !_preferenceBelongsToItems(key, items, destinationPrefix)) { + return false; + } + if (section == BackupSection.appSettings || + section == BackupSection.nodeSettings) { + return true; + } + return _hasDevicePrefix(key, section, destinationPrefix) || + (section == BackupSection.channels && + key.startsWith('message_filter_')); + }).toList(); + for (final key in matching) { + await prefs.remove(key); + } + for (final entry in values.entries) { + if (!_preferenceBelongsToItems(entry.key, items, sourcePrefix)) { + continue; + } + final key = _remapKey( + entry.key, + section, + sourcePrefix, + destinationPrefix, + ); + final value = entry.value; + if (section == BackupSection.appSettings && key == 'app_settings') { + final storedIncoming = _asJsonMapPreference(value); + if (storedIncoming == null) { + throw const FormatException('Invalid app settings in backup'); + } + final incoming = Map.from(storedIncoming); + final merged = _mergeSensitiveAppSettings( + existing: existingAppSettings, + incoming: incoming, + items: items, + ); + await prefs.setString(key, jsonEncode(merged)); + } else if (value is String) { + await prefs.setString(key, value); + } else if (value is bool) { + await prefs.setBool(key, value); + } else if (value is int) { + await prefs.setInt(key, value); + } else if (value is double) { + await prefs.setDouble(key, value); + } else if (value is Map || + (value is List && value.any((item) => item is! String))) { + await prefs.setString(key, jsonEncode(value)); + } else if (value is List && value.every((item) => item is String)) { + await prefs.setStringList(key, value.cast()); + } else { + throw FormatException('Invalid preference value for $key'); + } + } + } + + static Map _mergeSensitiveAppSettings({ + required Map? existing, + required Map incoming, + required Set items, + }) { + final includesAll = items.contains(BackupItem.appSettings); + final result = Map.from( + includesAll ? incoming : (existing ?? const {}), + ); + const sensitiveKeys = { + BackupItem.ipfsKey: 'upload_ipfs_api_key', + BackupItem.stadiaMapKey: 'map_tile_api_key', + }; + for (final entry in sensitiveKeys.entries) { + if (items.contains(entry.key)) { + if (incoming.containsKey(entry.value)) { + result[entry.value] = incoming[entry.value]; + } + } else if (includesAll && existing?.containsKey(entry.value) == true) { + result[entry.value] = existing![entry.value]; + } + } + return result; + } + + static String _remapKey( + String key, + BackupSection section, + String sourcePrefix, + String destinationPrefix, + ) { + if (sourcePrefix.isEmpty || destinationPrefix.isEmpty) return key; + final prefixes = switch (section) { + BackupSection.contacts => _contactPreferencePrefixes, + BackupSection.discoveredContacts => const ['discovered_contacts'], + BackupSection.channels => _channelPreferencePrefixes, + _ => const [], + }; + for (final prefix in prefixes) { + final scopedPrefix = '$prefix$sourcePrefix'; + if (key.startsWith(scopedPrefix)) { + return '$prefix$destinationPrefix${key.substring(scopedPrefix.length)}'; + } + } + return key; + } + + static bool _hasDevicePrefix( + String key, + BackupSection section, + String devicePrefix, + ) { + if (section == BackupSection.channels && + key.startsWith('message_filter_')) { + return true; + } + if (devicePrefix.isEmpty) return false; + final prefixes = switch (section) { + BackupSection.contacts => _contactPreferencePrefixes, + BackupSection.discoveredContacts => const ['discovered_contacts'], + BackupSection.channels => _channelPreferencePrefixes, + _ => const [], + }; + return prefixes.any((prefix) => key.startsWith('$prefix$devicePrefix')); + } + + static String _normalizePublicKey(String publicKey) => + RegExp(r'^[0-9a-fA-F]{64}$').hasMatch(publicKey) + ? publicKey.toLowerCase() + : ''; + + static String _devicePrefix(String publicKey) { + final normalized = _normalizePublicKey(publicKey); + return normalized.isEmpty ? '' : normalized.substring(0, 10); + } + + static Uint8List _secureBytes(int length) { + final random = Random.secure(); + return Uint8List.fromList( + List.generate(length, (_) => random.nextInt(256)), + ); + } + + static Future _deriveKey( + String password, + List salt, + int iterations, + ) => Pbkdf2.hmacSha256( + iterations: iterations, + bits: 256, + ).deriveKey(secretKey: SecretKey(utf8.encode(password)), nonce: salt); +} diff --git a/test/services/backup_service_test.dart b/test/services/backup_service_test.dart new file mode 100644 index 00000000..9cf07dd4 --- /dev/null +++ b/test/services/backup_service_test.dart @@ -0,0 +1,305 @@ +import 'dart:convert'; + +import 'package:flutter_test/flutter_test.dart'; +import 'package:meshcore_open/connector/meshcore_connector.dart'; +import 'package:meshcore_open/models/app_settings.dart'; +import 'package:meshcore_open/services/app_settings_service.dart'; +import 'package:meshcore_open/services/backup_service.dart'; +import 'package:meshcore_open/storage/prefs_manager.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +void main() { + const payload = { + 'format': 'meshcore-open-backup', + 'version': 1, + 'sourcePublicKey': '0011223344', + 'items': ['privateKey'], + 'sections': { + 'nodeSettings': {'privateKey': 'private-key-data'}, + }, + }; + + group('BackupService creation', () { + test( + 'expands stored JSON for readability and retains banner preferences', + () async { + SharedPreferences.setMockInitialValues({ + 'app_settings': jsonEncode({ + 'theme_mode': 'dark', + 'upload_ipfs_api_key': 'ipfs-secret', + 'map_tile_api_key': 'stadia-secret', + 'custom_themes': [ + {'name': 'Example'}, + ], + 'path_history_sample': { + 'path_bytes': [1, 16, 255], + }, + }), + 'node_banner_txt': 'banner text', + 'node_banner_expires_ms': 123, + }); + PrefsManager.reset(); + await PrefsManager.initialize(); + addTearDown(PrefsManager.reset); + final connector = MeshCoreConnector(); + addTearDown(connector.dispose); + + final json = await const BackupService().createBackup( + items: {BackupItem.appSettings}, + connector: connector, + settings: AppSettings(), + password: '', + ); + final payload = jsonDecode(json) as Map; + expect(payload['items'], [BackupItem.appSettings.name]); + final preferences = + (payload['sections'] as Map)['appSettings'] + as Map; + final values = preferences['preferences'] as Map; + expect(values['app_settings'], isA>()); + final appSettings = values['app_settings'] as Map; + expect(appSettings, isNot(contains('upload_ipfs_api_key'))); + expect(appSettings, isNot(contains('map_tile_api_key'))); + expect(values['node_banner_txt'], 'banner text'); + expect(values['node_banner_expires_ms'], 123); + expect(json, contains('"theme_mode": "dark"')); + expect(json, contains('"path_bytes": [1, 16, 255]')); + expect(json, isNot(contains('ipfs-secret'))); + expect(json, isNot(contains('stadia-secret'))); + final inspected = await const BackupService().inspectImport( + contents: json, + password: '', + ); + expect(inspected.availableItems, contains(BackupItem.appSettings)); + expect(inspected.availableItems, isNot(contains(BackupItem.ipfsKey))); + expect( + inspected.availableItems, + isNot(contains(BackupItem.stadiaMapKey)), + ); + final settingsService = AppSettingsService(); + addTearDown(settingsService.dispose); + await const BackupService().restoreBackup( + contents: json, + password: '', + items: {BackupItem.appSettings}, + connector: connector, + appSettingsService: settingsService, + ); + final restored = + jsonDecode(PrefsManager.instance.getString('app_settings')!) + as Map; + expect( + (restored['path_history_sample'] + as Map)['path_bytes'], + [1, 16, 255], + ); + }, + ); + + test('backs up a sensitive key without unrelated app settings', () async { + SharedPreferences.setMockInitialValues({ + 'app_settings': jsonEncode({ + 'theme_mode': 'dark', + 'upload_ipfs_api_key': 'ipfs-secret', + 'map_tile_api_key': 'stadia-secret', + }), + }); + PrefsManager.reset(); + await PrefsManager.initialize(); + addTearDown(PrefsManager.reset); + final connector = MeshCoreConnector(); + addTearDown(connector.dispose); + + final json = await const BackupService().createBackup( + items: {BackupItem.ipfsKey}, + connector: connector, + settings: AppSettings(), + password: '', + ); + final payload = jsonDecode(json) as Map; + expect(payload['items'], [BackupItem.ipfsKey.name]); + final section = + (payload['sections'] as Map)['appSettings'] + as Map; + final preferences = section['preferences'] as Map; + expect(preferences.keys, {'app_settings'}); + expect(preferences['app_settings'], { + 'upload_ipfs_api_key': 'ipfs-secret', + }); + expect(json, isNot(contains('stadia-secret'))); + }); + + test( + 'restores a selected key without replacing other app preferences', + () async { + SharedPreferences.setMockInitialValues({ + 'app_settings': jsonEncode({ + 'theme_mode': 'light', + 'upload_ipfs_api_key': 'old-ipfs', + 'map_tile_api_key': 'existing-stadia', + }), + }); + PrefsManager.reset(); + await PrefsManager.initialize(); + addTearDown(PrefsManager.reset); + final connector = MeshCoreConnector(); + final settingsService = AppSettingsService(); + addTearDown(connector.dispose); + addTearDown(settingsService.dispose); + + final backup = await BackupService.encodeBackup({ + 'format': 'meshcore-open-backup', + 'version': 1, + 'sourcePublicKey': '', + 'items': [BackupItem.ipfsKey.name], + 'sections': { + 'appSettings': { + 'preferences': { + 'app_settings': {'upload_ipfs_api_key': 'new-ipfs'}, + }, + }, + }, + }, password: ''); + await const BackupService().restoreBackup( + contents: backup, + password: '', + items: {BackupItem.ipfsKey}, + connector: connector, + appSettingsService: settingsService, + ); + + final restored = + jsonDecode(PrefsManager.instance.getString('app_settings')!) + as Map; + expect(restored['theme_mode'], 'light'); + expect(restored['upload_ipfs_api_key'], 'new-ipfs'); + expect(restored['map_tile_api_key'], 'existing-stadia'); + }, + ); + }); + + group('BackupService import inspection', () { + test( + 'identifies only the fields present in an official app backup', + () async { + final publicKey = List.filled(32, 'a1').join(); + final contactKey = List.filled(32, 'b2').join(); + final privateKey = List.filled(64, 'c3').join(); + final json = jsonEncode({ + 'name': 'Test node', + 'public_key': publicKey, + 'private_key': privateKey, + 'radio_settings': { + 'frequency': 869618, + 'bandwidth': 62500, + 'spreading_factor': 8, + 'coding_rate': 8, + 'tx_power': 22, + }, + 'position_settings': {'latitude': '47.5', 'longitude': '7.8'}, + 'other_settings': {'advert_location_policy': 0}, + 'auto_add_settings': {'auto_add_chat': true}, + 'channels': [ + {'name': 'Public', 'secret': List.filled(16, '01').join()}, + ], + 'contacts': [ + { + 'type': 1, + 'name': 'Contact', + 'custom_name': null, + 'public_key': contactKey, + 'flags': 0, + 'latitude': '0.0', + 'longitude': '0.0', + 'last_advert': 1, + 'last_modified': 1, + 'out_path_list': null, + }, + ], + }).replaceFirst('"name":"Test node",', '"name":"Test node"'); + + final inspected = await const BackupService().inspectImport( + contents: json, + password: '', + ); + expect(inspected.isOfficial, isTrue); + expect( + inspected.availableItems, + containsAll({ + BackupItem.deviceName, + BackupItem.privateKey, + BackupItem.publicKey, + BackupItem.radioSettings, + BackupItem.location, + BackupItem.contactSettings, + BackupItem.privacySettings, + BackupItem.channels, + BackupItem.contacts, + }), + ); + for (final item in [ + BackupItem.regions, + BackupItem.appSettings, + BackupItem.perContactSettings, + BackupItem.contactGroups, + BackupItem.contactHistory, + BackupItem.discoveredContacts, + BackupItem.channelFilters, + BackupItem.channelSettings, + BackupItem.communities, + BackupItem.channelHistory, + ]) { + expect(inspected.availableItems, isNot(contains(item))); + } + }, + ); + + test('reports only selected sections in a MeshCore Open backup', () async { + final json = await BackupService.encodeBackup({ + ...payload, + 'items': [BackupItem.deviceName.name, BackupItem.channels.name], + }, password: ''); + final inspected = await const BackupService().inspectImport( + contents: json, + password: '', + ); + expect(inspected.isOfficial, isFalse); + expect(inspected.availableItems, { + BackupItem.deviceName, + BackupItem.channels, + }); + }); + }); + + group('BackupService file encoding', () { + test('writes readable JSON when the password is empty', () async { + final file = await BackupService.encodeBackup(payload, password: ''); + expect(jsonDecode(file), payload); + expect(await BackupService.decodeBackup(file, password: ''), payload); + }); + + test('encrypts and restores payload when a password is provided', () async { + final file = await BackupService.encodeBackup( + payload, + password: 'correct horse battery staple', + ); + expect(file, contains('meshcore-open-encrypted-backup')); + expect(file, isNot(contains('private-key-data'))); + expect( + await BackupService.decodeBackup( + file, + password: 'correct horse battery staple', + ), + payload, + ); + }); + + test('rejects a wrong password', () async { + final file = await BackupService.encodeBackup(payload, password: 'right'); + await expectLater( + BackupService.decodeBackup(file, password: 'wrong'), + throwsFormatException, + ); + }); + }); +} diff --git a/untranslated.json b/untranslated.json index c7b11627..e3fb0acb 100644 --- a/untranslated.json +++ b/untranslated.json @@ -8,13 +8,33 @@ "backupRestore_selectImportFile", "backupRestore_password", "backupRestore_passwordHelp", + "backupRestore_importUnavailable", "backupRestore_items", "backupRestore_nodeSettings", "backupRestore_nodeSettingsDescription", + "backupRestore_deviceName", + "backupRestore_privateKey", + "backupRestore_publicKey", + "backupRestore_radioSettings", + "backupRestore_regions", + "backupRestore_location", + "backupRestore_contactSettings", + "backupRestore_privacySettings", + "backupRestore_contactsData", + "backupRestore_perContactSettings", + "backupRestore_contactGroups", + "backupRestore_contactHistory", + "backupRestore_channelsData", + "backupRestore_channelFilters", + "backupRestore_channelSettings", + "backupRestore_communities", + "backupRestore_channelHistory", "backupRestore_locationSettings", "backupRestore_locationSettingsDescription", "backupRestore_appSettings", "backupRestore_appSettingsDescription", + "backupRestore_ipfsKey", + "backupRestore_stadiaMapKey", "backupRestore_contacts", "backupRestore_contactsDescription", "backupRestore_discoveredContacts", @@ -41,13 +61,33 @@ "backupRestore_selectImportFile", "backupRestore_password", "backupRestore_passwordHelp", + "backupRestore_importUnavailable", "backupRestore_items", "backupRestore_nodeSettings", "backupRestore_nodeSettingsDescription", + "backupRestore_deviceName", + "backupRestore_privateKey", + "backupRestore_publicKey", + "backupRestore_radioSettings", + "backupRestore_regions", + "backupRestore_location", + "backupRestore_contactSettings", + "backupRestore_privacySettings", + "backupRestore_contactsData", + "backupRestore_perContactSettings", + "backupRestore_contactGroups", + "backupRestore_contactHistory", + "backupRestore_channelsData", + "backupRestore_channelFilters", + "backupRestore_channelSettings", + "backupRestore_communities", + "backupRestore_channelHistory", "backupRestore_locationSettings", "backupRestore_locationSettingsDescription", "backupRestore_appSettings", "backupRestore_appSettingsDescription", + "backupRestore_ipfsKey", + "backupRestore_stadiaMapKey", "backupRestore_contacts", "backupRestore_contactsDescription", "backupRestore_discoveredContacts", @@ -74,13 +114,33 @@ "backupRestore_selectImportFile", "backupRestore_password", "backupRestore_passwordHelp", + "backupRestore_importUnavailable", "backupRestore_items", "backupRestore_nodeSettings", "backupRestore_nodeSettingsDescription", + "backupRestore_deviceName", + "backupRestore_privateKey", + "backupRestore_publicKey", + "backupRestore_radioSettings", + "backupRestore_regions", + "backupRestore_location", + "backupRestore_contactSettings", + "backupRestore_privacySettings", + "backupRestore_contactsData", + "backupRestore_perContactSettings", + "backupRestore_contactGroups", + "backupRestore_contactHistory", + "backupRestore_channelsData", + "backupRestore_channelFilters", + "backupRestore_channelSettings", + "backupRestore_communities", + "backupRestore_channelHistory", "backupRestore_locationSettings", "backupRestore_locationSettingsDescription", "backupRestore_appSettings", "backupRestore_appSettingsDescription", + "backupRestore_ipfsKey", + "backupRestore_stadiaMapKey", "backupRestore_contacts", "backupRestore_contactsDescription", "backupRestore_discoveredContacts", @@ -107,13 +167,33 @@ "backupRestore_selectImportFile", "backupRestore_password", "backupRestore_passwordHelp", + "backupRestore_importUnavailable", "backupRestore_items", "backupRestore_nodeSettings", "backupRestore_nodeSettingsDescription", + "backupRestore_deviceName", + "backupRestore_privateKey", + "backupRestore_publicKey", + "backupRestore_radioSettings", + "backupRestore_regions", + "backupRestore_location", + "backupRestore_contactSettings", + "backupRestore_privacySettings", + "backupRestore_contactsData", + "backupRestore_perContactSettings", + "backupRestore_contactGroups", + "backupRestore_contactHistory", + "backupRestore_channelsData", + "backupRestore_channelFilters", + "backupRestore_channelSettings", + "backupRestore_communities", + "backupRestore_channelHistory", "backupRestore_locationSettings", "backupRestore_locationSettingsDescription", "backupRestore_appSettings", "backupRestore_appSettingsDescription", + "backupRestore_ipfsKey", + "backupRestore_stadiaMapKey", "backupRestore_contacts", "backupRestore_contactsDescription", "backupRestore_discoveredContacts", @@ -140,13 +220,33 @@ "backupRestore_selectImportFile", "backupRestore_password", "backupRestore_passwordHelp", + "backupRestore_importUnavailable", "backupRestore_items", "backupRestore_nodeSettings", "backupRestore_nodeSettingsDescription", + "backupRestore_deviceName", + "backupRestore_privateKey", + "backupRestore_publicKey", + "backupRestore_radioSettings", + "backupRestore_regions", + "backupRestore_location", + "backupRestore_contactSettings", + "backupRestore_privacySettings", + "backupRestore_contactsData", + "backupRestore_perContactSettings", + "backupRestore_contactGroups", + "backupRestore_contactHistory", + "backupRestore_channelsData", + "backupRestore_channelFilters", + "backupRestore_channelSettings", + "backupRestore_communities", + "backupRestore_channelHistory", "backupRestore_locationSettings", "backupRestore_locationSettingsDescription", "backupRestore_appSettings", "backupRestore_appSettingsDescription", + "backupRestore_ipfsKey", + "backupRestore_stadiaMapKey", "backupRestore_contacts", "backupRestore_contactsDescription", "backupRestore_discoveredContacts", @@ -173,13 +273,33 @@ "backupRestore_selectImportFile", "backupRestore_password", "backupRestore_passwordHelp", + "backupRestore_importUnavailable", "backupRestore_items", "backupRestore_nodeSettings", "backupRestore_nodeSettingsDescription", + "backupRestore_deviceName", + "backupRestore_privateKey", + "backupRestore_publicKey", + "backupRestore_radioSettings", + "backupRestore_regions", + "backupRestore_location", + "backupRestore_contactSettings", + "backupRestore_privacySettings", + "backupRestore_contactsData", + "backupRestore_perContactSettings", + "backupRestore_contactGroups", + "backupRestore_contactHistory", + "backupRestore_channelsData", + "backupRestore_channelFilters", + "backupRestore_channelSettings", + "backupRestore_communities", + "backupRestore_channelHistory", "backupRestore_locationSettings", "backupRestore_locationSettingsDescription", "backupRestore_appSettings", "backupRestore_appSettingsDescription", + "backupRestore_ipfsKey", + "backupRestore_stadiaMapKey", "backupRestore_contacts", "backupRestore_contactsDescription", "backupRestore_discoveredContacts", @@ -206,13 +326,33 @@ "backupRestore_selectImportFile", "backupRestore_password", "backupRestore_passwordHelp", + "backupRestore_importUnavailable", "backupRestore_items", "backupRestore_nodeSettings", "backupRestore_nodeSettingsDescription", + "backupRestore_deviceName", + "backupRestore_privateKey", + "backupRestore_publicKey", + "backupRestore_radioSettings", + "backupRestore_regions", + "backupRestore_location", + "backupRestore_contactSettings", + "backupRestore_privacySettings", + "backupRestore_contactsData", + "backupRestore_perContactSettings", + "backupRestore_contactGroups", + "backupRestore_contactHistory", + "backupRestore_channelsData", + "backupRestore_channelFilters", + "backupRestore_channelSettings", + "backupRestore_communities", + "backupRestore_channelHistory", "backupRestore_locationSettings", "backupRestore_locationSettingsDescription", "backupRestore_appSettings", "backupRestore_appSettingsDescription", + "backupRestore_ipfsKey", + "backupRestore_stadiaMapKey", "backupRestore_contacts", "backupRestore_contactsDescription", "backupRestore_discoveredContacts", @@ -239,13 +379,33 @@ "backupRestore_selectImportFile", "backupRestore_password", "backupRestore_passwordHelp", + "backupRestore_importUnavailable", "backupRestore_items", "backupRestore_nodeSettings", "backupRestore_nodeSettingsDescription", + "backupRestore_deviceName", + "backupRestore_privateKey", + "backupRestore_publicKey", + "backupRestore_radioSettings", + "backupRestore_regions", + "backupRestore_location", + "backupRestore_contactSettings", + "backupRestore_privacySettings", + "backupRestore_contactsData", + "backupRestore_perContactSettings", + "backupRestore_contactGroups", + "backupRestore_contactHistory", + "backupRestore_channelsData", + "backupRestore_channelFilters", + "backupRestore_channelSettings", + "backupRestore_communities", + "backupRestore_channelHistory", "backupRestore_locationSettings", "backupRestore_locationSettingsDescription", "backupRestore_appSettings", "backupRestore_appSettingsDescription", + "backupRestore_ipfsKey", + "backupRestore_stadiaMapKey", "backupRestore_contacts", "backupRestore_contactsDescription", "backupRestore_discoveredContacts", @@ -272,13 +432,33 @@ "backupRestore_selectImportFile", "backupRestore_password", "backupRestore_passwordHelp", + "backupRestore_importUnavailable", "backupRestore_items", "backupRestore_nodeSettings", "backupRestore_nodeSettingsDescription", + "backupRestore_deviceName", + "backupRestore_privateKey", + "backupRestore_publicKey", + "backupRestore_radioSettings", + "backupRestore_regions", + "backupRestore_location", + "backupRestore_contactSettings", + "backupRestore_privacySettings", + "backupRestore_contactsData", + "backupRestore_perContactSettings", + "backupRestore_contactGroups", + "backupRestore_contactHistory", + "backupRestore_channelsData", + "backupRestore_channelFilters", + "backupRestore_channelSettings", + "backupRestore_communities", + "backupRestore_channelHistory", "backupRestore_locationSettings", "backupRestore_locationSettingsDescription", "backupRestore_appSettings", "backupRestore_appSettingsDescription", + "backupRestore_ipfsKey", + "backupRestore_stadiaMapKey", "backupRestore_contacts", "backupRestore_contactsDescription", "backupRestore_discoveredContacts", @@ -305,13 +485,33 @@ "backupRestore_selectImportFile", "backupRestore_password", "backupRestore_passwordHelp", + "backupRestore_importUnavailable", "backupRestore_items", "backupRestore_nodeSettings", "backupRestore_nodeSettingsDescription", + "backupRestore_deviceName", + "backupRestore_privateKey", + "backupRestore_publicKey", + "backupRestore_radioSettings", + "backupRestore_regions", + "backupRestore_location", + "backupRestore_contactSettings", + "backupRestore_privacySettings", + "backupRestore_contactsData", + "backupRestore_perContactSettings", + "backupRestore_contactGroups", + "backupRestore_contactHistory", + "backupRestore_channelsData", + "backupRestore_channelFilters", + "backupRestore_channelSettings", + "backupRestore_communities", + "backupRestore_channelHistory", "backupRestore_locationSettings", "backupRestore_locationSettingsDescription", "backupRestore_appSettings", "backupRestore_appSettingsDescription", + "backupRestore_ipfsKey", + "backupRestore_stadiaMapKey", "backupRestore_contacts", "backupRestore_contactsDescription", "backupRestore_discoveredContacts", @@ -338,13 +538,33 @@ "backupRestore_selectImportFile", "backupRestore_password", "backupRestore_passwordHelp", + "backupRestore_importUnavailable", "backupRestore_items", "backupRestore_nodeSettings", "backupRestore_nodeSettingsDescription", + "backupRestore_deviceName", + "backupRestore_privateKey", + "backupRestore_publicKey", + "backupRestore_radioSettings", + "backupRestore_regions", + "backupRestore_location", + "backupRestore_contactSettings", + "backupRestore_privacySettings", + "backupRestore_contactsData", + "backupRestore_perContactSettings", + "backupRestore_contactGroups", + "backupRestore_contactHistory", + "backupRestore_channelsData", + "backupRestore_channelFilters", + "backupRestore_channelSettings", + "backupRestore_communities", + "backupRestore_channelHistory", "backupRestore_locationSettings", "backupRestore_locationSettingsDescription", "backupRestore_appSettings", "backupRestore_appSettingsDescription", + "backupRestore_ipfsKey", + "backupRestore_stadiaMapKey", "backupRestore_contacts", "backupRestore_contactsDescription", "backupRestore_discoveredContacts", @@ -371,13 +591,33 @@ "backupRestore_selectImportFile", "backupRestore_password", "backupRestore_passwordHelp", + "backupRestore_importUnavailable", "backupRestore_items", "backupRestore_nodeSettings", "backupRestore_nodeSettingsDescription", + "backupRestore_deviceName", + "backupRestore_privateKey", + "backupRestore_publicKey", + "backupRestore_radioSettings", + "backupRestore_regions", + "backupRestore_location", + "backupRestore_contactSettings", + "backupRestore_privacySettings", + "backupRestore_contactsData", + "backupRestore_perContactSettings", + "backupRestore_contactGroups", + "backupRestore_contactHistory", + "backupRestore_channelsData", + "backupRestore_channelFilters", + "backupRestore_channelSettings", + "backupRestore_communities", + "backupRestore_channelHistory", "backupRestore_locationSettings", "backupRestore_locationSettingsDescription", "backupRestore_appSettings", "backupRestore_appSettingsDescription", + "backupRestore_ipfsKey", + "backupRestore_stadiaMapKey", "backupRestore_contacts", "backupRestore_contactsDescription", "backupRestore_discoveredContacts", @@ -404,13 +644,33 @@ "backupRestore_selectImportFile", "backupRestore_password", "backupRestore_passwordHelp", + "backupRestore_importUnavailable", "backupRestore_items", "backupRestore_nodeSettings", "backupRestore_nodeSettingsDescription", + "backupRestore_deviceName", + "backupRestore_privateKey", + "backupRestore_publicKey", + "backupRestore_radioSettings", + "backupRestore_regions", + "backupRestore_location", + "backupRestore_contactSettings", + "backupRestore_privacySettings", + "backupRestore_contactsData", + "backupRestore_perContactSettings", + "backupRestore_contactGroups", + "backupRestore_contactHistory", + "backupRestore_channelsData", + "backupRestore_channelFilters", + "backupRestore_channelSettings", + "backupRestore_communities", + "backupRestore_channelHistory", "backupRestore_locationSettings", "backupRestore_locationSettingsDescription", "backupRestore_appSettings", "backupRestore_appSettingsDescription", + "backupRestore_ipfsKey", + "backupRestore_stadiaMapKey", "backupRestore_contacts", "backupRestore_contactsDescription", "backupRestore_discoveredContacts", @@ -437,13 +697,33 @@ "backupRestore_selectImportFile", "backupRestore_password", "backupRestore_passwordHelp", + "backupRestore_importUnavailable", "backupRestore_items", "backupRestore_nodeSettings", "backupRestore_nodeSettingsDescription", + "backupRestore_deviceName", + "backupRestore_privateKey", + "backupRestore_publicKey", + "backupRestore_radioSettings", + "backupRestore_regions", + "backupRestore_location", + "backupRestore_contactSettings", + "backupRestore_privacySettings", + "backupRestore_contactsData", + "backupRestore_perContactSettings", + "backupRestore_contactGroups", + "backupRestore_contactHistory", + "backupRestore_channelsData", + "backupRestore_channelFilters", + "backupRestore_channelSettings", + "backupRestore_communities", + "backupRestore_channelHistory", "backupRestore_locationSettings", "backupRestore_locationSettingsDescription", "backupRestore_appSettings", "backupRestore_appSettingsDescription", + "backupRestore_ipfsKey", + "backupRestore_stadiaMapKey", "backupRestore_contacts", "backupRestore_contactsDescription", "backupRestore_discoveredContacts", @@ -470,13 +750,33 @@ "backupRestore_selectImportFile", "backupRestore_password", "backupRestore_passwordHelp", + "backupRestore_importUnavailable", "backupRestore_items", "backupRestore_nodeSettings", "backupRestore_nodeSettingsDescription", + "backupRestore_deviceName", + "backupRestore_privateKey", + "backupRestore_publicKey", + "backupRestore_radioSettings", + "backupRestore_regions", + "backupRestore_location", + "backupRestore_contactSettings", + "backupRestore_privacySettings", + "backupRestore_contactsData", + "backupRestore_perContactSettings", + "backupRestore_contactGroups", + "backupRestore_contactHistory", + "backupRestore_channelsData", + "backupRestore_channelFilters", + "backupRestore_channelSettings", + "backupRestore_communities", + "backupRestore_channelHistory", "backupRestore_locationSettings", "backupRestore_locationSettingsDescription", "backupRestore_appSettings", "backupRestore_appSettingsDescription", + "backupRestore_ipfsKey", + "backupRestore_stadiaMapKey", "backupRestore_contacts", "backupRestore_contactsDescription", "backupRestore_discoveredContacts", @@ -503,13 +803,33 @@ "backupRestore_selectImportFile", "backupRestore_password", "backupRestore_passwordHelp", + "backupRestore_importUnavailable", "backupRestore_items", "backupRestore_nodeSettings", "backupRestore_nodeSettingsDescription", + "backupRestore_deviceName", + "backupRestore_privateKey", + "backupRestore_publicKey", + "backupRestore_radioSettings", + "backupRestore_regions", + "backupRestore_location", + "backupRestore_contactSettings", + "backupRestore_privacySettings", + "backupRestore_contactsData", + "backupRestore_perContactSettings", + "backupRestore_contactGroups", + "backupRestore_contactHistory", + "backupRestore_channelsData", + "backupRestore_channelFilters", + "backupRestore_channelSettings", + "backupRestore_communities", + "backupRestore_channelHistory", "backupRestore_locationSettings", "backupRestore_locationSettingsDescription", "backupRestore_appSettings", "backupRestore_appSettingsDescription", + "backupRestore_ipfsKey", + "backupRestore_stadiaMapKey", "backupRestore_contacts", "backupRestore_contactsDescription", "backupRestore_discoveredContacts", @@ -536,13 +856,33 @@ "backupRestore_selectImportFile", "backupRestore_password", "backupRestore_passwordHelp", + "backupRestore_importUnavailable", "backupRestore_items", "backupRestore_nodeSettings", "backupRestore_nodeSettingsDescription", + "backupRestore_deviceName", + "backupRestore_privateKey", + "backupRestore_publicKey", + "backupRestore_radioSettings", + "backupRestore_regions", + "backupRestore_location", + "backupRestore_contactSettings", + "backupRestore_privacySettings", + "backupRestore_contactsData", + "backupRestore_perContactSettings", + "backupRestore_contactGroups", + "backupRestore_contactHistory", + "backupRestore_channelsData", + "backupRestore_channelFilters", + "backupRestore_channelSettings", + "backupRestore_communities", + "backupRestore_channelHistory", "backupRestore_locationSettings", "backupRestore_locationSettingsDescription", "backupRestore_appSettings", "backupRestore_appSettingsDescription", + "backupRestore_ipfsKey", + "backupRestore_stadiaMapKey", "backupRestore_contacts", "backupRestore_contactsDescription", "backupRestore_discoveredContacts", From 76232c1ad75a0321ab8d5bb50adda8dde1b8514a Mon Sep 17 00:00:00 2001 From: ericz Date: Sun, 8 Nov 2026 03:15:32 +0100 Subject: [PATCH 03/16] clear contacts and channels before restoring. --- documentation/settings.md | 2 +- lib/l10n/app_en.arb | 2 +- lib/l10n/app_localizations.dart | 2 +- lib/l10n/app_localizations_bg.dart | 2 +- lib/l10n/app_localizations_de.dart | 2 +- lib/l10n/app_localizations_en.dart | 2 +- lib/l10n/app_localizations_es.dart | 2 +- lib/l10n/app_localizations_fr.dart | 2 +- lib/l10n/app_localizations_hu.dart | 2 +- lib/l10n/app_localizations_it.dart | 2 +- lib/l10n/app_localizations_ja.dart | 2 +- lib/l10n/app_localizations_ko.dart | 2 +- lib/l10n/app_localizations_nl.dart | 2 +- lib/l10n/app_localizations_pl.dart | 2 +- lib/l10n/app_localizations_pt.dart | 2 +- lib/l10n/app_localizations_ru.dart | 2 +- lib/l10n/app_localizations_sk.dart | 2 +- lib/l10n/app_localizations_sl.dart | 2 +- lib/l10n/app_localizations_sv.dart | 2 +- lib/l10n/app_localizations_uk.dart | 2 +- lib/l10n/app_localizations_zh.dart | 2 +- lib/screens/backup_restore_screen.dart | 2 + lib/services/backup_service.dart | 77 +++++++++++++++++++++----- 23 files changed, 85 insertions(+), 36 deletions(-) diff --git a/documentation/settings.md b/documentation/settings.md index 628fd35c..45d15b2b 100644 --- a/documentation/settings.md +++ b/documentation/settings.md @@ -212,7 +212,7 @@ The settings card links to **Backup & Restore** and **Export** subpages. ### Backup & Restore -Choose individual items to include in a backup or restore. Location settings include the saved coordinates, GPS enable state and interval, contact discovery options, and privacy/adverts settings. When importing, only items found in the selected file can be selected. Backups from the official MeshCore app are supported; those files do not include app preferences, groups, filters, or message history, so those choices are unavailable. A radio connection is required to restore radio settings and contact or channel lists. Contact and channel lists are restored to the connected radio; message history and groups are restored in the app. +Choose individual items to include in a backup or restore. Location settings include the saved coordinates, GPS enable state and interval, contact discovery options, and privacy/adverts settings. When importing, only items found in the selected file can be selected. Backups from the official MeshCore app are supported; those files do not include app preferences, groups, filters, or message history, so those choices are unavailable. A radio connection is required to restore radio settings and contact or channel lists. Restoring contacts or channels replaces the selected list on the radio, then reloads it from the device. If you also restore the radio identity, reconnect afterward to reload its data. Message history and groups are restored in the app. The private-key option is off by default because it changes the radio's identity. Select it only when you intend to restore that identity; the app asks for confirmation before proceeding. Some radios do not allow identity backup or restore, and the app will let you know if this feature is unavailable. diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index b345cc1f..909eceb0 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -234,7 +234,7 @@ "backupRestore_backup": "Create Backup", "backupRestore_restore": "Restore Selected", "backupRestore_backupComplete": "Backup file created.", - "backupRestore_restoreComplete": "Restore complete. Reconnect the radio to refresh its data.", + "backupRestore_restoreComplete": "Restore complete. Reconnect if you restored the radio identity.", "backupRestore_failed": "Backup operation failed: {error}", "@backupRestore_failed": { "placeholders": { diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart index 6c42cc51..7728370c 100644 --- a/lib/l10n/app_localizations.dart +++ b/lib/l10n/app_localizations.dart @@ -1081,7 +1081,7 @@ abstract class AppLocalizations { /// No description provided for @backupRestore_restoreComplete. /// /// In en, this message translates to: - /// **'Restore complete. Reconnect the radio to refresh its data.'** + /// **'Restore complete. Reconnect if you restored the radio identity.'** String get backupRestore_restoreComplete; /// No description provided for @backupRestore_failed. diff --git a/lib/l10n/app_localizations_bg.dart b/lib/l10n/app_localizations_bg.dart index 1525fd45..0e1f606e 100644 --- a/lib/l10n/app_localizations_bg.dart +++ b/lib/l10n/app_localizations_bg.dart @@ -542,7 +542,7 @@ class AppLocalizationsBg extends AppLocalizations { @override String get backupRestore_restoreComplete => - 'Restore complete. Reconnect the radio to refresh its data.'; + 'Restore complete. Reconnect if you restored the radio identity.'; @override String backupRestore_failed(String error) { diff --git a/lib/l10n/app_localizations_de.dart b/lib/l10n/app_localizations_de.dart index 7a98cc9a..367660db 100644 --- a/lib/l10n/app_localizations_de.dart +++ b/lib/l10n/app_localizations_de.dart @@ -545,7 +545,7 @@ class AppLocalizationsDe extends AppLocalizations { @override String get backupRestore_restoreComplete => - 'Restore complete. Reconnect the radio to refresh its data.'; + 'Restore complete. Reconnect if you restored the radio identity.'; @override String backupRestore_failed(String error) { diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart index 741c6a86..fb11ecfb 100644 --- a/lib/l10n/app_localizations_en.dart +++ b/lib/l10n/app_localizations_en.dart @@ -538,7 +538,7 @@ class AppLocalizationsEn extends AppLocalizations { @override String get backupRestore_restoreComplete => - 'Restore complete. Reconnect the radio to refresh its data.'; + 'Restore complete. Reconnect if you restored the radio identity.'; @override String backupRestore_failed(String error) { diff --git a/lib/l10n/app_localizations_es.dart b/lib/l10n/app_localizations_es.dart index 8249dd75..eede141c 100644 --- a/lib/l10n/app_localizations_es.dart +++ b/lib/l10n/app_localizations_es.dart @@ -543,7 +543,7 @@ class AppLocalizationsEs extends AppLocalizations { @override String get backupRestore_restoreComplete => - 'Restore complete. Reconnect the radio to refresh its data.'; + 'Restore complete. Reconnect if you restored the radio identity.'; @override String backupRestore_failed(String error) { diff --git a/lib/l10n/app_localizations_fr.dart b/lib/l10n/app_localizations_fr.dart index efae49c7..c0ffdabb 100644 --- a/lib/l10n/app_localizations_fr.dart +++ b/lib/l10n/app_localizations_fr.dart @@ -545,7 +545,7 @@ class AppLocalizationsFr extends AppLocalizations { @override String get backupRestore_restoreComplete => - 'Restore complete. Reconnect the radio to refresh its data.'; + 'Restore complete. Reconnect if you restored the radio identity.'; @override String backupRestore_failed(String error) { diff --git a/lib/l10n/app_localizations_hu.dart b/lib/l10n/app_localizations_hu.dart index 64420984..b6bdb2a2 100644 --- a/lib/l10n/app_localizations_hu.dart +++ b/lib/l10n/app_localizations_hu.dart @@ -541,7 +541,7 @@ class AppLocalizationsHu extends AppLocalizations { @override String get backupRestore_restoreComplete => - 'Restore complete. Reconnect the radio to refresh its data.'; + 'Restore complete. Reconnect if you restored the radio identity.'; @override String backupRestore_failed(String error) { diff --git a/lib/l10n/app_localizations_it.dart b/lib/l10n/app_localizations_it.dart index 998e97c0..e7d4f086 100644 --- a/lib/l10n/app_localizations_it.dart +++ b/lib/l10n/app_localizations_it.dart @@ -545,7 +545,7 @@ class AppLocalizationsIt extends AppLocalizations { @override String get backupRestore_restoreComplete => - 'Restore complete. Reconnect the radio to refresh its data.'; + 'Restore complete. Reconnect if you restored the radio identity.'; @override String backupRestore_failed(String error) { diff --git a/lib/l10n/app_localizations_ja.dart b/lib/l10n/app_localizations_ja.dart index 50eeb3d6..37673dd9 100644 --- a/lib/l10n/app_localizations_ja.dart +++ b/lib/l10n/app_localizations_ja.dart @@ -526,7 +526,7 @@ class AppLocalizationsJa extends AppLocalizations { @override String get backupRestore_restoreComplete => - 'Restore complete. Reconnect the radio to refresh its data.'; + 'Restore complete. Reconnect if you restored the radio identity.'; @override String backupRestore_failed(String error) { diff --git a/lib/l10n/app_localizations_ko.dart b/lib/l10n/app_localizations_ko.dart index 11acc5bc..7fb984ac 100644 --- a/lib/l10n/app_localizations_ko.dart +++ b/lib/l10n/app_localizations_ko.dart @@ -526,7 +526,7 @@ class AppLocalizationsKo extends AppLocalizations { @override String get backupRestore_restoreComplete => - 'Restore complete. Reconnect the radio to refresh its data.'; + 'Restore complete. Reconnect if you restored the radio identity.'; @override String backupRestore_failed(String error) { diff --git a/lib/l10n/app_localizations_nl.dart b/lib/l10n/app_localizations_nl.dart index 0da21c09..012ed113 100644 --- a/lib/l10n/app_localizations_nl.dart +++ b/lib/l10n/app_localizations_nl.dart @@ -541,7 +541,7 @@ class AppLocalizationsNl extends AppLocalizations { @override String get backupRestore_restoreComplete => - 'Restore complete. Reconnect the radio to refresh its data.'; + 'Restore complete. Reconnect if you restored the radio identity.'; @override String backupRestore_failed(String error) { diff --git a/lib/l10n/app_localizations_pl.dart b/lib/l10n/app_localizations_pl.dart index ab7bd293..effb0898 100644 --- a/lib/l10n/app_localizations_pl.dart +++ b/lib/l10n/app_localizations_pl.dart @@ -548,7 +548,7 @@ class AppLocalizationsPl extends AppLocalizations { @override String get backupRestore_restoreComplete => - 'Restore complete. Reconnect the radio to refresh its data.'; + 'Restore complete. Reconnect if you restored the radio identity.'; @override String backupRestore_failed(String error) { diff --git a/lib/l10n/app_localizations_pt.dart b/lib/l10n/app_localizations_pt.dart index 9f8f4943..6bfa701f 100644 --- a/lib/l10n/app_localizations_pt.dart +++ b/lib/l10n/app_localizations_pt.dart @@ -544,7 +544,7 @@ class AppLocalizationsPt extends AppLocalizations { @override String get backupRestore_restoreComplete => - 'Restore complete. Reconnect the radio to refresh its data.'; + 'Restore complete. Reconnect if you restored the radio identity.'; @override String backupRestore_failed(String error) { diff --git a/lib/l10n/app_localizations_ru.dart b/lib/l10n/app_localizations_ru.dart index c0534b20..626351fd 100644 --- a/lib/l10n/app_localizations_ru.dart +++ b/lib/l10n/app_localizations_ru.dart @@ -544,7 +544,7 @@ class AppLocalizationsRu extends AppLocalizations { @override String get backupRestore_restoreComplete => - 'Restore complete. Reconnect the radio to refresh its data.'; + 'Restore complete. Reconnect if you restored the radio identity.'; @override String backupRestore_failed(String error) { diff --git a/lib/l10n/app_localizations_sk.dart b/lib/l10n/app_localizations_sk.dart index 35263c5b..34c98ba8 100644 --- a/lib/l10n/app_localizations_sk.dart +++ b/lib/l10n/app_localizations_sk.dart @@ -544,7 +544,7 @@ class AppLocalizationsSk extends AppLocalizations { @override String get backupRestore_restoreComplete => - 'Restore complete. Reconnect the radio to refresh its data.'; + 'Restore complete. Reconnect if you restored the radio identity.'; @override String backupRestore_failed(String error) { diff --git a/lib/l10n/app_localizations_sl.dart b/lib/l10n/app_localizations_sl.dart index 95e03d47..c397c6a3 100644 --- a/lib/l10n/app_localizations_sl.dart +++ b/lib/l10n/app_localizations_sl.dart @@ -543,7 +543,7 @@ class AppLocalizationsSl extends AppLocalizations { @override String get backupRestore_restoreComplete => - 'Restore complete. Reconnect the radio to refresh its data.'; + 'Restore complete. Reconnect if you restored the radio identity.'; @override String backupRestore_failed(String error) { diff --git a/lib/l10n/app_localizations_sv.dart b/lib/l10n/app_localizations_sv.dart index 9be4b142..9ed2b494 100644 --- a/lib/l10n/app_localizations_sv.dart +++ b/lib/l10n/app_localizations_sv.dart @@ -539,7 +539,7 @@ class AppLocalizationsSv extends AppLocalizations { @override String get backupRestore_restoreComplete => - 'Restore complete. Reconnect the radio to refresh its data.'; + 'Restore complete. Reconnect if you restored the radio identity.'; @override String backupRestore_failed(String error) { diff --git a/lib/l10n/app_localizations_uk.dart b/lib/l10n/app_localizations_uk.dart index a87c8d27..fd931301 100644 --- a/lib/l10n/app_localizations_uk.dart +++ b/lib/l10n/app_localizations_uk.dart @@ -543,7 +543,7 @@ class AppLocalizationsUk extends AppLocalizations { @override String get backupRestore_restoreComplete => - 'Restore complete. Reconnect the radio to refresh its data.'; + 'Restore complete. Reconnect if you restored the radio identity.'; @override String backupRestore_failed(String error) { diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dart index 5c09fbb1..6edd82ac 100644 --- a/lib/l10n/app_localizations_zh.dart +++ b/lib/l10n/app_localizations_zh.dart @@ -520,7 +520,7 @@ class AppLocalizationsZh extends AppLocalizations { @override String get backupRestore_restoreComplete => - 'Restore complete. Reconnect the radio to refresh its data.'; + 'Restore complete. Reconnect if you restored the radio identity.'; @override String backupRestore_failed(String error) { diff --git a/lib/screens/backup_restore_screen.dart b/lib/screens/backup_restore_screen.dart index f6d50833..e9de609f 100644 --- a/lib/screens/backup_restore_screen.dart +++ b/lib/screens/backup_restore_screen.dart @@ -46,6 +46,8 @@ class _BackupRestoreScreenState extends State { BackupItem.location, BackupItem.contactSettings, BackupItem.privacySettings, + BackupItem.contacts, + BackupItem.channels, }; static const Set _defaultUncheckedOnRestore = { ..._defaultUncheckedItems, diff --git a/lib/services/backup_service.dart b/lib/services/backup_service.dart index 4eb205a2..e24ca0c5 100644 --- a/lib/services/backup_service.dart +++ b/lib/services/backup_service.dart @@ -1,3 +1,4 @@ +import 'dart:async'; import 'dart:convert'; import 'dart:math'; import 'dart:typed_data'; @@ -6,8 +7,8 @@ import 'package:cryptography/cryptography.dart'; import '../connector/meshcore_connector.dart'; import '../connector/meshcore_protocol.dart'; +import '../connector/pending_command_replies.dart'; import '../models/app_settings.dart'; -import '../models/contact.dart'; import 'app_settings_service.dart'; import '../storage/channel_store.dart'; import '../storage/contact_store.dart'; @@ -302,6 +303,8 @@ class BackupService { final restoreChannels = selectedItems.any( (item) => _sectionForItem(item) == BackupSection.channels, ); + final replaceContacts = selectedItems.contains(BackupItem.contacts); + final replaceChannels = selectedItems.contains(BackupItem.channels); if (importingIdentity && (sourcePublicKey.isEmpty || _normalizePublicKey(node?['publicKey'] as String? ?? '') != @@ -315,6 +318,9 @@ class BackupService { throw StateError('Wait for radio identity to finish loading'); } } + if (replaceContacts) await _clearRadioContacts(connector); + if (replaceChannels) await _clearRadioChannels(connector); + if (node != null) { final name = node['name']; if (selectedItems.contains(BackupItem.deviceName) && name is String) { @@ -474,12 +480,61 @@ class BackupService { ); } } - if (selectedItems.contains(BackupItem.contacts)) { + if (replaceContacts) { await _restoreRadioContacts(connector, destinationPublicKey); } - if (selectedItems.contains(BackupItem.channels)) { + if (replaceChannels) { await _restoreRadioChannels(connector, destinationPublicKey); } + if (!importingIdentity) { + if (replaceContacts) await _refreshContactsFromRadio(connector); + if (replaceChannels) await connector.getChannels(force: true); + } + } + + Future _clearRadioContacts(MeshCoreConnector connector) async { + await _refreshContactsFromRadio(connector); + for (final contact in connector.contacts.toList()) { + try { + await connector.sendFrame( + buildRemoveContactFrame(contact.publicKey), + waitForGenericAck: true, + ); + } on FirmwareCommandException { + // A contact removed on the radio since its last sync is already clear. + } + } + } + + Future _clearRadioChannels(MeshCoreConnector connector) async { + await connector.getChannels(force: true); + for (final channel in connector.channels) { + if (channel.isEmpty) continue; + await connector.sendFrame( + buildSetChannelFrame(channel.index, '', Uint8List(16)), + waitForGenericAck: true, + ); + } + } + + Future _refreshContactsFromRadio(MeshCoreConnector connector) async { + final refreshed = Completer(); + void checkComplete() { + if (connector.hasLoadedContacts && + !connector.isLoadingContacts && + !refreshed.isCompleted) { + refreshed.complete(); + } + } + + connector.addListener(checkComplete); + try { + await connector.getContacts(); + checkComplete(); + await refreshed.future.timeout(const Duration(seconds: 30)); + } finally { + connector.removeListener(checkComplete); + } } Future _restoreRadioContacts( @@ -492,22 +547,14 @@ class BackupService { if (contact.publicKeyHex.toUpperCase() == publicKey.toUpperCase()) { continue; } - Contact? existing; - for (final candidate in connector.contacts) { - if (candidate.publicKeyHex == contact.publicKeyHex) { - existing = candidate; - break; - } - } - final pathLengthValue = existing?.pathLength ?? contact.pathLength; - final pathHashWidth = existing?.pathHashWidth ?? contact.pathHashWidth; - final pathLength = pathLengthValue < 0 + final pathLength = contact.pathLength < 0 ? 0xff - : (pathLengthValue & 0x3f) | (((pathHashWidth - 1) & 0x03) << 6); + : (contact.pathLength & 0x3f) | + (((contact.pathHashWidth - 1) & 0x03) << 6); await connector.sendFrame( buildUpdateContactPathFrame( contact.publicKey, - existing?.path ?? contact.path, + contact.path, pathLength, type: contact.type, flags: contact.flags, From be28a1a258d299a69c43bfbbf8a37ecddfa8a657 Mon Sep 17 00:00:00 2001 From: ericz Date: Sun, 8 Nov 2026 04:04:04 +0100 Subject: [PATCH 04/16] add device name to backup-file name. --- lib/screens/backup_restore_screen.dart | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/screens/backup_restore_screen.dart b/lib/screens/backup_restore_screen.dart index e9de609f..c152dcc1 100644 --- a/lib/screens/backup_restore_screen.dart +++ b/lib/screens/backup_restore_screen.dart @@ -382,8 +382,14 @@ class _BackupRestoreScreenState extends State { password: _passwordController.text, ); if (!mounted) return; + final deviceName = (connector.selfName ?? '') + .trim() + .replaceAll(RegExp(r'[<>:"/\\|?*\x00-\x1f]'), '_') + .replaceAll(RegExp(r'\s+'), '_') + .replaceAll(RegExp(r'^\.+'), '') + .replaceAll(RegExp(r'[. ]+$'), ''); final filename = - 'meshcore-open_backup_${DateTime.now().millisecondsSinceEpoch}.json'; + 'meshcore-open_${deviceName.isEmpty ? 'radio' : deviceName}_backup_${DateTime.now().millisecondsSinceEpoch}.json'; final file = XFile.fromData( Uint8List.fromList(utf8.encode(contents)), name: filename, From c939f7a29ce9c9686c5c37899b3de9e94d255a46 Mon Sep 17 00:00:00 2001 From: zjs81 Date: Sat, 7 Nov 2026 22:31:14 -0700 Subject: [PATCH 05/16] Add Czech, in-chat search, typed-hash path trace and contact sharing - Czech UI locale (app_cs.arb), selectable in the language picker and as a message translation language; language names added to every locale. - Fix wrong language names: Slovak shown as Slovenian in it/ja/pt/sl, garbled Slovak/Bulgarian in pl, Ukrainian in ru, Hungarian in ko/zh. - Search inside DM and channel chats across the full stored history, with highlighted matches; filtered channel messages are excluded. - Path trace by typed hashes (e.g. A1,B2,C3) from the Contacts and map menus, without needing node locations; the map trace panel can hand its hops to it. - Share contacts in chats using the official app's format; received cards have a one-tap Add contact button that reuses the QR card import path. - Translations for all new strings in every locale; docs updated. --- CLAUDE.md | 2 +- README.md | 2 +- documentation/additional-features.md | 2 +- documentation/chat-and-messaging.md | 11 +- documentation/map-and-location.md | 9 + documentation/navigation.md | 1 + documentation/settings.md | 2 +- lib/connector/meshcore_connector.dart | 52 + lib/helpers/contact_share_message.dart | 63 + lib/helpers/message_search.dart | 45 + lib/helpers/path_trace_input.dart | 117 + lib/l10n/app_bg.arb | 77 +- lib/l10n/app_cs.arb | 4282 +++++++++++ lib/l10n/app_de.arb | 77 +- lib/l10n/app_en.arb | 75 + lib/l10n/app_es.arb | 77 +- lib/l10n/app_fr.arb | 77 +- lib/l10n/app_hu.arb | 77 +- lib/l10n/app_it.arb | 79 +- lib/l10n/app_ja.arb | 77 +- lib/l10n/app_ko.arb | 77 +- lib/l10n/app_localizations.dart | 203 + lib/l10n/app_localizations_bg.dart | 123 + lib/l10n/app_localizations_cs.dart | 7175 ++++++++++++++++++ lib/l10n/app_localizations_de.dart | 123 + lib/l10n/app_localizations_en.dart | 122 + lib/l10n/app_localizations_es.dart | 123 + lib/l10n/app_localizations_fr.dart | 123 + lib/l10n/app_localizations_hu.dart | 123 + lib/l10n/app_localizations_it.dart | 125 +- lib/l10n/app_localizations_ja.dart | 120 +- lib/l10n/app_localizations_ko.dart | 119 +- lib/l10n/app_localizations_nl.dart | 123 + lib/l10n/app_localizations_pl.dart | 131 +- lib/l10n/app_localizations_pt.dart | 125 +- lib/l10n/app_localizations_ru.dart | 126 +- lib/l10n/app_localizations_sk.dart | 125 + lib/l10n/app_localizations_sl.dart | 127 +- lib/l10n/app_localizations_sv.dart | 122 + lib/l10n/app_localizations_uk.dart | 125 + lib/l10n/app_localizations_zh.dart | 119 +- lib/l10n/app_nl.arb | 77 +- lib/l10n/app_pl.arb | 81 +- lib/l10n/app_pt.arb | 79 +- lib/l10n/app_ru.arb | 79 +- lib/l10n/app_sk.arb | 77 +- lib/l10n/app_sl.arb | 77 +- lib/l10n/app_sv.arb | 77 +- lib/l10n/app_uk.arb | 77 +- lib/l10n/app_zh.arb | 79 +- lib/models/map_path_trace_draft.dart | 4 + lib/models/translation_support.dart | 1 + lib/screens/channel_chat_screen.dart | 645 +- lib/screens/channels_screen.dart | 6 + lib/screens/chat_screen.dart | 298 +- lib/screens/contact_qr_scanner_screen.dart | 21 +- lib/screens/contacts_screen.dart | 11 + lib/screens/manual_path_trace_screen.dart | 273 + lib/screens/map_screen.dart | 30 + lib/services/notification_service.dart | 7 + lib/widgets/chat_search_results.dart | 222 + lib/widgets/language_picker_sheet.dart | 1 + lib/widgets/share_contact_sheet.dart | 157 + lib/widgets/shared_contact_card.dart | 187 + test/helpers/contact_share_message_test.dart | 68 + test/helpers/message_search_test.dart | 59 + test/helpers/path_trace_input_test.dart | 50 + 67 files changed, 17245 insertions(+), 381 deletions(-) create mode 100644 lib/helpers/contact_share_message.dart create mode 100644 lib/helpers/message_search.dart create mode 100644 lib/helpers/path_trace_input.dart create mode 100644 lib/l10n/app_cs.arb create mode 100644 lib/l10n/app_localizations_cs.dart create mode 100644 lib/screens/manual_path_trace_screen.dart create mode 100644 lib/widgets/chat_search_results.dart create mode 100644 lib/widgets/share_contact_sheet.dart create mode 100644 lib/widgets/shared_contact_card.dart create mode 100644 test/helpers/contact_share_message_test.dart create mode 100644 test/helpers/message_search_test.dart create mode 100644 test/helpers/path_trace_input_test.dart diff --git a/CLAUDE.md b/CLAUDE.md index 9a348612..4f24d742 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -47,7 +47,7 @@ For Linux, use `nix develop`; see [Linux with Nix](README.md#linux-with-nix) for | Image reassembly and file persistence | `lib/services/received_image_store.dart`, `lib/services/received_image_blob_store_io.dart` | | Material themes | `lib/theme/mesh_theme.dart` | | Screens and reusable UI | `lib/screens/`, `lib/widgets/` | -| Localization | `lib/l10n/` (18 locales) | +| Localization | `lib/l10n/` (19 locales) | `Provider`/`ChangeNotifier` drives UI state. `main.dart` wires `MeshTheme.light()` and `MeshTheme.dark()` and uses the saved theme preference. Its `MultiProvider` exposes `MeshCoreConnector`, `MessageRetryService`, `PathHistoryService`, `AppSettingsService`, `BleDebugLogService`, `AppDebugLogService`, `ChatTextScaleService`, `TranslationService`, `UiViewStateService`, `StorageService` (plain `Provider`), `MapTileCacheService`, `TimeoutPredictionService`, `ImageCodecService`, `ReceivedImageStore`, and `MessageFilterService`; screens read them with `Consumer`, `context.watch()`, or `context.read()`. diff --git a/README.md b/README.md index 5579a34b..3a768b7f 100644 --- a/README.md +++ b/README.md @@ -360,7 +360,7 @@ Messages are transmitted as binary frames using a custom protocol optimized for ### App Settings - **Theme**: System default, light, or dark mode -- **Language**: Use one of 18 languages (English, Chinese, French, Spanish, Portuguese, German, Dutch, Polish, Swedish, Italian, Slovak, Slovenian, Bulgarian, Russian, Ukrainian, Hungarian, Japanese, Korean) +- **Language**: Use one of 19 languages (English, Chinese, French, Spanish, Portuguese, German, Dutch, Polish, Swedish, Italian, Slovak, Czech, Slovenian, Bulgarian, Russian, Ukrainian, Hungarian, Japanese, Korean) - **Notifications**: Configurable for messages, channels, and node advertisements; per-channel muting; reply, mark-as-read, and mute actions on Android notifications and watches (reply and mark-as-read in Android Auto when built with `--android-project-arg=androidAuto=true`) - **Battery Chemistry**: Support for NMC, LiFePO4, LiPo, and LiPo HV battery types - **Message Retry**: Automatic retry with configurable path clearing diff --git a/documentation/additional-features.md b/documentation/additional-features.md index 46b81f96..75f039e5 100644 --- a/documentation/additional-features.md +++ b/documentation/additional-features.md @@ -26,7 +26,7 @@ A bottom sheet with a search field and a grid of GIF thumbnails. App Settings → Appearance → Language ### Supported Languages (18) -English, French, Spanish, German, Polish, Slovenian, Portuguese, Italian, Chinese, Swedish, Dutch, Slovak, Bulgarian, Russian, Ukrainian, Hungarian, Japanese, Korean +English, French, Spanish, German, Polish, Slovenian, Portuguese, Italian, Chinese, Swedish, Dutch, Slovak, Czech, Bulgarian, Russian, Ukrainian, Hungarian, Japanese, Korean ### How It Works - All UI strings go through Flutter's ARB localization system diff --git a/documentation/chat-and-messaging.md b/documentation/chat-and-messaging.md index 8c47e507..693f7b7d 100644 --- a/documentation/chat-and-messaging.md +++ b/documentation/chat-and-messaging.md @@ -18,7 +18,8 @@ From the Contacts screen, tap any Chat-type contact to open the ChatScreen. - **Title**: Contact name - **Subtitle**: Current routing path label (e.g., "2 hops", "flood (auto)", "direct (forced)") and unread count. Tapping the subtitle shows the full path details. -- **Action button**: +- **Action buttons**: + - **Search** (magnifier icon): Replaces the title with a search field and lists every message in this conversation's full history whose text (or translation) contains the typed word, newest first, with matches highlighted. Channel search also matches sender names and skips messages caught by the [message filter](message-filter.md). Back, Esc or the arrow closes search. Channel chats have the same button. - **Overflow menu** (⋮ icon): Contains Routing, Info, Telemetry, Settings, Chat background, and Clear Chat. Routing opens the routing sheet where you can switch between Auto, Direct, and Flood routing and manage recent paths (hop count, round-trip time, age, success count, color-coded by repeater). Info shows a dialog with contact type, path, GPS coordinates, and public key. Chat background sets a color or picture (with a fade slider) behind this chat only; see [Chat backgrounds](themes.md#chat-backgrounds). ### Message List @@ -56,6 +57,14 @@ From the Contacts screen, tap any Chat-type contact to open the ChatScreen. | Location pin | `m:,\|