Browse Source

refactor(neon_files): Adjust to updated WebDAV methods

pull/520/head
jld3103 1 year ago
parent
commit
698168013f
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 11
      packages/neon/neon_files/lib/blocs/browser.dart
  2. 11
      packages/neon/neon_files/lib/blocs/files.dart
  3. 2
      packages/neon/neon_files/lib/utils/download_task.dart
  4. 2
      packages/neon/neon_files/lib/utils/upload_task.dart

11
packages/neon/neon_files/lib/blocs/browser.dart

@ -44,9 +44,9 @@ class FilesBrowserBloc extends InteractiveBloc implements FilesBrowserBlocEvents
client.id,
'files-${path.value.join('/')}',
files,
() async => client.webdav.ls(
() async => client.webdav.propfind(
path.value.join('/'),
prop: WebDavPropfindProp.fromBools(
prop: WebDavPropWithoutValues.fromBools(
davgetcontenttype: true,
davgetetag: true,
davgetlastmodified: true,
@ -69,11 +69,6 @@ class FilesBrowserBloc extends InteractiveBloc implements FilesBrowserBlocEvents
@override
void createFolder(final List<String> path) {
wrapAction(
() async => client.webdav.mkdir(
path.join('/'),
safe: false,
),
);
wrapAction(() async => client.webdav.mkcol(path.join('/')));
}
}

11
packages/neon/neon_files/lib/blocs/files.dart

@ -65,7 +65,12 @@ class FilesBloc extends InteractiveBloc implements FilesBlocEvents, FilesBlocSta
@override
void addFavorite(final List<String> path) {
wrapAction(() async => client.webdav.updateProps(path.join('/'), WebDavProp(ocfavorite: 1)));
wrapAction(
() async => client.webdav.proppatch(
path.join('/'),
set: WebDavProp(ocfavorite: 1),
),
);
}
@override
@ -119,9 +124,9 @@ class FilesBloc extends InteractiveBloc implements FilesBlocEvents, FilesBlocSta
@override
void removeFavorite(final List<String> path) {
wrapAction(
() async => client.webdav.updateProps(
() async => client.webdav.proppatch(
path.join('/'),
WebDavProp(ocfavorite: 0),
set: WebDavProp(ocfavorite: 0),
),
);
}

2
packages/neon/neon_files/lib/utils/download_task.dart

@ -13,7 +13,7 @@ class DownloadTask {
Future execute(final NextcloudClient client, final IOSink sink) async {
final completer = Completer();
final response = await client.webdav.downloadStream(path.join('/'));
final response = await client.webdav.getStream(path.join('/'));
var downloaded = 0;
response.listen((final chunk) async {

2
packages/neon/neon_files/lib/utils/upload_task.dart

@ -16,7 +16,7 @@ class UploadTask {
Future execute(final NextcloudClient client, final Stream<List<int>> stream) async {
var uploaded = 0;
await client.webdav.uploadStream(
await client.webdav.putStream(
stream.map((final chunk) {
uploaded += chunk.length;
_streamController.add((uploaded / size * 100).toInt());

Loading…
Cancel
Save