support default file pool selection

- add defaultPoolId to AppSettings + persistence
- extend SettingsScreen with pool dropdown
- update uploadAttachment to use defaultPoolId with fallback

Signed-off-by: Texas0295 <kimura@texas0295.top>
This commit is contained in:
Texas0295
2025-09-21 15:23:08 +08:00
parent b638343f02
commit 3621ea7744
10 changed files with 116 additions and 28 deletions

View File

@@ -505,7 +505,7 @@ class ComposeLogic {
WidgetRef ref,
ComposeState state,
int index, {
String? poolId,
String? poolId, // For Unit Test
}) async {
final attachment = state.attachments.value[index];
if (attachment.isOnCloud) return;
@@ -522,14 +522,15 @@ class ComposeLogic {
SnCloudFile? cloudFile;
final settings = ref.watch(appSettingsNotifierProvider);
final selectedPoolId = poolId ?? settings.defaultPoolId ?? '500e5ed8-bd44-4359-bc0a-ec85e2adf447';
if (attachment.type == UniversalFileType.file) {
cloudFile =
await putFileToPool(
fileData: attachment,
atk: token,
baseUrl: baseUrl,
// TODO: Generic Pool ID (Now: Solian Network Driver)
poolId: poolId ?? '500e5ed8-bd44-4359-bc0a-ec85e2adf447',
poolId: selectedPoolId,
filename: attachment.data.name ?? 'General file',
mimetype:
attachment.data.mimeType ??