Fix review findings in channel notification modes
- Detect mentions on the original text, as @[name] or a whole-word @name - Save and restore the full mode map in review mode - Open the mode picker from the chat bell and show the mode in its tooltip - Share one mode picker sheet; fix the stale sheet context - Persist modes by name and skip unknown entries - Keep writing muted_channels so older builds keep the user's mutes - Remove the muteChannel/unmuteChannel/isChannelMuted shims - Update notifications docs to match the behaviour
This commit is contained in:
1 parent
705bff2f15
commit
f667320608
32 files changed
+502
-196
No files matched your search
@@ -198,12 +198,6 @@ class AppSettings {
|
||||
return profile.charMap;
|
||||
}
|
||||
|
||||
// Backward compatibility: returns true if channel is muted (mode == muted)
|
||||
bool isChannelMuted(String channelName) {
|
||||
return channelNotificationModes[channelName] ==
|
||||
ChannelNotificationMode.muted;
|
||||
}
|
||||
|
||||
AppSettings({
|
||||
this.clearPathOnMaxRetry = false,
|
||||
this.mapShowRepeaters = true,
|
||||
@@ -330,8 +324,13 @@ class AppSettings {
|
||||
'battery_chemistry_by_device_id': batteryChemistryByDeviceId,
|
||||
'battery_chemistry_by_repeater_id': batteryChemistryByRepeaterId,
|
||||
'unit_system': unitSystem.value,
|
||||
// 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.index),
|
||||
(key, value) => MapEntry(key, value.name),
|
||||
),
|
||||
'map_show_discovery_contacts': mapShowDiscoveryContacts,
|
||||
'evict_discovered_contacts_enabled': evictDiscoveredContactsEnabled,
|
||||
@@ -392,13 +391,10 @@ class AppSettings {
|
||||
// Load new modes (overrides old muted channels if present)
|
||||
if (newModes != null) {
|
||||
for (final entry in newModes.entries) {
|
||||
final channelName = entry.key;
|
||||
final modeIndex = entry.value as int?;
|
||||
if (modeIndex != null &&
|
||||
modeIndex >= 0 &&
|
||||
modeIndex < ChannelNotificationMode.values.length) {
|
||||
result[channelName] = ChannelNotificationMode.values[modeIndex];
|
||||
}
|
||||
final value = entry.value;
|
||||
if (value is! String) continue;
|
||||
final mode = ChannelNotificationMode.values.asNameMap()[value];
|
||||
if (mode != null) result[entry.key.toString()] = mode;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user