Browse Source

Merge branch 'main' into replace-choice-dialogs-2

ashilkn 2 years ago
parent
commit
b2bb0b6f57

+ 1 - 0
android/app/src/main/AndroidManifest.xml

@@ -74,6 +74,7 @@
         </intent>
     </queries>
     <uses-permission android:name="android.permission.INTERNET"/>
+    <uses-permission android:name="android.permission.MANAGE_MEDIA"/>
     <uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION"/>
     <uses-permission
             android:name="android.permission.READ_MEDIA_IMAGES"/> <!-- If you want to read images-->

+ 1 - 2
lib/core/constants.dart

@@ -18,8 +18,7 @@ const int batchSize = 1000;
 const photoGridSizeDefault = 4;
 const photoGridSizeMin = 2;
 const photoGridSizeMax = 6;
-const subGalleryLimitDefault = 80;
-const subGalleryLimitMin = 40;
+const subGalleryMultiplier = 10;
 
 // used to identify which ente file are available in app cache
 // todo: 6Jun22: delete old media identifier after 3 months

+ 8 - 0
lib/services/ignored_files_service.dart

@@ -99,6 +99,14 @@ class IgnoredFilesService {
     );
   }
 
+  String? getIgnoredIDForFile(File file) {
+    return _getIgnoreID(
+      file.localID,
+      file.deviceFolder,
+      file.title,
+    );
+  }
+
   // _getIgnoreID will return null if don't have sufficient information
   // to ignore the file based on the platform. Uploads from web or files shared to
   // end usually don't have local id.

+ 4 - 6
lib/ui/huge_listview/lazy_loading_gallery.dart

@@ -32,7 +32,7 @@ class LazyLoadingGallery extends StatefulWidget {
   final String tag;
   final String? logTag;
   final Stream<int> currentIndexStream;
-  final int? photoGirdSize;
+  final int photoGirdSize;
 
   LazyLoadingGallery(
     this.files,
@@ -190,7 +190,7 @@ class _LazyLoadingGalleryState extends State<LazyLoadingGallery> {
             getDayWidget(
               context,
               _files[0].creationTime!,
-              widget.photoGirdSize!,
+              widget.photoGirdSize,
             ),
             ValueListenableBuilder(
               valueListenable: _showSelectAllButton,
@@ -234,7 +234,7 @@ class _LazyLoadingGalleryState extends State<LazyLoadingGallery> {
             ? _getGallery()
             : PlaceHolderWidget(
                 _files.length,
-                widget.photoGirdSize!,
+                widget.photoGirdSize,
               ),
       ],
     );
@@ -242,9 +242,7 @@ class _LazyLoadingGalleryState extends State<LazyLoadingGallery> {
 
   Widget _getGallery() {
     final List<Widget> childGalleries = [];
-    final subGalleryItemLimit = widget.photoGirdSize! < photoGridSizeDefault
-        ? subGalleryLimitMin
-        : subGalleryLimitDefault;
+    final subGalleryItemLimit = widget.photoGirdSize * subGalleryMultiplier;
     for (int index = 0; index < _files.length; index += subGalleryItemLimit) {
       childGalleries.add(
         LazyLoadingGridView(

+ 3 - 1
lib/ui/settings_page.dart

@@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
 import 'package:photos/core/configuration.dart';
 import 'package:photos/core/event_bus.dart';
 import 'package:photos/events/opened_settings_event.dart';
+import 'package:photos/services/feature_flag_service.dart';
 import 'package:photos/theme/colors.dart';
 import 'package:photos/theme/ente_theme.dart';
 import 'package:photos/ui/settings/about_section_widget.dart';
@@ -99,7 +100,8 @@ class SettingsPage extends StatelessWidget {
       const AboutSectionWidget(),
     ]);
 
-    if (hasLoggedIn) {
+    if (hasLoggedIn &&
+        FeatureFlagService.instance.isInternalUserOrDebugBuild()) {
       contents.addAll([sectionSpacing, const DebugSectionWidget()]);
     }
     contents.add(const AppVersionWidget());

+ 7 - 3
lib/ui/viewer/gallery/device_folder_page.dart

@@ -195,12 +195,16 @@ class _BackupHeaderWidgetState extends State<BackupHeaderWidget> {
   ) async {
     final List<File> deviceCollectionFiles = await filesInDeviceCollection;
 
-    final localIDsOfFiles = <String>{};
+    final ignoredIdsForFile = <String>{};
     for (File file in deviceCollectionFiles) {
-      localIDsOfFiles.add(file.localID!);
+      final String? ignoreID =
+          IgnoredFilesService.instance.getIgnoredIDForFile(file);
+      if (ignoreID != null) {
+        ignoredIdsForFile.add(ignoreID);
+      }
     }
     final ignoredFiles = await IgnoredFilesService.instance.ignoredIDs;
-    return ignoredFiles.intersection(localIDsOfFiles).isNotEmpty;
+    return ignoredFiles.intersection(ignoredIdsForFile).isNotEmpty;
   }
 }
 

+ 1 - 1
lib/ui/viewer/gallery/gallery.dart

@@ -76,7 +76,7 @@ class _GalleryState extends State<Gallery> {
   StreamSubscription<TabDoubleTapEvent>? _tabDoubleTapEvent;
   final _forceReloadEventSubscriptions = <StreamSubscription<Event>>[];
   String? _logTag;
-  int? _photoGridSize;
+  late int _photoGridSize;
 
   @override
   void initState() {

+ 1 - 1
pubspec.yaml

@@ -12,7 +12,7 @@ description: ente photos application
 # Read more about iOS versioning at
 # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
 
-version: 0.7.6+406
+version: 0.7.8+408
 
 environment:
   sdk: '>=2.17.0 <3.0.0'