소스 검색

Merge pull request #319 from ente-io/bug_fixes

Add unsynced local folder for backup before creating public link
Manav 3 년 전
부모
커밋
0c4462c9a0
1개의 변경된 파일16개의 추가작업 그리고 0개의 파일을 삭제
  1. 16 0
      lib/ui/share_collection_widget.dart

+ 16 - 0
lib/ui/share_collection_widget.dart

@@ -7,7 +7,9 @@ import 'package:flutter_typeahead/flutter_typeahead.dart';
 import 'package:fluttercontactpicker/fluttercontactpicker.dart';
 import 'package:fluttercontactpicker/fluttercontactpicker.dart';
 import 'package:logging/logging.dart';
 import 'package:logging/logging.dart';
 import 'package:photos/core/configuration.dart';
 import 'package:photos/core/configuration.dart';
+import 'package:photos/core/event_bus.dart';
 import 'package:photos/db/public_keys_db.dart';
 import 'package:photos/db/public_keys_db.dart';
+import 'package:photos/events/backup_folders_updated_event.dart';
 import 'package:photos/models/collection.dart';
 import 'package:photos/models/collection.dart';
 import 'package:photos/models/public_key.dart';
 import 'package:photos/models/public_key.dart';
 import 'package:photos/services/collections_service.dart';
 import 'package:photos/services/collections_service.dart';
@@ -140,6 +142,20 @@ class _SharingDialogState extends State<SharingDialog> {
                     if (choice != DialogUserChoice.firstChoice) {
                     if (choice != DialogUserChoice.firstChoice) {
                       return;
                       return;
                     }
                     }
+                  } else {
+                    // Add local folder in backup patch before creating
+                    // sharable link
+                    if (widget.collection.type == CollectionType.folder) {
+                      final path = CollectionsService.instance
+                          .decryptCollectionPath(widget.collection);
+                      if (!Configuration.instance
+                          .getPathsToBackUp()
+                          .contains(path)) {
+                        await Configuration.instance
+                            .addPathToFoldersToBeBackedUp(path);
+                        Bus.instance.fire(BackupFoldersUpdatedEvent());
+                      }
+                    }
                   }
                   }
                   final dialog = createProgressDialog(
                   final dialog = createProgressDialog(
                     context,
                     context,