diff --git a/lib/connector/meshcore_connector.dart b/lib/connector/meshcore_connector.dart index acce36d6..121f55e8 100644 --- a/lib/connector/meshcore_connector.dart +++ b/lib/connector/meshcore_connector.dart @@ -228,6 +228,10 @@ enum ChannelWrite { /// Not connected, or no reply before the timeout. The write may or may not /// have landed. noReply, + + /// An edit to a new key cleared the old channel, but the new one was not + /// confirmed, so the slot is now empty. (#1026) + clearedNotAdded, } /// Result of [MeshCoreConnector.exportPrivateKey]. [identity] is @@ -6784,6 +6788,19 @@ class MeshCoreConnector extends ChangeNotifier { } Future getChannels({int? maxChannels, bool force = false}) async { + // A sync started while a channel write waits for its reply would share the + // reply queue with it. Replies are matched by order, so the sync's + // empty-slot ERR could be taken as the write's answer. Deferred until the + // writes finish, then run once (#1026). The writers' own re-reads call + // [_syncChannels] directly. + if (_channelWritesInFlight > 0) { + _channelSyncDeferredByWrite = true; + return; + } + return _syncChannels(maxChannels: maxChannels, force: force); + } + + Future _syncChannels({int? maxChannels, bool force = false}) async { if (!isConnected) return; if (_isSyncingChannels) { debugPrint('[ChannelSync] Already syncing channels, ignoring request'); @@ -7138,6 +7155,7 @@ class MeshCoreConnector extends ChangeNotifier { Duration channelWriteReplyTimeout = const Duration(seconds: 5); int _channelWritesInFlight = 0; + bool _channelSyncDeferredByWrite = false; /// True while the channel list cannot be trusted to show which slots are /// free: a sync is re-reading it, or a write has not been answered yet. A @@ -7145,6 +7163,30 @@ class MeshCoreConnector extends ChangeNotifier { bool get isChannelTableBusy => _isSyncingChannels || _channelWritesInFlight > 0; + void _beginChannelWrite() => _channelWritesInFlight++; + + /// Ends one write; the last one to end runs any sync that [getChannels] + /// deferred while writes were waiting for their replies. + void _endChannelWrite() { + _channelWritesInFlight--; + if (_channelWritesInFlight == 0 && _channelSyncDeferredByWrite) { + _channelSyncDeferredByWrite = false; + unawaited(_syncChannels(force: true)); + } + } + + /// Runs several channel writes as one, so no sync or other add can start + /// between two of them. Each write inside passes `refresh: false`, and the + /// caller re-reads the list once afterwards. (#1026) + Future batchChannelWrites(Future Function() writes) async { + _beginChannelWrite(); + try { + return await writes(); + } finally { + _endChannelWrite(); + } + } + /// Writes the client's cached channel list back onto the radio (#1060). /// /// For a radio that lost channel storage (reflash, wipe) the client's cache @@ -7172,7 +7214,7 @@ class MeshCoreConnector extends ChangeNotifier { // Counted as a write in flight for its whole length, so an add made while // it runs is refused instead of choosing a slot this is about to fill // (#1021, #1026). - _channelWritesInFlight++; + _beginChannelWrite(); try { var sent = 0; for (final channel in toRestore) { @@ -7201,10 +7243,10 @@ class MeshCoreConnector extends ChangeNotifier { // the radio has not answered for yet and report 0 every time. The // authoritative feedback is the erased-slot banner, which is re-derived // on every sync and therefore stays up if some writes did not land. - await getChannels(force: true); + await _syncChannels(force: true); return sent; } finally { - _channelWritesInFlight--; + _endChannelWrite(); } } @@ -7237,6 +7279,10 @@ class MeshCoreConnector extends ChangeNotifier { /// A new key is a slot reassignment for history purposes, the same as /// before the clear-then-add: the old key's PSK-keyed history is kept, so /// it comes back if that key is ever re-added (#1063). + /// + /// If the clear lands and the add does not, the slot is left empty and this + /// returns [ChannelWrite.clearedNotAdded], so the user is told the channel is + /// gone rather than that the change may not have happened. Future editChannel( Channel channel, String name, @@ -7252,29 +7298,32 @@ class MeshCoreConnector extends ChangeNotifier { refresh: true, ); } - _channelWritesInFlight++; + _beginChannelWrite(); try { final cleared = await _writeChannelSlot(channel.index, '', Uint8List(16)); if (cleared != ChannelWrite.ok) { - await getChannels(force: true); + await _syncChannels(force: true); return cleared; } await _retireSlotOccupant(channel.index); - return await _setChannel( + final added = await _setChannel( channel.index, name, psk, occupantPsk: null, refresh: true, ); + return added == ChannelWrite.ok + ? ChannelWrite.ok + : ChannelWrite.clearedNotAdded; } finally { - _channelWritesInFlight--; + _endChannelWrite(); } } Future deleteChannel(int index, {bool refresh = true}) async { if (!isConnected) return ChannelWrite.noReply; - _channelWritesInFlight++; + _beginChannelWrite(); try { // A slot is deleted by writing an empty name and a zero PSK. Its history // goes outright (the true-delete path, #1063), once the radio has said @@ -7284,10 +7333,10 @@ class MeshCoreConnector extends ChangeNotifier { await _channelMessageStore.clearChannelMessages(index); _channelMessages.remove(index); } - if (refresh) await getChannels(force: true); + if (refresh) await _syncChannels(force: true); return result; } finally { - _channelWritesInFlight--; + _endChannelWrite(); } } @@ -7298,7 +7347,7 @@ class MeshCoreConnector extends ChangeNotifier { required Uint8List? occupantPsk, required bool refresh, }) async { - _channelWritesInFlight++; + _beginChannelWrite(); try { // A rename (same PSK) keeps everything; a different PSK retires the // slot's previous occupant (see [_retireSlotOccupant]). @@ -7314,10 +7363,10 @@ class MeshCoreConnector extends ChangeNotifier { // Re-read on every outcome: after a refusal the list we chose the slot // from was wrong, and after no reply nobody knows what the slot holds. - if (refresh) await getChannels(force: true); + if (refresh) await _syncChannels(force: true); return result; } finally { - _channelWritesInFlight--; + _endChannelWrite(); } } diff --git a/lib/helpers/channel_slot_ui.dart b/lib/helpers/channel_slot_ui.dart index c49d47d2..7df68c6f 100644 --- a/lib/helpers/channel_slot_ui.dart +++ b/lib/helpers/channel_slot_ui.dart @@ -72,6 +72,7 @@ bool explainUnconfirmedChannelWrite(BuildContext context, ChannelWrite result) { ChannelWrite.occupied => l10n.channels_writeOccupied, ChannelWrite.rejected => l10n.channels_writeRejected, ChannelWrite.noReply => l10n.channels_writeNoReply, + ChannelWrite.clearedNotAdded => l10n.channels_writeClearedNotAdded, }; if (message == null) return false; showChannelBlockedMessage(context, message); diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 6897ba03..098923dc 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -1052,6 +1052,10 @@ "@channels_writeNoReply": { "description": "A channel write got no reply before the timeout, or the radio is not connected; it may or may not have landed. Persistent (#1026)." }, + "channels_writeClearedNotAdded": "The old channel was removed, but the radio did not confirm the new one, so that slot is now empty. Add the channel again.", + "@channels_writeClearedNotAdded": { + "description": "A channel key change is clear-then-add; the clear landed and the add did not, so the edited channel is gone from the radio. Persistent (#1026)." + }, "channels_sortBy": "Sort by", "channels_sortManual": "Manual", "channels_sortAZ": "A-Z", diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart index 4d1430a2..831075b4 100644 --- a/lib/l10n/app_localizations.dart +++ b/lib/l10n/app_localizations.dart @@ -3256,6 +3256,12 @@ abstract class AppLocalizations { /// **'The radio did not confirm the change. Check the channel list before trying again.'** String get channels_writeNoReply; + /// A channel key change is clear-then-add; the clear landed and the add did not, so the edited channel is gone from the radio. Persistent (#1026). + /// + /// In en, this message translates to: + /// **'The old channel was removed, but the radio did not confirm the new one, so that slot is now empty. Add the channel again.'** + String get channels_writeClearedNotAdded; + /// No description provided for @channels_sortBy. /// /// In en, this message translates to: diff --git a/lib/l10n/app_localizations_bg.dart b/lib/l10n/app_localizations_bg.dart index b329bbe7..04a61044 100644 --- a/lib/l10n/app_localizations_bg.dart +++ b/lib/l10n/app_localizations_bg.dart @@ -1851,6 +1851,10 @@ class AppLocalizationsBg extends AppLocalizations { String get channels_writeNoReply => 'The radio did not confirm the change. Check the channel list before trying again.'; + @override + String get channels_writeClearedNotAdded => + 'The old channel was removed, but the radio did not confirm the new one, so that slot is now empty. Add the channel again.'; + @override String get channels_sortBy => 'Сортирай по'; diff --git a/lib/l10n/app_localizations_de.dart b/lib/l10n/app_localizations_de.dart index 6fef73bf..cb8ad65a 100644 --- a/lib/l10n/app_localizations_de.dart +++ b/lib/l10n/app_localizations_de.dart @@ -1846,6 +1846,10 @@ class AppLocalizationsDe extends AppLocalizations { String get channels_writeNoReply => 'The radio did not confirm the change. Check the channel list before trying again.'; + @override + String get channels_writeClearedNotAdded => + 'The old channel was removed, but the radio did not confirm the new one, so that slot is now empty. Add the channel again.'; + @override String get channels_sortBy => 'Sortiere nach'; diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart index 8527a688..29c1cdc0 100644 --- a/lib/l10n/app_localizations_en.dart +++ b/lib/l10n/app_localizations_en.dart @@ -1824,6 +1824,10 @@ class AppLocalizationsEn extends AppLocalizations { String get channels_writeNoReply => 'The radio did not confirm the change. Check the channel list before trying again.'; + @override + String get channels_writeClearedNotAdded => + 'The old channel was removed, but the radio did not confirm the new one, so that slot is now empty. Add the channel again.'; + @override String get channels_sortBy => 'Sort by'; diff --git a/lib/l10n/app_localizations_es.dart b/lib/l10n/app_localizations_es.dart index 4c559480..81e17ae9 100644 --- a/lib/l10n/app_localizations_es.dart +++ b/lib/l10n/app_localizations_es.dart @@ -1847,6 +1847,10 @@ class AppLocalizationsEs extends AppLocalizations { String get channels_writeNoReply => 'The radio did not confirm the change. Check the channel list before trying again.'; + @override + String get channels_writeClearedNotAdded => + 'The old channel was removed, but the radio did not confirm the new one, so that slot is now empty. Add the channel again.'; + @override String get channels_sortBy => 'Ordenar por'; diff --git a/lib/l10n/app_localizations_fr.dart b/lib/l10n/app_localizations_fr.dart index a4ecf771..eb299a81 100644 --- a/lib/l10n/app_localizations_fr.dart +++ b/lib/l10n/app_localizations_fr.dart @@ -1852,6 +1852,10 @@ class AppLocalizationsFr extends AppLocalizations { String get channels_writeNoReply => 'The radio did not confirm the change. Check the channel list before trying again.'; + @override + String get channels_writeClearedNotAdded => + 'The old channel was removed, but the radio did not confirm the new one, so that slot is now empty. Add the channel again.'; + @override String get channels_sortBy => 'Trier par'; diff --git a/lib/l10n/app_localizations_hu.dart b/lib/l10n/app_localizations_hu.dart index 63b00a3d..daa23a33 100644 --- a/lib/l10n/app_localizations_hu.dart +++ b/lib/l10n/app_localizations_hu.dart @@ -1852,6 +1852,10 @@ class AppLocalizationsHu extends AppLocalizations { String get channels_writeNoReply => 'The radio did not confirm the change. Check the channel list before trying again.'; + @override + String get channels_writeClearedNotAdded => + 'The old channel was removed, but the radio did not confirm the new one, so that slot is now empty. Add the channel again.'; + @override String get channels_sortBy => 'Szűrés'; diff --git a/lib/l10n/app_localizations_it.dart b/lib/l10n/app_localizations_it.dart index 04902b49..132bf789 100644 --- a/lib/l10n/app_localizations_it.dart +++ b/lib/l10n/app_localizations_it.dart @@ -1849,6 +1849,10 @@ class AppLocalizationsIt extends AppLocalizations { String get channels_writeNoReply => 'The radio did not confirm the change. Check the channel list before trying again.'; + @override + String get channels_writeClearedNotAdded => + 'The old channel was removed, but the radio did not confirm the new one, so that slot is now empty. Add the channel again.'; + @override String get channels_sortBy => 'Ordina per'; diff --git a/lib/l10n/app_localizations_ja.dart b/lib/l10n/app_localizations_ja.dart index 633e7dcb..a12542fd 100644 --- a/lib/l10n/app_localizations_ja.dart +++ b/lib/l10n/app_localizations_ja.dart @@ -1790,6 +1790,10 @@ class AppLocalizationsJa extends AppLocalizations { String get channels_writeNoReply => 'The radio did not confirm the change. Check the channel list before trying again.'; + @override + String get channels_writeClearedNotAdded => + 'The old channel was removed, but the radio did not confirm the new one, so that slot is now empty. Add the channel again.'; + @override String get channels_sortBy => '並び替え'; diff --git a/lib/l10n/app_localizations_ko.dart b/lib/l10n/app_localizations_ko.dart index 410fb880..7dc55aaa 100644 --- a/lib/l10n/app_localizations_ko.dart +++ b/lib/l10n/app_localizations_ko.dart @@ -1785,6 +1785,10 @@ class AppLocalizationsKo extends AppLocalizations { String get channels_writeNoReply => 'The radio did not confirm the change. Check the channel list before trying again.'; + @override + String get channels_writeClearedNotAdded => + 'The old channel was removed, but the radio did not confirm the new one, so that slot is now empty. Add the channel again.'; + @override String get channels_sortBy => '정렬 기준 선택'; diff --git a/lib/l10n/app_localizations_nl.dart b/lib/l10n/app_localizations_nl.dart index 32493e33..7e6c8be8 100644 --- a/lib/l10n/app_localizations_nl.dart +++ b/lib/l10n/app_localizations_nl.dart @@ -1837,6 +1837,10 @@ class AppLocalizationsNl extends AppLocalizations { String get channels_writeNoReply => 'The radio did not confirm the change. Check the channel list before trying again.'; + @override + String get channels_writeClearedNotAdded => + 'The old channel was removed, but the radio did not confirm the new one, so that slot is now empty. Add the channel again.'; + @override String get channels_sortBy => 'Sorteren door'; diff --git a/lib/l10n/app_localizations_pl.dart b/lib/l10n/app_localizations_pl.dart index e264da75..2b47ec9c 100644 --- a/lib/l10n/app_localizations_pl.dart +++ b/lib/l10n/app_localizations_pl.dart @@ -1858,6 +1858,10 @@ class AppLocalizationsPl extends AppLocalizations { String get channels_writeNoReply => 'The radio did not confirm the change. Check the channel list before trying again.'; + @override + String get channels_writeClearedNotAdded => + 'The old channel was removed, but the radio did not confirm the new one, so that slot is now empty. Add the channel again.'; + @override String get channels_sortBy => 'Sortuj po'; diff --git a/lib/l10n/app_localizations_pt.dart b/lib/l10n/app_localizations_pt.dart index 2a47cf89..e2d732cf 100644 --- a/lib/l10n/app_localizations_pt.dart +++ b/lib/l10n/app_localizations_pt.dart @@ -1846,6 +1846,10 @@ class AppLocalizationsPt extends AppLocalizations { String get channels_writeNoReply => 'The radio did not confirm the change. Check the channel list before trying again.'; + @override + String get channels_writeClearedNotAdded => + 'The old channel was removed, but the radio did not confirm the new one, so that slot is now empty. Add the channel again.'; + @override String get channels_sortBy => 'Ordenar por'; diff --git a/lib/l10n/app_localizations_ru.dart b/lib/l10n/app_localizations_ru.dart index 3f1e2ded..7bee8375 100644 --- a/lib/l10n/app_localizations_ru.dart +++ b/lib/l10n/app_localizations_ru.dart @@ -1847,6 +1847,10 @@ class AppLocalizationsRu extends AppLocalizations { String get channels_writeNoReply => 'The radio did not confirm the change. Check the channel list before trying again.'; + @override + String get channels_writeClearedNotAdded => + 'The old channel was removed, but the radio did not confirm the new one, so that slot is now empty. Add the channel again.'; + @override String get channels_sortBy => 'Сортировка'; diff --git a/lib/l10n/app_localizations_sk.dart b/lib/l10n/app_localizations_sk.dart index 91344fd1..2e504702 100644 --- a/lib/l10n/app_localizations_sk.dart +++ b/lib/l10n/app_localizations_sk.dart @@ -1838,6 +1838,10 @@ class AppLocalizationsSk extends AppLocalizations { String get channels_writeNoReply => 'The radio did not confirm the change. Check the channel list before trying again.'; + @override + String get channels_writeClearedNotAdded => + 'The old channel was removed, but the radio did not confirm the new one, so that slot is now empty. Add the channel again.'; + @override String get channels_sortBy => 'Triediť podľa'; diff --git a/lib/l10n/app_localizations_sl.dart b/lib/l10n/app_localizations_sl.dart index 544f83ef..0a1a0ad9 100644 --- a/lib/l10n/app_localizations_sl.dart +++ b/lib/l10n/app_localizations_sl.dart @@ -1835,6 +1835,10 @@ class AppLocalizationsSl extends AppLocalizations { String get channels_writeNoReply => 'The radio did not confirm the change. Check the channel list before trying again.'; + @override + String get channels_writeClearedNotAdded => + 'The old channel was removed, but the radio did not confirm the new one, so that slot is now empty. Add the channel again.'; + @override String get channels_sortBy => 'Sortiraj po'; diff --git a/lib/l10n/app_localizations_sv.dart b/lib/l10n/app_localizations_sv.dart index e1590d5b..c1909ef6 100644 --- a/lib/l10n/app_localizations_sv.dart +++ b/lib/l10n/app_localizations_sv.dart @@ -1827,6 +1827,10 @@ class AppLocalizationsSv extends AppLocalizations { String get channels_writeNoReply => 'The radio did not confirm the change. Check the channel list before trying again.'; + @override + String get channels_writeClearedNotAdded => + 'The old channel was removed, but the radio did not confirm the new one, so that slot is now empty. Add the channel again.'; + @override String get channels_sortBy => 'Sortera efter'; diff --git a/lib/l10n/app_localizations_uk.dart b/lib/l10n/app_localizations_uk.dart index c453804d..d549d9b6 100644 --- a/lib/l10n/app_localizations_uk.dart +++ b/lib/l10n/app_localizations_uk.dart @@ -1842,6 +1842,10 @@ class AppLocalizationsUk extends AppLocalizations { String get channels_writeNoReply => 'The radio did not confirm the change. Check the channel list before trying again.'; + @override + String get channels_writeClearedNotAdded => + 'The old channel was removed, but the radio did not confirm the new one, so that slot is now empty. Add the channel again.'; + @override String get channels_sortBy => 'Сортувати за'; diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dart index 974dba0a..21288e83 100644 --- a/lib/l10n/app_localizations_zh.dart +++ b/lib/l10n/app_localizations_zh.dart @@ -1771,6 +1771,10 @@ class AppLocalizationsZh extends AppLocalizations { String get channels_writeNoReply => 'The radio did not confirm the change. Check the channel list before trying again.'; + @override + String get channels_writeClearedNotAdded => + 'The old channel was removed, but the radio did not confirm the new one, so that slot is now empty. Add the channel again.'; + @override String get channels_sortBy => '排序方式'; diff --git a/lib/screens/channels_screen.dart b/lib/screens/channels_screen.dart index 8a51269d..a49b2046 100644 --- a/lib/screens/channels_screen.dart +++ b/lib/screens/channels_screen.dart @@ -2194,17 +2194,19 @@ class _ChannelsScreenState extends State // Delete all community channels from the device. Each delete is // answered before the next goes out, and the list is re-read - // once at the end: a re-read between deletes would put the next - // one in the middle of a sync, where its reply cannot be told - // from the sync's (#1026). - ChannelWrite? failure; - for (final channel in communityChannels) { - final result = await connector.deleteChannel( - channel.index, - refresh: false, - ); - if (result != ChannelWrite.ok) failure ??= result; - } + // once at the end. A sync between two deletes would share their + // reply queue, so the loop runs as one batch (#1026). + final failure = await connector.batchChannelWrites(() async { + ChannelWrite? first; + for (final channel in communityChannels) { + final result = await connector.deleteChannel( + channel.index, + refresh: false, + ); + if (result != ChannelWrite.ok) first ??= result; + } + return first; + }); if (communityChannels.isNotEmpty) { await connector.getChannels(force: true); } diff --git a/lib/services/stock_config_import_service.dart b/lib/services/stock_config_import_service.dart index af991ff5..425d7f12 100644 --- a/lib/services/stock_config_import_service.dart +++ b/lib/services/stock_config_import_service.dart @@ -284,30 +284,33 @@ class StockConfigImportService { isSyncing: _connector.isChannelTableBusy, ); // Each write is answered before the next goes out, and the list is - // re-read once at the end. A re-read after every write would put the next - // write in the middle of a sync, where its reply cannot be told from the - // sync's (#1026). - var added = 0; - for (final assignment in plan.assignments) { - final result = await _connector.setChannel( - assignment.slot, - assignment.channel.name, - assignment.channel.secret, - refresh: false, - ); - if (result == ChannelWrite.ok) { - added++; - } else { - skipped.add( - SkippedChannel( - assignment.channel.name, - result == ChannelWrite.noReply - ? StockConfigImportIssue.noReply - : StockConfigImportIssue.rejected, - ), + // re-read once at the end. A sync between two writes would share their + // reply queue, where a write's reply cannot be told from the sync's, so + // the whole loop runs as one batch (#1026). + final added = await _connector.batchChannelWrites(() async { + var count = 0; + for (final assignment in plan.assignments) { + final result = await _connector.setChannel( + assignment.slot, + assignment.channel.name, + assignment.channel.secret, + refresh: false, ); + if (result == ChannelWrite.ok) { + count++; + } else { + skipped.add( + SkippedChannel( + assignment.channel.name, + result == ChannelWrite.noReply + ? StockConfigImportIssue.noReply + : StockConfigImportIssue.rejected, + ), + ); + } } - } + return count; + }); if (plan.assignments.isNotEmpty) { await _connector.getChannels(force: true); } diff --git a/test/connector/channel_write_reply_test.dart b/test/connector/channel_write_reply_test.dart index 39f5f58c..4cda5921 100644 --- a/test/connector/channel_write_reply_test.dart +++ b/test/connector/channel_write_reply_test.dart @@ -206,6 +206,59 @@ void main() { expect(setFrames(), hasLength(1)); expect(connector.channelMessagesForTest.containsKey(3), isTrue); }); + + test( + 'a clear that lands and an add that fails says the slot is empty', + () async { + final edit = connector.editChannel(current, 'Weather', psk(0x99)); + await untilSetFrames(1); + ok(); // the clear lands + + await untilSetFrames(2); + err(errCodeNotFound); // the add does not + + expect(await edit, ChannelWrite.clearedNotAdded); + }, + ); + }); + + // Gemini review of #1021: a sync started while a write waits for its reply + // shares the reply queue with it, so the sync's empty-slot ERR could be + // taken as the write's answer. The sync waits for the writes instead. + group('a sync requested during a write', () { + List getFrames() => + sent.where((f) => f.isNotEmpty && f[0] == cmdGetChannel).toList(); + + test('is deferred until the reply, then runs', () async { + final write = connector.setChannel(3, 'A', psk(0x22), refresh: false); + await connector.getChannels(force: true); + expect(connector.isSyncingChannels, isFalse); + expect(getFrames(), isEmpty); + + ok(); + expect(await write, ChannelWrite.ok); + await Future.delayed(Duration.zero); + expect(connector.isSyncingChannels, isTrue); + expect(getFrames(), isNotEmpty); + }); + + test('does not start between two writes of a batch', () async { + final batch = connector.batchChannelWrites(() async { + final first = connector.setChannel(3, 'A', psk(0x22), refresh: false); + await connector.getChannels(force: true); + ok(); + await first; + await Future.delayed(Duration.zero); + // Between the two writes: the deferred sync must not have started. + expect(connector.isSyncingChannels, isFalse); + final second = connector.setChannel(4, 'B', psk(0x33), refresh: false); + ok(); + return second; + }); + + expect(await batch, ChannelWrite.ok); + expect(getFrames(), isNotEmpty, reason: 'runs once the batch ends'); + }); }); // #1024: after a FAILED sync the cached list is restored but diff --git a/test/helpers/channel_slot_ui_test.dart b/test/helpers/channel_slot_ui_test.dart index 7fa56c2c..a1b566dd 100644 --- a/test/helpers/channel_slot_ui_test.dart +++ b/test/helpers/channel_slot_ui_test.dart @@ -43,6 +43,7 @@ final _allMessages = [ _l10n.channels_writeOccupied, _l10n.channels_writeRejected, _l10n.channels_writeNoReply, + _l10n.channels_writeClearedNotAdded, ]; Future _host(WidgetTester tester) async { @@ -147,6 +148,7 @@ void main() { ChannelWrite.occupied: _l10n.channels_writeOccupied, ChannelWrite.rejected: _l10n.channels_writeRejected, ChannelWrite.noReply: _l10n.channels_writeNoReply, + ChannelWrite.clearedNotAdded: _l10n.channels_writeClearedNotAdded, }; for (final entry in cases.entries) { testWidgets('${entry.key.name}: explained, persistently', (tester) async { diff --git a/untranslated.json b/untranslated.json index 787fbfb6..37fb524e 100644 --- a/untranslated.json +++ b/untranslated.json @@ -158,6 +158,7 @@ "channels_writeOccupied", "channels_writeRejected", "channels_writeNoReply", + "channels_writeClearedNotAdded", "composerBudgetBlockedTitle", "composerBudgetLimitedTitle", "composerBudgetBluetoothCause", @@ -532,6 +533,7 @@ "channels_writeOccupied", "channels_writeRejected", "channels_writeNoReply", + "channels_writeClearedNotAdded", "composerBudgetBlockedTitle", "composerBudgetLimitedTitle", "composerBudgetBluetoothCause", @@ -906,6 +908,7 @@ "channels_writeOccupied", "channels_writeRejected", "channels_writeNoReply", + "channels_writeClearedNotAdded", "composerBudgetBlockedTitle", "composerBudgetLimitedTitle", "composerBudgetBluetoothCause", @@ -1280,6 +1283,7 @@ "channels_writeOccupied", "channels_writeRejected", "channels_writeNoReply", + "channels_writeClearedNotAdded", "composerBudgetBlockedTitle", "composerBudgetLimitedTitle", "composerBudgetBluetoothCause", @@ -1654,6 +1658,7 @@ "channels_writeOccupied", "channels_writeRejected", "channels_writeNoReply", + "channels_writeClearedNotAdded", "composerBudgetBlockedTitle", "composerBudgetLimitedTitle", "composerBudgetBluetoothCause", @@ -2028,6 +2033,7 @@ "channels_writeOccupied", "channels_writeRejected", "channels_writeNoReply", + "channels_writeClearedNotAdded", "composerBudgetBlockedTitle", "composerBudgetLimitedTitle", "composerBudgetBluetoothCause", @@ -2402,6 +2408,7 @@ "channels_writeOccupied", "channels_writeRejected", "channels_writeNoReply", + "channels_writeClearedNotAdded", "composerBudgetBlockedTitle", "composerBudgetLimitedTitle", "composerBudgetBluetoothCause", @@ -2776,6 +2783,7 @@ "channels_writeOccupied", "channels_writeRejected", "channels_writeNoReply", + "channels_writeClearedNotAdded", "composerBudgetBlockedTitle", "composerBudgetLimitedTitle", "composerBudgetBluetoothCause", @@ -3150,6 +3158,7 @@ "channels_writeOccupied", "channels_writeRejected", "channels_writeNoReply", + "channels_writeClearedNotAdded", "composerBudgetBlockedTitle", "composerBudgetLimitedTitle", "composerBudgetBluetoothCause", @@ -3524,6 +3533,7 @@ "channels_writeOccupied", "channels_writeRejected", "channels_writeNoReply", + "channels_writeClearedNotAdded", "composerBudgetBlockedTitle", "composerBudgetLimitedTitle", "composerBudgetBluetoothCause", @@ -3898,6 +3908,7 @@ "channels_writeOccupied", "channels_writeRejected", "channels_writeNoReply", + "channels_writeClearedNotAdded", "composerBudgetBlockedTitle", "composerBudgetLimitedTitle", "composerBudgetBluetoothCause", @@ -4272,6 +4283,7 @@ "channels_writeOccupied", "channels_writeRejected", "channels_writeNoReply", + "channels_writeClearedNotAdded", "composerBudgetBlockedTitle", "composerBudgetLimitedTitle", "composerBudgetBluetoothCause", @@ -4646,6 +4658,7 @@ "channels_writeOccupied", "channels_writeRejected", "channels_writeNoReply", + "channels_writeClearedNotAdded", "composerBudgetBlockedTitle", "composerBudgetLimitedTitle", "composerBudgetBluetoothCause", @@ -5020,6 +5033,7 @@ "channels_writeOccupied", "channels_writeRejected", "channels_writeNoReply", + "channels_writeClearedNotAdded", "composerBudgetBlockedTitle", "composerBudgetLimitedTitle", "composerBudgetBluetoothCause", @@ -5394,6 +5408,7 @@ "channels_writeOccupied", "channels_writeRejected", "channels_writeNoReply", + "channels_writeClearedNotAdded", "composerBudgetBlockedTitle", "composerBudgetLimitedTitle", "composerBudgetBluetoothCause", @@ -5768,6 +5783,7 @@ "channels_writeOccupied", "channels_writeRejected", "channels_writeNoReply", + "channels_writeClearedNotAdded", "composerBudgetBlockedTitle", "composerBudgetLimitedTitle", "composerBudgetBluetoothCause", @@ -6142,6 +6158,7 @@ "channels_writeOccupied", "channels_writeRejected", "channels_writeNoReply", + "channels_writeClearedNotAdded", "composerBudgetBlockedTitle", "composerBudgetLimitedTitle", "composerBudgetBluetoothCause",