Store histories and the tile index in SQLite

Message, channel and route histories move from whole-blob preferences to
indexed SQLite rows on native platforms, so chats page from storage instead
of loading a full conversation. Web keeps the preferences store. Existing
histories are imported once on the first launch.

Linux and Windows keep the map tile index in SQLite and import the old JSON
index on first use.

Unreadable legacy data no longer blocks saves, migrations or startup: it is
left in place and skipped. If the database cannot be opened, the run keeps
histories in preferences and the next launch merges them in.

Also adds a performance profiling reference and a script that clears the
Dart HTTP profile.
This commit is contained in:
zjs81 committed 2026-11-09 22:32:40 -07:00
1 parent 0106569e7d
commit 2d56d5e349
47 files changed
+4465 -614

No files matched your search

+16 -10
View File
@@ -8,6 +8,7 @@ import 'package:flutter_map/flutter_map.dart';
import '../models/app_settings.dart';
import '../theme/mesh_theme.dart';
import 'app_settings_service.dart';
import 'map_tile_cache_repository.dart';
enum MapRasterSourcePreset {
osmAuto('osm_auto'),
@@ -347,6 +348,7 @@ class MapTileCacheService extends ChangeNotifier {
cacheKey,
stalePeriod: const Duration(days: 365),
maxNrOfCacheObjects: 200000,
repo: createMapTileCacheRepository(cacheKey),
),
) {
tileProvider = CachedNetworkTileProvider(cacheManager: this.cacheManager);
@@ -534,19 +536,23 @@ class MapTileCacheService extends ChangeNotifier {
Future<CachedTileInventory> getCachedTileInventory() async {
final repo = _concreteCacheManager.config.repo;
await repo.open();
final objects = await repo.getAllObjects();
final tiles = <CachedTileInfo>[];
int totalBytes = 0;
try {
final objects = await repo.getAllObjects();
final tiles = <CachedTileInfo>[];
int totalBytes = 0;
for (final object in objects) {
totalBytes += object.length ?? 0;
final tile = _parseCachedTile(object);
if (tile != null) {
tiles.add(tile);
for (final object in objects) {
totalBytes += object.length ?? 0;
final tile = _parseCachedTile(object);
if (tile != null) {
tiles.add(tile);
}
}
}
return CachedTileInventory(tiles: tiles, totalBytes: totalBytes);
return CachedTileInventory(tiles: tiles, totalBytes: totalBytes);
} finally {
await repo.close();
}
}
List<CachedTileInfo> filterTilesForActiveSource(