merge changes?

This commit is contained in:
ashilkn 2022-06-06 11:58:49 +05:30
parent 9336975931
commit e4223d910f
6 changed files with 26 additions and 41 deletions

View file

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

View file

@ -69,10 +69,6 @@ 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),
),

View file

@ -1,5 +1,6 @@
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';
@ -52,7 +53,7 @@ class _TwoFactorAuthenticationPageState
return Scaffold(
appBar: AppBar(
title: Text(
"Two-factor authentication",
"two-factor authentication",
),
),
body: _getBody(),
@ -66,7 +67,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,
@ -111,7 +112,7 @@ class _TwoFactorAuthenticationPageState
width: double.infinity,
height: 64,
child: OutlinedButton(
child: Text("Verify"),
child: Text("verify"),
onPressed: _code.length == 6
? () async {
_verifyTwoFactorCode(_code);
@ -129,7 +130,7 @@ class _TwoFactorAuthenticationPageState
padding: EdgeInsets.all(10),
child: Center(
child: Text(
"Lost device?",
"lost device?",
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 12,

View file

@ -115,7 +115,16 @@ Future<void> sendLogs(
Future<void> _sendLogs(
BuildContext context, String toEmail, String subject, String body) async {
String zipFilePath = await getZippedLogsFile(context);
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();
final Email email = Email(
recipients: [toEmail],
subject: subject,
@ -127,33 +136,13 @@ Future<void> _sendLogs(
await FlutterEmailSender.send(email);
} catch (e, s) {
_logger.severe('email sender failed', e, s);
await shareLogs(context, toEmail, zipFilePath);
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));
}
}
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));
}

View file

@ -74,8 +74,7 @@ Future<MediaUploadData> _getMediaUploadDataFromAssetFile(ente.File file) async {
if (file.fileType == FileType.livePhoto && io.Platform.isIOS) {
final io.File videoUrl = await Motionphoto.getLivePhotoFile(file.localID);
if (videoUrl == null || !videoUrl.existsSync()) {
String errMsg = "missing livePhoto url for ${file
.toString()} with subType ${file.fileSubType};
String errMsg = "missing livePhoto url for " + file.toString();
_logger.severe(errMsg);
throw InvalidFileUploadState(errMsg);
}

View file

@ -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.32+312
version: 0.5.31+311
environment:
sdk: ">=2.10.0 <3.0.0"