Browse Source

Sharing: Add collect photos option

Neeraj Gupta 2 years ago
parent
commit
9014d5c5a5

+ 7 - 3
lib/ui/actions/collection/collection_sharing_actions.dart

@@ -31,15 +31,19 @@ class CollectionActions {
 
   Future<bool> enableUrl(
     BuildContext context,
-    Collection collection,
-  ) async {
+    Collection collection, {
+    bool enableCollect = false,
+  }) async {
     final dialog = createProgressDialog(
       context,
       "Creating link...",
     );
     try {
       await dialog.show();
-      await CollectionsService.instance.createShareUrl(collection);
+      await CollectionsService.instance.createShareUrl(
+        collection,
+        enableCollect: enableCollect,
+      );
       dialog.hide();
       return true;
     } catch (e) {

+ 25 - 2
lib/ui/sharing/share_collection_page.dart

@@ -198,7 +198,7 @@ class _ShareCollectionPageState extends State<ShareCollectionPage> {
         ],
       );
     } else {
-      children.add(
+      children.addAll([
         MenuItemWidget(
           captionedTextWidget: const CaptionedTextWidget(
             title: "Create public link",
@@ -206,6 +206,7 @@ class _ShareCollectionPageState extends State<ShareCollectionPage> {
           leadingIcon: Icons.link,
           menuItemColor: getEnteColorScheme(context).fillFaint,
           pressedColor: getEnteColorScheme(context).fillFaint,
+          isBottomBorderRadiusRemoved: true,
           onTap: () async {
             final bool result =
                 await collectionActions.enableUrl(context, widget.collection);
@@ -214,7 +215,29 @@ class _ShareCollectionPageState extends State<ShareCollectionPage> {
             }
           },
         ),
-      );
+        DividerWidget(
+          dividerType: DividerType.menu,
+          bgColor: getEnteColorScheme(context).fillFaint,
+        ),
+        MenuItemWidget(
+          captionedTextWidget: const CaptionedTextWidget(
+            title: "Collect photos",
+          ),
+          leadingIcon: Icons.link,
+          menuItemColor: getEnteColorScheme(context).fillFaint,
+          pressedColor: getEnteColorScheme(context).fillFaint,
+          onTap: () async {
+            final bool result = await collectionActions.enableUrl(
+              context,
+              widget.collection,
+              enableCollect: true,
+            );
+            if (result && mounted) {
+              setState(() => {});
+            }
+          },
+        ),
+      ]);
       if (_sharees.isEmpty && !hasUrl) {
         children.add(
           const MenuSectionDescriptionWidget(