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.
26 lines
862 B
Dart
26 lines
862 B
Dart
import 'prefs_manager.dart';
|
|
|
|
/// Storage scopes (first 10 hex chars of a radio's public key) that must
|
|
/// never adopt data from the legacy unscoped keys.
|
|
///
|
|
/// The per-radio stores move a legacy key into the first scope that loads it
|
|
/// and then delete the legacy key. A scope listed here, such as the simulated
|
|
/// review-mode radio, leaves legacy data for the next real radio.
|
|
final Set<String> scopesWithoutLegacyMigration = {};
|
|
|
|
bool canMigrateLegacyKeys(String scopeHex) =>
|
|
!scopesWithoutLegacyMigration.contains(scopeHex);
|
|
|
|
Future<String?> migrateLegacyStringPreference(
|
|
String oldKey,
|
|
String newKey,
|
|
) async {
|
|
final prefs = PrefsManager.instance;
|
|
final value = prefs.getString(oldKey);
|
|
if (value == null || value.isEmpty) return value;
|
|
if (await prefs.setString(newKey, value)) {
|
|
await prefs.remove(oldKey);
|
|
}
|
|
return value;
|
|
}
|