fix(settings): ensure manual bridge configuration is applied correctly and improve storage fallback
This commit is contained in:
parent
a7362f651e
commit
f06e20479a
File diff suppressed because it is too large
Load Diff
@ -123,7 +123,6 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
),
|
||||
),
|
||||
);
|
||||
await widget.controller.settingsController.saveSnapshot(nextSettings);
|
||||
if (isManual && _bridgeTokenController.text.isNotEmpty) {
|
||||
await widget.controller.settingsController.saveSecretValueByRef(
|
||||
nextSettings.acpBridgeServerModeConfig.selfHosted.passwordRef,
|
||||
@ -132,6 +131,8 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
module: 'Manual',
|
||||
);
|
||||
}
|
||||
await widget.controller.saveSettings(nextSettings);
|
||||
|
||||
_lastSavedAccountBaseUrl = nextSettings.accountBaseUrl;
|
||||
_lastSavedAccountIdentifier = nextSettings.accountUsername;
|
||||
_lastSavedBridgeUrl = nextSettings.acpBridgeServerModeConfig.selfHosted.serverUrl;
|
||||
|
||||
@ -143,7 +143,17 @@ class StoreLayoutResolver {
|
||||
await _resolvePath(_supportRootPathResolver) ??
|
||||
await _defaultSupportRootPath();
|
||||
if (supportRootPath == null) {
|
||||
throw StateError('Cannot resolve persistent storage root.');
|
||||
// Fallback to a temporary directory instead of failing fast with an error.
|
||||
// This ensures the app remains usable in "memory-only" or "ephemeral" mode.
|
||||
final tempDir = await Directory.systemTemp.createTemp('xworkmate-fallback-');
|
||||
final layout = StoreLayout(
|
||||
rootDirectory: tempDir,
|
||||
configDirectory: await ensureDirectory('${tempDir.path}/config'),
|
||||
tasksDirectory: await ensureDirectory('${tempDir.path}/tasks'),
|
||||
secretDirectory: await ensureDirectory('${tempDir.path}/secrets'),
|
||||
);
|
||||
_cached = layout;
|
||||
return layout;
|
||||
}
|
||||
final appDataRootPath =
|
||||
await _resolvePath(_appDataRootPathResolver) ?? supportRootPath;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user