fix: skip SAF picker on Android TV

This commit is contained in:
edde746
2026-03-25 20:56:32 +01:00
parent 843faee4c5
commit bfe35220aa
2 changed files with 8 additions and 0 deletions
@@ -1050,6 +1050,11 @@ class _SettingsScreenState extends State<SettingsScreen> with FocusableTab {
selectedPath = await safService.pickDirectory();
if (selectedPath != null) {
pathType = 'saf';
} else if (PlatformDetector.isTV()) {
if (mounted) {
showErrorSnackBar(context, t.settings.downloadLocationSelectError);
}
return;
}
} else {
// Use file_picker on desktop
+3
View File
@@ -3,6 +3,7 @@ import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:saf_util/saf_util.dart';
import '../utils/platform_detector.dart';
import 'package:saf_util/saf_util_platform_interface.dart';
import 'package:saf_stream/saf_stream.dart';
@@ -22,6 +23,8 @@ class SafStorageService {
/// Returns the content:// URI or null if cancelled
Future<String?> pickDirectory() async {
if (!isAvailable) return null;
// SAF document picker is not available on Android TV
if (TvDetectionService.isTVSync()) return null;
try {
// Pick directory with persistent write permission
final doc = await _safUtil.pickDirectory(writePermission: true, persistablePermission: true);