ソースを参照

use sendEmail for feedback & account deletion

Neeraj Gupta 3 年 前
コミット
44af6608e7
1 ファイル変更10 行追加16 行削除
  1. 10 16
      lib/ui/account/delete_account_page.dart

+ 10 - 16
lib/ui/account/delete_account_page.dart

@@ -1,7 +1,6 @@
 import 'dart:convert';
 
 import 'package:flutter/material.dart';
-import 'package:flutter_email_sender/flutter_email_sender.dart';
 import 'package:flutter_sodium/flutter_sodium.dart';
 import 'package:photos/core/configuration.dart';
 import 'package:photos/models/delete_account.dart';
@@ -11,8 +10,8 @@ import 'package:photos/ui/common/gradient_button.dart';
 import 'package:photos/ui/tools/app_lock.dart';
 import 'package:photos/utils/auth_util.dart';
 import 'package:photos/utils/crypto_util.dart';
+import 'package:photos/utils/email_util.dart';
 import 'package:photos/utils/toast_util.dart';
-import 'package:url_launcher/url_launcher.dart';
 
 class DeleteAccountPage extends StatelessWidget {
   const DeleteAccountPage({
@@ -81,11 +80,10 @@ class DeleteAccountPage extends StatelessWidget {
                 paddingValue: 4,
                 iconData: Icons.check,
                 onTap: () async {
-                  await launchUrl(
-                    Uri(
-                      scheme: "mailto",
-                      path: 'feedback@ente.io',
-                    ),
+                  await sendEmail(
+                    context,
+                    to: 'feedback@ente.io',
+                    subject: '[Feedback]',
                   );
                 },
               ),
@@ -222,15 +220,11 @@ class DeleteAccountPage extends StatelessWidget {
           ),
           onPressed: () async {
             Navigator.of(context, rootNavigator: true).pop('dialog');
-            try {
-              final Email email = Email(
-                recipients: ['account-deletion@ente.io'],
-                isHTML: false,
-              );
-              await FlutterEmailSender.send(email);
-            } catch (e) {
-              launch("mailto:account-deletion@ente.io");
-            }
+            await sendEmail(
+              context,
+              to: 'account-deletion@ente.io',
+              subject: '[Delete account]',
+            );
           },
         ),
         TextButton(