Fixed ios related bugs, removed unimplemented actions to comply with apple guidelines

This commit is contained in:
2023-08-08 22:31:13 +02:00
parent 45a829082b
commit d234074b87
6 changed files with 54 additions and 28 deletions

View File

@ -1,6 +1,7 @@
import 'package:nextcloud/nextcloud.dart';
import '../../../../../model/endpointData.dart';
import '../../webdavApi.dart';
import 'cacheableFile.dart';
import 'listFilesParams.dart';
@ -14,9 +15,19 @@ class ListFiles extends WebdavApi<ListFilesParams> {
@override
Future<ListFilesResponse> run() async {
List<WebDavFile> davFiles = (await (await WebdavApi.webdav).propfind(params.path)).toWebDavFiles();
davFiles.removeWhere((element) => element.path == "/${params.path}/" || element.path == "/"); // somehow the current working folder is also listed, it is filtered here.
Set<CacheableFile> files = davFiles.map((e) => CacheableFile.fromDavFile(e)).toSet();
// webdav handles subdirectories wrong, this is a fix
if(EndpointData().getEndpointMode() == EndpointMode.stage) {
files = files.map((e) { // somehow
e.path = e.path.split("mobile/cloud/remote.php/webdav")[1];
return e;
}).toSet();
}
// somehow the current working folder is also listed, it is filtered here.
files.removeWhere((element) => element.path == "/${params.path}/" || element.path == "/");
return ListFilesResponse(files);
}
}