mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-01-23 01:06:21 +01:00
Support link share dirs in Sharing
This commit is contained in:
parent
da1093a606
commit
210e4f845f
2 changed files with 41 additions and 22 deletions
|
@ -2,11 +2,13 @@ import 'package:bloc/bloc.dart';
|
|||
import 'package:kiwi/kiwi.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:nc_photos/account.dart';
|
||||
import 'package:nc_photos/api/api_util.dart' as api_util;
|
||||
import 'package:nc_photos/entity/file.dart';
|
||||
import 'package:nc_photos/entity/file_util.dart' as file_util;
|
||||
import 'package:nc_photos/entity/share.dart';
|
||||
import 'package:nc_photos/entity/share/data_source.dart';
|
||||
import 'package:nc_photos/event/event.dart';
|
||||
import 'package:nc_photos/remote_storage_util.dart' as remote_storage_util;
|
||||
import 'package:nc_photos/use_case/find_file.dart';
|
||||
|
||||
class ListSharingItem {
|
||||
|
@ -175,6 +177,22 @@ class ListSharingBloc extends Bloc<ListSharingBlocEvent, ListSharingBlocState> {
|
|||
final shareRepo = ShareRepo(ShareRemoteDataSource());
|
||||
final shares = await shareRepo.listAll(ev.account);
|
||||
final futures = shares.map((e) async {
|
||||
// include link share dirs
|
||||
if (e.itemType == ShareItemType.folder) {
|
||||
final webdavPath =
|
||||
"${api_util.getWebdavRootUrlRelative(ev.account)}/${e.path}";
|
||||
if (webdavPath.startsWith(
|
||||
remote_storage_util.getRemoteLinkSharesDir(ev.account))) {
|
||||
return ListSharingItem(
|
||||
e,
|
||||
File(
|
||||
path: webdavPath,
|
||||
isCollection: true,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (!file_util.isSupportedMime(e.mimeType)) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -82,6 +82,7 @@ class _SharedFileViewerState extends State<SharedFileViewer> {
|
|||
title: Text(path.withoutExtension(widget.file.filename)),
|
||||
pinned: true,
|
||||
),
|
||||
if (widget.file.isCollection != true)
|
||||
SliverToBoxAdapter(
|
||||
child: SizedBox(
|
||||
height: 256,
|
||||
|
|
Loading…
Reference in a new issue