mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-08-20 09:57:15 +02:00
fix(ios): block iCloud Drive folder selection
- Detect iCloud path and show error when user tries to select it - Fallback to app Documents folder if iCloud path detected at runtime - Add localization string for iCloud not supported error
This commit is contained in:
@@ -1564,11 +1564,28 @@ class DownloadQueueNotifier extends Notifier<DownloadQueueState> {
|
||||
}
|
||||
}
|
||||
|
||||
if (state.outputDir.isEmpty) {
|
||||
if (state.outputDir.isEmpty) {
|
||||
_log.d('Output dir empty, initializing...');
|
||||
await _initOutputDir();
|
||||
}
|
||||
|
||||
// iOS: Validate that outputDir is writable (not iCloud Drive which Go can't access)
|
||||
if (Platform.isIOS && state.outputDir.isNotEmpty) {
|
||||
final isICloudPath = state.outputDir.contains('Mobile Documents') ||
|
||||
state.outputDir.contains('CloudDocs') ||
|
||||
state.outputDir.contains('com~apple~CloudDocs');
|
||||
if (isICloudPath) {
|
||||
_log.w('iOS: iCloud Drive path detected, falling back to app Documents folder');
|
||||
_log.w('Go backend cannot write to iCloud Drive due to iOS sandboxing');
|
||||
final dir = await getApplicationDocumentsDirectory();
|
||||
final musicDir = Directory('${dir.path}/SpotiFLAC');
|
||||
if (!await musicDir.exists()) {
|
||||
await musicDir.create(recursive: true);
|
||||
}
|
||||
state = state.copyWith(outputDir: musicDir.path);
|
||||
}
|
||||
}
|
||||
|
||||
if (state.outputDir.isEmpty) {
|
||||
_log.d('Using fallback directory...');
|
||||
final dir = await getApplicationDocumentsDirectory();
|
||||
|
||||
Reference in New Issue
Block a user