Use shared_collection for incoming collections

This commit is contained in:
Neeraj Gupta 2021-09-10 23:56:04 +05:30
parent a0cbf3141e
commit 4cc64dcd43
3 changed files with 9 additions and 10 deletions

View file

@ -19,7 +19,7 @@ class CollectionPage extends StatelessWidget {
CollectionPage(this.c,
{this.tagPrefix = "collection",
this.appBarType = GalleryAppBarType.collection,
this.appBarType = GalleryAppBarType.owned_collection,
Key key})
: super(key: key);

View file

@ -20,10 +20,10 @@ import 'package:photos/utils/toast_util.dart';
enum GalleryAppBarType {
homepage,
local_folder,
// indicator for gallery view of collections shared with the user
shared_collection,
collection,
search_results,
incoming_collection,
owned_collection,
search_results
}
class GalleryAppBarWidget extends StatefulWidget {
@ -106,7 +106,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
List<Widget> actions = <Widget>[];
if (Configuration.instance.hasConfiguredAccount() &&
(widget.type == GalleryAppBarType.local_folder ||
widget.type == GalleryAppBarType.collection)) {
widget.type == GalleryAppBarType.owned_collection)) {
actions.add(IconButton(
icon: Icon(Icons.person_add),
onPressed: () {
@ -168,7 +168,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
List<Widget> actions = <Widget>[];
// skip add button for incoming collection till this feature is implemented
if (Configuration.instance.hasConfiguredAccount() &&
widget.type != GalleryAppBarType.incoming_collection) {
widget.type != GalleryAppBarType.shared_collection) {
actions.add(IconButton(
icon:
Icon(Platform.isAndroid ? Icons.add_outlined : CupertinoIcons.add),
@ -193,9 +193,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
_showDeleteSheet(context);
},
));
} else if (widget.type == GalleryAppBarType.collection ||
(widget.type == GalleryAppBarType.shared_collection &&
widget.collection.owner.id == Configuration.instance.getUserID())) {
} else if (widget.type == GalleryAppBarType.owned_collection) {
if (widget.collection.type == CollectionType.folder) {
actions.add(IconButton(
icon: Icon(Platform.isAndroid

View file

@ -347,6 +347,7 @@ class OutgoingCollectionItem extends StatelessWidget {
onTap: () {
final page = CollectionPage(
c,
appBarType: GalleryAppBarType.owned_collection,
tagPrefix: "outgoing_collection",
);
routeToPage(context, page);
@ -422,7 +423,7 @@ class IncomingCollectionItem extends StatelessWidget {
routeToPage(
context,
CollectionPage(c,
appBarType: GalleryAppBarType.incoming_collection,
appBarType: GalleryAppBarType.shared_collection,
tagPrefix: "shared_collection"));
},
);