TF-1033: able share other file not media file

This commit is contained in:
ManhNTX
2022-10-05 15:06:37 +07:00
committed by Dat H. Pham
parent b180f0187b
commit 9fd1b4f653
4 changed files with 13 additions and 4 deletions
@@ -4,6 +4,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter_downloader/flutter_downloader.dart';
import 'package:jmap_dart_client/jmap/mail/email/email_address.dart';
import 'package:model/model.dart';
import 'package:receive_sharing_intent/receive_sharing_intent.dart';
import 'package:tmail_ui_user/features/base/base_controller.dart';
import 'package:tmail_ui_user/features/caching/caching_manager.dart';
import 'package:tmail_ui_user/features/cleanup/domain/model/cleanup_rule.dart';
@@ -96,8 +97,13 @@ class HomeController extends BaseController {
_emailReceiveManager.receivingSharingStream.listen((uri) {
log('HomeController::onReady(): Received Email: ${uri.toString()}');
if (uri != null) {
log('HomeController::onReady(): Address: ${uri.path}');
_emailReceiveManager.setPendingEmailAddress(EmailAddress(null, uri.path));
if(_emailReceiveManager.mailRegex.hasMatch(uri.path)) {
log('HomeController::onReady(): Address: ${uri.path}');
_emailReceiveManager.setPendingEmailAddress(EmailAddress(null, uri.path));
} else {
log('HomeController::onInit(): SharedMediaFilePath: ${uri.path}');
_emailReceiveManager.setPendingFileInfo([SharedMediaFile(uri.path, null, null, SharedMediaType.FILE)]);
}
}
});