chore: Migrate wrong datatype for fontSizeFactor

This commit is contained in:
krille-chan 2025-10-25 20:36:09 +02:00
parent fb29b4c54e
commit 8cf46f0a7f
No known key found for this signature in database

View file

@ -1,5 +1,6 @@
import 'dart:convert';
import 'package:async/async.dart';
import 'package:flutter/foundation.dart';
import 'package:http/http.dart' as http;
@ -72,6 +73,20 @@ enum AppSettings<T> {
final store = AppSettings._store = await SharedPreferences.getInstance();
// Migrate wrong datatype for fontSizeFactor
final fontSizeFactorString =
Result(() => store.getString(AppSettings.fontSizeFactor.key))
.asValue
?.value;
if (fontSizeFactorString != null) {
Logs().i('Migrate wrong datatype for fontSizeFactor!');
await store.remove(AppSettings.fontSizeFactor.key);
final fontSizeFactor = double.tryParse(fontSizeFactorString);
if (fontSizeFactor != null) {
await store.setDouble(AppSettings.fontSizeFactor.key, fontSizeFactor);
}
}
if (store.getBool(AppSettings.sendOnEnter.key) == null) {
await store.setBool(AppSettings.sendOnEnter.key, !PlatformInfos.isMobile);
}