warn user before sharing an album containing hidden files
This commit is contained in:
parent
5fac3dae60
commit
82b008496a
|
@ -4,12 +4,15 @@ import 'package:flutter/material.dart';
|
|||
import 'package:logging/logging.dart';
|
||||
import 'package:photos/core/configuration.dart';
|
||||
import 'package:photos/core/event_bus.dart';
|
||||
import 'package:photos/db/files_db.dart';
|
||||
import 'package:photos/ente_theme_data.dart';
|
||||
import 'package:photos/events/subscription_purchased_event.dart';
|
||||
import 'package:photos/models/collection.dart';
|
||||
import 'package:photos/models/gallery_type.dart';
|
||||
import 'package:photos/models/magic_metadata.dart';
|
||||
import 'package:photos/models/selected_files.dart';
|
||||
import 'package:photos/services/collections_service.dart';
|
||||
import 'package:photos/ui/common/dialogs.dart';
|
||||
import 'package:photos/ui/common/rename_dialog.dart';
|
||||
import 'package:photos/ui/sharing/share_collection_widget.dart';
|
||||
import 'package:photos/utils/dialog_util.dart';
|
||||
|
@ -128,8 +131,25 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
|
|||
message: "Share",
|
||||
child: IconButton(
|
||||
icon: Icon(Icons.adaptive.share),
|
||||
onPressed: () {
|
||||
_showShareCollectionDialog();
|
||||
onPressed: () async {
|
||||
if (await _collectionHasSharedFiles()) {
|
||||
final choice = await showChoiceDialog(
|
||||
context,
|
||||
'Share hidden items?',
|
||||
"Looks like you're trying to share an album that has some hidden items.\n\nThese hidden items can be seen by the recipient.",
|
||||
firstAction: "Cancel",
|
||||
secondAction: "Share anyway",
|
||||
secondActionColor:
|
||||
Theme.of(context).colorScheme.defaultTextColor,
|
||||
);
|
||||
if (choice != DialogUserChoice.secondChoice) {
|
||||
return;
|
||||
} else {
|
||||
_showShareCollectionDialog();
|
||||
}
|
||||
} else {
|
||||
_showShareCollectionDialog();
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
|
@ -225,4 +245,12 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
|
|||
showGenericErrorDialog(context);
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool> _collectionHasSharedFiles() async {
|
||||
final collectionIDsWithHiddenFiles =
|
||||
await FilesDB.instance.getCollectionIDsOfHiddenFiles(
|
||||
Configuration.instance.getUserID(),
|
||||
);
|
||||
return collectionIDsWithHiddenFiles.contains(widget.collection.id);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue