Merge remote-tracking branch 'origin/dev' into fix/ui-issues

# Conflicts:
#	untranslated.json
This commit is contained in:
zjs81 committed 2026-10-24 21:13:02 -07:00
commit 7c2f481520
52 files changed
+1397 -111

No files matched your search

+16 -7
View File
@@ -42,7 +42,7 @@ Message notifications can be answered without opening the app, from the notifica
- **Reply** sends through the connected radio exactly like the chat screen: same length limits, SMAZ and Cyr2Lat handling, and retries. Your reply is then added to the notification.
- **Replies over the message limit** are split at word boundaries into up to 3 messages. Longer replies are not sent; a "Reply not sent" notification asks you to open the app.
- **Mark as read** clears the unread count on the phone only. MeshCore has no read receipts, so nothing is sent over the mesh.
- **Mute channel** (phone and watch) mutes that channel, the same as the bell icon in the channel chat.
- **Mute channel** (phone and watch) sets that channel to **Muted**, the same as choosing Muted from the bell icon in the channel chat.
- If the radio is disconnected, the conversation is no longer on the radio, the radio reports a send error, or the app isn't running, a "Reply not sent" notification explains why. The reply is not queued. If a split reply fails partway, earlier parts may already have been sent.
- Replies are sent as typed; composer translation is not applied.
@@ -107,15 +107,24 @@ Access via **App Settings → Notifications**:
| Channel Message Notifications | On | Channel alerts (greyed out if master is off) |
| Advertisement Notifications | On | New node alerts (greyed out if master is off) |
### Per-Channel Muting
### Per-Channel Notification Modes
Mute or unmute a channel from any of these places. Muted channels do not generate OS notifications.
Each channel supports three notification modes:
- The bell icon in the channel chat app bar
- Long-press a channel in the channels list → "Mute channel" / "Unmute channel"
- **Mute channel** on a channel notification (Android)
| Mode | Icon | Behavior |
|---|---|---|
| **All messages** | 🔔 | Receive notifications for every message |
| **Mentions only** | 🔔! | Only notify when a message mentions your name (see below) |
| **Muted** | 🔕 | No notifications |
There is no per-contact muting.
Set the mode from:
- The notifications icon in the channel chat app bar (tap to open the mode picker)
- Long-press a channel in the channels list → **Notification settings** → select mode
The Android **Mute channel** notification action sets the channel to **Muted**; it cannot choose another mode.
A message mentions you if it contains `@[yourname]` or `@yourname`, case-insensitively. The plain `@yourname` form must stand alone as a word, so `@bobby` does not mention `bob` and `x@bob.com` is not a mention; names with spaces must be written in full. Detection (`MeshCoreConnector.textMentionsName`) runs on the original text, before any automatic translation.
## Rate Limiting
+124 -3
View File
@@ -38,7 +38,8 @@ import '../services/image_codec_service.dart';
import '../services/received_image_store.dart';
import '../services/message_retry_service.dart';
import '../services/path_history_service.dart';
import '../services/app_settings_service.dart';
import '../services/app_settings_service.dart'
show AppSettingsService, ChannelNotificationMode;
import '../services/background_service.dart';
import '../services/timeout_prediction_service.dart';
import '../services/translation_service.dart';
@@ -298,6 +299,22 @@ class MeshCoreConnector extends ChangeNotifier {
Stopwatch? _airtimeBumpStopwatch;
int _prevTotalAirSecs = 0;
int? _batteryMillivolts;
// Thresholds (percent) that trigger a low-battery notification once per
// crossing, re-arming 5 points above the threshold after recharge.
static const List<int> _lowBatteryThresholds = [25, 10];
final Set<int> _batteryAlertedThresholds = {};
// Consecutive readings that newly crossed a threshold. Alerts need
// [_lowBatteryConfirmReadings] in a row so a single TX-load voltage sag
// doesn't notify.
int _lowBatteryReadingStreak = 0;
// Device key the posted low-battery notifications were scoped to, kept so
// they can still be cancelled after the session's identity is cleared.
String? _lowBatteryAlertDeviceKey;
static const int _lowBatteryConfirmReadings = 2;
// Readings below this are treated as "no battery sensor" (boards without
// one report 0 mV). Any single Li cell, including LiFePO4 (2600 mV empty),
// is protection-cut well above 2 V, so lower values are not real readings.
static const int _minPlausibleBatteryMillivolts = 2000;
double? _selfLatitude;
double? _selfLongitude;
final List<DirectRepeater> _directRepeaters = List.empty(growable: true);
@@ -691,6 +708,9 @@ class MeshCoreConnector extends ChangeNotifier {
/// from ver code 8.
bool get supportsNodeDiscover => (_firmwareVerCode ?? 0) >= 8;
/// CMD_SET_PATH_HASH_MODE exists from ver code 10 (v1.14.0).
bool get supportsPathHashMode => (_firmwareVerCode ?? 0) >= 10;
/// CMD_GET/SET_DEFAULT_FLOOD_SCOPE exist from ver code 11 (v1.15.0).
bool get supportsDefaultFloodScope => (_firmwareVerCode ?? 0) >= 11;
@@ -1256,8 +1276,9 @@ class MeshCoreConnector extends ChangeNotifier {
/// (notification shade, watch, or Android Auto).
Future<void> handleNotificationReply(NotificationReply reply) async {
if (reply.action == NotificationReplyAction.mute) {
await _appSettingsService?.muteChannel(
await _appSettingsService?.setChannelNotificationMode(
_channelDisplayName(reply.channelIndex!),
ChannelNotificationMode.muted,
);
await _notificationService.clearChannelNotification(
reply.channelIndex!,
@@ -6501,6 +6522,7 @@ class MeshCoreConnector extends ChangeNotifier {
_batteryMillivolts = reader.readUInt16LE();
_storageUsedKb = reader.readUInt32LE();
_storageTotalKb = reader.readUInt32LE();
_checkLowBatteryThresholds();
final volts = (_batteryMillivolts! / 1000.0).toStringAsFixed(2);
_appDebugLogService?.info(
'Pulled battery: $volts V ($_batteryMillivolts mV)',
@@ -6515,6 +6537,64 @@ class MeshCoreConnector extends ChangeNotifier {
}
}
void _checkLowBatteryThresholds() {
final millivolts = _batteryMillivolts;
if (millivolts == null || millivolts < _minPlausibleBatteryMillivolts) {
return;
}
// Until the device identity (and so its saved chemistry) is known, the
// percentage falls back to NMC and can read low for e.g. LiFePO4 packs.
// Skip evaluation; the next battery poll re-checks once identity is set.
if (batteryDeviceKey == null || _appSettingsService == null) return;
final percent = batteryPercent;
if (percent == null) return;
// Only the lowest newly crossed threshold notifies; higher ones crossed
// in the same reading are marked as alerted silently.
final newlyCrossed = <int>[];
for (final threshold in _lowBatteryThresholds) {
if (percent <= threshold &&
!_batteryAlertedThresholds.contains(threshold)) {
newlyCrossed.add(threshold);
} else if (percent > threshold + 5 &&
_batteryAlertedThresholds.contains(threshold)) {
// Re-arm once the battery recovers 5 points above the threshold,
// so a recharge + discharge cycle alerts again without flapping.
_batteryAlertedThresholds.remove(threshold);
final alertDeviceKey = _lowBatteryAlertDeviceKey;
if (alertDeviceKey != null) {
unawaited(
_notificationService.clearLowBatteryNotifications(alertDeviceKey, [
threshold,
]),
);
}
}
}
if (newlyCrossed.isEmpty) {
_lowBatteryReadingStreak = 0;
return;
}
// Debounce: wait for consecutive low readings before alerting.
if (++_lowBatteryReadingStreak < _lowBatteryConfirmReadings) return;
_lowBatteryReadingStreak = 0;
_batteryAlertedThresholds.addAll(newlyCrossed);
final deviceKey = batteryDeviceKey!;
_lowBatteryAlertDeviceKey = deviceKey;
final lowestNewlyCrossed = newlyCrossed.reduce((a, b) => a < b ? a : b);
if (!(_appSettingsService?.settings.notificationsEnabled ?? false)) {
return;
}
unawaited(
_notificationService.showLowBatteryNotification(
deviceKey: deviceKey,
deviceName: deviceDisplayName,
batteryPercent: percent,
threshold: lowestNewlyCrossed,
),
);
}
void _checkManualAddContacts() async {
// If manual add contacts is enabled, set auto add config and other params.
// and disable it after
@@ -7383,7 +7463,12 @@ class MeshCoreConnector extends ChangeNotifier {
}
final label = channelName ?? _channelDisplayName(channelIndex);
if (_appSettingsService!.isChannelMuted(label)) return;
final notificationMode = _appSettingsService!.getChannelNotificationMode(
label,
);
// Check if channel is muted
if (notificationMode == ChannelNotificationMode.muted) return;
// Reuse translation result only if completed and non-empty; else use original text
final resolvedText =
@@ -7392,6 +7477,14 @@ class MeshCoreConnector extends ChangeNotifier {
translationResult.translatedText.trim().isNotEmpty)
? translationResult.translatedText.trim()
: message.text.trim();
// Mentions are matched on the untranslated text.
if (notificationMode == ChannelNotificationMode.mentionsOnly) {
if (!textMentionsName(message.originalText ?? message.text, _selfName)) {
return;
}
}
unawaited(() async {
await _notificationService.showChannelMessageNotification(
channelName: label,
@@ -7404,6 +7497,22 @@ class MeshCoreConnector extends ChangeNotifier {
}());
}
/// Whether [text] mentions [name], case-insensitively, as either
/// `@[name]` (the reply/mention prefix the app sends) or a plain `@name`.
/// The plain form needs a word boundary on both sides, so `@bobby` does
/// not mention `bob` and `x@bob.com` is not a mention. Names containing
/// spaces must be written out in full.
@visibleForTesting
static bool textMentionsName(String text, String? name) {
if (name == null || name.isEmpty) return false;
final escaped = RegExp.escape(name);
return RegExp(
'@\\[$escaped\\]|(?<![\\p{L}\\p{N}_])@$escaped(?![\\p{L}\\p{N}_])',
caseSensitive: false,
unicode: true,
).hasMatch(text);
}
/// Handles RESP_CODE_CHANNEL_DATA_RECV (GRP_DATA). Frames whose dataType is
/// not 0xAE1C — or that arrive before an [ImageChunkTransport] is installed —
/// are ignored without disturbing any other behaviour.
@@ -8598,6 +8707,18 @@ class MeshCoreConnector extends ChangeNotifier {
_hasReceivedDeviceInfo = false;
_batteryMillivolts = null;
_batteryRequested = false;
final alertDeviceKey = _lowBatteryAlertDeviceKey;
if (alertDeviceKey != null && _batteryAlertedThresholds.isNotEmpty) {
unawaited(
_notificationService.clearLowBatteryNotifications(
alertDeviceKey,
_batteryAlertedThresholds.toList(),
),
);
}
_batteryAlertedThresholds.clear();
_lowBatteryAlertDeviceKey = null;
_lowBatteryReadingStreak = 0;
_pathHashByteWidth = 1;
_maxContacts = _defaultMaxContacts;
_maxChannels = _defaultMaxChannels;
+4
View File
@@ -359,6 +359,10 @@
"channels_public": "Публично",
"channels_private": "Частен",
"channels_editChannel": "Редактирай канал",
"channels_notificationSettings": "Настройки за известия",
"channels_notifyAll": "Всички съобщения",
"channels_notifyMentionsOnly": "Само споменавания",
"channels_notifyNone": "Заглушено",
"channels_muteChannel": "Заглуши канала",
"channels_unmuteChannel": "Включи известията на канала",
"channels_deleteChannel": "Изтрий канала",
+4
View File
@@ -369,6 +369,10 @@
"channels_public": "Öffentlich",
"channels_private": "Privat",
"channels_editChannel": "Kanal bearbeiten",
"channels_notificationSettings": "Benachrichtigungseinstellungen",
"channels_notifyAll": "Alle Nachrichten",
"channels_notifyMentionsOnly": "Nur Erwähnungen",
"channels_notifyNone": "Stummgeschaltet",
"channels_muteChannel": "Kanal stummschalten",
"channels_unmuteChannel": "Kanal Stummschaltung aufheben",
"channels_deleteChannel": "Kanal löschen",
+29
View File
@@ -198,6 +198,7 @@
"settings_radioSettingsSubtitle": "Frequency, power, spreading factor",
"settings_radioSettingsUpdated": "Radio settings updated",
"settings_radioSettingsNotApplied": "The radio did not apply these settings",
"settings_pathHashModeNotApplied": "Radio settings were applied, but the radio did not confirm the new path hash size",
"settings_regionSettings": "Regions",
"settings_regionSettingsSubtitle": "Limit channel floods to an area",
"settings_regionEmptyExplanation": "Regions limit flood messages to repeaters in an area. Fetch them from nearby repeaters or add one by name.",
@@ -717,6 +718,18 @@
"channels_addSectionCreate": "Create new",
"channels_dragToReorder": "Drag to reorder",
"channels_editChannel": "Edit channel",
"channels_notificationSettings": "Notification settings",
"channels_notifyAll": "All messages",
"channels_notifyMentionsOnly": "Mentions only",
"channels_notifyNone": "Muted",
"channels_notificationModeTooltip": "Notifications: {mode}",
"@channels_notificationModeTooltip": {
"placeholders": {
"mode": {
"type": "String"
}
}
},
"channels_muteChannel": "Mute channel",
"channels_unmuteChannel": "Unmute channel",
"channels_deleteChannel": "Delete channel",
@@ -2686,6 +2699,22 @@
"contacts_contactAdvertCopied": "Advert copied to Clipboard.",
"contacts_contactAdvertCopyFailed": "Copying advert to Clipboard failed.",
"notification_activityTitle": "MeshCore Activity",
"notification_lowBatteryTitle": "Low battery",
"@notification_lowBatteryTitle": {
"description": "Title of the low battery notification"
},
"notification_lowBatteryBody": "{deviceName} battery is at {percent}%",
"@notification_lowBatteryBody": {
"description": "Body of the low battery notification; deviceName is the connected radio's node name",
"placeholders": {
"deviceName": {
"type": "String"
},
"percent": {
"type": "int"
}
}
},
"notification_messagesCount": "{count} {count, plural, =1{message} other{messages}}",
"@notification_messagesCount": {
"placeholders": {
+4
View File
@@ -369,6 +369,10 @@
"channels_public": "Público",
"channels_private": "Privado",
"channels_editChannel": "Editar canal",
"channels_notificationSettings": "Configuración de notificaciones",
"channels_notifyAll": "Todos los mensajes",
"channels_notifyMentionsOnly": "Solo menciones",
"channels_notifyNone": "Silenciado",
"channels_muteChannel": "Silenciar canal",
"channels_unmuteChannel": "Activar canal",
"channels_deleteChannel": "Eliminar canal",
+4
View File
@@ -369,6 +369,10 @@
"channels_public": "Public",
"channels_private": "Privé",
"channels_editChannel": "Modifier le canal",
"channels_notificationSettings": "Paramètres des notifications",
"channels_notifyAll": "Tous les messages",
"channels_notifyMentionsOnly": "Mentions uniquement",
"channels_notifyNone": "Désactivé",
"channels_muteChannel": "Désactiver les notifications du canal",
"channels_unmuteChannel": "Réactiver les notifications du canal",
"channels_deleteChannel": "Supprimer le canal",
+4
View File
@@ -511,6 +511,10 @@
"channels_public": "Nyilvános",
"channels_private": "Magán",
"channels_editChannel": "Csatorna szerkesztése",
"channels_notificationSettings": "Értesítési beállítások",
"channels_notifyAll": "Összes üzenet",
"channels_notifyMentionsOnly": "Csak említések",
"channels_notifyNone": "Némít",
"channels_muteChannel": "Csatorna némítása",
"channels_unmuteChannel": "Csatorna némításának feloldása",
"channels_deleteChannel": "Csatorna törlése",
+4
View File
@@ -414,6 +414,10 @@
"channels_public": "Pubblico",
"channels_private": "Privato",
"channels_editChannel": "Modifica canale",
"channels_notificationSettings": "Impostazioni notifiche",
"channels_notifyAll": "Tutti i messaggi",
"channels_notifyMentionsOnly": "Solo menzioni",
"channels_notifyNone": "Silenziato",
"channels_muteChannel": "Silenzia canale",
"channels_unmuteChannel": "Attiva notifiche canale",
"channels_deleteChannel": "Elimina canale",
+4
View File
@@ -517,6 +517,10 @@
"channels_public": "公開",
"channels_private": "非公開",
"channels_editChannel": "チャンネルを編集",
"channels_notificationSettings": "通知設定",
"channels_notifyAll": "すべてのメッセージ",
"channels_notifyMentionsOnly": "メンションのみ",
"channels_notifyNone": "ミュート",
"channels_muteChannel": "チャンネルをミュート",
"channels_unmuteChannel": "チャンネルのミュートを解除",
"channels_deleteChannel": "チャンネルを削除",
+4
View File
@@ -511,6 +511,10 @@
"channels_public": "대중의",
"channels_private": "사립",
"channels_editChannel": "채널 편집",
"channels_notificationSettings": "알림 설정",
"channels_notifyAll": "모든 메시지",
"channels_notifyMentionsOnly": "언급만",
"channels_notifyNone": "음소거",
"channels_muteChannel": "음소거 채널",
"channels_unmuteChannel": "채널 음소거 해제",
"channels_deleteChannel": "채널 삭제",
+48
View File
@@ -862,6 +862,12 @@ abstract class AppLocalizations {
/// **'The radio did not apply these settings'**
String get settings_radioSettingsNotApplied;
/// No description provided for @settings_pathHashModeNotApplied.
///
/// In en, this message translates to:
/// **'Radio settings were applied, but the radio did not confirm the new path hash size'**
String get settings_pathHashModeNotApplied;
/// No description provided for @settings_regionSettings.
///
/// In en, this message translates to:
@@ -2632,6 +2638,36 @@ abstract class AppLocalizations {
/// **'Edit channel'**
String get channels_editChannel;
/// No description provided for @channels_notificationSettings.
///
/// In en, this message translates to:
/// **'Notification settings'**
String get channels_notificationSettings;
/// No description provided for @channels_notifyAll.
///
/// In en, this message translates to:
/// **'All messages'**
String get channels_notifyAll;
/// No description provided for @channels_notifyMentionsOnly.
///
/// In en, this message translates to:
/// **'Mentions only'**
String get channels_notifyMentionsOnly;
/// No description provided for @channels_notifyNone.
///
/// In en, this message translates to:
/// **'Muted'**
String get channels_notifyNone;
/// No description provided for @channels_notificationModeTooltip.
///
/// In en, this message translates to:
/// **'Notifications: {mode}'**
String channels_notificationModeTooltip(String mode);
/// No description provided for @channels_muteChannel.
///
/// In en, this message translates to:
@@ -8156,6 +8192,18 @@ abstract class AppLocalizations {
/// **'MeshCore Activity'**
String get notification_activityTitle;
/// Title of the low battery notification
///
/// In en, this message translates to:
/// **'Low battery'**
String get notification_lowBatteryTitle;
/// Body of the low battery notification; deviceName is the connected radio's node name
///
/// In en, this message translates to:
/// **'{deviceName} battery is at {percent}%'**
String notification_lowBatteryBody(String deviceName, int percent);
/// No description provided for @notification_messagesCount.
///
/// In en, this message translates to:
+29
View File
@@ -425,6 +425,10 @@ class AppLocalizationsBg extends AppLocalizations {
String get settings_radioSettingsNotApplied =>
'Радиото не приложи тези настройки';
@override
String get settings_pathHashModeNotApplied =>
'Radio settings were applied, but the radio did not confirm the new path hash size';
@override
String get settings_regionSettings => 'Региони';
@@ -1472,6 +1476,23 @@ class AppLocalizationsBg extends AppLocalizations {
@override
String get channels_editChannel => 'Редактирай канал';
@override
String get channels_notificationSettings => 'Настройки за известия';
@override
String get channels_notifyAll => 'Всички съобщения';
@override
String get channels_notifyMentionsOnly => 'Само споменавания';
@override
String get channels_notifyNone => 'Заглушено';
@override
String channels_notificationModeTooltip(String mode) {
return 'Notifications: $mode';
}
@override
String get channels_muteChannel => 'Заглуши канала';
@@ -4756,6 +4777,14 @@ class AppLocalizationsBg extends AppLocalizations {
@override
String get notification_activityTitle => 'Активност на MeshCore';
@override
String get notification_lowBatteryTitle => 'Low battery';
@override
String notification_lowBatteryBody(String deviceName, int percent) {
return '$deviceName battery is at $percent%';
}
@override
String notification_messagesCount(int count) {
String _temp0 = intl.Intl.pluralLogic(
+29
View File
@@ -427,6 +427,10 @@ class AppLocalizationsDe extends AppLocalizations {
String get settings_radioSettingsNotApplied =>
'Das Funkgerät hat diese Einstellungen nicht übernommen';
@override
String get settings_pathHashModeNotApplied =>
'Radio settings were applied, but the radio did not confirm the new path hash size';
@override
String get settings_regionSettings => 'Regionen';
@@ -1466,6 +1470,23 @@ class AppLocalizationsDe extends AppLocalizations {
@override
String get channels_editChannel => 'Kanal bearbeiten';
@override
String get channels_notificationSettings => 'Benachrichtigungseinstellungen';
@override
String get channels_notifyAll => 'Alle Nachrichten';
@override
String get channels_notifyMentionsOnly => 'Nur Erwähnungen';
@override
String get channels_notifyNone => 'Stummgeschaltet';
@override
String channels_notificationModeTooltip(String mode) {
return 'Notifications: $mode';
}
@override
String get channels_muteChannel => 'Kanal stummschalten';
@@ -4767,6 +4788,14 @@ class AppLocalizationsDe extends AppLocalizations {
@override
String get notification_activityTitle => 'MeshCore Aktivität';
@override
String get notification_lowBatteryTitle => 'Low battery';
@override
String notification_lowBatteryBody(String deviceName, int percent) {
return '$deviceName battery is at $percent%';
}
@override
String notification_messagesCount(int count) {
String _temp0 = intl.Intl.pluralLogic(
+29
View File
@@ -421,6 +421,10 @@ class AppLocalizationsEn extends AppLocalizations {
String get settings_radioSettingsNotApplied =>
'The radio did not apply these settings';
@override
String get settings_pathHashModeNotApplied =>
'Radio settings were applied, but the radio did not confirm the new path hash size';
@override
String get settings_regionSettings => 'Regions';
@@ -1446,6 +1450,23 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get channels_editChannel => 'Edit channel';
@override
String get channels_notificationSettings => 'Notification settings';
@override
String get channels_notifyAll => 'All messages';
@override
String get channels_notifyMentionsOnly => 'Mentions only';
@override
String get channels_notifyNone => 'Muted';
@override
String channels_notificationModeTooltip(String mode) {
return 'Notifications: $mode';
}
@override
String get channels_muteChannel => 'Mute channel';
@@ -4691,6 +4712,14 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get notification_activityTitle => 'MeshCore Activity';
@override
String get notification_lowBatteryTitle => 'Low battery';
@override
String notification_lowBatteryBody(String deviceName, int percent) {
return '$deviceName battery is at $percent%';
}
@override
String notification_messagesCount(int count) {
String _temp0 = intl.Intl.pluralLogic(
+29
View File
@@ -425,6 +425,10 @@ class AppLocalizationsEs extends AppLocalizations {
String get settings_radioSettingsNotApplied =>
'La radio no aplicó esta configuración';
@override
String get settings_pathHashModeNotApplied =>
'Radio settings were applied, but the radio did not confirm the new path hash size';
@override
String get settings_regionSettings => 'Regiones';
@@ -1465,6 +1469,23 @@ class AppLocalizationsEs extends AppLocalizations {
@override
String get channels_editChannel => 'Editar canal';
@override
String get channels_notificationSettings => 'Configuración de notificaciones';
@override
String get channels_notifyAll => 'Todos los mensajes';
@override
String get channels_notifyMentionsOnly => 'Solo menciones';
@override
String get channels_notifyNone => 'Silenciado';
@override
String channels_notificationModeTooltip(String mode) {
return 'Notifications: $mode';
}
@override
String get channels_muteChannel => 'Silenciar canal';
@@ -4758,6 +4779,14 @@ class AppLocalizationsEs extends AppLocalizations {
@override
String get notification_activityTitle => 'Actividad de MeshCore';
@override
String get notification_lowBatteryTitle => 'Low battery';
@override
String notification_lowBatteryBody(String deviceName, int percent) {
return '$deviceName battery is at $percent%';
}
@override
String notification_messagesCount(int count) {
String _temp0 = intl.Intl.pluralLogic(
+29
View File
@@ -427,6 +427,10 @@ class AppLocalizationsFr extends AppLocalizations {
String get settings_radioSettingsNotApplied =>
'La radio n\'a pas appliqué ces paramètres';
@override
String get settings_pathHashModeNotApplied =>
'Radio settings were applied, but the radio did not confirm the new path hash size';
@override
String get settings_regionSettings => 'Régions';
@@ -1470,6 +1474,23 @@ class AppLocalizationsFr extends AppLocalizations {
@override
String get channels_editChannel => 'Modifier le canal';
@override
String get channels_notificationSettings => 'Paramètres des notifications';
@override
String get channels_notifyAll => 'Tous les messages';
@override
String get channels_notifyMentionsOnly => 'Mentions uniquement';
@override
String get channels_notifyNone => 'Désactivé';
@override
String channels_notificationModeTooltip(String mode) {
return 'Notifications: $mode';
}
@override
String get channels_muteChannel => 'Désactiver les notifications du canal';
@@ -4777,6 +4798,14 @@ class AppLocalizationsFr extends AppLocalizations {
@override
String get notification_activityTitle => 'Activité MeshCore';
@override
String get notification_lowBatteryTitle => 'Low battery';
@override
String notification_lowBatteryBody(String deviceName, int percent) {
return '$deviceName battery is at $percent%';
}
@override
String notification_messagesCount(int count) {
String _temp0 = intl.Intl.pluralLogic(
+29
View File
@@ -423,6 +423,10 @@ class AppLocalizationsHu extends AppLocalizations {
String get settings_radioSettingsNotApplied =>
'A rádió nem alkalmazta ezeket a beállításokat';
@override
String get settings_pathHashModeNotApplied =>
'Radio settings were applied, but the radio did not confirm the new path hash size';
@override
String get settings_regionSettings => 'Tájak';
@@ -1461,6 +1465,23 @@ class AppLocalizationsHu extends AppLocalizations {
@override
String get channels_editChannel => 'Csatorna szerkesztése';
@override
String get channels_notificationSettings => 'Értesítési beállítások';
@override
String get channels_notifyAll => 'Összes üzenet';
@override
String get channels_notifyMentionsOnly => 'Csak említések';
@override
String get channels_notifyNone => 'Némít';
@override
String channels_notificationModeTooltip(String mode) {
return 'Notifications: $mode';
}
@override
String get channels_muteChannel => 'Csatorna némítása';
@@ -4755,6 +4776,14 @@ class AppLocalizationsHu extends AppLocalizations {
@override
String get notification_activityTitle => 'MeshCore tevékenység';
@override
String get notification_lowBatteryTitle => 'Low battery';
@override
String notification_lowBatteryBody(String deviceName, int percent) {
return '$deviceName battery is at $percent%';
}
@override
String notification_messagesCount(int count) {
String _temp0 = intl.Intl.pluralLogic(
+29
View File
@@ -427,6 +427,10 @@ class AppLocalizationsIt extends AppLocalizations {
String get settings_radioSettingsNotApplied =>
'La radio non ha applicato queste impostazioni';
@override
String get settings_pathHashModeNotApplied =>
'Radio settings were applied, but the radio did not confirm the new path hash size';
@override
String get settings_regionSettings => 'Regioni';
@@ -1469,6 +1473,23 @@ class AppLocalizationsIt extends AppLocalizations {
@override
String get channels_editChannel => 'Modifica canale';
@override
String get channels_notificationSettings => 'Impostazioni notifiche';
@override
String get channels_notifyAll => 'Tutti i messaggi';
@override
String get channels_notifyMentionsOnly => 'Solo menzioni';
@override
String get channels_notifyNone => 'Silenziato';
@override
String channels_notificationModeTooltip(String mode) {
return 'Notifications: $mode';
}
@override
String get channels_muteChannel => 'Silenzia canale';
@@ -4764,6 +4785,14 @@ class AppLocalizationsIt extends AppLocalizations {
@override
String get notification_activityTitle => 'Attività MeshCore';
@override
String get notification_lowBatteryTitle => 'Low battery';
@override
String notification_lowBatteryBody(String deviceName, int percent) {
return '$deviceName battery is at $percent%';
}
@override
String notification_messagesCount(int count) {
String _temp0 = intl.Intl.pluralLogic(
+29
View File
@@ -407,6 +407,10 @@ class AppLocalizationsJa extends AppLocalizations {
@override
String get settings_radioSettingsNotApplied => 'ラジオがこれらの設定を適用しませんでした';
@override
String get settings_pathHashModeNotApplied =>
'Radio settings were applied, but the radio did not confirm the new path hash size';
@override
String get settings_regionSettings => '地域';
@@ -1393,6 +1397,23 @@ class AppLocalizationsJa extends AppLocalizations {
@override
String get channels_editChannel => 'チャンネルを編集';
@override
String get channels_notificationSettings => '通知設定';
@override
String get channels_notifyAll => 'すべてのメッセージ';
@override
String get channels_notifyMentionsOnly => 'メンションのみ';
@override
String get channels_notifyNone => 'ミュート';
@override
String channels_notificationModeTooltip(String mode) {
return 'Notifications: $mode';
}
@override
String get channels_muteChannel => 'チャンネルをミュート';
@@ -4527,6 +4548,14 @@ class AppLocalizationsJa extends AppLocalizations {
@override
String get notification_activityTitle => 'メッシュコアの活動';
@override
String get notification_lowBatteryTitle => 'Low battery';
@override
String notification_lowBatteryBody(String deviceName, int percent) {
return '$deviceName battery is at $percent%';
}
@override
String notification_messagesCount(int count) {
String _temp0 = intl.Intl.pluralLogic(
+29
View File
@@ -407,6 +407,10 @@ class AppLocalizationsKo extends AppLocalizations {
@override
String get settings_radioSettingsNotApplied => '라디오가 이 설정을 적용하지 않았습니다';
@override
String get settings_pathHashModeNotApplied =>
'Radio settings were applied, but the radio did not confirm the new path hash size';
@override
String get settings_regionSettings => '지역';
@@ -1398,6 +1402,23 @@ class AppLocalizationsKo extends AppLocalizations {
@override
String get channels_editChannel => '채널 편집';
@override
String get channels_notificationSettings => '알림 설정';
@override
String get channels_notifyAll => '모든 메시지';
@override
String get channels_notifyMentionsOnly => '언급만';
@override
String get channels_notifyNone => '음소거';
@override
String channels_notificationModeTooltip(String mode) {
return 'Notifications: $mode';
}
@override
String get channels_muteChannel => '음소거 채널';
@@ -4538,6 +4559,14 @@ class AppLocalizationsKo extends AppLocalizations {
@override
String get notification_activityTitle => '메쉬코어 활동';
@override
String get notification_lowBatteryTitle => 'Low battery';
@override
String notification_lowBatteryBody(String deviceName, int percent) {
return '$deviceName battery is at $percent%';
}
@override
String notification_messagesCount(int count) {
String _temp0 = intl.Intl.pluralLogic(
+29
View File
@@ -423,6 +423,10 @@ class AppLocalizationsNl extends AppLocalizations {
String get settings_radioSettingsNotApplied =>
'De radio heeft deze instellingen niet toegepast';
@override
String get settings_pathHashModeNotApplied =>
'Radio settings were applied, but the radio did not confirm the new path hash size';
@override
String get settings_regionSettings => 'Regio\'s';
@@ -1457,6 +1461,23 @@ class AppLocalizationsNl extends AppLocalizations {
@override
String get channels_editChannel => 'Kanaal bewerken';
@override
String get channels_notificationSettings => 'Meldingsinstellingen';
@override
String get channels_notifyAll => 'Alle berichten';
@override
String get channels_notifyMentionsOnly => 'Alleen vermeldingen';
@override
String get channels_notifyNone => 'Gedempt';
@override
String channels_notificationModeTooltip(String mode) {
return 'Notifications: $mode';
}
@override
String get channels_muteChannel => 'Kanaal dempen';
@@ -4733,6 +4754,14 @@ class AppLocalizationsNl extends AppLocalizations {
@override
String get notification_activityTitle => 'MeshCore Activiteit';
@override
String get notification_lowBatteryTitle => 'Low battery';
@override
String notification_lowBatteryBody(String deviceName, int percent) {
return '$deviceName battery is at $percent%';
}
@override
String notification_messagesCount(int count) {
String _temp0 = intl.Intl.pluralLogic(
+29
View File
@@ -431,6 +431,10 @@ class AppLocalizationsPl extends AppLocalizations {
String get settings_radioSettingsNotApplied =>
'Radio nie zastosowało tych ustawień';
@override
String get settings_pathHashModeNotApplied =>
'Radio settings were applied, but the radio did not confirm the new path hash size';
@override
String get settings_regionSettings => 'Regiony';
@@ -1483,6 +1487,23 @@ class AppLocalizationsPl extends AppLocalizations {
@override
String get channels_editChannel => 'Edytuj kanał';
@override
String get channels_notificationSettings => 'Ustawienia powiadomień';
@override
String get channels_notifyAll => 'Wszystkie wiadomości';
@override
String get channels_notifyMentionsOnly => 'Tylko wzmianki';
@override
String get channels_notifyNone => 'Wyciszone';
@override
String channels_notificationModeTooltip(String mode) {
return 'Notifications: $mode';
}
@override
String get channels_muteChannel => 'Wycisz kanał';
@@ -4784,6 +4805,14 @@ class AppLocalizationsPl extends AppLocalizations {
@override
String get notification_activityTitle => 'Aktywność MeshCore';
@override
String get notification_lowBatteryTitle => 'Low battery';
@override
String notification_lowBatteryBody(String deviceName, int percent) {
return '$deviceName battery is at $percent%';
}
@override
String notification_messagesCount(int count) {
String _temp0 = intl.Intl.pluralLogic(
+29
View File
@@ -427,6 +427,10 @@ class AppLocalizationsPt extends AppLocalizations {
String get settings_radioSettingsNotApplied =>
'O rádio não aplicou estas configurações';
@override
String get settings_pathHashModeNotApplied =>
'Radio settings were applied, but the radio did not confirm the new path hash size';
@override
String get settings_regionSettings => 'Regiões';
@@ -1468,6 +1472,23 @@ class AppLocalizationsPt extends AppLocalizations {
@override
String get channels_editChannel => 'Editar canal';
@override
String get channels_notificationSettings => 'Configurações de notificação';
@override
String get channels_notifyAll => 'Todas as mensagens';
@override
String get channels_notifyMentionsOnly => 'Apenas menções';
@override
String get channels_notifyNone => 'Silenciado';
@override
String channels_notificationModeTooltip(String mode) {
return 'Notifications: $mode';
}
@override
String get channels_muteChannel => 'Silenciar canal';
@@ -4760,6 +4781,14 @@ class AppLocalizationsPt extends AppLocalizations {
@override
String get notification_activityTitle => 'Atividade MeshCore';
@override
String get notification_lowBatteryTitle => 'Low battery';
@override
String notification_lowBatteryBody(String deviceName, int percent) {
return '$deviceName battery is at $percent%';
}
@override
String notification_messagesCount(int count) {
String _temp0 = intl.Intl.pluralLogic(
+29
View File
@@ -426,6 +426,10 @@ class AppLocalizationsRu extends AppLocalizations {
String get settings_radioSettingsNotApplied =>
'Радиомодуль не применил эти настройки';
@override
String get settings_pathHashModeNotApplied =>
'Radio settings were applied, but the radio did not confirm the new path hash size';
@override
String get settings_regionSettings => 'Регионы';
@@ -1472,6 +1476,23 @@ class AppLocalizationsRu extends AppLocalizations {
@override
String get channels_editChannel => 'Изменить канал';
@override
String get channels_notificationSettings => 'Настройки уведомлений';
@override
String get channels_notifyAll => 'Все сообщения';
@override
String get channels_notifyMentionsOnly => 'Только упоминания';
@override
String get channels_notifyNone => 'Без звука';
@override
String channels_notificationModeTooltip(String mode) {
return 'Notifications: $mode';
}
@override
String get channels_muteChannel => 'Отключить уведомления канала';
@@ -4768,6 +4789,14 @@ class AppLocalizationsRu extends AppLocalizations {
@override
String get notification_activityTitle => 'Активность MeshCore';
@override
String get notification_lowBatteryTitle => 'Low battery';
@override
String notification_lowBatteryBody(String deviceName, int percent) {
return '$deviceName battery is at $percent%';
}
@override
String notification_messagesCount(int count) {
String _temp0 = intl.Intl.pluralLogic(
+29
View File
@@ -426,6 +426,10 @@ class AppLocalizationsSk extends AppLocalizations {
String get settings_radioSettingsNotApplied =>
'Rádio tieto nastavenia neuplatnilo';
@override
String get settings_pathHashModeNotApplied =>
'Radio settings were applied, but the radio did not confirm the new path hash size';
@override
String get settings_regionSettings => 'Regiony';
@@ -1460,6 +1464,23 @@ class AppLocalizationsSk extends AppLocalizations {
@override
String get channels_editChannel => 'Upraviť kanál';
@override
String get channels_notificationSettings => 'Nastavenia notifikácií';
@override
String get channels_notifyAll => 'Všetky správy';
@override
String get channels_notifyMentionsOnly => 'Iba zmienky';
@override
String get channels_notifyNone => 'Stíšené';
@override
String channels_notificationModeTooltip(String mode) {
return 'Notifications: $mode';
}
@override
String get channels_muteChannel => 'Stlmiť kanál';
@@ -4741,6 +4762,14 @@ class AppLocalizationsSk extends AppLocalizations {
@override
String get notification_activityTitle => 'Aktivita MeshCore';
@override
String get notification_lowBatteryTitle => 'Low battery';
@override
String notification_lowBatteryBody(String deviceName, int percent) {
return '$deviceName battery is at $percent%';
}
@override
String notification_messagesCount(int count) {
String _temp0 = intl.Intl.pluralLogic(
+29
View File
@@ -425,6 +425,10 @@ class AppLocalizationsSl extends AppLocalizations {
String get settings_radioSettingsNotApplied =>
'Radio teh nastavitev ni uveljavil';
@override
String get settings_pathHashModeNotApplied =>
'Radio settings were applied, but the radio did not confirm the new path hash size';
@override
String get settings_regionSettings => 'Regioni';
@@ -1458,6 +1462,23 @@ class AppLocalizationsSl extends AppLocalizations {
@override
String get channels_editChannel => 'Uredi kanal';
@override
String get channels_notificationSettings => 'Nastavitve obvestil';
@override
String get channels_notifyAll => 'Vsa sporočila';
@override
String get channels_notifyMentionsOnly => 'Samo omembe';
@override
String get channels_notifyNone => 'Utišano';
@override
String channels_notificationModeTooltip(String mode) {
return 'Notifications: $mode';
}
@override
String get channels_muteChannel => 'Utišaj kanal';
@@ -4739,6 +4760,14 @@ class AppLocalizationsSl extends AppLocalizations {
@override
String get notification_activityTitle => 'Aktivnost MeshCore';
@override
String get notification_lowBatteryTitle => 'Low battery';
@override
String notification_lowBatteryBody(String deviceName, int percent) {
return '$deviceName battery is at $percent%';
}
@override
String notification_messagesCount(int count) {
String _temp0 = intl.Intl.pluralLogic(
+29
View File
@@ -423,6 +423,10 @@ class AppLocalizationsSv extends AppLocalizations {
String get settings_radioSettingsNotApplied =>
'Radion tillämpade inte dessa inställningar';
@override
String get settings_pathHashModeNotApplied =>
'Radio settings were applied, but the radio did not confirm the new path hash size';
@override
String get settings_regionSettings => 'Regioner';
@@ -1447,6 +1451,23 @@ class AppLocalizationsSv extends AppLocalizations {
@override
String get channels_editChannel => 'Redigera kanal';
@override
String get channels_notificationSettings => 'Aviseringsinställningar';
@override
String get channels_notifyAll => 'Alla meddelanden';
@override
String get channels_notifyMentionsOnly => 'Endast omnämnanden';
@override
String get channels_notifyNone => 'Tyst';
@override
String channels_notificationModeTooltip(String mode) {
return 'Notifications: $mode';
}
@override
String get channels_muteChannel => 'Tysta kanal';
@@ -4715,6 +4736,14 @@ class AppLocalizationsSv extends AppLocalizations {
@override
String get notification_activityTitle => 'MeshCore Aktivitet';
@override
String get notification_lowBatteryTitle => 'Low battery';
@override
String notification_lowBatteryBody(String deviceName, int percent) {
return '$deviceName battery is at $percent%';
}
@override
String notification_messagesCount(int count) {
String _temp0 = intl.Intl.pluralLogic(
+29
View File
@@ -425,6 +425,10 @@ class AppLocalizationsUk extends AppLocalizations {
String get settings_radioSettingsNotApplied =>
'Радіомодуль не застосував ці налаштування';
@override
String get settings_pathHashModeNotApplied =>
'Radio settings were applied, but the radio did not confirm the new path hash size';
@override
String get settings_regionSettings => 'Ріси';
@@ -1463,6 +1467,23 @@ class AppLocalizationsUk extends AppLocalizations {
@override
String get channels_editChannel => 'Редагувати канал';
@override
String get channels_notificationSettings => 'Налаштування сповіщень';
@override
String get channels_notifyAll => 'Усі повідомлення';
@override
String get channels_notifyMentionsOnly => 'Лише згадки';
@override
String get channels_notifyNone => 'Вимкнено';
@override
String channels_notificationModeTooltip(String mode) {
return 'Notifications: $mode';
}
@override
String get channels_muteChannel => 'Вимкнути сповіщення каналу';
@@ -4767,6 +4788,14 @@ class AppLocalizationsUk extends AppLocalizations {
@override
String get notification_activityTitle => 'Активність MeshCore';
@override
String get notification_lowBatteryTitle => 'Low battery';
@override
String notification_lowBatteryBody(String deviceName, int percent) {
return '$deviceName battery is at $percent%';
}
@override
String notification_messagesCount(int count) {
String _temp0 = intl.Intl.pluralLogic(
+29
View File
@@ -401,6 +401,10 @@ class AppLocalizationsZh extends AppLocalizations {
@override
String get settings_radioSettingsNotApplied => '收音机未应用这些设置';
@override
String get settings_pathHashModeNotApplied =>
'Radio settings were applied, but the radio did not confirm the new path hash size';
@override
String get settings_regionSettings => '地区';
@@ -1375,6 +1379,23 @@ class AppLocalizationsZh extends AppLocalizations {
@override
String get channels_editChannel => '编辑频道';
@override
String get channels_notificationSettings => '通知设置';
@override
String get channels_notifyAll => '所有消息';
@override
String get channels_notifyMentionsOnly => '仅提及';
@override
String get channels_notifyNone => '静音';
@override
String channels_notificationModeTooltip(String mode) {
return 'Notifications: $mode';
}
@override
String get channels_muteChannel => '静音频道';
@@ -4435,6 +4456,14 @@ class AppLocalizationsZh extends AppLocalizations {
@override
String get notification_activityTitle => 'MeshCore 活动';
@override
String get notification_lowBatteryTitle => 'Low battery';
@override
String notification_lowBatteryBody(String deviceName, int percent) {
return '$deviceName battery is at $percent%';
}
@override
String notification_messagesCount(int count) {
return '$count 条消息';
+4
View File
@@ -375,6 +375,10 @@
"channels_addSectionCreate": "Nieuw aanmaken",
"channels_dragToReorder": "Sleep om te herschikken",
"channels_editChannel": "Kanaal bewerken",
"channels_notificationSettings": "Meldingsinstellingen",
"channels_notifyAll": "Alle berichten",
"channels_notifyMentionsOnly": "Alleen vermeldingen",
"channels_notifyNone": "Gedempt",
"channels_muteChannel": "Kanaal dempen",
"channels_unmuteChannel": "Kanaal dempen opheffen",
"channels_deleteChannel": "Kanaal verwijderen",
+4
View File
@@ -369,6 +369,10 @@
"channels_public": "Publiczny",
"channels_private": "Prywatny",
"channels_editChannel": "Edytuj kanał",
"channels_notificationSettings": "Ustawienia powiadomień",
"channels_notifyAll": "Wszystkie wiadomości",
"channels_notifyMentionsOnly": "Tylko wzmianki",
"channels_notifyNone": "Wyciszone",
"channels_muteChannel": "Wycisz kanał",
"channels_unmuteChannel": "Wyłącz wyciszenie kanału",
"channels_deleteChannel": "Usuń kanał",
+4
View File
@@ -359,6 +359,10 @@
"channels_public": "Público",
"channels_private": "Privado",
"channels_editChannel": "Editar canal",
"channels_notificationSettings": "Configurações de notificação",
"channels_notifyAll": "Todas as mensagens",
"channels_notifyMentionsOnly": "Apenas menções",
"channels_notifyNone": "Silenciado",
"channels_muteChannel": "Silenciar canal",
"channels_unmuteChannel": "Ativar canal",
"channels_deleteChannel": "Excluir canal",
+4
View File
@@ -251,6 +251,10 @@
"channels_public": "Публичный",
"channels_private": "Приватный",
"channels_editChannel": "Изменить канал",
"channels_notificationSettings": "Настройки уведомлений",
"channels_notifyAll": "Все сообщения",
"channels_notifyMentionsOnly": "Только упоминания",
"channels_notifyNone": "Без звука",
"channels_muteChannel": "Отключить уведомления канала",
"channels_unmuteChannel": "Включить уведомления канала",
"channels_deleteChannel": "Удалить канал",
+4
View File
@@ -359,6 +359,10 @@
"channels_public": "Veľké verejné",
"channels_private": "Osobné",
"channels_editChannel": "Upraviť kanál",
"channels_notificationSettings": "Nastavenia notifikácií",
"channels_notifyAll": "Všetky správy",
"channels_notifyMentionsOnly": "Iba zmienky",
"channels_notifyNone": "Stíšené",
"channels_muteChannel": "Stlmiť kanál",
"channels_unmuteChannel": "Zrušiť stlmenie kanála",
"channels_deleteChannel": "Odstrániť kanál",
+4
View File
@@ -359,6 +359,10 @@
"channels_public": "Javni",
"channels_private": "Zasebni",
"channels_editChannel": "Uredi kanal",
"channels_notificationSettings": "Nastavitve obvestil",
"channels_notifyAll": "Vsa sporočila",
"channels_notifyMentionsOnly": "Samo omembe",
"channels_notifyNone": "Utišano",
"channels_muteChannel": "Utišaj kanal",
"channels_unmuteChannel": "Vklopi obvestila kanala",
"channels_deleteChannel": "Pošlji kanal",
+4
View File
@@ -359,6 +359,10 @@
"channels_public": "Publik",
"channels_private": "Privat",
"channels_editChannel": "Redigera kanal",
"channels_notificationSettings": "Aviseringsinställningar",
"channels_notifyAll": "Alla meddelanden",
"channels_notifyMentionsOnly": "Endast omnämnanden",
"channels_notifyNone": "Tyst",
"channels_muteChannel": "Tysta kanal",
"channels_unmuteChannel": "Slå på ljud för kanal",
"channels_deleteChannel": "Ta bort kanal",
+4
View File
@@ -362,6 +362,10 @@
"channels_via": "через {path}",
"channels_private": "Приватний",
"channels_editChannel": "Редагувати канал",
"channels_notificationSettings": "Налаштування сповіщень",
"channels_notifyAll": "Усі повідомлення",
"channels_notifyMentionsOnly": "Лише згадки",
"channels_notifyNone": "Вимкнено",
"channels_muteChannel": "Вимкнути сповіщення каналу",
"channels_unmuteChannel": "Увімкнути сповіщення каналу",
"channels_deleteChannel": "Видалити канал",
+4
View File
@@ -374,6 +374,10 @@
"channels_public": "公共",
"channels_private": "私有",
"channels_editChannel": "编辑频道",
"channels_notificationSettings": "通知设置",
"channels_notifyAll": "所有消息",
"channels_notifyMentionsOnly": "仅提及",
"channels_notifyNone": "静音",
"channels_muteChannel": "静音频道",
"channels_unmuteChannel": "取消静音频道",
"channels_deleteChannel": "删除频道",
+46 -11
View File
@@ -3,6 +3,8 @@ import 'translation_support.dart';
enum UnitSystem { metric, imperial }
enum ChannelNotificationMode { all, mentionsOnly, muted }
extension UnitSystemValue on UnitSystem {
String get value {
switch (this) {
@@ -123,7 +125,7 @@ class AppSettings {
final Map<String, String> batteryChemistryByDeviceId;
final Map<String, String> batteryChemistryByRepeaterId;
final UnitSystem unitSystem;
final Set<String> mutedChannels;
final Map<String, ChannelNotificationMode> channelNotificationModes;
final bool mapShowDiscoveryContacts;
final bool evictDiscoveredContactsEnabled;
final String tcpServerAddress;
@@ -238,7 +240,7 @@ class AppSettings {
Map<String, String>? batteryChemistryByDeviceId,
Map<String, String>? batteryChemistryByRepeaterId,
this.unitSystem = UnitSystem.metric,
Set<String>? mutedChannels,
Map<String, ChannelNotificationMode>? channelNotificationModes,
this.mapShowDiscoveryContacts = true,
this.evictDiscoveredContactsEnabled = true,
this.tcpServerAddress = '',
@@ -264,7 +266,7 @@ class AppSettings {
String? selectedCyr2latProfileId,
}) : batteryChemistryByDeviceId = batteryChemistryByDeviceId ?? {},
batteryChemistryByRepeaterId = batteryChemistryByRepeaterId ?? {},
mutedChannels = mutedChannels ?? {},
channelNotificationModes = channelNotificationModes ?? {},
imageCodecDownloadedModels = imageCodecDownloadedModels ?? const [],
translationDownloadedModels = translationDownloadedModels ?? const [],
cyr2latProfiles =
@@ -322,7 +324,14 @@ class AppSettings {
'battery_chemistry_by_device_id': batteryChemistryByDeviceId,
'battery_chemistry_by_repeater_id': batteryChemistryByRepeaterId,
'unit_system': unitSystem.value,
'muted_channels': mutedChannels.toList(),
// Written for older builds that only read the muted set.
'muted_channels': [
for (final entry in channelNotificationModes.entries)
if (entry.value == ChannelNotificationMode.muted) entry.key,
],
'channel_notification_modes': channelNotificationModes.map(
(key, value) => MapEntry(key, value.name),
),
'map_show_discovery_contacts': mapShowDiscoveryContacts,
'evict_discovered_contacts_enabled': evictDiscoveredContactsEnabled,
'tcp_server_address': tcpServerAddress,
@@ -363,6 +372,35 @@ class AppSettings {
return UnitSystem.metric;
}
Map<String, ChannelNotificationMode> parseChannelNotificationModes(
Map<String, dynamic> json,
) {
// Migration from old muted_channels (Set<String>) to new system
final mutedList = json['muted_channels'] as List?;
final newModes = json['channel_notification_modes'] as Map?;
final result = <String, ChannelNotificationMode>{};
// Migrate old muted channels
if (mutedList != null) {
for (final channelName in mutedList) {
result[channelName.toString()] = ChannelNotificationMode.muted;
}
}
// Load new modes (overrides old muted channels if present)
if (newModes != null) {
for (final entry in newModes.entries) {
final value = entry.value;
if (value is! String) continue;
final mode = ChannelNotificationMode.values.asNameMap()[value];
if (mode != null) result[entry.key.toString()] = mode;
}
}
return result;
}
return AppSettings(
clearPathOnMaxRetry: json['clear_path_on_max_retry'] as bool? ?? false,
mapShowRepeaters: json['map_show_repeaters'] as bool? ?? true,
@@ -425,11 +463,7 @@ class AppSettings {
) ??
{},
unitSystem: parseUnitSystem(json['unit_system']),
mutedChannels:
((json['muted_channels'] as List?)
?.map((e) => e.toString())
.toSet()) ??
{},
channelNotificationModes: parseChannelNotificationModes(json),
mapShowDiscoveryContacts:
json['map_show_discovery_contacts'] as bool? ?? true,
evictDiscoveredContactsEnabled:
@@ -554,7 +588,7 @@ class AppSettings {
Map<String, String>? batteryChemistryByDeviceId,
Map<String, String>? batteryChemistryByRepeaterId,
UnitSystem? unitSystem,
Set<String>? mutedChannels,
Map<String, ChannelNotificationMode>? channelNotificationModes,
bool? mapShowDiscoveryContacts,
bool? evictDiscoveredContactsEnabled,
String? tcpServerAddress,
@@ -639,7 +673,8 @@ class AppSettings {
batteryChemistryByRepeaterId:
batteryChemistryByRepeaterId ?? this.batteryChemistryByRepeaterId,
unitSystem: unitSystem ?? this.unitSystem,
mutedChannels: mutedChannels ?? this.mutedChannels,
channelNotificationModes:
channelNotificationModes ?? this.channelNotificationModes,
mapShowDiscoveryContacts:
mapShowDiscoveryContacts ?? this.mapShowDiscoveryContacts,
evictDiscoveredContactsEnabled:
+32 -18
View File
@@ -1,13 +1,17 @@
import '../services/app_settings_service.dart';
import 'dart:convert';
import '../services/app_settings_service.dart'
show AppSettingsService, ChannelNotificationMode;
import '../services/storage_service.dart';
import '../services/timeout_prediction_service.dart';
import '../storage/legacy_key_migration.dart';
import '../storage/prefs_manager.dart';
import 'review_radio.dart';
/// Muted channel names as they were when review mode started. Persisted so an
/// interrupted session (crash, app killed) is still undone on the next launch.
const _savedMutedChannelsKey = 'review_mode_saved_muted_channels';
/// Channel notification modes (JSON map of channel name to mode name) as they
/// were when review mode started. Persisted so an interrupted session (crash,
/// app killed) is still undone on the next launch.
const _savedChannelModesKey = 'review_mode_saved_channel_modes';
/// Prefix for snapshots of app-wide repeater keys (saved passwords, clock sync
/// toggles) taken when review mode starts. An empty snapshot means the key did
@@ -31,10 +35,11 @@ Future<void> clearReviewModeData() async {
/// Starts a review session from a clean slate.
///
/// The simulated radio's scope never adopts legacy unscoped keys, so real
/// radio data cannot be pulled into it. Channel mutes are app-wide and keyed
/// by channel name (muting the simulated "Public" would mute the real one),
/// so the current mutes are saved for [endReviewModeSession] to put back, as
/// are the app-wide repeater keys. Delivery timing is not recorded meanwhile.
/// radio data cannot be pulled into it. Channel notification modes are
/// app-wide and keyed by channel name (muting the simulated "Public" would
/// mute the real one), so the current modes are saved for
/// [endReviewModeSession] to put back, as are the app-wide repeater keys.
/// Delivery timing is not recorded meanwhile.
Future<void> beginReviewModeSession(AppSettingsService? settings) async {
scopesWithoutLegacyMigration.add(ReviewRadio.storagePrefix);
TimeoutPredictionService.recordingSuspended = true;
@@ -47,16 +52,16 @@ Future<void> beginReviewModeSession(AppSettingsService? settings) async {
await prefs.setString(savedKey, prefs.getString(key) ?? '');
}
// An earlier interrupted session's record holds the real pre-review state.
if (settings != null && !prefs.containsKey(_savedMutedChannelsKey)) {
await prefs.setStringList(
_savedMutedChannelsKey,
settings.settings.mutedChannels.toList(),
if (settings != null && !prefs.containsKey(_savedChannelModesKey)) {
final modes = settings.settings.channelNotificationModes.map(
(channel, mode) => MapEntry(channel, mode.name),
);
await prefs.setString(_savedChannelModesKey, jsonEncode(modes));
}
}
/// Deletes the review session's data and restores the channel mutes and
/// repeater keys saved by [beginReviewModeSession]. Also called at startup to finish a session that
/// Deletes the review session's data and restores the channel notification
/// modes and repeater keys saved by [beginReviewModeSession]. Also called at startup to finish a session that
/// was interrupted; it does nothing when no session was left behind.
Future<void> endReviewModeSession(AppSettingsService? settings) async {
TimeoutPredictionService.recordingSuspended = false;
@@ -73,10 +78,19 @@ Future<void> endReviewModeSession(AppSettingsService? settings) async {
}
await prefs.remove(savedKey);
}
final savedMutes = prefs.getStringList(_savedMutedChannelsKey);
if (savedMutes == null || settings == null) return;
final savedModes = prefs.getString(_savedChannelModesKey);
if (savedModes == null || settings == null) return;
final restored = <String, ChannelNotificationMode>{};
final decoded = jsonDecode(savedModes);
if (decoded is Map) {
final byName = ChannelNotificationMode.values.asNameMap();
for (final entry in decoded.entries) {
final mode = byName[entry.value];
if (mode != null) restored[entry.key.toString()] = mode;
}
}
await settings.updateSettings(
settings.settings.copyWith(mutedChannels: savedMutes.toSet()),
settings.settings.copyWith(channelNotificationModes: restored),
);
await prefs.remove(_savedMutedChannelsKey);
await prefs.remove(_savedChannelModesKey);
}
+17 -12
View File
@@ -27,7 +27,8 @@ import '../l10n/l10n.dart';
import '../models/channel.dart';
import '../models/channel_message.dart';
import '../models/image_codec_support.dart' show aeicRatePointForUi;
import '../services/app_settings_service.dart';
import '../services/app_settings_service.dart'
show AppSettingsService, ChannelNotificationMode;
import '../services/chat_text_scale_service.dart';
import '../services/image_chunk_transport.dart';
import '../services/image_codec_service.dart';
@@ -37,6 +38,7 @@ import '../utils/image_save.dart';
import '../utils/lora_airtime.dart';
import '../widgets/marker_label_dialog.dart';
import '../widgets/received_image_message.dart';
import '../widgets/channel_notification_mode_sheet.dart';
import '../widgets/chat_day_separator.dart';
import '../widgets/empty_state.dart';
@@ -404,19 +406,22 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
Consumer<AppSettingsService>(
builder: (context, settings, _) {
final muteKey = widget.channel.muteKey;
final muted = settings.isChannelMuted(muteKey);
final notificationMode = settings.getChannelNotificationMode(
muteKey,
);
return IconButton(
tooltip: muted
? context.l10n.channels_unmuteChannel
: context.l10n.channels_muteChannel,
icon: Icon(
muted
? Icons.notifications_off_outlined
: Icons.notifications_outlined,
tooltip: context.l10n.channels_notificationModeTooltip(
channelNotificationModeLabel(context, notificationMode),
),
onPressed: () => muted
? settings.unmuteChannel(muteKey)
: settings.muteChannel(muteKey),
icon: Icon(
notificationMode == ChannelNotificationMode.muted
? Icons.notifications_off
: notificationMode == ChannelNotificationMode.mentionsOnly
? Icons.notification_important
: Icons.notifications,
),
onPressed: () =>
showChannelNotificationModeSheet(context, muteKey),
);
},
),
+18 -22
View File
@@ -10,7 +10,8 @@ import 'package:uuid/uuid.dart';
import '../connector/meshcore_connector.dart';
import '../l10n/l10n.dart';
import '../services/app_settings_service.dart';
import '../services/app_settings_service.dart'
show AppSettingsService, ChannelNotificationMode;
import '../services/ui_view_state_service.dart';
import '../models/channel.dart';
import '../models/community.dart';
@@ -19,6 +20,7 @@ import '../theme/mesh_theme.dart';
import '../utils/dialog_utils.dart';
import '../utils/disconnect_navigation_mixin.dart';
import '../utils/route_transitions.dart';
import '../widgets/channel_notification_mode_sheet.dart';
import '../widgets/list_filter_widget.dart';
import '../widgets/empty_state.dart';
import '../widgets/mesh_ui.dart';
@@ -372,9 +374,9 @@ class _ChannelsScreenState extends State<ChannelsScreen>
int listIndex = 0,
}) {
final unreadCount = connector.getUnreadCountForChannel(channel);
final isMuted = context.watch<AppSettingsService>().isChannelMuted(
channel.muteKey,
);
final notificationMode = context
.watch<AppSettingsService>()
.getChannelNotificationMode(channel.muteKey);
final scheme = Theme.of(context).colorScheme;
// Determine icon and colors based on channel type
@@ -580,9 +582,9 @@ class _ChannelsScreenState extends State<ChannelsScreen>
Row(
mainAxisSize: MainAxisSize.min,
children: [
if (isMuted) ...[
if (notificationMode != ChannelNotificationMode.all) ...[
Icon(
Icons.notifications_off,
channelNotificationModeIcon(notificationMode),
size: 18,
color: scheme.onSurfaceVariant,
),
@@ -625,8 +627,6 @@ class _ChannelsScreenState extends State<ChannelsScreen>
Channel channel,
) {
final parentContext = context;
final settingsService = context.read<AppSettingsService>();
final isMuted = settingsService.isChannelMuted(channel.muteKey);
showMeshSheet(
parentContext,
@@ -645,23 +645,19 @@ class _ChannelsScreenState extends State<ChannelsScreen>
}
},
),
// Notification mode selection
ListTile(
leading: Icon(
isMuted
? Icons.notifications_outlined
: Icons.notifications_off_outlined,
),
title: Text(
isMuted
? sheetContext.l10n.channels_unmuteChannel
: sheetContext.l10n.channels_muteChannel,
),
leading: const Icon(Icons.notifications_outlined),
title: Text(sheetContext.l10n.channels_notificationSettings),
trailing: const Icon(Icons.chevron_right),
onTap: () async {
Navigator.pop(sheetContext);
if (isMuted) {
await settingsService.unmuteChannel(channel.muteKey);
} else {
await settingsService.muteChannel(channel.muteKey);
await Future.delayed(const Duration(milliseconds: 100));
if (parentContext.mounted) {
showChannelNotificationModeSheet(
parentContext,
channel.muteKey,
);
}
},
),
+2 -9
View File
@@ -25,9 +25,6 @@ import '../widgets/sync_progress_overlay.dart';
import 'region_management_screen.dart';
import '../utils/share_origin.dart';
/// Companion firmware version that added CMD_SET_PATH_HASH_MODE (v1.14.0).
const int _minFirmwareVerCodeForPathHashMode = 10;
class SettingsScreen extends StatefulWidget {
const SettingsScreen({super.key});
@@ -566,14 +563,10 @@ class _SettingsScreenState extends State<SettingsScreen> {
title: l10n.repeater_pathHashMode,
subtitle: !connected
? offline
: (connector.firmwareVerCode ?? 0) <
_minFirmwareVerCodeForPathHashMode
: !connector.supportsPathHashMode
? l10n.settings_requiresFirmware('v1.14')
: _pathHashModeSubtitle(context, connector.pathHashByteWidth),
onTap:
connector.isConnected &&
(connector.firmwareVerCode ?? 0) >=
_minFirmwareVerCodeForPathHashMode
onTap: connector.isConnected && connector.supportsPathHashMode
? () => _editPathHashMode(context, connector)
: null,
),
+18 -11
View File
@@ -3,6 +3,8 @@ import 'package:flutter/foundation.dart';
import '../models/app_settings.dart';
import '../models/image_codec_support.dart';
import '../models/translation_support.dart';
export '../models/app_settings.dart' show ChannelNotificationMode;
import '../storage/prefs_manager.dart';
import '../utils/app_logger.dart';
import '../helpers/cyr2lat.dart';
@@ -286,19 +288,24 @@ class AppSettingsService extends ChangeNotifier {
await updateSettings(_settings.copyWith(unitSystem: value));
}
bool isChannelMuted(String channelName) {
return _settings.mutedChannels.contains(channelName);
ChannelNotificationMode getChannelNotificationMode(String channelName) {
return _settings.channelNotificationModes[channelName] ??
ChannelNotificationMode.all;
}
Future<void> muteChannel(String channelName) async {
final updated = Set<String>.from(_settings.mutedChannels)..add(channelName);
await updateSettings(_settings.copyWith(mutedChannels: updated));
}
Future<void> unmuteChannel(String channelName) async {
final updated = Set<String>.from(_settings.mutedChannels)
..remove(channelName);
await updateSettings(_settings.copyWith(mutedChannels: updated));
Future<void> setChannelNotificationMode(
String channelName,
ChannelNotificationMode mode,
) async {
final updated = Map<String, ChannelNotificationMode>.from(
_settings.channelNotificationModes,
);
if (mode == ChannelNotificationMode.all) {
updated.remove(channelName);
} else {
updated[channelName] = mode;
}
await updateSettings(_settings.copyWith(channelNotificationModes: updated));
}
Future<void> setTcpServerAddress(String value) async {
+68
View File
@@ -612,6 +612,54 @@ class NotificationService {
}
}
/// Posts a low-battery alert for the connected device.
///
/// Uses a per-device, per-threshold notification id so each alert level
/// updates its own notification instead of stacking, and alerts for
/// different radios don't overwrite each other. Bypasses the rate-limit
/// queue, which only handles message and advert notifications.
Future<void> showLowBatteryNotification({
required String deviceKey,
required String deviceName,
required int batteryPercent,
required int threshold,
}) async {
if (!await _ensureCanNotify()) return;
const androidDetails = AndroidNotificationDetails(
'low_battery',
'Low Battery',
channelDescription: 'Low battery alerts for the connected device',
importance: Importance.high,
priority: Priority.high,
icon: '@mipmap/ic_launcher',
);
const darwinDetails = DarwinNotificationDetails(
presentAlert: true,
presentBadge: false,
presentSound: true,
);
const notificationDetails = NotificationDetails(
android: androidDetails,
iOS: darwinDetails,
macOS: darwinDetails,
);
try {
await _notifications.show(
id: _lowBatteryNotificationId(deviceKey, threshold),
title: _l10n.notification_lowBatteryTitle,
body: _l10n.notification_lowBatteryBody(deviceName, batteryPercent),
notificationDetails: notificationDetails,
payload: 'low_battery',
);
} catch (e) {
debugPrint('Failed to show low battery notification: $e');
}
}
/// Returns a privacy-safe identifier for debug logging.
/// - advert: shows device name (body contains contactName)
/// - message: shows "from: sender" (avoids logging message content)
@@ -668,6 +716,26 @@ class NotificationService {
await _updateBadge(totalUnreadCount);
}
static int _lowBatteryNotificationId(String deviceKey, int threshold) =>
'low_battery:$deviceKey:$threshold'.hashCode;
/// Cancel a device's low-battery notifications for the given thresholds.
Future<void> clearLowBatteryNotifications(
String deviceKey,
Iterable<int> thresholds,
) async {
if (!await _ensureInitialized()) return;
for (final threshold in thresholds) {
try {
await _notifications.cancel(
id: _lowBatteryNotificationId(deviceKey, threshold),
);
} catch (e) {
debugPrint('Failed to clear low battery notification: $e');
}
}
}
/// Cancel advert notifications for the given contact public key hexes.
Future<void> clearAdvertNotifications(List<String> contactIds) async {
if (!await _ensureInitialized()) return;
@@ -0,0 +1,65 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../l10n/l10n.dart';
import '../services/app_settings_service.dart'
show AppSettingsService, ChannelNotificationMode;
import 'mesh_ui.dart';
/// Localized label for a channel notification [mode].
String channelNotificationModeLabel(
BuildContext context,
ChannelNotificationMode mode,
) => switch (mode) {
ChannelNotificationMode.all => context.l10n.channels_notifyAll,
ChannelNotificationMode.mentionsOnly =>
context.l10n.channels_notifyMentionsOnly,
ChannelNotificationMode.muted => context.l10n.channels_notifyNone,
};
/// Icon for a channel notification [mode].
IconData channelNotificationModeIcon(ChannelNotificationMode mode) =>
switch (mode) {
ChannelNotificationMode.all => Icons.notifications,
ChannelNotificationMode.mentionsOnly => Icons.notification_important,
ChannelNotificationMode.muted => Icons.notifications_off,
};
/// Shows the per-channel notification mode picker (all / mentions only /
/// muted) for the channel identified by [muteKey].
void showChannelNotificationModeSheet(BuildContext context, String muteKey) {
final settingsService = context.read<AppSettingsService>();
final currentMode = settingsService.getChannelNotificationMode(muteKey);
showMeshSheet(
context,
builder: (sheetContext) {
final scheme = Theme.of(sheetContext).colorScheme;
return SafeArea(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
for (final mode in ChannelNotificationMode.values)
ListTile(
leading: Icon(
channelNotificationModeIcon(mode),
color: mode == currentMode
? scheme.primary
: scheme.onSurfaceVariant,
),
title: Text(channelNotificationModeLabel(sheetContext, mode)),
trailing: mode == currentMode ? const Icon(Icons.check) : null,
onTap: () async {
Navigator.pop(sheetContext);
await settingsService.setChannelNotificationMode(
muteKey,
mode,
);
},
),
],
),
);
},
);
}
+79 -5
View File
@@ -30,9 +30,9 @@ bool _isAllowedRepeatFreqKHz(MeshCoreConnector connector, int freqKHz) {
/// Lowest TX power companion firmware accepts (CMD_SET_RADIO_TX_POWER).
const int _minTxPowerDbm = -9;
/// Radio parameter editor (preset, frequency, bandwidth, SF, CR, TX power and
/// off-grid client repeat). Stays open when the radio rejects or fails to
/// apply the settings so the user's edits are not lost.
/// Radio parameter editor (preset, frequency, bandwidth, SF, CR, TX power,
/// path-hash size and off-grid client repeat). Stays open when the radio
/// rejects or fails to apply the settings so the user's edits are not lost.
class RadioSettingsDialog extends StatefulWidget {
final MeshCoreConnector connector;
@@ -49,11 +49,14 @@ class _RadioSettingsDialogState extends State<RadioSettingsDialog> {
LoRaCodingRate _codingRate = LoRaCodingRate.cr4_5;
final _txPowerController = TextEditingController(text: '20');
bool _clientRepeat = false;
int _pathHashByteWidth = 1;
int? _selectedPresetIndex;
_RadioSettingsSnapshot? _lastNonRepeatSnapshot;
String? _frequencyError;
String? _txPowerError;
bool get _supportsPathHashMode => widget.connector.supportsPathHashMode;
AppDebugLogService get _appLog =>
Provider.of<AppDebugLogService>(context, listen: false);
@@ -106,6 +109,7 @@ class _RadioSettingsDialogState extends State<RadioSettingsDialog> {
_txPowerController.text = widget.connector.currentTxPower.toString();
}
_pathHashByteWidth = widget.connector.pathHashByteWidth;
_clientRepeat = widget.connector.clientRepeat ?? false;
_selectedPresetIndex = _findMatchingPresetIndex();
if (_clientRepeat) {
@@ -439,11 +443,34 @@ class _RadioSettingsDialogState extends State<RadioSettingsDialog> {
return;
}
await widget.connector.sendFrame(buildSetRadioTxPowerFrame(txPower));
// setPathHashMode updates the local width optimistically; the refreshed
// DEVICE_INFO below overwrites it with what the radio actually stored.
final requestedPathHashWidth =
_supportsPathHashMode &&
_pathHashByteWidth != widget.connector.pathHashByteWidth
? _pathHashByteWidth
: null;
if (requestedPathHashWidth != null) {
await widget.connector.setPathHashMode(requestedPathHashWidth - 1);
}
final selfInfo = widget.connector.receivedFrames
.firstWhere((f) => f.isNotEmpty && f[0] == respCodeSelfInfo)
.timeout(const Duration(seconds: 5));
final deviceInfo = requestedPathHashWidth == null
? null
: widget.connector.receivedFrames
.firstWhere((f) => f.isNotEmpty && f[0] == respCodeDeviceInfo)
.timeout(const Duration(seconds: 5));
await widget.connector.refreshDeviceInfo();
final applied = await selfInfo.then(
// Without a refreshed DEVICE_INFO the path hash change is unconfirmed
// (this also covers setPathHashMode skipping a disconnected radio).
final pathHashApplied =
deviceInfo == null ||
await deviceInfo.then(
(_) => widget.connector.pathHashByteWidth == requestedPathHashWidth,
onError: (_) => false,
);
final radioApplied = await selfInfo.then(
(_) => _deviceMatches(
freqHz: freqHz,
bwHz: bwHz,
@@ -454,7 +481,7 @@ class _RadioSettingsDialogState extends State<RadioSettingsDialog> {
),
onError: (_) => true,
);
if (!applied) {
if (!radioApplied) {
_logRadioSettingsState('Radio did not apply requested settings');
if (!mounted) return;
showDismissibleSnackBar(
@@ -463,6 +490,17 @@ class _RadioSettingsDialogState extends State<RadioSettingsDialog> {
);
return;
}
if (!pathHashApplied) {
// Radio params and TX power were already applied; only the path
// hash size is outstanding, so say that rather than a generic error.
_logRadioSettingsState('Radio did not apply requested path hash size');
if (!mounted) return;
showDismissibleSnackBar(
context,
content: Text(l10n.settings_pathHashModeNotApplied),
);
return;
}
final rememberedSnapshot = _clientRepeat
? _lastNonRepeatSnapshot
: _currentSnapshot();
@@ -539,6 +577,7 @@ class _RadioSettingsDialogState extends State<RadioSettingsDialog> {
'sf=${_spreadingFactor.label} '
'cr=${_codingRate.label} '
'tx=${_txPowerController.text}dBm '
'pathHash=${_pathHashByteWidth}B '
'repeat=$_clientRepeat '
'preset=${_presetLabel(_selectedPresetIndex)} '
'lastNonRepeat=${_formatSnapshot(_lastNonRepeatSnapshot)}',
@@ -673,6 +712,41 @@ class _RadioSettingsDialogState extends State<RadioSettingsDialog> {
},
),
const SizedBox(height: 16),
if (_supportsPathHashMode) ...[
// Values are path hash modes (0-2, byte width - 1), matching
// the selectors in settings_screen and repeater_settings_screen.
DropdownButtonFormField<int>(
initialValue: (_pathHashByteWidth - 1).clamp(0, 2).toInt(),
decoration: InputDecoration(
labelText: l10n.repeater_pathHashMode,
helperText: l10n.settings_pathHashModeHelper,
helperMaxLines: 5,
border: const OutlineInputBorder(),
),
items: [
DropdownMenuItem(
value: 0,
child: Text(l10n.repeater_pathHashModeOption0),
),
DropdownMenuItem(
value: 1,
child: Text(l10n.repeater_pathHashModeOption1),
),
DropdownMenuItem(
value: 2,
child: Text(l10n.repeater_pathHashModeOption2),
),
],
onChanged: (value) {
if (value == null) return;
setState(() => _pathHashByteWidth = value + 1);
_logRadioSettingsState(
'Manual settings edit: path hash size',
);
},
),
const SizedBox(height: 16),
],
TextField(
controller: _txPowerController,
onChanged: (_) => _handleManualSettingsChanged('tx power'),
@@ -0,0 +1,33 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:meshcore_open/connector/meshcore_connector.dart';
void main() {
bool mentions(String text, String? name) =>
MeshCoreConnector.textMentionsName(text, name);
test('matches bracketed and plain mentions case-insensitively', () {
expect(mentions('@[Bob] hello', 'Bob'), isTrue);
expect(mentions('hey @[bob]', 'Bob'), isTrue);
expect(mentions('hey @bob, look', 'Bob'), isTrue);
expect(mentions('@BOB', 'Bob'), isTrue);
expect(mentions('ping @Иван!', 'иван'), isTrue);
});
test('requires a word boundary for plain mentions', () {
expect(mentions('hey @bobby', 'Bob'), isFalse);
expect(mentions('mail x@bob.com', 'Bob'), isFalse);
expect(mentions('hey bob', 'Bob'), isFalse);
});
test('names with spaces or regex characters must match in full', () {
expect(mentions('hi @Bob Smith', 'Bob Smith'), isTrue);
expect(mentions('hi @Bob', 'Bob Smith'), isFalse);
expect(mentions('@[Node (1)] ok', 'Node (1)'), isTrue);
expect(mentions('@[Node 1] ok', 'Node (1)'), isFalse);
});
test('no self name never matches', () {
expect(mentions('@[Bob] hi', null), isFalse);
expect(mentions('@ hi', ''), isFalse);
});
}
@@ -0,0 +1,37 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:meshcore_open/models/app_settings.dart';
void main() {
test('channel notification modes round-trip by name', () {
final settings = AppSettings(
channelNotificationModes: {
'a': ChannelNotificationMode.mentionsOnly,
'b': ChannelNotificationMode.muted,
},
);
final json = settings.toJson();
expect(json['channel_notification_modes'], {
'a': 'mentionsOnly',
'b': 'muted',
});
expect(json['muted_channels'], ['b']);
expect(
AppSettings.fromJson(json).channelNotificationModes,
settings.channelNotificationModes,
);
});
test('invalid channel notification mode entries are skipped', () {
final settings = AppSettings.fromJson({
'channel_notification_modes': {
'ok': 'muted',
'unknown': 'loud',
'int': 2,
'null': null,
},
});
expect(settings.channelNotificationModes, {
'ok': ChannelNotificationMode.muted,
});
});
}
@@ -24,7 +24,10 @@ void main() {
test('channel mutes made in review mode are undone on exit', () async {
final settings = AppSettingsService();
await settings.loadSettings();
await settings.muteChannel('Hiking Group');
await settings.setChannelNotificationMode(
'Hiking Group',
ChannelNotificationMode.muted,
);
final connector = MeshCoreConnector();
addTearDown(connector.dispose);
final retryService = MessageRetryService();
@@ -39,23 +42,41 @@ void main() {
await connector.connectReview();
// Mutes are keyed by channel name, so these would leak into real radios.
await settings.muteChannel('Public');
await settings.unmuteChannel('Hiking Group');
await settings.setChannelNotificationMode(
'Public',
ChannelNotificationMode.muted,
);
await settings.setChannelNotificationMode(
'Hiking Group',
ChannelNotificationMode.all,
);
// Other app preferences are the user's to change, even while reviewing.
await PrefsManager.instance.setString('unrelated_key', 'changed');
await connector.disconnect(manual: true);
expect(settings.isChannelMuted('Public'), isFalse);
expect(settings.isChannelMuted('Hiking Group'), isTrue);
expect(
settings.getChannelNotificationMode('Public'),
ChannelNotificationMode.all,
);
expect(
settings.getChannelNotificationMode('Hiking Group'),
ChannelNotificationMode.muted,
);
expect(PrefsManager.instance.getString('unrelated_key'), 'changed');
// A fresh launch has nothing left to undo.
final relaunched = AppSettingsService();
await relaunched.loadSettings();
await endReviewModeSession(relaunched);
expect(relaunched.isChannelMuted('Public'), isFalse);
expect(relaunched.isChannelMuted('Hiking Group'), isTrue);
expect(
relaunched.getChannelNotificationMode('Public'),
ChannelNotificationMode.all,
);
expect(
relaunched.getChannelNotificationMode('Hiking Group'),
ChannelNotificationMode.muted,
);
});
test(
@@ -63,11 +84,20 @@ void main() {
() async {
final settings = AppSettingsService();
await settings.loadSettings();
await settings.muteChannel('Hiking Group');
await settings.setChannelNotificationMode(
'Hiking Group',
ChannelNotificationMode.muted,
);
await beginReviewModeSession(settings);
await settings.muteChannel('Public');
await settings.unmuteChannel('Hiking Group');
await settings.setChannelNotificationMode(
'Public',
ChannelNotificationMode.muted,
);
await settings.setChannelNotificationMode(
'Hiking Group',
ChannelNotificationMode.all,
);
await PrefsManager.instance.setString(
'contacts${ReviewRadio.storagePrefix}',
'[]',
@@ -76,11 +106,20 @@ void main() {
final relaunched = AppSettingsService();
await relaunched.loadSettings();
expect(relaunched.isChannelMuted('Public'), isTrue);
expect(
relaunched.getChannelNotificationMode('Public'),
ChannelNotificationMode.muted,
);
await endReviewModeSession(relaunched);
expect(relaunched.isChannelMuted('Public'), isFalse);
expect(relaunched.isChannelMuted('Hiking Group'), isTrue);
expect(
relaunched.getChannelNotificationMode('Public'),
ChannelNotificationMode.all,
);
expect(
relaunched.getChannelNotificationMode('Hiking Group'),
ChannelNotificationMode.muted,
);
expect(
PrefsManager.instance.getKeys().where(
(k) => k.contains(ReviewRadio.storagePrefix),
@@ -90,6 +129,61 @@ void main() {
},
);
test('every channel notification mode is restored on exit', () async {
final settings = AppSettingsService();
await settings.loadSettings();
await settings.setChannelNotificationMode(
'Hiking Group',
ChannelNotificationMode.mentionsOnly,
);
await settings.setChannelNotificationMode(
'Noisy',
ChannelNotificationMode.muted,
);
await beginReviewModeSession(settings);
await settings.setChannelNotificationMode(
'Hiking Group',
ChannelNotificationMode.all,
);
await settings.setChannelNotificationMode(
'Noisy',
ChannelNotificationMode.mentionsOnly,
);
await settings.setChannelNotificationMode(
'Public',
ChannelNotificationMode.mentionsOnly,
);
await endReviewModeSession(settings);
expect(
settings.getChannelNotificationMode('Hiking Group'),
ChannelNotificationMode.mentionsOnly,
);
expect(
settings.getChannelNotificationMode('Noisy'),
ChannelNotificationMode.muted,
);
expect(
settings.getChannelNotificationMode('Public'),
ChannelNotificationMode.all,
);
});
test('setting a channel back to all drops its stored mode', () async {
final settings = AppSettingsService();
await settings.loadSettings();
await settings.setChannelNotificationMode(
'Public',
ChannelNotificationMode.muted,
);
await settings.setChannelNotificationMode(
'Public',
ChannelNotificationMode.all,
);
expect(settings.settings.channelNotificationModes, isEmpty);
});
test('the review scope never adopts legacy unscoped data', () async {
await PrefsManager.instance.setString('contacts', '[]');
await beginReviewModeSession(null);
+68
View File
@@ -1,13 +1,17 @@
{
"bg": [
"settings_pathHashModeNotApplied",
"contacts_removeAutoAddNote",
"contacts_removeFailed",
"channels_notificationModeTooltip",
"map_pathTraceAddMoreHint",
"map_pathTraceModeRoundTrip",
"map_pathTraceModeRoundTripHint",
"map_pathTraceModeAsEntered",
"map_pathTraceModeAsEnteredHint",
"map_pathTraceViewLast",
"notification_lowBatteryTitle",
"notification_lowBatteryBody",
"notification_sharedLocation",
"notification_sharedLocationNamed",
"notification_reacted",
@@ -22,14 +26,18 @@
],
"de": [
"settings_pathHashModeNotApplied",
"contacts_removeAutoAddNote",
"contacts_removeFailed",
"channels_notificationModeTooltip",
"map_pathTraceAddMoreHint",
"map_pathTraceModeRoundTrip",
"map_pathTraceModeRoundTripHint",
"map_pathTraceModeAsEntered",
"map_pathTraceModeAsEnteredHint",
"map_pathTraceViewLast",
"notification_lowBatteryTitle",
"notification_lowBatteryBody",
"notification_sharedLocation",
"notification_sharedLocationNamed",
"notification_reacted",
@@ -44,14 +52,18 @@
],
"es": [
"settings_pathHashModeNotApplied",
"contacts_removeAutoAddNote",
"contacts_removeFailed",
"channels_notificationModeTooltip",
"map_pathTraceAddMoreHint",
"map_pathTraceModeRoundTrip",
"map_pathTraceModeRoundTripHint",
"map_pathTraceModeAsEntered",
"map_pathTraceModeAsEnteredHint",
"map_pathTraceViewLast",
"notification_lowBatteryTitle",
"notification_lowBatteryBody",
"notification_sharedLocation",
"notification_sharedLocationNamed",
"notification_reacted",
@@ -66,14 +78,18 @@
],
"fr": [
"settings_pathHashModeNotApplied",
"contacts_removeAutoAddNote",
"contacts_removeFailed",
"channels_notificationModeTooltip",
"map_pathTraceAddMoreHint",
"map_pathTraceModeRoundTrip",
"map_pathTraceModeRoundTripHint",
"map_pathTraceModeAsEntered",
"map_pathTraceModeAsEnteredHint",
"map_pathTraceViewLast",
"notification_lowBatteryTitle",
"notification_lowBatteryBody",
"notification_sharedLocation",
"notification_sharedLocationNamed",
"notification_reacted",
@@ -88,14 +104,18 @@
],
"hu": [
"settings_pathHashModeNotApplied",
"contacts_removeAutoAddNote",
"contacts_removeFailed",
"channels_notificationModeTooltip",
"map_pathTraceAddMoreHint",
"map_pathTraceModeRoundTrip",
"map_pathTraceModeRoundTripHint",
"map_pathTraceModeAsEntered",
"map_pathTraceModeAsEnteredHint",
"map_pathTraceViewLast",
"notification_lowBatteryTitle",
"notification_lowBatteryBody",
"notification_sharedLocation",
"notification_sharedLocationNamed",
"notification_reacted",
@@ -110,14 +130,18 @@
],
"it": [
"settings_pathHashModeNotApplied",
"contacts_removeAutoAddNote",
"contacts_removeFailed",
"channels_notificationModeTooltip",
"map_pathTraceAddMoreHint",
"map_pathTraceModeRoundTrip",
"map_pathTraceModeRoundTripHint",
"map_pathTraceModeAsEntered",
"map_pathTraceModeAsEnteredHint",
"map_pathTraceViewLast",
"notification_lowBatteryTitle",
"notification_lowBatteryBody",
"notification_sharedLocation",
"notification_sharedLocationNamed",
"notification_reacted",
@@ -132,14 +156,18 @@
],
"ja": [
"settings_pathHashModeNotApplied",
"contacts_removeAutoAddNote",
"contacts_removeFailed",
"channels_notificationModeTooltip",
"map_pathTraceAddMoreHint",
"map_pathTraceModeRoundTrip",
"map_pathTraceModeRoundTripHint",
"map_pathTraceModeAsEntered",
"map_pathTraceModeAsEnteredHint",
"map_pathTraceViewLast",
"notification_lowBatteryTitle",
"notification_lowBatteryBody",
"notification_sharedLocation",
"notification_sharedLocationNamed",
"notification_reacted",
@@ -154,14 +182,18 @@
],
"ko": [
"settings_pathHashModeNotApplied",
"contacts_removeAutoAddNote",
"contacts_removeFailed",
"channels_notificationModeTooltip",
"map_pathTraceAddMoreHint",
"map_pathTraceModeRoundTrip",
"map_pathTraceModeRoundTripHint",
"map_pathTraceModeAsEntered",
"map_pathTraceModeAsEnteredHint",
"map_pathTraceViewLast",
"notification_lowBatteryTitle",
"notification_lowBatteryBody",
"notification_sharedLocation",
"notification_sharedLocationNamed",
"notification_reacted",
@@ -176,14 +208,18 @@
],
"nl": [
"settings_pathHashModeNotApplied",
"contacts_removeAutoAddNote",
"contacts_removeFailed",
"channels_notificationModeTooltip",
"map_pathTraceAddMoreHint",
"map_pathTraceModeRoundTrip",
"map_pathTraceModeRoundTripHint",
"map_pathTraceModeAsEntered",
"map_pathTraceModeAsEnteredHint",
"map_pathTraceViewLast",
"notification_lowBatteryTitle",
"notification_lowBatteryBody",
"notification_sharedLocation",
"notification_sharedLocationNamed",
"notification_reacted",
@@ -198,14 +234,18 @@
],
"pl": [
"settings_pathHashModeNotApplied",
"contacts_removeAutoAddNote",
"contacts_removeFailed",
"channels_notificationModeTooltip",
"map_pathTraceAddMoreHint",
"map_pathTraceModeRoundTrip",
"map_pathTraceModeRoundTripHint",
"map_pathTraceModeAsEntered",
"map_pathTraceModeAsEnteredHint",
"map_pathTraceViewLast",
"notification_lowBatteryTitle",
"notification_lowBatteryBody",
"notification_sharedLocation",
"notification_sharedLocationNamed",
"notification_reacted",
@@ -220,14 +260,18 @@
],
"pt": [
"settings_pathHashModeNotApplied",
"contacts_removeAutoAddNote",
"contacts_removeFailed",
"channels_notificationModeTooltip",
"map_pathTraceAddMoreHint",
"map_pathTraceModeRoundTrip",
"map_pathTraceModeRoundTripHint",
"map_pathTraceModeAsEntered",
"map_pathTraceModeAsEnteredHint",
"map_pathTraceViewLast",
"notification_lowBatteryTitle",
"notification_lowBatteryBody",
"notification_sharedLocation",
"notification_sharedLocationNamed",
"notification_reacted",
@@ -242,14 +286,18 @@
],
"ru": [
"settings_pathHashModeNotApplied",
"contacts_removeAutoAddNote",
"contacts_removeFailed",
"channels_notificationModeTooltip",
"map_pathTraceAddMoreHint",
"map_pathTraceModeRoundTrip",
"map_pathTraceModeRoundTripHint",
"map_pathTraceModeAsEntered",
"map_pathTraceModeAsEnteredHint",
"map_pathTraceViewLast",
"notification_lowBatteryTitle",
"notification_lowBatteryBody",
"notification_sharedLocation",
"notification_sharedLocationNamed",
"notification_reacted",
@@ -264,14 +312,18 @@
],
"sk": [
"settings_pathHashModeNotApplied",
"contacts_removeAutoAddNote",
"contacts_removeFailed",
"channels_notificationModeTooltip",
"map_pathTraceAddMoreHint",
"map_pathTraceModeRoundTrip",
"map_pathTraceModeRoundTripHint",
"map_pathTraceModeAsEntered",
"map_pathTraceModeAsEnteredHint",
"map_pathTraceViewLast",
"notification_lowBatteryTitle",
"notification_lowBatteryBody",
"notification_sharedLocation",
"notification_sharedLocationNamed",
"notification_reacted",
@@ -286,14 +338,18 @@
],
"sl": [
"settings_pathHashModeNotApplied",
"contacts_removeAutoAddNote",
"contacts_removeFailed",
"channels_notificationModeTooltip",
"map_pathTraceAddMoreHint",
"map_pathTraceModeRoundTrip",
"map_pathTraceModeRoundTripHint",
"map_pathTraceModeAsEntered",
"map_pathTraceModeAsEnteredHint",
"map_pathTraceViewLast",
"notification_lowBatteryTitle",
"notification_lowBatteryBody",
"notification_sharedLocation",
"notification_sharedLocationNamed",
"notification_reacted",
@@ -308,14 +364,18 @@
],
"sv": [
"settings_pathHashModeNotApplied",
"contacts_removeAutoAddNote",
"contacts_removeFailed",
"channels_notificationModeTooltip",
"map_pathTraceAddMoreHint",
"map_pathTraceModeRoundTrip",
"map_pathTraceModeRoundTripHint",
"map_pathTraceModeAsEntered",
"map_pathTraceModeAsEnteredHint",
"map_pathTraceViewLast",
"notification_lowBatteryTitle",
"notification_lowBatteryBody",
"notification_sharedLocation",
"notification_sharedLocationNamed",
"notification_reacted",
@@ -330,14 +390,18 @@
],
"uk": [
"settings_pathHashModeNotApplied",
"contacts_removeAutoAddNote",
"contacts_removeFailed",
"channels_notificationModeTooltip",
"map_pathTraceAddMoreHint",
"map_pathTraceModeRoundTrip",
"map_pathTraceModeRoundTripHint",
"map_pathTraceModeAsEntered",
"map_pathTraceModeAsEnteredHint",
"map_pathTraceViewLast",
"notification_lowBatteryTitle",
"notification_lowBatteryBody",
"notification_sharedLocation",
"notification_sharedLocationNamed",
"notification_reacted",
@@ -352,14 +416,18 @@
],
"zh": [
"settings_pathHashModeNotApplied",
"contacts_removeAutoAddNote",
"contacts_removeFailed",
"channels_notificationModeTooltip",
"map_pathTraceAddMoreHint",
"map_pathTraceModeRoundTrip",
"map_pathTraceModeRoundTripHint",
"map_pathTraceModeAsEntered",
"map_pathTraceModeAsEnteredHint",
"map_pathTraceViewLast",
"notification_lowBatteryTitle",
"notification_lowBatteryBody",
"notification_sharedLocation",
"notification_sharedLocationNamed",
"notification_reacted",