Share only supported in static albums

This commit is contained in:
Ming Ming 2021-10-18 17:29:55 +08:00
parent bcf71f2eb3
commit b533c9caf7
2 changed files with 20 additions and 19 deletions

View file

@ -35,6 +35,7 @@ import 'package:nc_photos/widget/fancy_option_picker.dart';
import 'package:nc_photos/widget/photo_list_helper.dart';
import 'package:nc_photos/widget/photo_list_item.dart';
import 'package:nc_photos/widget/selectable_item_stream_list_mixin.dart';
import 'package:nc_photos/widget/share_album_dialog.dart';
import 'package:nc_photos/widget/simple_input_dialog.dart';
import 'package:nc_photos/widget/viewer.dart';
@ -236,6 +237,15 @@ class _AlbumBrowserState extends State<AlbumBrowser>
context,
widget.account,
_album!,
actions: [
if (_album!.albumFile!.isOwned(widget.account.username) &&
Lab().enableSharedAlbum)
IconButton(
onPressed: () => _onSharePressed(context),
icon: const Icon(Icons.share),
tooltip: L10n.global().shareTooltip,
),
],
menuItemBuilder: (_) => [
if (_album!.albumFile!.isOwned(widget.account.username) &&
Lab().enableSharedAlbum)
@ -310,6 +320,16 @@ class _AlbumBrowserState extends State<AlbumBrowser>
album: _album));
}
void _onSharePressed(BuildContext context) async {
await showDialog(
context: context,
builder: (_) => ShareAlbumDialog(
account: widget.account,
file: _album!.albumFile!,
),
);
}
void _onMenuSelected(BuildContext context, int option) {
switch (option) {
case _menuValueDownload:

View file

@ -11,7 +11,6 @@ import 'package:nc_photos/entity/album/cover_provider.dart';
import 'package:nc_photos/entity/file.dart';
import 'package:nc_photos/entity/file/data_source.dart';
import 'package:nc_photos/k.dart' as k;
import 'package:nc_photos/lab.dart';
import 'package:nc_photos/notified_action.dart';
import 'package:nc_photos/pref.dart';
import 'package:nc_photos/remote_storage_util.dart' as remote_storage_util;
@ -20,7 +19,6 @@ import 'package:nc_photos/use_case/update_album.dart';
import 'package:nc_photos/widget/album_browser_app_bar.dart';
import 'package:nc_photos/widget/selectable_item_stream_list_mixin.dart';
import 'package:nc_photos/widget/selection_app_bar.dart';
import 'package:nc_photos/widget/share_album_dialog.dart';
import 'package:nc_photos/widget/zoom_menu_button.dart';
mixin AlbumBrowserMixin<T extends StatefulWidget>
@ -77,13 +75,6 @@ mixin AlbumBrowserMixin<T extends StatefulWidget>
Pref.inst().setAlbumBrowserZoomLevel(_thumbZoomLevel);
},
),
if (album.albumFile!.isOwned(account.username) &&
Lab().enableSharedAlbum)
IconButton(
onPressed: () => _onSharePressed(context, account, album),
icon: const Icon(Icons.share),
tooltip: L10n.global().shareTooltip,
),
if (album.albumFile?.path.startsWith(
remote_storage_util.getRemotePendingSharedAlbumsDir(account)) ==
true)
@ -237,16 +228,6 @@ mixin AlbumBrowserMixin<T extends StatefulWidget>
}
}
void _onSharePressed(BuildContext context, Account account, Album album) {
showDialog(
context: context,
builder: (_) => ShareAlbumDialog(
account: account,
file: album.albumFile!,
),
);
}
void _onAddToCollectionPressed(
BuildContext context, Account account, Album album) async {
Navigator.of(context).pop();