mirror of
https://github.com/rzuasti/oott.git
synced 2026-07-08 19:21:54 +02:00
Surface persistence and fetch errors instead of swallowing them
PrefUtil.setValue now returns the underlying SharedPreferences result and throws on unsupported types; settings save reports failures rather than always showing success. Device detail and event history report the real Dio error message and skip cancellations. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
f7f255e20f
commit
e70676a193
@@ -67,13 +67,23 @@ class _SettingsState extends State<Settings> {
|
||||
}
|
||||
}
|
||||
|
||||
void _save() {
|
||||
Future<void> _save() async {
|
||||
if (!_formKey.currentState!.validate()) return;
|
||||
PrefUtil.setValue('base_url', _baseUrlController.text);
|
||||
PrefUtil.setValue('api_key', XOR().xorEncode(_apiKeyController.text));
|
||||
BackendAPI.instance.reconfigureFromPrefs();
|
||||
context.read<AppState>().setTheme(_selectedTheme);
|
||||
UISnackbars.showSuccess(context, 'Settings saved successfully');
|
||||
final urlOk = await PrefUtil.setValue('base_url', _baseUrlController.text);
|
||||
if (!mounted) return;
|
||||
final keyOk = await PrefUtil.setValue(
|
||||
'api_key',
|
||||
XOR().xorEncode(_apiKeyController.text),
|
||||
);
|
||||
if (!mounted) return;
|
||||
final themeOk = await context.read<AppState>().setTheme(_selectedTheme);
|
||||
if (!mounted) return;
|
||||
if (urlOk && keyOk && themeOk) {
|
||||
BackendAPI.instance.reconfigureFromPrefs();
|
||||
UISnackbars.showSuccess(context, 'Settings saved successfully');
|
||||
} else {
|
||||
UISnackbars.showError(context, 'Failed to save settings');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user