浏览代码

Use shared_collection for incoming collections

Neeraj Gupta 3 年之前
父节点
当前提交
4cc64dcd43
共有 3 个文件被更改,包括 9 次插入10 次删除
  1. 1 1
      lib/ui/collection_page.dart
  2. 6 8
      lib/ui/gallery_app_bar_widget.dart
  3. 2 1
      lib/ui/shared_collections_gallery.dart

+ 1 - 1
lib/ui/collection_page.dart

@@ -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);
 

+ 6 - 8
lib/ui/gallery_app_bar_widget.dart

@@ -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

+ 2 - 1
lib/ui/shared_collections_gallery.dart

@@ -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"));
       },
     );