mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-03-25 08:24:43 +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:kiwi/kiwi.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
import 'package:nc_photos/account.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.dart';
|
||||||
import 'package:nc_photos/entity/file_util.dart' as file_util;
|
import 'package:nc_photos/entity/file_util.dart' as file_util;
|
||||||
import 'package:nc_photos/entity/share.dart';
|
import 'package:nc_photos/entity/share.dart';
|
||||||
import 'package:nc_photos/entity/share/data_source.dart';
|
import 'package:nc_photos/entity/share/data_source.dart';
|
||||||
import 'package:nc_photos/event/event.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';
|
import 'package:nc_photos/use_case/find_file.dart';
|
||||||
|
|
||||||
class ListSharingItem {
|
class ListSharingItem {
|
||||||
|
@ -175,6 +177,22 @@ class ListSharingBloc extends Bloc<ListSharingBlocEvent, ListSharingBlocState> {
|
||||||
final shareRepo = ShareRepo(ShareRemoteDataSource());
|
final shareRepo = ShareRepo(ShareRemoteDataSource());
|
||||||
final shares = await shareRepo.listAll(ev.account);
|
final shares = await shareRepo.listAll(ev.account);
|
||||||
final futures = shares.map((e) async {
|
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)) {
|
if (!file_util.isSupportedMime(e.mimeType)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,31 +82,32 @@ class _SharedFileViewerState extends State<SharedFileViewer> {
|
||||||
title: Text(path.withoutExtension(widget.file.filename)),
|
title: Text(path.withoutExtension(widget.file.filename)),
|
||||||
pinned: true,
|
pinned: true,
|
||||||
),
|
),
|
||||||
SliverToBoxAdapter(
|
if (widget.file.isCollection != true)
|
||||||
child: SizedBox(
|
SliverToBoxAdapter(
|
||||||
height: 256,
|
child: SizedBox(
|
||||||
child: FittedBox(
|
height: 256,
|
||||||
alignment: Alignment.center,
|
child: FittedBox(
|
||||||
fit: BoxFit.cover,
|
alignment: Alignment.center,
|
||||||
clipBehavior: Clip.hardEdge,
|
fit: BoxFit.cover,
|
||||||
child: CachedNetworkImage(
|
clipBehavior: Clip.hardEdge,
|
||||||
cacheManager: CoverCacheManager.inst,
|
child: CachedNetworkImage(
|
||||||
imageUrl: previewUrl,
|
cacheManager: CoverCacheManager.inst,
|
||||||
httpHeaders: {
|
imageUrl: previewUrl,
|
||||||
"Authorization":
|
httpHeaders: {
|
||||||
Api.getAuthorizationHeaderValue(widget.account),
|
"Authorization":
|
||||||
},
|
Api.getAuthorizationHeaderValue(widget.account),
|
||||||
fadeInDuration: const Duration(),
|
},
|
||||||
filterQuality: FilterQuality.high,
|
fadeInDuration: const Duration(),
|
||||||
errorWidget: (context, url, error) {
|
filterQuality: FilterQuality.high,
|
||||||
// just leave it empty
|
errorWidget: (context, url, error) {
|
||||||
return Container();
|
// just leave it empty
|
||||||
},
|
return Container();
|
||||||
imageRenderMethodForWeb: ImageRenderMethodForWeb.HttpGet,
|
},
|
||||||
|
imageRenderMethodForWeb: ImageRenderMethodForWeb.HttpGet,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
SliverToBoxAdapter(
|
SliverToBoxAdapter(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16),
|
||||||
|
|
Loading…
Add table
Reference in a new issue