fix: delay iOS folder picker after sheet dismiss and update Afkar hosts

This commit is contained in:
zarzet
2026-03-16 20:17:00 +07:00
parent 3747ffff64
commit 84381d142a
5 changed files with 44 additions and 6 deletions
@@ -1310,8 +1310,27 @@ class _DownloadSettingsPageState extends ConsumerState<DownloadSettingsPage> {
subtitle: Text(context.l10n.setupChooseFromFilesSubtitle),
onTap: () async {
Navigator.pop(ctx);
if (Platform.isIOS) {
await Future<void>.delayed(const Duration(milliseconds: 250));
}
// Note: iOS requires folder to have at least one file to be selectable
final result = await FilePicker.platform.getDirectoryPath();
String? result;
try {
result = await FilePicker.platform.getDirectoryPath();
} catch (e) {
if (ctx.mounted) {
ScaffoldMessenger.of(ctx).showSnackBar(
SnackBar(
content: Text('Failed to open folder picker: $e'),
backgroundColor: Theme.of(ctx).colorScheme.error,
duration: const Duration(seconds: 4),
),
);
}
return;
}
if (result != null) {
// iOS: Validate the selected path is writable (not iCloud or container root)
if (Platform.isIOS) {
+20 -1
View File
@@ -321,7 +321,26 @@ class _SetupScreenState extends ConsumerState<SetupScreen> {
title: Text(context.l10n.setupChooseFromFiles),
onTap: () async {
Navigator.pop(ctx);
final result = await FilePicker.platform.getDirectoryPath();
if (Platform.isIOS) {
await Future<void>.delayed(const Duration(milliseconds: 250));
}
String? result;
try {
result = await FilePicker.platform.getDirectoryPath();
} catch (e) {
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('Failed to open folder picker: $e'),
backgroundColor: Theme.of(context).colorScheme.error,
duration: const Duration(seconds: 4),
),
);
}
return;
}
if (result != null) {
// iOS: Validate the selected path is writable
if (Platform.isIOS) {