UI refresh: shared widgets, screen cleanups, and full translations
- Extract reusable widgets (chat composer/send pipeline, message bubble frame, reaction chips, path map scaffold, radio settings dialog, translation settings section, map POI clusters, nav tiles, etc.) and slim down the screens that used them - Map: hide/remove markers with restore, confirm before setting node location, POI clustering, semantics labels - Map cache: cancellable downloads and a bulk tile limit - Repeater: unsaved-changes guard, CLI search/copy/share transcript, framed-command debug preview, disconnected banner - Confirm before clearing chats and debug logs - Keep cached unread totals in sync on per-contact/channel updates - Move remaining hardcoded strings into l10n and translate the 98 new keys into all 17 non-English locales
This commit is contained in:
1 parent
9609a8231d
commit
88dcc5943f
100 files changed
+19778
-8167
No files matched your search
@@ -275,14 +275,26 @@ class MapTileCacheResult {
|
||||
final int total;
|
||||
final int downloaded;
|
||||
final int failed;
|
||||
final bool cancelled;
|
||||
|
||||
const MapTileCacheResult({
|
||||
required this.total,
|
||||
required this.downloaded,
|
||||
required this.failed,
|
||||
this.cancelled = false,
|
||||
});
|
||||
}
|
||||
|
||||
/// Cooperative cancellation flag for [MapTileCacheService.downloadRegion].
|
||||
/// Tiles already in flight finish; no new tiles are queued after [cancel].
|
||||
class MapTileDownloadCancelToken {
|
||||
bool _cancelled = false;
|
||||
|
||||
bool get isCancelled => _cancelled;
|
||||
|
||||
void cancel() => _cancelled = true;
|
||||
}
|
||||
|
||||
class CachedTileInfo {
|
||||
final String key;
|
||||
final String host;
|
||||
@@ -316,6 +328,10 @@ class MapTileCacheService extends ChangeNotifier {
|
||||
static const int defaultMinZoom = 10;
|
||||
static const int defaultMaxZoom = 15;
|
||||
|
||||
/// Largest bulk download the UI allows in one go. Keeps a single request
|
||||
/// within tile-server usage policies and avoids filling the device.
|
||||
static const int maxBulkDownloadTiles = 20000;
|
||||
|
||||
final AppSettingsService appSettingsService;
|
||||
final BaseCacheManager cacheManager;
|
||||
late final TileProvider tileProvider;
|
||||
@@ -614,6 +630,7 @@ class MapTileCacheService extends ChangeNotifier {
|
||||
int concurrentDownloads = 8,
|
||||
Map<String, String>? headers,
|
||||
void Function(MapTileCacheProgress progress)? onProgress,
|
||||
MapTileDownloadCancelToken? cancelToken,
|
||||
}) async {
|
||||
final safeMin = math.min(minZoom, maxZoom);
|
||||
final safeMax = math.max(minZoom, maxZoom);
|
||||
@@ -652,10 +669,17 @@ class MapTileCacheService extends ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
var stoppedEarly = false;
|
||||
|
||||
outer:
|
||||
for (int zoom = safeMin; zoom <= safeMax; zoom++) {
|
||||
final tileBounds = _tileBoundsForBounds(bounds, zoom);
|
||||
for (int x = tileBounds.minX; x <= tileBounds.maxX; x++) {
|
||||
for (int y = tileBounds.minY; y <= tileBounds.maxY; y++) {
|
||||
if (cancelToken?.isCancelled ?? false) {
|
||||
stoppedEarly = true;
|
||||
break outer;
|
||||
}
|
||||
final url = _buildTileUrl(x, y, zoom, urlTemplate: currentTemplate);
|
||||
await queueDownload(url);
|
||||
}
|
||||
@@ -670,6 +694,7 @@ class MapTileCacheService extends ChangeNotifier {
|
||||
total: total,
|
||||
downloaded: completed - failed,
|
||||
failed: failed,
|
||||
cancelled: stoppedEarly,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -131,6 +131,14 @@ class RepeaterCommandService {
|
||||
);
|
||||
}
|
||||
|
||||
/// The text [sendCommand] would put on the wire for its next attempt: the
|
||||
/// clock-sync rewrite plus the `XX|` reply prefix (unless [raw]). Used for
|
||||
/// debug previews so they match what is actually sent.
|
||||
String previewFramedCommand(String command, {bool raw = false}) {
|
||||
if (raw) return command;
|
||||
return '${_peekPrefixToken()}${normalizeRepeaterClockSyncCommand(command)}';
|
||||
}
|
||||
|
||||
/// Send [line] verbatim and don't wait for a reply. While `region load` is
|
||||
/// active the firmware consumes each line before prefix stripping and
|
||||
/// sends nothing back (simple_repeater/MyMesh.cpp handleCommand).
|
||||
@@ -185,6 +193,17 @@ class RepeaterCommandService {
|
||||
_pendingByPrefix.clear();
|
||||
}
|
||||
|
||||
String _peekPrefixToken() {
|
||||
for (var i = 0; i < 256; i++) {
|
||||
final value = (_prefixCounter + i) & 0xFF;
|
||||
final token = '${value.toRadixString(16).padLeft(2, '0').toUpperCase()}|';
|
||||
if (!_pendingByPrefix.containsKey(token)) {
|
||||
return token;
|
||||
}
|
||||
}
|
||||
return '00|';
|
||||
}
|
||||
|
||||
String _nextPrefixToken() {
|
||||
for (var i = 0; i < 256; i++) {
|
||||
final value = _prefixCounter++ & 0xFF;
|
||||
|
||||
Reference in new issue
Block a user