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

Revert "merge changes?"

This reverts commit e4223d910ff05559e2cb21cba0d166fc1c14ba42.
Neeraj Gupta 3 лет назад
Родитель
Сommit
80afffe3e6

+ 1 - 1
lib/models/file.dart

@@ -231,7 +231,7 @@ class File {
 
   @override
   String toString() {
-    return '''File(generatedID: $generatedID, localID: $localID, 
+    return '''File(generatedID: $generatedID, localID: $localID, title: $title, 
       uploadedFileId: $uploadedFileID, modificationTime: $modificationTime, 
       ownerID: $ownerID, collectionID: $collectionID, updationTime: $updationTime)''';
   }

+ 4 - 0
lib/ui/settings/support_section_widget.dart

@@ -69,6 +69,10 @@ class SupportSectionWidget extends StatelessWidget {
           onTap: () async {
             await sendLogs(context, "report bug", "bug@ente.io");
           },
+          onDoubleTap: () async {
+            final zipFilePath = await getZippedLogsFile(context);
+            await shareLogs(context, "bug@ente.io", zipFilePath);
+        },
           child: SettingsTextItem(
               text: "Report bug 🐞", icon: Icons.navigate_next),
         ),

+ 4 - 5
lib/ui/two_factor_authentication_page.dart

@@ -1,6 +1,5 @@
 import 'package:flutter/material.dart';
 import 'package:flutter/services.dart';
-import 'package:flutter/widgets.dart';
 import 'package:photos/services/user_service.dart';
 import 'package:photos/ui/lifecycle_event_handler.dart';
 import 'package:pinput/pin_put/pin_put.dart';
@@ -53,7 +52,7 @@ class _TwoFactorAuthenticationPageState
     return Scaffold(
       appBar: AppBar(
         title: Text(
-          "two-factor authentication",
+          "Two-factor authentication",
         ),
       ),
       body: _getBody(),
@@ -67,7 +66,7 @@ class _TwoFactorAuthenticationPageState
       mainAxisSize: MainAxisSize.max,
       children: [
         Text(
-          "enter the 6-digit code from\nyour authenticator app",
+          "Enter the 6-digit code from\nyour authenticator app",
           style: TextStyle(
             height: 1.4,
             fontSize: 16,
@@ -112,7 +111,7 @@ class _TwoFactorAuthenticationPageState
           width: double.infinity,
           height: 64,
           child: OutlinedButton(
-            child: Text("verify"),
+            child: Text("Verify"),
             onPressed: _code.length == 6
                 ? () async {
                     _verifyTwoFactorCode(_code);
@@ -130,7 +129,7 @@ class _TwoFactorAuthenticationPageState
             padding: EdgeInsets.all(10),
             child: Center(
               child: Text(
-                "lost device?",
+                "Lost device?",
                 style: TextStyle(
                   decoration: TextDecoration.underline,
                   fontSize: 12,

+ 29 - 18
lib/utils/email_util.dart

@@ -115,16 +115,7 @@ Future<void> sendLogs(
 
 Future<void> _sendLogs(
     BuildContext context, String toEmail, String subject, String body) async {
-  final dialog = createProgressDialog(context, "preparing logs...");
-  await dialog.show();
-  final tempPath = (await getTemporaryDirectory()).path;
-  final zipFilePath = tempPath + "/logs.zip";
-  final logsDirectory = Directory(tempPath + "/logs");
-  var encoder = ZipFileEncoder();
-  encoder.create(zipFilePath);
-  encoder.addDirectory(logsDirectory);
-  encoder.close();
-  await dialog.hide();
+  String zipFilePath = await getZippedLogsFile(context);
   final Email email = Email(
     recipients: [toEmail],
     subject: subject,
@@ -136,13 +127,33 @@ Future<void> _sendLogs(
     await FlutterEmailSender.send(email);
   } catch (e, s) {
     _logger.severe('email sender failed', e, s);
-    final result = await showChoiceDialog(
-        context, "email logs", "please send the logs to $toEmail",
-        firstAction: "copy email", secondAction: "send");
-    if (result != null && result == DialogUserChoice.firstChoice) {
-      await Clipboard.setData(ClipboardData(text: toEmail));
-    }
-    final Size size = MediaQuery.of(context).size;
-    await Share.shareFiles([zipFilePath], sharePositionOrigin: Rect.fromLTWH(0, 0, size.width, size.height / 2));
+    await shareLogs(context, toEmail, zipFilePath);
+  }
+}
+
+Future<String> getZippedLogsFile(BuildContext context) async {
+  final dialog = createProgressDialog(context, "preparing logs...");
+  await dialog.show();
+  final tempPath = (await getTemporaryDirectory()).path;
+  final zipFilePath = tempPath + "/logs.zip";
+  final logsDirectory = Directory(tempPath + "/logs");
+  var encoder = ZipFileEncoder();
+  encoder.create(zipFilePath);
+  encoder.addDirectory(logsDirectory);
+  encoder.close();
+  await dialog.hide();
+  return zipFilePath;
+}
+
+Future<void> shareLogs(
+    BuildContext context, String toEmail, String zipFilePath) async {
+  final result = await showChoiceDialog(
+      context, "email logs", "please send the logs to $toEmail",
+      firstAction: "copy email", secondAction: "send");
+  if (result != null && result == DialogUserChoice.firstChoice) {
+    await Clipboard.setData(ClipboardData(text: toEmail));
   }
+  final Size size = MediaQuery.of(context).size;
+  await Share.shareFiles([zipFilePath],
+      sharePositionOrigin: Rect.fromLTWH(0, 0, size.width, size.height / 2));
 }

+ 2 - 1
pubspec.yaml

@@ -11,6 +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.33+313
 
 environment:
@@ -22,7 +23,7 @@ dependencies:
     git: "https://github.com/jhomlala/alice.git"
   animate_do: ^2.0.0
   archive: ^3.1.2
-  background_fetch: ^1.0.1
+  background_fetch: ^1.0.1lib/utils/file_uploader_util.dart
   bip39: ^1.0.6
   cached_network_image: ^3.0.0
   chewie: