ソースを参照

Merge remote-tracking branch 'origin/master' into family_plan

Neeraj Gupta 3 年 前
コミット
f1719517cd

+ 17 - 17
ios/Podfile.lock

@@ -26,15 +26,15 @@ PODS:
     - FirebaseCoreDiagnostics (~> 8.0)
     - GoogleUtilities/Environment (~> 7.6)
     - GoogleUtilities/Logger (~> 7.6)
-  - FirebaseCoreDiagnostics (8.9.0):
+  - FirebaseCoreDiagnostics (8.12.0):
     - GoogleDataTransport (~> 9.1)
-    - GoogleUtilities/Environment (~> 7.6)
-    - GoogleUtilities/Logger (~> 7.6)
+    - GoogleUtilities/Environment (~> 7.7)
+    - GoogleUtilities/Logger (~> 7.7)
     - nanopb (~> 2.30908.0)
-  - FirebaseInstallations (8.9.0):
+  - FirebaseInstallations (8.12.0):
     - FirebaseCore (~> 8.0)
-    - GoogleUtilities/Environment (~> 7.6)
-    - GoogleUtilities/UserDefaults (~> 7.6)
+    - GoogleUtilities/Environment (~> 7.7)
+    - GoogleUtilities/UserDefaults (~> 7.7)
     - PromisesObjC (< 3.0, >= 1.2)
   - FirebaseMessaging (8.9.0):
     - FirebaseCore (~> 8.0)
@@ -82,22 +82,22 @@ PODS:
     - GoogleUtilities/Environment (~> 7.2)
     - nanopb (~> 2.30908.0)
     - PromisesObjC (< 3.0, >= 1.2)
-  - GoogleUtilities/AppDelegateSwizzler (7.6.0):
+  - GoogleUtilities/AppDelegateSwizzler (7.7.0):
     - GoogleUtilities/Environment
     - GoogleUtilities/Logger
     - GoogleUtilities/Network
-  - GoogleUtilities/Environment (7.6.0):
+  - GoogleUtilities/Environment (7.7.0):
     - PromisesObjC (< 3.0, >= 1.2)
-  - GoogleUtilities/Logger (7.6.0):
+  - GoogleUtilities/Logger (7.7.0):
     - GoogleUtilities/Environment
-  - GoogleUtilities/Network (7.6.0):
+  - GoogleUtilities/Network (7.7.0):
     - GoogleUtilities/Logger
     - "GoogleUtilities/NSData+zlib"
     - GoogleUtilities/Reachability
-  - "GoogleUtilities/NSData+zlib (7.6.0)"
-  - GoogleUtilities/Reachability (7.6.0):
+  - "GoogleUtilities/NSData+zlib (7.7.0)"
+  - GoogleUtilities/Reachability (7.7.0):
     - GoogleUtilities/Logger
-  - GoogleUtilities/UserDefaults (7.6.0):
+  - GoogleUtilities/UserDefaults (7.7.0):
     - GoogleUtilities/Logger
   - image_editor (0.0.1):
     - Flutter
@@ -338,8 +338,8 @@ SPEC CHECKSUMS:
   firebase_core: f770e033e790657b3505f04be4cb24c482912f11
   firebase_messaging: 0c8d1a1732487db7f332fb65232053e93201e2fb
   FirebaseCore: 599ee609343eaf4941bd188f85e3aa077ffe325b
-  FirebaseCoreDiagnostics: 5daa63f1c1409d981a2d5007daa100b36eac6a34
-  FirebaseInstallations: caa7c8e0d3e2345b8829d2fa9ca1b4dfbf2fcc85
+  FirebaseCoreDiagnostics: 3b40dfadef5b90433a60ae01f01e90fe87aa76aa
+  FirebaseInstallations: 25764cf322e77f99449395870a65b2bef88e1545
   FirebaseMessaging: 82c4a48638f53f7b184f3cc9f6cd2cbe533ab316
   fk_user_agent: 1f47ec39291e8372b1d692b50084b0d54103c545
   Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
@@ -354,7 +354,7 @@ SPEC CHECKSUMS:
   fluttertoast: 6122fa75143e992b1d3470f61000f591a798cc58
   FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
   GoogleDataTransport: 629c20a4d363167143f30ea78320d5a7eb8bd940
-  GoogleUtilities: 684ee790a24f73ebb2d1d966e9711c203f2a4237
+  GoogleUtilities: e0913149f6b0625b553d70dae12b49fc62914fd1
   image_editor: c1d038630eedea60d2dee9c14f36aa66c7f9cfab
   in_app_purchase: 3e2155afa9d03d4fa32d9e62d567885080ce97d6
   KTVCocoaHTTPServer: df8d7b861e603ff8037e9b2138aca2563a6b768d
@@ -392,4 +392,4 @@ SPEC CHECKSUMS:
 
 PODFILE CHECKSUM: 58fb802948678e2071d210cfc8aab09d85c8341b
 
-COCOAPODS: 1.11.2
+COCOAPODS: 1.11.3

+ 4 - 1
lib/ui/collections_gallery_widget.dart

@@ -1,4 +1,5 @@
 import 'dart:async';
+import 'dart:math';
 
 import 'package:flutter/material.dart';
 import 'package:flutter/widgets.dart';
@@ -120,6 +121,8 @@ class _CollectionsGalleryWidgetState extends State<CollectionsGalleryWidget>
   }
 
   Widget _getCollectionsGalleryWidget(CollectionItems items) {
+    Size size = MediaQuery.of(context).size;
+    int albumsCountInOneRow = max(size.width~/220.0, 2);
     return SingleChildScrollView(
       child: Container(
         margin: const EdgeInsets.only(bottom: 50),
@@ -175,7 +178,7 @@ class _CollectionsGalleryWidgetState extends State<CollectionsGalleryWidget>
                     itemCount:
                         items.collections.length + 1, // To include the + button
                     gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
-                      crossAxisCount: 2,
+                      crossAxisCount: albumsCountInOneRow,
                       mainAxisSpacing: 12,
                     ),
                   )

+ 3 - 1
lib/ui/fading_bottom_bar.dart

@@ -33,6 +33,7 @@ class FadingBottomBar extends StatefulWidget {
 
 class FadingBottomBarState extends State<FadingBottomBar> {
   bool _shouldHide = false;
+  final GlobalKey shareButtonKey = GlobalKey();
 
   @override
   Widget build(BuildContext context) {
@@ -131,11 +132,12 @@ class FadingBottomBarState extends State<FadingBottomBar> {
           child: Padding(
             padding: const EdgeInsets.only(top: 12, bottom: 12),
             child: IconButton(
+              key: shareButtonKey,
               icon: Icon(Platform.isAndroid
                   ? Icons.share_outlined
                   : CupertinoIcons.share),
               onPressed: () {
-                share(context, [widget.file]);
+                share(context, [widget.file], shareButtonKey: shareButtonKey);
               },
             ),
           ),

+ 3 - 2
lib/ui/gallery_app_bar_widget.dart

@@ -56,7 +56,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
   StreamSubscription _userAuthEventSubscription;
   Function() _selectedFilesListener;
   String _appBarTitle;
-
+  final GlobalKey shareButtonKey = GlobalKey();
   @override
   void initState() {
     _selectedFilesListener = () {
@@ -341,6 +341,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
       Tooltip(
         message: "share",
         child: IconButton(
+          key: shareButtonKey,
           icon: Icon(
               Platform.isAndroid ? Icons.share_outlined : CupertinoIcons.share),
           onPressed: () {
@@ -468,7 +469,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
   }
 
   void _shareSelected(BuildContext context) {
-    share(context, widget.selectedFiles.files.toList());
+    share(context, widget.selectedFiles.files.toList(), shareButtonKey: shareButtonKey);
   }
 
   void _showRemoveFromCollectionSheet(BuildContext context) {

+ 3 - 1
lib/ui/memories_widget.dart

@@ -205,6 +205,7 @@ class _FullScreenMemoryState extends State<FullScreenMemory> {
   double _opacity = 1;
   PageController _pageController;
   bool _shouldDisableScroll = false;
+  final GlobalKey shareButtonKey = GlobalKey();
 
   @override
   void initState() {
@@ -231,9 +232,10 @@ class _FullScreenMemoryState extends State<FullScreenMemory> {
         elevation: 0,
         actions: [
           IconButton(
+            key: shareButtonKey,
             icon: Icon(Icons.share),
             onPressed: () {
-              share(context, [file]);
+              share(context, [file], shareButtonKey: shareButtonKey);
             },
           ),
         ],

+ 1 - 3
lib/ui/settings/support_section_widget.dart

@@ -59,9 +59,7 @@ class SupportSectionWidget extends StatelessWidget {
         GestureDetector(
           behavior: HitTestBehavior.translucent,
           onTap: () async {
-            await sendLogs(context, "report bug", "bug@ente.io", postShare: () {
-              showToast("thanks for reporting a bug!");
-            });
+            await sendLogs(context, "report bug", "bug@ente.io");
           },
           child: SettingsTextItem(
               text: "report bug 🐞", icon: Icons.navigate_next),

+ 4 - 1
lib/ui/shared_collections_gallery.dart

@@ -1,4 +1,5 @@
 import 'dart:async';
+import 'dart:math';
 
 import 'package:flutter/material.dart';
 import 'package:flutter/widgets.dart';
@@ -107,6 +108,8 @@ class _SharedCollectionGalleryState extends State<SharedCollectionGallery>
   }
 
   Widget _getSharedCollectionsGallery(SharedCollections collections) {
+    Size size = MediaQuery.of(context).size;
+    int albumsCountInOneRow = max(size.width~/220.0, 2);
     return SingleChildScrollView(
       child: Container(
         margin: const EdgeInsets.only(bottom: 50),
@@ -125,7 +128,7 @@ class _SharedCollectionGalleryState extends State<SharedCollectionGallery>
                     },
                     itemCount: collections.incoming.length,
                     gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
-                      crossAxisCount: 2,
+                      crossAxisCount: albumsCountInOneRow,
                     ),
                   )
                 : _getIncomingCollectionEmptyState(),

+ 3 - 2
lib/utils/email_util.dart

@@ -138,10 +138,11 @@ Future<void> _sendLogs(
     _logger.severe('email sender failed', e, s);
     final result = await showChoiceDialog(
         context, "email logs", "please send the logs to $toEmail",
-        firstAction: "copy email", secondAction: "ok");
+        firstAction: "copy email", secondAction: "send");
     if (result != null && result == DialogUserChoice.firstChoice) {
       await Clipboard.setData(ClipboardData(text: toEmail));
     }
-    await Share.shareFiles([zipFilePath]);
+    final Size size = MediaQuery.of(context).size;
+    await Share.shareFiles([zipFilePath], sharePositionOrigin: Rect.fromLTWH(0, 0, size.width, size.height / 2));
   }
 }

+ 23 - 2
lib/utils/share_util.dart

@@ -11,12 +11,14 @@ import 'package:photos/models/file_type.dart';
 import 'package:photos/utils/dialog_util.dart';
 import 'package:photos/utils/exif_util.dart';
 import 'package:photos/utils/file_util.dart';
+import 'package:photos/utils/toast_util.dart';
 import 'package:receive_sharing_intent/receive_sharing_intent.dart';
 import 'package:share_plus/share_plus.dart';
 
 final _logger = Logger("ShareUtil");
 // share is used to share media/files from ente to other apps
-Future<void> share(BuildContext context, List<File> files) async {
+Future<void> share(BuildContext context, List<File> files,
+    {GlobalKey shareButtonKey}) async {
   final dialog = createProgressDialog(context, "preparing...");
   await dialog.show();
   final List<Future<String>> pathFutures = [];
@@ -31,7 +33,26 @@ Future<void> share(BuildContext context, List<File> files) async {
   }
   final paths = await Future.wait(pathFutures);
   await dialog.hide();
-  return Share.shareFiles(paths);
+  return Share.shareFiles(
+    paths,
+    // required for ipad https://github.com/flutter/flutter/issues/47220#issuecomment-608453383
+    sharePositionOrigin: shareButtonRect(context, shareButtonKey),
+  );
+}
+
+Rect shareButtonRect(BuildContext context, GlobalKey shareButtonKey) {
+  Size size = MediaQuery.of(context).size;
+  RenderBox renderBox = shareButtonKey?.currentContext?.findRenderObject();
+  if (renderBox == null) {
+    return Rect.fromLTWH(0, 0, size.width, size.height / 2);
+  }
+  size = renderBox.size;
+  Offset position = renderBox.localToGlobal(Offset.zero);
+  return Rect.fromCenter(
+    center: position + Offset(size.width / 2, size.height / 2),
+    width: size.width,
+    height: size.height,
+  );
 }
 
 Future<void> shareText(String text) async {

+ 6 - 6
pubspec.lock

@@ -964,42 +964,42 @@ packages:
       name: share_plus
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "2.2.0"
+    version: "4.0.4"
   share_plus_linux:
     dependency: transitive
     description:
       name: share_plus_linux
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "2.0.4"
+    version: "3.0.0"
   share_plus_macos:
     dependency: transitive
     description:
       name: share_plus_macos
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "2.0.2"
+    version: "3.0.0"
   share_plus_platform_interface:
     dependency: transitive
     description:
       name: share_plus_platform_interface
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "2.0.1"
+    version: "3.0.2"
   share_plus_web:
     dependency: transitive
     description:
       name: share_plus_web
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "2.0.4"
+    version: "3.0.0"
   share_plus_windows:
     dependency: transitive
     description:
       name: share_plus_windows
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "2.0.3"
+    version: "3.0.0"
   shared_preferences:
     dependency: "direct main"
     description:

+ 2 - 2
pubspec.yaml

@@ -11,7 +11,7 @@ description: ente photos application
 # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
 # Read more about iOS versioning at
 # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
-version: 0.5.13+293
+version: 0.5.16+296
 
 environment:
   sdk: ">=2.10.0 <3.0.0"
@@ -88,7 +88,7 @@ dependencies:
   receive_sharing_intent: ^1.4.5
   scrollable_positioned_list: ^0.2.2
   sentry: ^5.0.0
-  share_plus: ^2.2.0
+  share_plus: ^4.0.4
   shared_preferences: ^2.0.5
   sqflite: ^2.0.0+3
   sqflite_migration: ^0.3.0

+ 1 - 1
thirdparty/plugins

@@ -1 +1 @@
-Subproject commit a3216f71ee2376c671119c661d86500ae2849463
+Subproject commit db016cc95c6337766617d644585a835f7693a7df