Просмотр исходного кода

Revert "Hide incoming shared (#1584)"

This reverts commit 3ed2cae6da1c9c6aa303eccdf8e4c4c82b1ea493, reversing
changes made to 2a24d2f031909a1a4ccf04917578042897238246.
ashilkn 1 год назад
Родитель
Сommit
4e68907bdf

+ 0 - 10
lib/generated/l10n.dart

@@ -8157,16 +8157,6 @@ class S {
       args: [],
       args: [],
     );
     );
   }
   }
-
-  /// `Archive shared albums`
-  String get archiveSharedAlbums {
-    return Intl.message(
-      'Archive shared albums',
-      name: 'archiveSharedAlbums',
-      desc: '',
-      args: [],
-    );
-  }
 }
 }
 
 
 class AppLocalizationDelegate extends LocalizationsDelegate<S> {
 class AppLocalizationDelegate extends LocalizationsDelegate<S> {

+ 1 - 2
lib/l10n/intl_en.arb

@@ -1159,6 +1159,5 @@
   "signOutFromOtherDevices": "Sign out from other devices",
   "signOutFromOtherDevices": "Sign out from other devices",
   "signOutOtherBody": "If you think someone might know your password, you can force all other devices using your account to sign out.",
   "signOutOtherBody": "If you think someone might know your password, you can force all other devices using your account to sign out.",
   "signOutOtherDevices": "Sign out other devices",
   "signOutOtherDevices": "Sign out other devices",
-  "doNotSignOut": "Do not sign out",
-  "archiveSharedAlbums": "Archive shared albums"
+  "doNotSignOut": "Do not sign out"
 }
 }

+ 11 - 19
lib/services/collections_service.dart

@@ -147,7 +147,7 @@ class CollectionsService {
       );
       );
     }
     }
     await _updateDB(updatedCollections);
     await _updateDB(updatedCollections);
-    await _prefs.setInt(_collectionsSyncTimeKey, maxUpdationTime);
+    _prefs.setInt(_collectionsSyncTimeKey, maxUpdationTime);
     watch.logAndReset("till DB insertion ${updatedCollections.length}");
     watch.logAndReset("till DB insertion ${updatedCollections.length}");
     for (final collection in fetchedCollections) {
     for (final collection in fetchedCollections) {
       _cacheLocalPathAndCollection(collection);
       _cacheLocalPathAndCollection(collection);
@@ -222,24 +222,16 @@ class CollectionsService {
   }
   }
 
 
   Set<int> archivedOrHiddenCollectionIds() {
   Set<int> archivedOrHiddenCollectionIds() {
-    final bool archiveIncomingCollections =
-        LocalSettings.instance.archiveSharedAlbums;
-    final int ownerID = _config.getUserID()!;
-    final Set<int> result = <int>{};
-    for (final collection in _collectionIDToCollections.values) {
-      if (collection.isHidden() ||
-          collection.isArchived() ||
-          collection.hasShareeArchived()) {
-        result.add(collection.id);
-        continue;
-      }
-      if (archiveIncomingCollections) {
-        if (collection.owner?.id != ownerID) {
-          result.add(collection.id);
-        }
-      }
-    }
-    return result;
+    return _collectionIDToCollections.values
+        .toList()
+        .where(
+          (element) =>
+              element.hasShareeArchived() ||
+              element.isHidden() ||
+              element.isArchived(),
+        )
+        .map((e) => e.id)
+        .toSet();
   }
   }
 
 
   int getCollectionSyncTime(int collectionID) {
   int getCollectionSyncTime(int collectionID) {

+ 1 - 30
lib/ui/settings/advanced_settings_screen.dart

@@ -2,8 +2,6 @@ import "dart:async";
 
 
 import 'package:flutter/material.dart';
 import 'package:flutter/material.dart';
 import "package:photos/core/error-reporting/super_logging.dart";
 import "package:photos/core/error-reporting/super_logging.dart";
-import "package:photos/core/event_bus.dart";
-import "package:photos/events/force_reload_home_gallery_event.dart";
 import "package:photos/generated/l10n.dart";
 import "package:photos/generated/l10n.dart";
 import "package:photos/services/memories_service.dart";
 import "package:photos/services/memories_service.dart";
 import "package:photos/services/user_remote_flag_service.dart";
 import "package:photos/services/user_remote_flag_service.dart";
@@ -121,32 +119,6 @@ class _AdvancedSettingsScreenState extends State<AdvancedSettingsScreen> {
                             const SizedBox(
                             const SizedBox(
                               height: 24,
                               height: 24,
                             ),
                             ),
-                            MenuItemWidget(
-                              captionedTextWidget: CaptionedTextWidget(
-                                title: S.of(context).archiveSharedAlbums,
-                              ),
-                              menuItemColor: colorScheme.fillFaint,
-                              singleBorderRadius: 8,
-                              alignCaptionedTextToLeft: true,
-                              trailingWidget: ToggleSwitchWidget(
-                                value: () =>
-                                    LocalSettings.instance.archiveSharedAlbums,
-                                onChanged: () async {
-                                  await LocalSettings.instance
-                                      .setArchiveSharedAlbums(
-                                    !LocalSettings.instance.archiveSharedAlbums,
-                                  );
-                                  Bus.instance.fire(
-                                    ForceReloadHomeGalleryEvent(
-                                      "Hide/show shared albums",
-                                    ),
-                                  );
-                                },
-                              ),
-                            ),
-                            const SizedBox(
-                              height: 24,
-                            ),
                             MenuItemWidget(
                             MenuItemWidget(
                               captionedTextWidget: CaptionedTextWidget(
                               captionedTextWidget: CaptionedTextWidget(
                                 title: S.of(context).manageDeviceStorage,
                                 title: S.of(context).manageDeviceStorage,
@@ -159,8 +131,7 @@ class _AdvancedSettingsScreenState extends State<AdvancedSettingsScreen> {
                               singleBorderRadius: 8,
                               singleBorderRadius: 8,
                               alignCaptionedTextToLeft: true,
                               alignCaptionedTextToLeft: true,
                               onTap: () async {
                               onTap: () async {
-                                await routeToPage(
-                                    context, const AppStorageViewer());
+                                routeToPage(context, const AppStorageViewer());
                               },
                               },
                             ),
                             ),
                             const SizedBox(
                             const SizedBox(

+ 0 - 9
lib/utils/local_settings.dart

@@ -13,7 +13,6 @@ class LocalSettings {
   static final LocalSettings instance = LocalSettings._privateConstructor();
   static final LocalSettings instance = LocalSettings._privateConstructor();
   static const kCollectionSortPref = "collection_sort_pref";
   static const kCollectionSortPref = "collection_sort_pref";
   static const kPhotoGridSize = "photo_grid_size";
   static const kPhotoGridSize = "photo_grid_size";
-  static const kArchiveSharedAlbums = "archive_shared_albums";
   static const kRateUsShownCount = "rate_us_shown_count";
   static const kRateUsShownCount = "rate_us_shown_count";
   static const kRateUsPromptThreshold = 2;
   static const kRateUsPromptThreshold = 2;
 
 
@@ -39,18 +38,10 @@ class LocalSettings {
     }
     }
   }
   }
 
 
-  bool get archiveSharedAlbums {
-    return _prefs.getBool(kArchiveSharedAlbums) ?? false;
-  }
-
   Future<void> setPhotoGridSize(int value) async {
   Future<void> setPhotoGridSize(int value) async {
     await _prefs.setInt(kPhotoGridSize, value);
     await _prefs.setInt(kPhotoGridSize, value);
   }
   }
 
 
-  Future<void> setArchiveSharedAlbums(bool value) async {
-    await _prefs.setBool(kArchiveSharedAlbums, value);
-  }
-
   int getRateUsShownCount() {
   int getRateUsShownCount() {
     if (_prefs.containsKey(kRateUsShownCount)) {
     if (_prefs.containsKey(kRateUsShownCount)) {
       return _prefs.getInt(kRateUsShownCount)!;
       return _prefs.getInt(kRateUsShownCount)!;