Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Own mobile mail composition

Neeraj Gupta221f8b882534
diff --git a/mobile/apps/auth/android/app/src/main/AndroidManifest.xml b/mobile/apps/auth/android/app/src/main/AndroidManifest.xml
index 50d9278fa0..398e94bd98 100644
--- a/mobile/apps/auth/android/app/src/main/AndroidManifest.xml
+++ b/mobile/apps/auth/android/app/src/main/AndroidManifest.xml
@@ -112,12 +112,6 @@
android:value="https://[email protected]/9"/>
</application>
- <queries>
- <intent>
- <action android:name="android.intent.action.SENDTO"/>
- <data android:scheme="mailto"/>
- </intent>
- </queries>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"
diff --git a/mobile/apps/auth/ios/Podfile.lock b/mobile/apps/auth/ios/Podfile.lock
index 3529790518..d98a8853c3 100644
--- a/mobile/apps/auth/ios/Podfile.lock
+++ b/mobile/apps/auth/ios/Podfile.lock
@@ -41,6 +41,8 @@ PODS:
- DKPhotoGallery/Resource (0.0.19):
- SDWebImage
- SwiftyGif
+ - ente_mail (0.0.1):
+ - Flutter
- ente_qr (0.0.1):
- Flutter
- ente_qr_scanner (0.0.1):
@@ -53,8 +55,6 @@ PODS:
- file_saver (0.0.1):
- Flutter
- Flutter (1.0.0)
- - flutter_email_sender (0.0.1):
- - Flutter
- flutter_local_notifications (0.0.1):
- Flutter
- flutter_native_splash (2.4.3):
@@ -130,13 +130,13 @@ DEPENDENCIES:
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
- cupertino_http (from `.symlinks/plugins/cupertino_http/darwin`)
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
+ - ente_mail (from `.symlinks/plugins/ente_mail/ios`)
- ente_qr (from `.symlinks/plugins/ente_qr/ios`)
- ente_qr_scanner (from `.symlinks/plugins/ente_qr_scanner/ios`)
- ente_screen_cover (from `.symlinks/plugins/ente_screen_cover/ios`)
- file_picker (from `.symlinks/plugins/file_picker/ios`)
- file_saver (from `.symlinks/plugins/file_saver/ios`)
- Flutter (from `Flutter`)
- - flutter_email_sender (from `.symlinks/plugins/flutter_email_sender/ios`)
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
- flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`)
- flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
@@ -175,6 +175,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/cupertino_http/darwin"
device_info_plus:
:path: ".symlinks/plugins/device_info_plus/ios"
+ ente_mail:
+ :path: ".symlinks/plugins/ente_mail/ios"
ente_qr:
:path: ".symlinks/plugins/ente_qr/ios"
ente_qr_scanner:
@@ -187,8 +189,6 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/file_saver/ios"
Flutter:
:path: Flutter
- flutter_email_sender:
- :path: ".symlinks/plugins/flutter_email_sender/ios"
flutter_local_notifications:
:path: ".symlinks/plugins/flutter_local_notifications/ios"
flutter_native_splash:
@@ -232,13 +232,13 @@ SPEC CHECKSUMS:
device_info_plus: 21fcca2080fbcd348be798aa36c3e5ed849eefbe
DKImagePickerController: 946cec48c7873164274ecc4624d19e3da4c1ef3c
DKPhotoGallery: b3834fecb755ee09a593d7c9e389d8b5d6deed60
+ ente_mail: 90753dd584f49ee092759a32d4143ca51db69641
ente_qr: 86beaf5d2644705db9b565b32dd8b82c05fb36af
ente_qr_scanner: 91ee1a2245149fb91f00b5b688285a7c94bb9caa
ente_screen_cover: 6792566774f1c83939f9c1d03ed0a1f1ded45ae4
file_picker: a0560bc09d61de87f12d246fc47d2119e6ef37be
file_saver: 6cdbcddd690cb02b0c1a0c225b37cd805c2bf8b6
Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467
- flutter_email_sender: aa1e9772696691d02cd91fea829856c11efb8e58
flutter_local_notifications: a5a732f069baa862e728d839dd2ebb904737effb
flutter_native_splash: c32d145d68aeda5502d5f543ee38c192065986cf
flutter_secure_storage: 2c2ff13db9e0a5647389bff88b0ecac56e3f3418
diff --git a/mobile/apps/auth/lib/utils/email_util.dart b/mobile/apps/auth/lib/utils/email_util.dart
index b019d2c120..eaa305de2d 100644
--- a/mobile/apps/auth/lib/utils/email_util.dart
+++ b/mobile/apps/auth/lib/utils/email_util.dart
@@ -9,6 +9,7 @@ import 'package:ente_auth/utils/directory_utils.dart' as auth_dir;
import 'package:ente_auth/utils/share_utils.dart' as auth_share;
import 'package:ente_auth/utils/toast_util.dart';
import 'package:ente_logging/logging.dart';
+import 'package:ente_mail/ente_mail.dart';
import 'package:ente_strings/ente_strings.dart';
import 'package:ente_ui/components/buttons/button_widget.dart';
import 'package:ente_ui/components/buttons/models/button_type.dart';
@@ -24,6 +25,7 @@ import 'package:share_plus/share_plus.dart';
import 'package:url_launcher/url_launcher.dart';
final Logger _logger = Logger('email_util');
+const MailComposer _mailComposer = MailComposer();
bool isValidEmail(String? email) {
if (email == null) {
@@ -123,21 +125,6 @@ Future<void> openSupportPage(String? subject, String? body) async {
if (!launched) {
_logger.warning("Failed to open support discussions at $supportUri");
}
- // final String zipFilePath = await getZippedLogsFile(context);
- // final Email email = Email(
- // recipients: [toEmail],
- // subject: subject ?? '',
- // body: body ?? '',
- // attachmentPaths: [zipFilePath],
- // isHTML: false,
- // );
- // try {
- // await FlutterEmailSender.send(email);
- // } catch (e, s) {
- // _logger.severe('email sender failed', e, s);
- // Navigator.of(context, rootNavigator: true).pop();
- // await shareLogs(context, toEmail, zipFilePath);
- // }
}
Future<String> getZippedLogsFile(BuildContext context) async {
@@ -249,25 +236,10 @@ Future<void> sendEmail(
final String clientDebugInfo = await _clientInfo();
final String subject0 = subject ?? '[Support]';
final String body0 = (body ?? '') + clientDebugInfo;
- // final EmailContent email = EmailContent(
- // to: [
- // to,
- // ],
- // subject: subject ?? '[Support]',
- // body: (body ?? '') + clientDebugInfo,
- // );
- if (Platform.isAndroid) {
- // Special handling due to issue in proton mail android client
- // https://github.com/ente/photos-app/pull/253
- final params = buildMailtoUri(to: to, subject: subject0, body: body0);
- if (await canLaunchUrl(params)) {
- await launchUrl(params);
- } else {
- // this will trigger _showNoMailAppsDialog
- throw Exception('Could not launch ${params.toString()}');
- }
- } else {
- if (!context.mounted) return;
+ final result = await _mailComposer.compose(
+ MailDraft(recipient: to, subject: subject0, body: body0),
+ );
+ if (result is MailUnavailable && context.mounted) {
_showNoMailAppsDialog(context, to);
}
} catch (e) {
diff --git a/mobile/apps/auth/pubspec.yaml b/mobile/apps/auth/pubspec.yaml
index 4c4fb97304..5ba7d39d57 100644
--- a/mobile/apps/auth/pubspec.yaml
+++ b/mobile/apps/auth/pubspec.yaml
@@ -45,6 +45,8 @@ dependencies:
path: ../../packages/lock_screen
ente_logging:
path: ../../packages/logging
+ ente_mail:
+ path: ../../packages/mail
ente_network:
path: ../../packages/network
ente_pure_utils:
@@ -71,7 +73,6 @@ dependencies:
flutter_animate: 4.5.2
flutter_context_menu: 0.2.4
flutter_displaymode: 0.6.0
- flutter_email_sender: 7.0.0
flutter_launcher_icons: 0.14.4
flutter_local_notifications: 19.3.0
flutter_localizations:
diff --git a/mobile/apps/locker/android/app/src/main/AndroidManifest.xml b/mobile/apps/locker/android/app/src/main/AndroidManifest.xml
index 3febd237d9..d269fb342f 100644
--- a/mobile/apps/locker/android/app/src/main/AndroidManifest.xml
+++ b/mobile/apps/locker/android/app/src/main/AndroidManifest.xml
@@ -75,11 +75,6 @@
<action android:name="android.intent.action.PROCESS_TEXT"/>
<data android:mimeType="text/plain"/>
</intent>
- <!-- Allow flutter_email_sender to discover installed mail clients on Android 11+ -->
- <intent>
- <action android:name="android.intent.action.SENDTO" />
- <data android:scheme="mailto" />
- </intent>
</queries>
<uses-permission android:name="android.permission.USE_BIOMETRIC"/>
</manifest>
diff --git a/mobile/apps/locker/ios/Podfile.lock b/mobile/apps/locker/ios/Podfile.lock
index 10c52b2d6d..86dc8e418c 100644
--- a/mobile/apps/locker/ios/Podfile.lock
+++ b/mobile/apps/locker/ios/Podfile.lock
@@ -37,6 +37,8 @@ PODS:
- DKPhotoGallery/Resource (0.0.19):
- SDWebImage
- SwiftyGif
+ - ente_mail (0.0.1):
+ - Flutter
- ente_rust (0.0.1):
- Flutter
- ente_screen_cover (0.0.1):
@@ -47,8 +49,6 @@ PODS:
- file_saver (0.0.1):
- Flutter
- Flutter (1.0.0)
- - flutter_email_sender (0.0.1):
- - Flutter
- flutter_native_splash (2.4.3):
- Flutter
- flutter_secure_storage (6.0.0):
@@ -95,12 +95,12 @@ DEPENDENCIES:
- app_links (from `.symlinks/plugins/app_links/ios`)
- cupertino_http (from `.symlinks/plugins/cupertino_http/darwin`)
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
+ - ente_mail (from `.symlinks/plugins/ente_mail/ios`)
- ente_rust (from `.symlinks/plugins/ente_rust/ios`)
- ente_screen_cover (from `.symlinks/plugins/ente_screen_cover/ios`)
- file_picker (from `.symlinks/plugins/file_picker/ios`)
- file_saver (from `.symlinks/plugins/file_saver/ios`)
- Flutter (from `Flutter`)
- - flutter_email_sender (from `.symlinks/plugins/flutter_email_sender/ios`)
- flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`)
- flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
@@ -132,6 +132,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/cupertino_http/darwin"
device_info_plus:
:path: ".symlinks/plugins/device_info_plus/ios"
+ ente_mail:
+ :path: ".symlinks/plugins/ente_mail/ios"
ente_rust:
:path: ".symlinks/plugins/ente_rust/ios"
ente_screen_cover:
@@ -142,8 +144,6 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/file_saver/ios"
Flutter:
:path: Flutter
- flutter_email_sender:
- :path: ".symlinks/plugins/flutter_email_sender/ios"
flutter_native_splash:
:path: ".symlinks/plugins/flutter_native_splash/ios"
flutter_secure_storage:
@@ -181,12 +181,12 @@ SPEC CHECKSUMS:
device_info_plus: 21fcca2080fbcd348be798aa36c3e5ed849eefbe
DKImagePickerController: 946cec48c7873164274ecc4624d19e3da4c1ef3c
DKPhotoGallery: b3834fecb755ee09a593d7c9e389d8b5d6deed60
+ ente_mail: 90753dd584f49ee092759a32d4143ca51db69641
ente_rust: d0197ebd5460e8f67576579452b073d698404abe
ente_screen_cover: 6792566774f1c83939f9c1d03ed0a1f1ded45ae4
file_picker: a0560bc09d61de87f12d246fc47d2119e6ef37be
file_saver: 6cdbcddd690cb02b0c1a0c225b37cd805c2bf8b6
Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467
- flutter_email_sender: aa1e9772696691d02cd91fea829856c11efb8e58
flutter_native_splash: c32d145d68aeda5502d5f543ee38c192065986cf
flutter_secure_storage: 2c2ff13db9e0a5647389bff88b0ecac56e3f3418
fluttertoast: 2c67e14dce98bbdb200df9e1acf610d7a6264ea1
diff --git a/mobile/apps/photos/android/app/src/main/AndroidManifest.xml b/mobile/apps/photos/android/app/src/main/AndroidManifest.xml
index f2bf816bb7..1e08637eb2 100644
--- a/mobile/apps/photos/android/app/src/main/AndroidManifest.xml
+++ b/mobile/apps/photos/android/app/src/main/AndroidManifest.xml
@@ -259,14 +259,6 @@
</receiver>
</application>
- <!-- Android 11: https://developer.android.com/preview/privacy/package-visibility -->
- <!-- https://developer.android.com/training/package-visibility/use-cases -->
- <queries>
- <intent>
- <action android:name="android.intent.action.SENDTO" />
- <data android:scheme="mailto" />
- </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" />
diff --git a/mobile/apps/photos/ios/Podfile.lock b/mobile/apps/photos/ios/Podfile.lock
index c1e96792be..3719e402cb 100644
--- a/mobile/apps/photos/ios/Podfile.lock
+++ b/mobile/apps/photos/ios/Podfile.lock
@@ -16,6 +16,8 @@ PODS:
- Flutter
- ente_cast (0.0.1):
- Flutter
+ - ente_mail (0.0.1):
+ - Flutter
- ente_panorama_viewer (0.0.1):
- Flutter
- ente_photos_platform (0.0.1):
@@ -68,8 +70,6 @@ PODS:
- GoogleUtilities/UserDefaults (~> 8.1)
- nanopb (~> 3.30910.0)
- Flutter (1.0.0)
- - flutter_email_sender (0.0.1):
- - Flutter
- flutter_image_compress_common (1.0.0):
- Flutter
- Mantle
@@ -172,8 +172,6 @@ PODS:
- Flutter
- native_video_player (4.0.0):
- Flutter
- - open_mail_app (0.0.1):
- - Flutter
- OrderedSet (6.0.3)
- package_info_plus (0.4.5):
- Flutter
@@ -252,6 +250,7 @@ DEPENDENCIES:
- cupertino_http (from `.symlinks/plugins/cupertino_http/darwin`)
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
- ente_cast (from `.symlinks/plugins/ente_cast/ios`)
+ - ente_mail (from `.symlinks/plugins/ente_mail/ios`)
- ente_panorama_viewer (from `.symlinks/plugins/ente_panorama_viewer/ios`)
- ente_photos_platform (from `.symlinks/plugins/ente_photos_platform/ios`)
- ente_photos_rust (from `.symlinks/plugins/ente_photos_rust/ios`)
@@ -264,7 +263,6 @@ DEPENDENCIES:
- firebase_core (from `.symlinks/plugins/firebase_core/ios`)
- firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`)
- Flutter (from `Flutter`)
- - flutter_email_sender (from `.symlinks/plugins/flutter_email_sender/ios`)
- flutter_image_compress_common (from `.symlinks/plugins/flutter_image_compress_common/ios`)
- flutter_inappwebview_ios (from `.symlinks/plugins/flutter_inappwebview_ios/ios`)
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
@@ -287,7 +285,6 @@ DEPENDENCIES:
- move_to_background (from `.symlinks/plugins/move_to_background/ios`)
- native_video_editor (from `.symlinks/plugins/native_video_editor/ios`)
- native_video_player (from `.symlinks/plugins/native_video_player/ios`)
- - open_mail_app (from `.symlinks/plugins/open_mail_app/ios`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
- photo_manager (from `.symlinks/plugins/photo_manager/darwin`)
@@ -342,6 +339,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/device_info_plus/ios"
ente_cast:
:path: ".symlinks/plugins/ente_cast/ios"
+ ente_mail:
+ :path: ".symlinks/plugins/ente_mail/ios"
ente_panorama_viewer:
:path: ".symlinks/plugins/ente_panorama_viewer/ios"
ente_photos_platform:
@@ -366,8 +365,6 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/firebase_messaging/ios"
Flutter:
:path: Flutter
- flutter_email_sender:
- :path: ".symlinks/plugins/flutter_email_sender/ios"
flutter_image_compress_common:
:path: ".symlinks/plugins/flutter_image_compress_common/ios"
flutter_inappwebview_ios:
@@ -412,8 +409,6 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/native_video_editor/ios"
native_video_player:
:path: ".symlinks/plugins/native_video_player/ios"
- open_mail_app:
- :path: ".symlinks/plugins/open_mail_app/ios"
package_info_plus:
:path: ".symlinks/plugins/package_info_plus/ios"
permission_handler_apple:
@@ -454,6 +449,7 @@ SPEC CHECKSUMS:
cupertino_http: 94ac07f5ff090b8effa6c5e2c47871d48ab7c86c
device_info_plus: 21fcca2080fbcd348be798aa36c3e5ed849eefbe
ente_cast: a25feb3127397e5fc6aff03a12120916707757d4
+ ente_mail: 90753dd584f49ee092759a32d4143ca51db69641
ente_panorama_viewer: 87bb22e7868c3005314f80c05ee0787aa07edcd8
ente_photos_platform: 9a5d62b4008563bdfefe6a42cc4297c5c19bf70c
ente_photos_rust: 2db1f31cbe3f13ef0f52909a52b1f885b880a6ec
@@ -472,7 +468,6 @@ SPEC CHECKSUMS:
FirebaseInstallations: 317270fec08a5d418fdbc8429282238cab3ac843
FirebaseMessaging: 3b26e2cee503815e01c3701236b020aa9b576f09
Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467
- flutter_email_sender: aa1e9772696691d02cd91fea829856c11efb8e58
flutter_image_compress_common: 1697a328fd72bfb335507c6bca1a65fa5ad87df1
flutter_inappwebview_ios: b89ba3482b96fb25e00c967aae065701b66e9b99
flutter_local_notifications: a5a732f069baa862e728d839dd2ebb904737effb
@@ -500,7 +495,6 @@ SPEC CHECKSUMS:
nanopb: fad817b59e0457d11a5dfbde799381cd727c1275
native_video_editor: a6a0fbb3b418961d09f4fecf5730c740f7210247
native_video_player: 6809dec117e8997161dbfb42a6f90d6df71a504d
- open_mail_app: 7314a609e88eed22d53671279e189af7a0ab0f11
OrderedSet: e539b66b644ff081c73a262d24ad552a69be3a94
package_info_plus: af8e2ca6888548050f16fa2f1938db7b5a5df499
permission_handler_apple: 92d754bbaa7361d436db2d6c3c1c2a0fdcec462e
diff --git a/mobile/apps/photos/ios/Runner.xcodeproj/project.pbxproj b/mobile/apps/photos/ios/Runner.xcodeproj/project.pbxproj
index dd3a2d5362..ea2f91a6ba 100644
--- a/mobile/apps/photos/ios/Runner.xcodeproj/project.pbxproj
+++ b/mobile/apps/photos/ios/Runner.xcodeproj/project.pbxproj
@@ -636,6 +636,7 @@
"${BUILT_PRODUCTS_DIR}/cupertino_http/cupertino_http.framework",
"${BUILT_PRODUCTS_DIR}/device_info_plus/device_info_plus.framework",
"${BUILT_PRODUCTS_DIR}/ente_cast/ente_cast.framework",
+ "${BUILT_PRODUCTS_DIR}/ente_mail/ente_mail.framework",
"${BUILT_PRODUCTS_DIR}/ente_panorama_viewer/ente_panorama_viewer.framework",
"${BUILT_PRODUCTS_DIR}/ente_photos_platform/ente_photos_platform.framework",
"${BUILT_PRODUCTS_DIR}/ente_photos_rust/ente_photos_rust.framework",
@@ -643,7 +644,6 @@
"${BUILT_PRODUCTS_DIR}/ente_rust/ente_rust.framework",
"${BUILT_PRODUCTS_DIR}/ente_screen_cover/ente_screen_cover.framework",
"${BUILT_PRODUCTS_DIR}/file_saver/file_saver.framework",
- "${BUILT_PRODUCTS_DIR}/flutter_email_sender/flutter_email_sender.framework",
"${BUILT_PRODUCTS_DIR}/flutter_image_compress_common/flutter_image_compress_common.framework",
"${BUILT_PRODUCTS_DIR}/flutter_inappwebview_ios/flutter_inappwebview_ios.framework",
"${BUILT_PRODUCTS_DIR}/flutter_local_notifications/flutter_local_notifications.framework",
@@ -668,7 +668,6 @@
"${BUILT_PRODUCTS_DIR}/nanopb/nanopb.framework",
"${BUILT_PRODUCTS_DIR}/native_video_editor/native_video_editor.framework",
"${BUILT_PRODUCTS_DIR}/native_video_player/native_video_player.framework",
- "${BUILT_PRODUCTS_DIR}/open_mail_app/open_mail_app.framework",
"${BUILT_PRODUCTS_DIR}/package_info_plus/package_info_plus.framework",
"${BUILT_PRODUCTS_DIR}/photo_manager/photo_manager.framework",
"${BUILT_PRODUCTS_DIR}/receive_sharing_intent/receive_sharing_intent.framework",
@@ -733,6 +732,7 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/cupertino_http.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/device_info_plus.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ente_cast.framework",
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ente_mail.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ente_panorama_viewer.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ente_photos_platform.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ente_photos_rust.framework",
@@ -740,7 +740,6 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ente_rust.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ente_screen_cover.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/file_saver.framework",
- "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_email_sender.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_image_compress_common.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_inappwebview_ios.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_local_notifications.framework",
@@ -765,7 +764,6 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/nanopb.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/native_video_editor.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/native_video_player.framework",
- "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/open_mail_app.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/package_info_plus.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/photo_manager.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/receive_sharing_intent.framework",
diff --git a/mobile/apps/photos/ios/Runner/Info.plist b/mobile/apps/photos/ios/Runner/Info.plist
index 23f72360e2..499ef0d81a 100644
--- a/mobile/apps/photos/ios/Runner/Info.plist
+++ b/mobile/apps/photos/ios/Runner/Info.plist
@@ -26,18 +26,6 @@
<string>15.1</string>
<key>FlutterDeepLinkingEnabled</key>
<false/>
- <key>LSApplicationQueriesSchemes</key>
- <array>
- <string>googlegmail</string>
- <string>x-dispatch</string>
- <string>readdle-spark</string>
- <string>airmail</string>
- <string>ms-outlook</string>
- <string>ymail</string>
- <string>fastmail</string>
- <string>superhuman</string>
- <string>protonmail</string>
- </array>
<key>AppGroupId</key>
<string>$(CUSTOM_GROUP_ID)</string>
<key>CFBundleURLTypes</key>
diff --git a/mobile/apps/photos/lib/ui/settings/support/report_issue_page.dart b/mobile/apps/photos/lib/ui/settings/support/report_issue_page.dart
index 0eab8fb679..44fbf6adba 100644
--- a/mobile/apps/photos/lib/ui/settings/support/report_issue_page.dart
+++ b/mobile/apps/photos/lib/ui/settings/support/report_issue_page.dart
@@ -143,7 +143,14 @@ class _ReportIssuePageState extends State<ReportIssuePage> {
if (_attachLogs) {
if (!mounted) return;
- logsZipFilePath = await getZippedLogsFile(context);
+ logsZipFilePath = await getZippedLogsFile(
+ context,
+ reportText: buildSupportReportText(
+ to: recipientEmail,
+ subject: subject,
+ body: body,
+ ),
+ );
logsLabel = l10n.export;
}
@@ -160,7 +167,6 @@ class _ReportIssuePageState extends State<ReportIssuePage> {
} else {
if (!mounted) return;
didOpenComposer = await sendComposedEmail(
- context,
to: recipientEmail,
subject: subject,
body: body,
diff --git a/mobile/apps/photos/lib/utils/email_util.dart b/mobile/apps/photos/lib/utils/email_util.dart
index 3fdb358434..1892772fd2 100644
--- a/mobile/apps/photos/lib/utils/email_util.dart
+++ b/mobile/apps/photos/lib/utils/email_util.dart
@@ -3,16 +3,14 @@ import 'dart:io';
import 'package:archive/archive_io.dart';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:email_validator/email_validator.dart';
+import 'package:ente_mail/ente_mail.dart';
import "package:ente_strings/ente_strings.dart";
import 'package:ente_ui/pages/log_file_viewer.dart';
import "package:file_saver/file_saver.dart";
-import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
-import 'package:flutter_email_sender/flutter_email_sender.dart';
import "package:intl/intl.dart";
import 'package:logging/logging.dart';
-import 'package:open_mail_app/open_mail_app.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:path_provider/path_provider.dart';
import 'package:photos/core/configuration.dart';
@@ -27,9 +25,9 @@ import 'package:photos/ui/components/models/button_type.dart';
import 'package:photos/ui/notification/toast.dart';
import 'package:photos/utils/dialog_util.dart';
import 'package:share_plus/share_plus.dart';
-import 'package:url_launcher/url_launcher.dart';
final Logger _logger = Logger('email_util');
+const MailComposer _mailComposer = MailComposer();
bool isValidEmail(String? email) {
if (email == null) {
@@ -105,7 +103,14 @@ Future<void> _sendLogs(
String? subject,
String? body,
) async {
- final String zipFilePath = await getZippedLogsFile(context);
+ final String zipFilePath = await getZippedLogsFile(
+ context,
+ reportText: buildSupportReportText(
+ to: toEmail,
+ subject: subject ?? '',
+ body: body ?? '',
+ ),
+ );
if (!context.mounted) return;
final didOpenComposer = await sendLogsWithSubjectAndBody(
context,
@@ -129,14 +134,22 @@ Future<bool> sendLogsWithSubjectAndBody(
String? body,
String? zipFilePath,
}) async {
- final effectiveZipFilePath = zipFilePath ?? await getZippedLogsFile(context);
+ final effectiveZipFilePath =
+ zipFilePath ??
+ await getZippedLogsFile(
+ context,
+ reportText: buildSupportReportText(
+ to: toEmail,
+ subject: subject ?? '',
+ body: body ?? '',
+ ),
+ );
if (!context.mounted) return false;
return sendComposedEmail(
- context,
to: toEmail,
subject: subject ?? '',
body: body ?? '',
- attachmentPaths: [effectiveZipFilePath],
+ attachmentPath: effectiveZipFilePath,
);
}
@@ -145,22 +158,29 @@ Future<void> triggerSendLogs(
String? subject,
String? body,
) async {
- final String zipFilePath = await getZippedLogsFile(null);
- final Email email = Email(
- recipients: [toEmail],
+ final String zipFilePath = await getZippedLogsFile(
+ null,
+ reportText: buildSupportReportText(
+ to: toEmail,
+ subject: subject ?? '',
+ body: body ?? '',
+ ),
+ );
+ final launched = await sendComposedEmail(
+ to: toEmail,
subject: subject ?? '',
body: body ?? '',
- attachmentPaths: [zipFilePath],
- isHTML: false,
+ attachmentPath: zipFilePath,
);
- try {
- await FlutterEmailSender.send(email);
- } catch (e, s) {
- _logger.severe('email sender failed', e, s);
+ if (!launched) {
+ _logger.warning('Mail composer is unavailable');
}
}
-Future<String> getZippedLogsFile(BuildContext? context) async {
+Future<String> getZippedLogsFile(
+ BuildContext? context, {
+ String? reportText,
+}) async {
late final ProgressDialog dialog;
if (context != null) {
dialog = createProgressDialog(context, context.strings.preparingLogs);
@@ -177,6 +197,11 @@ Future<String> getZippedLogsFile(BuildContext? context) async {
final encoder = ZipFileEncoder();
encoder.create(zipFilePath);
await encoder.addDirectory(logsDirectory);
+ if (reportText != null) {
+ encoder.addArchiveFile(
+ ArchiveFile.string('support-report.txt', reportText),
+ );
+ }
await encoder.close();
if (context != null) {
await dialog.hide();
@@ -257,7 +282,6 @@ Future<void> sendEmail(
final String clientDebugInfo = await _clientInfo();
if (!context.mounted) return;
final didOpenComposer = await sendComposedEmail(
- context,
to: to,
subject: subject ?? '[Support]',
body: (body ?? '') + clientDebugInfo,
@@ -279,7 +303,6 @@ Future<void> openEmailComposer(
}) async {
try {
final didOpenComposer = await sendComposedEmail(
- context,
to: to,
subject: '',
body: '',
@@ -295,77 +318,27 @@ Future<void> openEmailComposer(
}
}
-Future<bool> sendComposedEmail(
- BuildContext context, {
+Future<bool> sendComposedEmail({
required String to,
required String subject,
required String body,
- List<String>? attachmentPaths,
+ String? attachmentPath,
}) async {
try {
- final hasAttachment = attachmentPaths != null && attachmentPaths.isNotEmpty;
- if (hasAttachment) {
- final email = Email(
- recipients: [to],
+ final result = await _mailComposer.compose(
+ MailDraft(
+ recipient: to,
subject: subject,
body: body,
- attachmentPaths: attachmentPaths,
- isHTML: false,
- );
- await FlutterEmailSender.send(email);
- return true;
- }
-
- final emailContent = EmailContent(to: [to], subject: subject, body: body);
-
- if (Platform.isAndroid) {
- // Special handling due to issue in proton mail android client
- // https://github.com/ente/photos-app/pull/253
- final params = _buildMailtoUri(to, subject: subject, body: body);
- if (!await canLaunchUrl(params)) {
- return false;
- }
- await launchUrl(params);
- return true;
- }
-
- final result = await OpenMailApp.composeNewEmailInMailApp(
- nativePickerTitle: context.strings.selectMailApp,
- emailContent: emailContent,
+ attachment: attachmentPath == null
+ ? null
+ : MailAttachment(path: attachmentPath, mimeType: 'application/zip'),
+ ),
);
- if (!result.didOpen && !result.canOpen) {
+ if (result is MailUnavailable) {
+ _logger.warning('Mail composer unavailable: ${result.reason.name}');
return false;
}
- if (!result.didOpen && result.canOpen) {
- if (!context.mounted) return false;
- await showCupertinoModalPopup(
- context: context,
- builder: (sheetContext) => CupertinoActionSheet(
- title: Text(sheetContext.strings.selectMailApp + " \n $to"),
- actions: [
- for (final app in result.options)
- CupertinoActionSheetAction(
- child: Text(app.name),
- onPressed: () async {
- await OpenMailApp.composeNewEmailInSpecificMailApp(
- mailApp: app,
- emailContent: emailContent,
- );
- if (sheetContext.mounted) {
- Navigator.of(sheetContext).pop();
- }
- },
- ),
- ],
- cancelButton: CupertinoActionSheetAction(
- child: Text(sheetContext.strings.cancel),
- onPressed: () {
- Navigator.of(sheetContext).pop();
- },
- ),
- ),
- );
- }
return true;
} catch (e, s) {
_logger.severe("Failed to send composed email to $to", e, s);
@@ -373,21 +346,6 @@ Future<bool> sendComposedEmail(
}
}
-Uri _buildMailtoUri(String to, {String? subject, String? body}) {
- final queryParameters = <String, String>{};
- if (subject != null && subject.isNotEmpty) {
- queryParameters["subject"] = subject;
- }
- if (body != null && body.isNotEmpty) {
- queryParameters["body"] = body;
- }
- return Uri(
- scheme: "mailto",
- path: to,
- queryParameters: queryParameters.isEmpty ? null : queryParameters,
- );
-}
-
Future<String> getSupportDeviceInfo() async {
final packageInfo = await PackageInfo.fromPlatform();
final platformDeviceInfo = await _getPlatformDeviceInfo();
@@ -412,6 +370,12 @@ String buildSupportEmailBody({required String message, String? deviceInfo}) {
return "$trimmedMessage\n\n-------------------\n$trimmedDeviceInfo";
}
+String buildSupportReportText({
+ required String to,
+ required String subject,
+ required String body,
+}) => "To: $to\nSubject: $subject\n\n$body";
+
Future<String> _clientInfo() async {
final packageInfo = await PackageInfo.fromPlatform();
final supportDeviceInfo = await getSupportDeviceInfo();
diff --git a/mobile/apps/photos/pubspec.yaml b/mobile/apps/photos/pubspec.yaml
index 96c4f48445..b7c1ce61f5 100644
--- a/mobile/apps/photos/pubspec.yaml
+++ b/mobile/apps/photos/pubspec.yaml
@@ -66,6 +66,8 @@ dependencies:
path: ../../packages/install_source
ente_lock_screen:
path: ../../packages/lock_screen
+ ente_mail:
+ path: ../../packages/mail
ente_panorama_viewer:
path: plugins/ente_panorama_viewer
ente_photos_platform:
@@ -109,7 +111,6 @@ dependencies:
path: flutter_cache_manager
flutter_displaymode: 0.6.0
flutter_easyloading: 3.0.5
- flutter_email_sender: 7.0.0
flutter_image_compress: 2.4.0
flutter_inappwebview: 6.1.5
flutter_local_notifications: 19.3.0
@@ -178,10 +179,6 @@ dependencies:
native_video_editor:
path: ../../packages/native_video_editor
native_video_player: 4.0.1
- open_mail_app: # replace plugin, git is archived
- git:
- url: https://github.com/ente/open-mail-app-flutter.git
- ref: 13c0244db82b386ad1a53b2451bdfda8d2687cb6
package_info_plus: 8.3.1
password_strength: 0.2.0
path: 1.9.1 #dart
diff --git a/mobile/packages/mail/android/build.gradle b/mobile/packages/mail/android/build.gradle
new file mode 100644
index 0000000000..d30aa51e5f
--- /dev/null
+++ b/mobile/packages/mail/android/build.gradle
@@ -0,0 +1,55 @@
+group 'io.ente.mail'
+version '1.0'
+
+buildscript {
+ ext.kotlin_version = '1.9.25'
+ repositories {
+ google()
+ mavenCentral()
+ }
+
+ dependencies {
+ classpath 'com.android.tools.build:gradle:8.7.3'
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
+ }
+}
+
+rootProject.allprojects {
+ repositories {
+ google()
+ mavenCentral()
+ }
+}
+
+apply plugin: 'com.android.library'
+apply plugin: 'kotlin-android'
+
+def mailCompileSdkVersion = rootProject.ext.has('compileSdkVersion') ?
+ rootProject.ext.compileSdkVersion : 35
+
+android {
+ namespace 'io.ente.mail'
+ compileSdkVersion mailCompileSdkVersion
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ kotlinOptions {
+ jvmTarget = '1.8'
+ }
+
+ sourceSets {
+ main.java.srcDirs += 'src/main/kotlin'
+ }
+
+ defaultConfig {
+ minSdkVersion 24
+ }
+}
+
+dependencies {
+ implementation 'androidx.core:core:1.15.0'
+ testImplementation 'junit:junit:4.13.2'
+}
diff --git a/mobile/packages/mail/android/src/main/AndroidManifest.xml b/mobile/packages/mail/android/src/main/AndroidManifest.xml
new file mode 100644
index 0000000000..5f75a5a17e
--- /dev/null
+++ b/mobile/packages/mail/android/src/main/AndroidManifest.xml
@@ -0,0 +1,24 @@
+<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+ <queries>
+ <intent>
+ <action android:name="android.intent.action.SENDTO" />
+ <data android:scheme="mailto" />
+ </intent>
+ <intent>
+ <action android:name="android.intent.action.SEND" />
+ <data android:mimeType="*/*" />
+ </intent>
+ </queries>
+
+ <application>
+ <provider
+ android:name=".MailFileProvider"
+ android:authorities="${applicationId}.ente_mail.attachments"
+ android:exported="false"
+ android:grantUriPermissions="true">
+ <meta-data
+ android:name="android.support.FILE_PROVIDER_PATHS"
+ android:resource="@xml/ente_mail_paths" />
+ </provider>
+ </application>
+</manifest>
diff --git a/mobile/packages/mail/android/src/main/kotlin/io/ente/mail/MailFileProvider.kt b/mobile/packages/mail/android/src/main/kotlin/io/ente/mail/MailFileProvider.kt
new file mode 100644
index 0000000000..3cb4de1038
--- /dev/null
+++ b/mobile/packages/mail/android/src/main/kotlin/io/ente/mail/MailFileProvider.kt
@@ -0,0 +1,5 @@
+package io.ente.mail
+
+import androidx.core.content.FileProvider
+
+class MailFileProvider : FileProvider()
diff --git a/mobile/packages/mail/android/src/main/kotlin/io/ente/mail/MailPlugin.kt b/mobile/packages/mail/android/src/main/kotlin/io/ente/mail/MailPlugin.kt
new file mode 100644
index 0000000000..974a9c18b9
--- /dev/null
+++ b/mobile/packages/mail/android/src/main/kotlin/io/ente/mail/MailPlugin.kt
@@ -0,0 +1,114 @@
+package io.ente.mail
+
+import android.app.Activity
+import io.ente.mail.core.MailAttachment
+import io.ente.mail.core.MailComposer
+import io.ente.mail.core.MailRequest
+import io.ente.mail.core.MailResult
+import io.ente.mail.core.MailUnavailableReason
+import io.flutter.embedding.engine.plugins.FlutterPlugin
+import io.flutter.embedding.engine.plugins.activity.ActivityAware
+import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding
+import io.flutter.plugin.common.MethodCall
+import io.flutter.plugin.common.MethodChannel
+
+class MailPlugin : FlutterPlugin, ActivityAware, MethodChannel.MethodCallHandler {
+ private lateinit var channel: MethodChannel
+ private lateinit var composer: MailComposer
+ private var activity: Activity? = null
+
+ override fun onAttachedToEngine(binding: FlutterPlugin.FlutterPluginBinding) {
+ composer = MailComposer(binding.applicationContext)
+ channel = MethodChannel(binding.binaryMessenger, CHANNEL)
+ channel.setMethodCallHandler(this)
+ }
+
+ override fun onMethodCall(call: MethodCall, result: MethodChannel.Result) {
+ if (call.method != "compose") {
+ result.notImplemented()
+ return
+ }
+ val request = try {
+ call.toRequest()
+ } catch (error: IllegalArgumentException) {
+ result.error("invalidDraft", error.message, null)
+ return
+ }
+ composer.compose(request, { activity }) { outcome ->
+ result.success(outcome.channelValue)
+ }
+ }
+
+ override fun onAttachedToActivity(binding: ActivityPluginBinding) {
+ activity = binding.activity
+ }
+
+ override fun onDetachedFromActivityForConfigChanges() {
+ activity = null
+ }
+
+ override fun onReattachedToActivityForConfigChanges(binding: ActivityPluginBinding) {
+ activity = binding.activity
+ }
+
+ override fun onDetachedFromActivity() {
+ activity = null
+ }
+
+ override fun onDetachedFromEngine(binding: FlutterPlugin.FlutterPluginBinding) {
+ activity = null
+ channel.setMethodCallHandler(null)
+ composer.close()
+ }
+
+ private companion object {
+ const val CHANNEL = "io.ente.mail/composer"
+ }
+}
+
+private val MailResult.channelValue: Map<String, String>
+ get() = when (this) {
+ MailResult.Launched -> mapOf("status" to "launched")
+ is MailResult.Unavailable -> mapOf(
+ "status" to "unavailable",
+ "reason" to reason.channelValue
+ )
+ }
+
+private val MailUnavailableReason.channelValue: String
+ get() = when (this) {
+ MailUnavailableReason.NO_MAIL_CLIENT -> "noMailClient"
+ MailUnavailableReason.ATTACHMENT_COMPOSER_UNAVAILABLE -> {
+ "attachmentComposerUnavailable"
+ }
+ MailUnavailableReason.ATTACHMENT_MISSING -> "attachmentMissing"
+ MailUnavailableReason.ATTACHMENT_UNREADABLE -> "attachmentUnreadable"
+ MailUnavailableReason.ATTACHMENT_TOO_LARGE -> "attachmentTooLarge"
+ MailUnavailableReason.COMPOSER_BUSY -> "composerBusy"
+ MailUnavailableReason.PRESENTATION_FAILED -> "presentationFailed"
+ }
+
+private fun MethodCall.toRequest(): MailRequest {
+ val arguments = arguments as? Map<*, *>
+ ?: throw IllegalArgumentException("Mail draft is missing")
+ fun string(name: String): String = arguments[name] as? String
+ ?: throw IllegalArgumentException("Mail draft has no $name")
+
+ val attachment = arguments["attachment"]?.let { value ->
+ val map = value as? Map<*, *>
+ ?: throw IllegalArgumentException("Attachment is invalid")
+ fun attachmentString(name: String): String = map[name] as? String
+ ?: throw IllegalArgumentException("Attachment has no $name")
+
+ MailAttachment(
+ path = attachmentString("path"),
+ mimeType = attachmentString("mimeType")
+ )
+ }
+ return MailRequest(
+ recipient = string("recipient"),
+ subject = string("subject"),
+ body = string("body"),
+ attachment = attachment
+ )
+}
diff --git a/mobile/packages/mail/android/src/main/kotlin/io/ente/mail/core/AttachmentStore.kt b/mobile/packages/mail/android/src/main/kotlin/io/ente/mail/core/AttachmentStore.kt
new file mode 100644
index 0000000000..d7957c6227
--- /dev/null
+++ b/mobile/packages/mail/android/src/main/kotlin/io/ente/mail/core/AttachmentStore.kt
@@ -0,0 +1,78 @@
+package io.ente.mail.core
+
+import java.io.File
+import java.io.IOException
+import java.util.UUID
+
+class AttachmentStore(
+ private val root: File,
+ private val maximumBytes: Long = MAXIMUM_BYTES,
+ private val now: () -> Long = System::currentTimeMillis
+) {
+ sealed interface StageResult {
+ data class Staged(val directory: File, val file: File) : StageResult
+ data class Unavailable(val reason: MailUnavailableReason) : StageResult
+ }
+
+ fun stage(attachment: MailAttachment): StageResult {
+ val source = File(attachment.path)
+ if (!source.exists()) {
+ return StageResult.Unavailable(MailUnavailableReason.ATTACHMENT_MISSING)
+ }
+ if (!source.isFile || !source.canRead()) {
+ return StageResult.Unavailable(MailUnavailableReason.ATTACHMENT_UNREADABLE)
+ }
+ val sourceLength = source.length()
+ if (sourceLength > maximumBytes) {
+ return StageResult.Unavailable(MailUnavailableReason.ATTACHMENT_TOO_LARGE)
+ }
+
+ val directory = File(root, UUID.randomUUID().toString())
+ return try {
+ check(directory.mkdirs()) { "Could not create mail attachment directory" }
+ val destination = File(directory, source.name)
+ source.inputStream().use { input ->
+ destination.outputStream().use { output ->
+ val buffer = ByteArray(DEFAULT_BUFFER_SIZE)
+ var copied = 0L
+ while (true) {
+ val count = input.read(buffer)
+ if (count < 0) break
+ copied += count
+ if (copied > maximumBytes) throw AttachmentTooLargeException()
+ output.write(buffer, 0, count)
+ }
+ }
+ }
+ if (destination.length() != sourceLength) {
+ throw IOException("Attachment changed while being copied")
+ }
+ directory.setLastModified(now())
+ StageResult.Staged(directory, destination)
+ } catch (_: AttachmentTooLargeException) {
+ directory.deleteRecursively()
+ StageResult.Unavailable(MailUnavailableReason.ATTACHMENT_TOO_LARGE)
+ } catch (_: Exception) {
+ directory.deleteRecursively()
+ StageResult.Unavailable(MailUnavailableReason.ATTACHMENT_UNREADABLE)
+ }
+ }
+
+ fun discard(staged: StageResult.Staged) {
+ staged.directory.deleteRecursively()
+ }
+
+ fun pruneExpired(retentionMs: Long = RETENTION_MS) {
+ val cutoff = now() - retentionMs
+ root.listFiles()?.forEach { entry ->
+ if (entry.lastModified() < cutoff) entry.deleteRecursively()
+ }
+ }
+
+ companion object {
+ const val MAXIMUM_BYTES = 20 * 1024 * 1024L
+ const val RETENTION_MS = 24 * 60 * 60 * 1000L
+ }
+}
+
+private class AttachmentTooLargeException : IOException()
diff --git a/mobile/packages/mail/android/src/main/kotlin/io/ente/mail/core/MailComposer.kt b/mobile/packages/mail/android/src/main/kotlin/io/ente/mail/core/MailComposer.kt
new file mode 100644
index 0000000000..4c3e0f830a
--- /dev/null
+++ b/mobile/packages/mail/android/src/main/kotlin/io/ente/mail/core/MailComposer.kt
@@ -0,0 +1,217 @@
+package io.ente.mail.core
+
+import android.app.Activity
+import android.content.ClipData
+import android.content.ComponentName
+import android.content.Context
+import android.content.Intent
+import android.content.pm.PackageManager
+import android.content.pm.ResolveInfo
+import android.net.Uri
+import android.os.Build
+import android.os.Handler
+import android.os.Looper
+import androidx.annotation.MainThread
+import androidx.core.content.FileProvider
+import java.util.concurrent.ExecutorService
+import java.util.concurrent.Executors
+
+class MailComposer(
+ private val context: Context
+) {
+ private sealed interface Preparation {
+ data class Ready(
+ val intent: Intent,
+ val attachment: AttachmentStore.StageResult.Staged?
+ ) : Preparation
+
+ data class Unavailable(val reason: MailUnavailableReason) : Preparation
+ }
+
+ private var isComposing = false
+ private var isClosed = false
+ private val attachmentStore = AttachmentStore(context.cacheDir.resolve("ente_mail"))
+ private val executor: ExecutorService = newExecutor()
+ private val mainHandler = Handler(Looper.getMainLooper())
+
+ @MainThread
+ fun compose(
+ request: MailRequest,
+ activityProvider: () -> Activity?,
+ completion: (MailResult) -> Unit
+ ) {
+ if (isClosed || activityProvider() == null) {
+ completion(MailResult.Unavailable(MailUnavailableReason.PRESENTATION_FAILED))
+ return
+ }
+ if (isComposing) {
+ completion(MailResult.Unavailable(MailUnavailableReason.COMPOSER_BUSY))
+ return
+ }
+ isComposing = true
+ executor.execute {
+ val preparation = try {
+ prepare(request)
+ } catch (_: Exception) {
+ Preparation.Unavailable(MailUnavailableReason.PRESENTATION_FAILED)
+ }
+ mainHandler.post {
+ if (isClosed) {
+ if (preparation is Preparation.Ready) discard(preparation)
+ return@post
+ }
+ val result = when (preparation) {
+ is Preparation.Unavailable -> MailResult.Unavailable(preparation.reason)
+ is Preparation.Ready -> activityProvider()?.let { launch(it, preparation) }
+ ?: run {
+ discard(preparation)
+ MailResult.Unavailable(MailUnavailableReason.PRESENTATION_FAILED)
+ }
+ }
+ isComposing = false
+ completion(result)
+ }
+ }
+ }
+
+ @MainThread
+ fun close() {
+ if (isClosed) return
+ isClosed = true
+ executor.shutdownNow()
+ }
+
+ private fun prepare(request: MailRequest): Preparation {
+ attachmentStore.pruneExpired()
+ return if (request.attachment == null) {
+ prepareMailto(request)
+ } else {
+ prepareAttachment(request, request.attachment)
+ }
+ }
+
+ private fun launch(activity: Activity, prepared: Preparation.Ready): MailResult = try {
+ activity.startActivity(prepared.intent)
+ MailResult.Launched
+ } catch (_: Exception) {
+ discard(prepared)
+ MailResult.Unavailable(MailUnavailableReason.PRESENTATION_FAILED)
+ }
+
+ private fun discard(prepared: Preparation.Ready) {
+ prepared.attachment?.let(attachmentStore::discard)
+ }
+
+ private fun prepareMailto(request: MailRequest): Preparation {
+ val intent = Intent(Intent.ACTION_SENDTO, request.mailtoUri())
+ if (queryActivities(intent).isEmpty()) {
+ return Preparation.Unavailable(MailUnavailableReason.NO_MAIL_CLIENT)
+ }
+ return Preparation.Ready(Intent.createChooser(intent, null), null)
+ }
+
+ private fun prepareAttachment(
+ request: MailRequest,
+ attachment: MailAttachment
+ ): Preparation {
+ val mailPackages = queryActivities(
+ Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:"))
+ ).mapTo(mutableSetOf()) { it.activityInfo.packageName }
+ if (mailPackages.isEmpty()) {
+ return Preparation.Unavailable(MailUnavailableReason.NO_MAIL_CLIENT)
+ }
+
+ val targets = queryActivities(
+ Intent(Intent.ACTION_SEND).setType(attachment.mimeType)
+ ).filter { it.activityInfo.packageName in mailPackages }
+ .distinctBy { it.activityInfo.packageName to it.activityInfo.name }
+ if (targets.isEmpty()) {
+ return Preparation.Unavailable(
+ MailUnavailableReason.ATTACHMENT_COMPOSER_UNAVAILABLE
+ )
+ }
+
+ val staged = when (val result = attachmentStore.stage(attachment)) {
+ is AttachmentStore.StageResult.Staged -> result
+ is AttachmentStore.StageResult.Unavailable -> {
+ return Preparation.Unavailable(result.reason)
+ }
+ }
+ return try {
+ val uri = FileProvider.getUriForFile(
+ context,
+ "${context.packageName}.ente_mail.attachments",
+ staged.file
+ )
+ val intents = targets.map { target ->
+ Intent(Intent.ACTION_SEND).apply {
+ component = ComponentName(
+ target.activityInfo.packageName,
+ target.activityInfo.name
+ )
+ type = attachment.mimeType
+ putExtra(Intent.EXTRA_EMAIL, arrayOf(request.recipient))
+ putExtra(Intent.EXTRA_SUBJECT, request.subject)
+ putExtra(Intent.EXTRA_TEXT, request.body)
+ putExtra(Intent.EXTRA_STREAM, uri)
+ clipData = ClipData.newUri(
+ context.contentResolver,
+ staged.file.name,
+ uri
+ )
+ addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
+ }
+ }
+ val chooser = Intent.createChooser(intents.first(), null).apply {
+ if (intents.size > 1) {
+ putExtra(Intent.EXTRA_ALTERNATE_INTENTS, intents.drop(1).toTypedArray())
+ }
+ clipData = intents.first().clipData
+ addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
+ }
+ Preparation.Ready(chooser, staged)
+ } catch (_: Exception) {
+ attachmentStore.discard(staged)
+ Preparation.Unavailable(MailUnavailableReason.PRESENTATION_FAILED)
+ }
+ }
+
+ private fun queryActivities(intent: Intent): List<ResolveInfo> {
+ val packageManager = context.packageManager
+ return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ packageManager.queryIntentActivities(
+ intent,
+ PackageManager.ResolveInfoFlags.of(
+ PackageManager.MATCH_DEFAULT_ONLY.toLong()
+ )
+ )
+ } else {
+ @Suppress("DEPRECATION")
+ packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY)
+ }
+ }
+
+ private companion object {
+ fun newExecutor(): ExecutorService = Executors.newSingleThreadExecutor { task ->
+ Thread(task, "mail-composer").apply { isDaemon = true }
+ }
+ }
+}
+
+private fun MailRequest.mailtoUri(): Uri {
+ val query = buildList {
+ if (subject.isNotEmpty()) add("subject=${Uri.encode(subject)}")
+ if (body.isNotEmpty()) add("body=${Uri.encode(body)}")
+ }
+ val encodedRecipient = Uri.encode(recipient, "@+")
+ return Uri.parse(
+ buildString {
+ append("mailto:")
+ append(encodedRecipient)
+ if (query.isNotEmpty()) {
+ append('?')
+ append(query.joinToString("&"))
+ }
+ }
+ )
+}
diff --git a/mobile/packages/mail/android/src/main/kotlin/io/ente/mail/core/MailModels.kt b/mobile/packages/mail/android/src/main/kotlin/io/ente/mail/core/MailModels.kt
new file mode 100644
index 0000000000..8911cc6cc1
--- /dev/null
+++ b/mobile/packages/mail/android/src/main/kotlin/io/ente/mail/core/MailModels.kt
@@ -0,0 +1,57 @@
+package io.ente.mail.core
+
+import java.io.File
+
+enum class MailUnavailableReason {
+ NO_MAIL_CLIENT,
+ ATTACHMENT_COMPOSER_UNAVAILABLE,
+ ATTACHMENT_MISSING,
+ ATTACHMENT_UNREADABLE,
+ ATTACHMENT_TOO_LARGE,
+ COMPOSER_BUSY,
+ PRESENTATION_FAILED
+}
+
+sealed interface MailResult {
+ data object Launched : MailResult
+ data class Unavailable(val reason: MailUnavailableReason) : MailResult
+}
+
+data class MailAttachment(
+ val path: String,
+ val mimeType: String
+) {
+ init {
+ require(File(path).isAbsolute) { "Attachment path must be absolute" }
+ require(MIME_TYPE.matches(mimeType)) { "Attachment MIME type is invalid" }
+ require(File(path).name.isSafeFileName()) { "Attachment filename is invalid" }
+ }
+
+ private companion object {
+ val MIME_TYPE = Regex("^[A-Za-z0-9!#\\$&^_.+-]+/[A-Za-z0-9!#\\$&^_.+-]+$")
+ }
+}
+
+data class MailRequest(
+ val recipient: String,
+ val subject: String,
+ val body: String,
+ val attachment: MailAttachment?
+) {
+ init {
+ require(recipient.isNotEmpty() && recipient == recipient.trim()) {
+ "Recipient is invalid"
+ }
+ require(listOf(recipient, subject, body).none { '\u0000' in it }) {
+ "Mail text contains a null byte"
+ }
+ }
+}
+
+private fun String.isSafeFileName(): Boolean =
+ isNotEmpty() &&
+ this != "." &&
+ this != ".." &&
+ '/' !in this &&
+ '\\' !in this &&
+ none { it.code < 0x20 || it.code == 0x7f }
diff --git a/mobile/packages/mail/android/src/main/res/xml/ente_mail_paths.xml b/mobile/packages/mail/android/src/main/res/xml/ente_mail_paths.xml
new file mode 100644
index 0000000000..d8644cba6c
--- /dev/null
+++ b/mobile/packages/mail/android/src/main/res/xml/ente_mail_paths.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<paths xmlns:android="http://schemas.android.com/apk/res/android">
+ <cache-path name="attachments" path="ente_mail/" />
+</paths>
diff --git a/mobile/packages/mail/android/src/test/kotlin/io/ente/mail/core/AttachmentStoreTest.kt b/mobile/packages/mail/android/src/test/kotlin/io/ente/mail/core/AttachmentStoreTest.kt
new file mode 100644
index 0000000000..3d0fff2bca
--- /dev/null
+++ b/mobile/packages/mail/android/src/test/kotlin/io/ente/mail/core/AttachmentStoreTest.kt
@@ -0,0 +1,87 @@
+package io.ente.mail.core
+
+import java.nio.file.Files
+import org.junit.Assert.assertArrayEquals
+import org.junit.Assert.assertEquals
+import org.junit.Assert.assertFalse
+import org.junit.Assert.assertTrue
+import org.junit.Test
+
+class AttachmentStoreTest {
+ @Test
+ fun `stages attachment in an isolated session`() {
+ val temporary = Files.createTempDirectory("ente-mail-test").toFile()
+ try {
+ val source = temporary.resolve("source.zip").apply {
+ writeBytes(byteArrayOf(1, 2, 3))
+ }
+ val store = AttachmentStore(temporary.resolve("mail"))
+
+ val result = store.stage(
+ MailAttachment(source.absolutePath, "application/zip")
+ )
+
+ assertTrue(result is AttachmentStore.StageResult.Staged)
+ result as AttachmentStore.StageResult.Staged
+ assertEquals("source.zip", result.file.name)
+ assertArrayEquals(source.readBytes(), result.file.readBytes())
+ assertTrue(result.file.canonicalPath.startsWith(
+ temporary.resolve("mail").canonicalPath
+ ))
+ } finally {
+ temporary.deleteRecursively()
+ }
+ }
+
+ @Test
+ fun `rejects unusable attachments and prunes expired sessions`() {
+ var now = 2 * AttachmentStore.RETENTION_MS
+ val temporary = Files.createTempDirectory("ente-mail-test").toFile()
+ try {
+ val store = AttachmentStore(temporary.resolve("mail")) { now }
+ val missing = store.stage(
+ MailAttachment(
+ temporary.resolve("missing.zip").absolutePath,
+ "application/zip"
+ )
+ )
+ assertEquals(
+ MailUnavailableReason.ATTACHMENT_MISSING,
+ (missing as AttachmentStore.StageResult.Unavailable).reason
+ )
+
+ val oversizedFile = temporary.resolve("oversized.zip").apply {
+ writeBytes(byteArrayOf(1, 2, 3))
+ }
+ val oversized = AttachmentStore(
+ temporary.resolve("mail"),
+ maximumBytes = 2
+ ).stage(
+ MailAttachment(
+ oversizedFile.absolutePath,
+ "application/zip"
+ )
+ )
+ assertEquals(
+ MailUnavailableReason.ATTACHMENT_TOO_LARGE,
+ (oversized as AttachmentStore.StageResult.Unavailable).reason
+ )
+
+ val expired = temporary.resolve("mail/expired").apply {
+ mkdirs()
+ setLastModified(0)
+ }
+ val current = temporary.resolve("mail/current").apply {
+ mkdirs()
+ setLastModified(now)
+ }
+ now += 1
+ store.pruneExpired()
+
+ assertFalse(expired.exists())
+ assertTrue(current.exists())
+ } finally {
+ temporary.deleteRecursively()
+ }
+ }
+}
diff --git a/mobile/packages/mail/android/src/test/kotlin/io/ente/mail/core/MailModelsTest.kt b/mobile/packages/mail/android/src/test/kotlin/io/ente/mail/core/MailModelsTest.kt
new file mode 100644
index 0000000000..352a0f7167
--- /dev/null
+++ b/mobile/packages/mail/android/src/test/kotlin/io/ente/mail/core/MailModelsTest.kt
@@ -0,0 +1,19 @@
+package io.ente.mail.core
+
+import org.junit.Assert.assertThrows
+import org.junit.Test
+
+class MailModelsTest {
+ @Test
+ fun `requires explicit valid attachment metadata`() {
+ assertThrows(IllegalArgumentException::class.java) {
+ MailAttachment("relative.zip", "application/zip")
+ }
+ assertThrows(IllegalArgumentException::class.java) {
+ MailAttachment("/tmp/logs.zip", "zip")
+ }
+ assertThrows(IllegalArgumentException::class.java) {
+ MailAttachment("/", "application/zip")
+ }
+ }
+}
diff --git a/mobile/packages/mail/ios/.swift-format b/mobile/packages/mail/ios/.swift-format
new file mode 100644
index 0000000000..54e7d601fa
--- /dev/null
+++ b/mobile/packages/mail/ios/.swift-format
@@ -0,0 +1,9 @@
+{
+ "indentation": { "spaces": 4 },
+ "lineLength": 100,
+ "rules": {
+ "AllPublicDeclarationsHaveDocumentation": false,
+ "FileScopedDeclarationPrivacy": false
+ },
+ "version": 1
+}
diff --git a/mobile/packages/mail/ios/Classes/MailComposer.swift b/mobile/packages/mail/ios/Classes/MailComposer.swift
new file mode 100644
index 0000000000..cdffcaf21d
--- /dev/null
+++ b/mobile/packages/mail/ios/Classes/MailComposer.swift
@@ -0,0 +1,238 @@
+import Foundation
+import Intents
+import MessageUI
+import UIKit
+
+@MainActor
+public final class MailComposer: NSObject, MFMailComposeViewControllerDelegate {
+ private var preparationID: UUID?
+ private var activeController: UIViewController?
+ private var isClosed = false
+
+ public override init() {
+ super.init()
+ }
+
+ public func compose(_ request: MailRequest, presenter: UIViewController) async -> MailResult {
+ guard !isClosed else {
+ return .unavailable(.presentationFailed)
+ }
+ guard preparationID == nil, activeController == nil else {
+ return .unavailable(.composerBusy)
+ }
+ let identifier = UUID()
+ preparationID = identifier
+ defer {
+ if preparationID == identifier {
+ preparationID = nil
+ }
+ }
+
+ guard let attachment = request.attachment else {
+ guard let url = request.mailtoURL else {
+ return .unavailable(.presentationFailed)
+ }
+ let opened = await withCheckedContinuation { continuation in
+ UIApplication.shared.open(url, options: [:]) { success in
+ continuation.resume(returning: success)
+ }
+ }
+ guard preparationID == identifier else {
+ return .unavailable(.presentationFailed)
+ }
+ if opened {
+ return .launched
+ }
+ if #unavailable(iOS 18.0) {
+ return .unavailable(.noMailClient)
+ }
+ return await presentShareSheet(for: request, attachment: nil, from: presenter)
+ }
+
+ if !MFMailComposeViewController.canSendMail() {
+ let failure = await Task.detached(priority: .userInitiated) {
+ AttachmentLoader.validationFailure(for: attachment)
+ }.value
+ guard preparationID == identifier else {
+ return .unavailable(.presentationFailed)
+ }
+ if let failure {
+ return .unavailable(failure)
+ }
+ if #unavailable(iOS 18.0) {
+ return .unavailable(.attachmentComposerUnavailable)
+ }
+ return await presentShareSheet(
+ for: request,
+ attachment: attachment,
+ from: presenter
+ )
+ }
+
+ let loaded = await Task.detached(priority: .userInitiated) {
+ AttachmentLoader.load(attachment)
+ }.value
+ guard preparationID == identifier else {
+ return .unavailable(.presentationFailed)
+ }
+ let attachmentData: Data
+ switch loaded {
+ case let .success(data):
+ attachmentData = data
+ case let .failure(reason):
+ return .unavailable(reason)
+ }
+
+ let controller = MFMailComposeViewController()
+ controller.mailComposeDelegate = self
+ controller.setToRecipients([request.recipient])
+ controller.setSubject(request.subject)
+ controller.setMessageBody(request.body, isHTML: false)
+ controller.addAttachmentData(
+ attachmentData,
+ mimeType: attachment.mimeType,
+ fileName: attachment.url.lastPathComponent
+ )
+ return await present(controller, from: presenter)
+ }
+
+ private func presentShareSheet(
+ for request: MailRequest,
+ attachment: MailAttachment?,
+ from presenter: UIViewController
+ ) async -> MailResult {
+ let draft = DraftItemSource(
+ recipient: request.recipient,
+ subject: request.subject,
+ body: request.body
+ )
+ var activityItems: [Any] = [draft]
+ if let attachment {
+ activityItems.append(attachment.url)
+ }
+ let controller = UIActivityViewController(
+ activityItems: activityItems,
+ applicationActivities: nil
+ )
+ controller.completionWithItemsHandler = { [weak self, weak controller] _, _, _, _ in
+ Task { @MainActor in
+ guard let self, self.activeController === controller else { return }
+ self.activeController = nil
+ }
+ }
+ return await present(controller, from: presenter)
+ }
+
+ private func present(
+ _ controller: UIViewController,
+ from presenter: UIViewController
+ ) async -> MailResult {
+ let visiblePresenter = presenter.visibleController
+ guard visiblePresenter.viewIfLoaded?.window != nil else {
+ return .unavailable(.presentationFailed)
+ }
+ if let popover = controller.popoverPresentationController {
+ popover.sourceView = visiblePresenter.view
+ popover.sourceRect = CGRect(
+ x: visiblePresenter.view.bounds.midX,
+ y: visiblePresenter.view.bounds.midY,
+ width: 0,
+ height: 0
+ )
+ }
+ activeController = controller
+ await withCheckedContinuation { continuation in
+ visiblePresenter.present(controller, animated: true) {
+ continuation.resume()
+ }
+ }
+ guard controller.presentingViewController != nil else {
+ activeController = nil
+ return .unavailable(.presentationFailed)
+ }
+ return .launched
+ }
+
+ public func close() {
+ isClosed = true
+ preparationID = nil
+ activeController?.dismiss(animated: false)
+ activeController = nil
+ }
+
+ public nonisolated func mailComposeController(
+ _ controller: MFMailComposeViewController,
+ didFinishWith _: MFMailComposeResult,
+ error _: Error?
+ ) {
+ Task { @MainActor [weak self] in
+ guard let self, activeController === controller else { return }
+ activeController = nil
+ controller.dismiss(animated: true)
+ }
+ }
+}
+
+private final class DraftItemSource: NSObject, UIActivityItemSource {
+ private let recipient: String
+ private let subject: String
+ private let body: String
+
+ init(recipient: String, subject: String, body: String) {
+ self.recipient = recipient
+ self.subject = subject
+ self.body = body
+ }
+
+ func activityViewControllerPlaceholderItem(_: UIActivityViewController) -> Any {
+ body
+ }
+
+ func activityViewController(
+ _: UIActivityViewController,
+ itemForActivityType _: UIActivity.ActivityType?
+ ) -> Any? {
+ body
+ }
+
+ func activityViewController(
+ _: UIActivityViewController,
+ subjectForActivityType _: UIActivity.ActivityType?
+ ) -> String {
+ subject
+ }
+
+ @available(iOS 18.0, *)
+ func activityViewControllerShareRecipients(_: UIActivityViewController) -> [INPerson] {
+ let handle = INPersonHandle(value: recipient, type: .emailAddress)
+ return [
+ INPerson(
+ personHandle: handle,
+ nameComponents: nil,
+ displayName: recipient,
+ image: nil,
+ contactIdentifier: nil,
+ customIdentifier: nil
+ )
+ ]
+ }
+}
+
+private extension UIViewController {
+ var visibleController: UIViewController {
+ if let presented = presentedViewController, !presented.isBeingDismissed {
+ return presented.visibleController
+ }
+ if let navigation = self as? UINavigationController,
+ let visible = navigation.visibleViewController
+ {
+ return visible.visibleController
+ }
+ if let tab = self as? UITabBarController,
+ let selected = tab.selectedViewController
+ {
+ return selected.visibleController
+ }
+ return self
+ }
+}
diff --git a/mobile/packages/mail/ios/Classes/MailModels.swift b/mobile/packages/mail/ios/Classes/MailModels.swift
new file mode 100644
index 0000000000..401b41499f
--- /dev/null
+++ b/mobile/packages/mail/ios/Classes/MailModels.swift
@@ -0,0 +1,136 @@
+import Foundation
+
+public enum MailUnavailableReason: String, Error, Sendable {
+ case noMailClient
+ case attachmentComposerUnavailable
+ case attachmentMissing
+ case attachmentUnreadable
+ case attachmentTooLarge
+ case composerBusy
+ case presentationFailed
+}
+
+public enum MailResult: Sendable {
+ case launched
+ case unavailable(MailUnavailableReason)
+}
+
+public struct MailAttachment: Sendable {
+ public let url: URL
+ public let mimeType: String
+
+ public init(path: String, mimeType: String) throws {
+ guard path.hasPrefix("/") else {
+ throw MailValidationError("Attachment path must be absolute")
+ }
+ guard Self.validMIMEType(mimeType) else {
+ throw MailValidationError("Attachment MIME type is invalid")
+ }
+ let url = URL(fileURLWithPath: path)
+ let fileName = url.lastPathComponent
+ guard fileName.isSafeFileName else {
+ throw MailValidationError("Attachment filename is invalid")
+ }
+ self.url = url
+ self.mimeType = mimeType
+ }
+
+ private static func validMIMEType(_ value: String) -> Bool {
+ let parts = value.split(separator: "/", omittingEmptySubsequences: false)
+ guard parts.count == 2 else { return false }
+ let allowed = CharacterSet(
+ charactersIn: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!#$&^_.+-")
+ return parts.allSatisfy { part in
+ !part.isEmpty && part.unicodeScalars.allSatisfy(allowed.contains)
+ }
+ }
+}
+
+public struct MailRequest: Sendable {
+ public let recipient: String
+ public let subject: String
+ public let body: String
+ public let attachment: MailAttachment?
+
+ public init(
+ recipient: String,
+ subject: String,
+ body: String,
+ attachment: MailAttachment?
+ ) throws {
+ guard !recipient.isEmpty,
+ recipient == recipient.trimmingCharacters(in: .whitespacesAndNewlines)
+ else {
+ throw MailValidationError("Recipient is invalid")
+ }
+ guard ![recipient, subject, body].contains(where: { $0.contains("\0") }) else {
+ throw MailValidationError("Mail text contains a null byte")
+ }
+ self.recipient = recipient
+ self.subject = subject
+ self.body = body
+ self.attachment = attachment
+ }
+
+ var mailtoURL: URL? {
+ var components = URLComponents()
+ components.scheme = "mailto"
+ components.path = recipient
+ components.queryItems = [
+ subject.isEmpty ? nil : URLQueryItem(name: "subject", value: subject),
+ body.isEmpty ? nil : URLQueryItem(name: "body", value: body),
+ ].compactMap { $0 }
+ return components.url
+ }
+}
+
+enum AttachmentLoader {
+ static let maximumBytes: Int64 = 20 * 1024 * 1024
+
+ static func validationFailure(for attachment: MailAttachment) -> MailUnavailableReason? {
+ let path = attachment.url.path
+ guard FileManager.default.fileExists(atPath: path) else {
+ return .attachmentMissing
+ }
+ guard FileManager.default.isReadableFile(atPath: path),
+ let attributes = try? FileManager.default.attributesOfItem(atPath: path),
+ attributes[.type] as? FileAttributeType == .typeRegular,
+ let size = attributes[.size] as? NSNumber
+ else {
+ return .attachmentUnreadable
+ }
+ guard size.int64Value <= maximumBytes else {
+ return .attachmentTooLarge
+ }
+ return nil
+ }
+
+ static func load(_ attachment: MailAttachment) -> Result<Data, MailUnavailableReason> {
+ if let failure = validationFailure(for: attachment) {
+ return .failure(failure)
+ }
+ do {
+ return .success(try Data(contentsOf: attachment.url, options: .mappedIfSafe))
+ } catch {
+ return .failure(.attachmentUnreadable)
+ }
+ }
+}
+
+struct MailValidationError: LocalizedError {
+ init(_ message: String) {
+ self.message = message
+ }
+
+ let message: String
+ var errorDescription: String? { message }
+}
+
+private extension String {
+ var isSafeFileName: Bool {
+ !isEmpty && self != "." && self != ".." && !contains("/") && !contains("\\")
+ && unicodeScalars.allSatisfy {
+ !CharacterSet.controlCharacters.contains($0)
+ }
+ }
+}
diff --git a/mobile/packages/mail/ios/Classes/MailPlugin.swift b/mobile/packages/mail/ios/Classes/MailPlugin.swift
new file mode 100644
index 0000000000..0e36819ea0
--- /dev/null
+++ b/mobile/packages/mail/ios/Classes/MailPlugin.swift
@@ -0,0 +1,113 @@
+@preconcurrency import Flutter
+import Foundation
+import UIKit
+
+@MainActor
+public final class MailPlugin: NSObject, @preconcurrency FlutterPlugin {
+ private let composer = MailComposer()
+ private var isDetached = false
+
+ public static func register(with registrar: FlutterPluginRegistrar) {
+ let channel = FlutterMethodChannel(
+ name: "io.ente.mail/composer",
+ binaryMessenger: registrar.messenger()
+ )
+ let instance = MailPlugin()
+ registrar.addMethodCallDelegate(instance, channel: channel)
+ registrar.publish(instance)
+ }
+
+ public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
+ guard call.method == "compose" else {
+ result(FlutterMethodNotImplemented)
+ return
+ }
+ let request: MailRequest
+ do {
+ request = try call.mailRequest()
+ } catch {
+ result(
+ FlutterError(
+ code: "invalidDraft",
+ message: error.localizedDescription,
+ details: nil
+ )
+ )
+ return
+ }
+ guard let presenter = UIApplication.shared.activePresenter else {
+ result(MailResult.unavailable(.presentationFailed).channelValue)
+ return
+ }
+
+ Task { [weak self] in
+ guard let self else { return }
+ let value = await composer.compose(request, presenter: presenter).channelValue
+ guard !isDetached else { return }
+ result(value)
+ }
+ }
+
+ public func detachFromEngine(for _: FlutterPluginRegistrar) {
+ isDetached = true
+ composer.close()
+ }
+}
+
+private extension UIApplication {
+ var activePresenter: UIViewController? {
+ connectedScenes
+ .compactMap { $0 as? UIWindowScene }
+ .filter { $0.activationState == .foregroundActive }
+ .flatMap(\.windows)
+ .first(where: \.isKeyWindow)?
+ .rootViewController
+ }
+}
+
+private extension FlutterMethodCall {
+ func mailRequest() throws -> MailRequest {
+ guard let arguments = arguments as? [String: Any] else {
+ throw MailValidationError("Mail draft is missing")
+ }
+ func string(_ name: String) throws -> String {
+ guard let value = arguments[name] as? String else {
+ throw MailValidationError("Mail draft has no \(name)")
+ }
+ return value
+ }
+
+ let attachment: MailAttachment?
+ if let value = arguments["attachment"] {
+ guard let map = value as? [String: Any],
+ let path = map["path"] as? String,
+ let mimeType = map["mimeType"] as? String
+ else {
+ throw MailValidationError("Attachment is invalid")
+ }
+ attachment = try MailAttachment(
+ path: path,
+ mimeType: mimeType
+ )
+ } else {
+ attachment = nil
+ }
+ return try MailRequest(
+ recipient: string("recipient"),
+ subject: string("subject"),
+ body: string("body"),
+ attachment: attachment
+ )
+ }
+}
+
+private extension MailResult {
+ var channelValue: [String: String] {
+ switch self {
+ case .launched:
+ return ["status": "launched"]
+ case let .unavailable(reason):
+ return ["status": "unavailable", "reason": reason.rawValue]
+ }
+ }
+}
diff --git a/mobile/packages/mail/ios/Package.swift b/mobile/packages/mail/ios/Package.swift
new file mode 100644
index 0000000000..69fa0e47df
--- /dev/null
+++ b/mobile/packages/mail/ios/Package.swift
@@ -0,0 +1,22 @@
+// swift-tools-version: 5.9
+
+import PackageDescription
+
+let package = Package(
+ name: "MailCore",
+ platforms: [.iOS(.v13)],
+ products: [.library(name: "MailCore", targets: ["MailCore"])],
+ targets: [
+ .target(
+ name: "MailCore",
+ path: "Classes",
+ exclude: ["MailPlugin.swift"]
+ ),
+ .testTarget(
+ name: "MailCoreTests",
+ dependencies: ["MailCore"],
+ path: "Tests"
+ ),
+ ],
+ swiftLanguageVersions: [.v5]
+)
diff --git a/mobile/packages/mail/ios/Tests/MailModelsTests.swift b/mobile/packages/mail/ios/Tests/MailModelsTests.swift
new file mode 100644
index 0000000000..60d5b1b323
--- /dev/null
+++ b/mobile/packages/mail/ios/Tests/MailModelsTests.swift
@@ -0,0 +1,82 @@
+import Foundation
+import XCTest
+
+@testable import MailCore
+
+final class MailModelsTests: XCTestCase {
+ func testMailtoURLPreservesContent() throws {
+ let request = try MailRequest(
+ recipient: "[email protected]",
+ subject: "Logs & diagnostics",
+ body: "First line\nSecond line",
+ attachment: nil
+ )
+
+ let components = try XCTUnwrap(
+ request.mailtoURL.flatMap { URLComponents(url: $0, resolvingAgainstBaseURL: false) }
+ )
+ XCTAssertEqual(components.scheme, "mailto")
+ XCTAssertEqual(components.path, "[email protected]")
+ XCTAssertEqual(
+ components.queryItems,
+ [
+ URLQueryItem(name: "subject", value: "Logs & diagnostics"),
+ URLQueryItem(name: "body", value: "First line\nSecond line"),
+ ]
+ )
+ }
+
+ func testAttachmentRequiresSafeMetadata() {
+ XCTAssertThrowsError(
+ try MailAttachment(
+ path: "logs.zip",
+ mimeType: "application/zip"
+ )
+ )
+ XCTAssertThrowsError(
+ try MailAttachment(
+ path: "/tmp/logs.zip",
+ mimeType: "zip"
+ )
+ )
+ XCTAssertThrowsError(
+ try MailAttachment(
+ path: "/",
+ mimeType: "application/zip"
+ )
+ )
+ }
+
+ func testAttachmentLoaderReportsMissingAndOversizedFiles() throws {
+ let directory = FileManager.default.temporaryDirectory
+ .appendingPathComponent(UUID().uuidString, isDirectory: true)
+ try FileManager.default.createDirectory(
+ at: directory,
+ withIntermediateDirectories: true
+ )
+ defer { try? FileManager.default.removeItem(at: directory) }
+
+ let missing = try MailAttachment(
+ path: directory.appendingPathComponent("missing.zip").path,
+ mimeType: "application/zip"
+ )
+ XCTAssertEqual(
+ AttachmentLoader.validationFailure(for: missing),
+ .attachmentMissing
+ )
+
+ let oversizedURL = directory.appendingPathComponent("oversized.zip")
+ FileManager.default.createFile(atPath: oversizedURL.path, contents: nil)
+ let handle = try FileHandle(forWritingTo: oversizedURL)
+ try handle.truncate(atOffset: UInt64(AttachmentLoader.maximumBytes + 1))
+ try handle.close()
+ let oversized = try MailAttachment(
+ path: oversizedURL.path,
+ mimeType: "application/zip"
+ )
+ XCTAssertEqual(
+ AttachmentLoader.validationFailure(for: oversized),
+ .attachmentTooLarge
+ )
+ }
+}
diff --git a/mobile/packages/mail/ios/ente_mail.podspec b/mobile/packages/mail/ios/ente_mail.podspec
new file mode 100644
index 0000000000..a4bb07c36f
--- /dev/null
+++ b/mobile/packages/mail/ios/ente_mail.podspec
@@ -0,0 +1,18 @@
+Pod::Spec.new do |s|
+ s.name = 'ente_mail'
+ s.version = '0.0.1'
+ s.summary = 'Ente-owned system mail composition'
+ s.homepage = 'https://github.com/ente-io/ente'
+ s.license = { :type => 'AGPL-3.0-only' }
+ s.author = { 'Ente' => '[email protected]' }
+ s.source = { :path => '.' }
+ s.source_files = 'Classes/**/*'
+ s.dependency 'Flutter'
+ s.frameworks = 'Intents', 'MessageUI'
+ s.platform = :ios, '13.0'
+ s.swift_version = '5.0'
+ s.pod_target_xcconfig = {
+ 'DEFINES_MODULE' => 'YES',
+ 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386'
+ }
+end
diff --git a/mobile/packages/mail/lib/ente_mail.dart b/mobile/packages/mail/lib/ente_mail.dart
new file mode 100644
index 0000000000..fbf1984c9a
--- /dev/null
+++ b/mobile/packages/mail/lib/ente_mail.dart
@@ -0,0 +1,160 @@
+import 'package:flutter/services.dart';
+
+enum MailUnavailableReason {
+ unsupportedPlatform,
+ noMailClient,
+ attachmentComposerUnavailable,
+ attachmentMissing,
+ attachmentUnreadable,
+ attachmentTooLarge,
+ composerBusy,
+ presentationFailed,
+}
+
+sealed class MailComposeResult {
+ const MailComposeResult();
+}
+
+final class MailHandoffLaunched extends MailComposeResult {
+ const MailHandoffLaunched();
+}
+
+final class MailUnavailable extends MailComposeResult {
+ const MailUnavailable(this.reason);
+
+ final MailUnavailableReason reason;
+}
+
+final class MailException implements Exception {
+ const MailException(this.code, this.message, {this.details, this.cause});
+
+ final String code;
+ final String message;
+ final Object? details;
+ final Object? cause;
+
+ @override
+ String toString() => 'MailException($code, $message)';
+}
+
+final class MailAttachment {
+ const MailAttachment({required this.path, required this.mimeType});
+
+ final String path;
+ final String mimeType;
+
+ Map<String, Object> get _channelValue => {'path': path, 'mimeType': mimeType};
+}
+
+final class MailDraft {
+ const MailDraft({
+ required this.recipient,
+ this.subject = '',
+ this.body = '',
+ this.attachment,
+ });
+
+ final String recipient;
+ final String subject;
+ final String body;
+ final MailAttachment? attachment;
+
+ Map<String, Object?> get _channelValue => {
+ 'recipient': recipient,
+ 'subject': subject,
+ 'body': body,
+ 'attachment': ?attachment?._channelValue,
+ };
+}
+
+final class MailComposer {
+ const MailComposer({
+ MethodChannel channel = const MethodChannel('io.ente.mail/composer'),
+ }) : _channel = channel;
+
+ final MethodChannel _channel;
+
+ Future<MailComposeResult> compose(MailDraft draft) async {
+ _validate(draft);
+ final Map<Object?, Object?>? response;
+ try {
+ response = await _channel.invokeMapMethod<Object?, Object?>(
+ 'compose',
+ draft._channelValue,
+ );
+ } on MissingPluginException {
+ return const MailUnavailable(MailUnavailableReason.unsupportedPlatform);
+ } on PlatformException catch (error) {
+ throw MailException(
+ error.code,
+ error.message ?? 'Mail composition failed',
+ details: error.details,
+ cause: error,
+ );
+ }
+ return _parseResult(response);
+ }
+}
+
+MailComposeResult _parseResult(Map<Object?, Object?>? response) {
+ if (response == null) {
+ throw const MailException('invalidResponse', 'Native result is missing');
+ }
+ switch (response['status']) {
+ case 'launched':
+ return const MailHandoffLaunched();
+ case 'unavailable':
+ final reasonName = response['reason'];
+ if (reasonName is! String) {
+ throw const MailException(
+ 'invalidResponse',
+ 'Unavailable result has no reason',
+ );
+ }
+ final reason = MailUnavailableReason.values
+ .where((candidate) => candidate.name == reasonName)
+ .firstOrNull;
+ if (reason == null) {
+ throw MailException(
+ 'invalidResponse',
+ 'Unknown unavailable reason: $reasonName',
+ );
+ }
+ return MailUnavailable(reason);
+ default:
+ throw const MailException(
+ 'invalidResponse',
+ 'Native result has an unknown status',
+ );
+ }
+}
+
+void _validate(MailDraft draft) {
+ if (draft.recipient.isEmpty || draft.recipient != draft.recipient.trim()) {
+ throw const MailException('invalidDraft', 'Recipient is invalid');
+ }
+ if (_containsNull(draft.recipient) ||
+ _containsNull(draft.subject) ||
+ _containsNull(draft.body)) {
+ throw const MailException('invalidDraft', 'Mail text contains a null byte');
+ }
+
+ final attachment = draft.attachment;
+ if (attachment == null) return;
+ if (!attachment.path.startsWith('/')) {
+ throw const MailException(
+ 'invalidDraft',
+ 'Attachment path must be absolute',
+ );
+ }
+ if (!_validMimeType.hasMatch(attachment.mimeType)) {
+ throw const MailException(
+ 'invalidDraft',
+ 'Attachment MIME type is invalid',
+ );
+ }
+}
+
+bool _containsNull(String value) => value.contains('\u0000');
+
+final _validMimeType = RegExp(r"^[A-Za-z0-9!#$&^_.+-]+/[A-Za-z0-9!#$&^_.+-]+$");
diff --git a/mobile/packages/mail/pubspec.yaml b/mobile/packages/mail/pubspec.yaml
new file mode 100644
index 0000000000..4dad416bad
--- /dev/null
+++ b/mobile/packages/mail/pubspec.yaml
@@ -0,0 +1,25 @@
+name: ente_mail
+description: Ente-owned system mail composition for Android and iOS
+
+resolution: workspace
+environment:
+ sdk: ">=3.10.0 <4.0.0"
+ flutter: ">=3.38.0"
+
+dependencies:
+ flutter:
+ sdk: flutter
+
+dev_dependencies:
+ flutter_lints: 6.0.0
+ flutter_test:
+ sdk: flutter
+
+flutter:
+ plugin:
+ platforms:
+ android:
+ package: io.ente.mail
+ pluginClass: MailPlugin
+ ios:
+ pluginClass: MailPlugin
diff --git a/mobile/packages/mail/test/ente_mail_test.dart b/mobile/packages/mail/test/ente_mail_test.dart
new file mode 100644
index 0000000000..0bb67fd6d7
--- /dev/null
+++ b/mobile/packages/mail/test/ente_mail_test.dart
@@ -0,0 +1,94 @@
+import 'package:ente_mail/ente_mail.dart';
+import 'package:flutter/services.dart';
+import 'package:flutter_test/flutter_test.dart';
+
+void main() {
+ TestWidgetsFlutterBinding.ensureInitialized();
+
+ const channel = MethodChannel('ente_mail_test');
+ const composer = MailComposer(channel: channel);
+
+ tearDown(() {
+ TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
+ .setMockMethodCallHandler(channel, null);
+ });
+
+ test('sends the narrow typed request', () async {
+ MethodCall? received;
+ TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
+ .setMockMethodCallHandler(channel, (call) async {
+ received = call;
+ return {'status': 'launched'};
+ });
+
+ final result = await composer.compose(
+ const MailDraft(
+ recipient: '[email protected]',
+ subject: 'Logs',
+ body: 'Attached',
+ attachment: MailAttachment(
+ path: '/tmp/logs.zip',
+ mimeType: 'application/zip',
+ ),
+ ),
+ );
+
+ expect(result, isA<MailHandoffLaunched>());
+ expect(received?.method, 'compose');
+ expect(received?.arguments, {
+ 'recipient': '[email protected]',
+ 'subject': 'Logs',
+ 'body': 'Attached',
+ 'attachment': {'path': '/tmp/logs.zip', 'mimeType': 'application/zip'},
+ });
+ });
+
+ test('parses every unavailable reason', () async {
+ for (final reason in MailUnavailableReason.values) {
+ TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
+ .setMockMethodCallHandler(channel, (_) async {
+ return {'status': 'unavailable', 'reason': reason.name};
+ });
+
+ final result = await composer.compose(
+ const MailDraft(recipient: '[email protected]'),
+ );
+
+ expect(result, isA<MailUnavailable>());
+ expect((result as MailUnavailable).reason, reason);
+ }
+ });
+
+ test('rejects malformed native results', () async {
+ TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
+ .setMockMethodCallHandler(channel, (_) async {
+ return {'status': 'unavailable', 'reason': 'copied'};
+ });
+
+ await expectLater(
+ composer.compose(const MailDraft(recipient: '[email protected]')),
+ throwsA(
+ isA<MailException>().having(
+ (error) => error.code,
+ 'code',
+ 'invalidResponse',
+ ),
+ ),
+ );
+ });
+
+ test('rejects relative attachment paths', () async {
+ await expectLater(
+ composer.compose(
+ const MailDraft(
+ recipient: '[email protected]',
+ attachment: MailAttachment(
+ path: 'logs.zip',
+ mimeType: 'application/zip',
+ ),
+ ),
+ ),
+ throwsA(isA<MailException>()),
+ );
+ });
+}
diff --git a/mobile/packages/utils/lib/email_util.dart b/mobile/packages/utils/lib/email_util.dart
index ae5a43e9ee..b8e32c1cc7 100644
--- a/mobile/packages/utils/lib/email_util.dart
+++ b/mobile/packages/utils/lib/email_util.dart
@@ -3,6 +3,7 @@ import 'dart:io';
import 'package:archive/archive_io.dart';
import 'package:ente_configuration/base_configuration.dart';
import 'package:ente_logging/logging.dart';
+import 'package:ente_mail/ente_mail.dart';
import 'package:ente_pure_utils/ente_pure_utils.dart' as pure_utils;
import 'package:ente_strings/extensions.dart';
import 'package:ente_ui/components/base_bottom_sheet.dart';
@@ -18,7 +19,6 @@ import 'package:ente_utils/share_utils.dart';
import "package:file_saver/file_saver.dart";
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
-import 'package:flutter_email_sender/flutter_email_sender.dart';
import "package:intl/intl.dart";
import 'package:package_info_plus/package_info_plus.dart';
import 'package:path_provider/path_provider.dart';
@@ -26,6 +26,7 @@ import 'package:share_plus/share_plus.dart';
import 'package:url_launcher/url_launcher.dart';
final Logger _logger = Logger('email_util');
+const MailComposer _mailComposer = MailComposer();
bool isValidEmail(String? email) {
if (email == null) {
@@ -100,23 +101,20 @@ Future<void> _sendLogs(
String? body,
) async {
final String zipFilePath = await getZippedLogsFile();
- final Email email = Email(
- recipients: [toEmail],
- subject: subject ?? '',
- body: body ?? '',
- attachmentPaths: [zipFilePath],
- isHTML: false,
- );
try {
- await FlutterEmailSender.send(email);
+ final launched = await _launchEmail(
+ to: toEmail,
+ subject: subject ?? '',
+ body: body ?? '',
+ attachmentPath: zipFilePath,
+ );
+ if (launched) return;
} catch (e, s) {
_logger.severe('email sender failed', e, s);
- if (!context.mounted) {
- return;
- }
- Navigator.of(context).pop();
- await shareLogs(context, toEmail, zipFilePath);
}
+ if (!context.mounted) return;
+ Navigator.of(context).pop();
+ await shareLogs(context, toEmail, zipFilePath);
}
Future<void> shareLogs(
@@ -199,39 +197,6 @@ Future<void> exportLogs(
}
}
-Future<void> sendLogsViaEmail(
- String toEmail,
- String? subject,
- String? body,
-) async {
- final String zipFilePath = await getZippedLogsFile();
- final Email email = Email(
- recipients: [toEmail],
- subject: subject ?? '',
- body: body ?? '',
- attachmentPaths: [zipFilePath],
- isHTML: false,
- );
- try {
- await FlutterEmailSender.send(email);
- } catch (e, s) {
- _logger.severe('email sender failed', e, s);
- rethrow;
- }
-}
-
-Uri buildMailtoUri({
- required String to,
- required String subject,
- required String body,
-}) {
- return Uri(
- scheme: 'mailto',
- path: to,
- queryParameters: {'subject': subject, 'body': body},
- );
-}
-
Future<void> sendEmail(
BuildContext context, {
required String to,
@@ -244,20 +209,8 @@ Future<void> sendEmail(
final String subject0 = subject ?? '[Support]';
final String body0 = (body ?? '') + clientDebugInfo;
- if (Platform.isAndroid) {
- // Special handling due to issue in proton mail android client
- // https://github.com/ente/photos-app/pull/253
- final params = buildMailtoUri(to: to, subject: subject0, body: body0);
- if (await canLaunchUrl(params)) {
- await launchUrl(params);
- } else {
- // this will trigger _showNoMailAppsDialog
- throw Exception('Could not launch ${params.toString()}');
- }
- } else {
- if (!context.mounted) {
- return;
- }
+ final launched = await _launchEmail(to: to, subject: subject0, body: body0);
+ if (!launched && context.mounted) {
_showNoMailAppsDialog(context, to);
}
} catch (e) {
@@ -268,6 +221,29 @@ Future<void> sendEmail(
}
}
+Future<bool> _launchEmail({
+ required String to,
+ required String subject,
+ required String body,
+ String? attachmentPath,
+}) async {
+ final result = await _mailComposer.compose(
+ MailDraft(
+ recipient: to,
+ subject: subject,
+ body: body,
+ attachment: attachmentPath == null
+ ? null
+ : MailAttachment(path: attachmentPath, mimeType: 'application/zip'),
+ ),
+ );
+ if (result is MailUnavailable) {
+ _logger.warning('Mail composer unavailable: ${result.reason.name}');
+ return false;
+ }
+ return true;
+}
+
Future<String> _clientInfo(BaseConfiguration? configuration) async {
final packageInfo = await PackageInfo.fromPlatform();
final String debugInfo =
diff --git a/mobile/packages/utils/pubspec.yaml b/mobile/packages/utils/pubspec.yaml
index 267d9d2ca8..b77358da50 100644
--- a/mobile/packages/utils/pubspec.yaml
+++ b/mobile/packages/utils/pubspec.yaml
@@ -12,6 +12,8 @@ dependencies:
path: ../../packages/configuration
ente_logging:
path: ../../packages/logging
+ ente_mail:
+ path: ../mail
ente_pure_utils:
path: ../ente_pure_utils
ente_strings:
@@ -21,7 +23,6 @@ dependencies:
file_saver: 0.3.1
flutter:
sdk: flutter
- flutter_email_sender: 7.0.0
intl: 0.20.2
logging: 1.3.0
package_info_plus: 8.3.1
diff --git a/mobile/pubspec.lock b/mobile/pubspec.lock
index d1e9abee6e..6d593fc708 100644
--- a/mobile/pubspec.lock
+++ b/mobile/pubspec.lock
@@ -863,14 +863,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.0.5"
- flutter_email_sender:
- dependency: transitive
- description:
- name: flutter_email_sender
- sha256: d39eb5e91358fc19ec4050da69accec21f9d5b2b6bcf188aa246327b6ca2352c
- url: "https://pub.dev"
- source: hosted
- version: "7.0.0"
flutter_image_compress:
dependency: transitive
description:
@@ -1965,15 +1957,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.0.3"
- open_mail_app:
- dependency: transitive
- description:
- path: "."
- ref: "13c0244db82b386ad1a53b2451bdfda8d2687cb6"
- resolved-ref: "13c0244db82b386ad1a53b2451bdfda8d2687cb6"
- url: "https://github.com/ente/open-mail-app-flutter.git"
- source: git
- version: "0.4.4"
otp:
dependency: transitive
description:
diff --git a/mobile/pubspec.yaml b/mobile/pubspec.yaml
index 1a3a4411b5..6e168a0b51 100644
--- a/mobile/pubspec.yaml
+++ b/mobile/pubspec.yaml
@@ -34,6 +34,7 @@ workspace:
- packages/lock_screen
- packages/log_viewer
- packages/logging
+ - packages/mail
- packages/native_video_editor
- packages/network
- packages/qr