open composer view when selected share file
This commit is contained in:
@@ -82,27 +82,6 @@
|
|||||||
<data android:mimeType="image/*" />
|
<data android:mimeType="image/*" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.SEND" />
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
|
||||||
<data android:mimeType="video/*" />
|
|
||||||
</intent-filter>
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.SEND_MULTIPLE" />
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
|
||||||
<data android:mimeType="video/*" />
|
|
||||||
</intent-filter>
|
|
||||||
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.SEND" />
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
|
||||||
<data android:mimeType="*/*" />
|
|
||||||
</intent-filter>
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.SEND_MULTIPLE" />
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
|
||||||
<data android:mimeType="*/*" />
|
|
||||||
</intent-filter>
|
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<provider
|
<provider
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
# 12. change-app-group-id-in-receive-sharing-intent
|
||||||
|
|
||||||
|
Date: 2022-08-03
|
||||||
|
|
||||||
|
## Status
|
||||||
|
|
||||||
|
Accepted
|
||||||
|
|
||||||
|
## Context
|
||||||
|
|
||||||
|
Because this app group id not same app bundle id in iOS so i changed the code to get the app group id by bundle id with the app group id of this project.
|
||||||
|
|
||||||
|
## Decision
|
||||||
|
|
||||||
|
Required define APP_GROUP_ID in User-Defined at Build Setting
|
||||||
|
|
||||||
|
## Consequences
|
||||||
|
|
||||||
|
- Can share image like normal
|
||||||
@@ -460,6 +460,7 @@
|
|||||||
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
|
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||||
|
APP_GROUP_ID = group.com.linagora.teammail;
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
@@ -593,6 +594,7 @@
|
|||||||
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
|
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||||
|
APP_GROUP_ID = group.com.linagora.teammail;
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
@@ -620,6 +622,7 @@
|
|||||||
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
|
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||||
|
APP_GROUP_ID = group.com.linagora.teammail;
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
|
<key>AppGroupId</key>
|
||||||
|
<string>${APP_GROUP_ID}</string>
|
||||||
<key>CADisableMinimumFrameDurationOnPhone</key>
|
<key>CADisableMinimumFrameDurationOnPhone</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
|||||||
@@ -26,12 +26,8 @@
|
|||||||
<dict>
|
<dict>
|
||||||
<key>NSExtensionActivationRule</key>
|
<key>NSExtensionActivationRule</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>NSExtensionActivationSupportsFileWithMaxCount</key>
|
|
||||||
<integer>15</integer>
|
|
||||||
<key>NSExtensionActivationSupportsImageWithMaxCount</key>
|
<key>NSExtensionActivationSupportsImageWithMaxCount</key>
|
||||||
<integer>15</integer>
|
<integer>15</integer>
|
||||||
<key>NSExtensionActivationSupportsMovieWithMaxCount</key>
|
|
||||||
<integer>15</integer>
|
|
||||||
<key>NSExtensionActivationSupportsText</key>
|
<key>NSExtensionActivationSupportsText</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
|
<key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
|
||||||
@@ -39,7 +35,6 @@
|
|||||||
</dict>
|
</dict>
|
||||||
<key>PHSupportedMediaTypes</key>
|
<key>PHSupportedMediaTypes</key>
|
||||||
<array>
|
<array>
|
||||||
<string>Video</string>
|
|
||||||
<string>Image</string>
|
<string>Image</string>
|
||||||
</array>
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
|
|||||||
@@ -5,15 +5,13 @@ import Photos
|
|||||||
|
|
||||||
class ShareViewController: SLComposeServiceViewController {
|
class ShareViewController: SLComposeServiceViewController {
|
||||||
var hostAppBundleIdentifier = ""
|
var hostAppBundleIdentifier = ""
|
||||||
let appGroupId = "group.com.linagora.teammail"
|
var appGroupId = ""
|
||||||
let sharedKey = "ShareKey"
|
let sharedKey = "ShareKey"
|
||||||
var sharedMedia: [SharedMediaFile] = []
|
var sharedMedia: [SharedMediaFile] = []
|
||||||
var sharedText: [String] = []
|
var sharedText: [String] = []
|
||||||
let imageContentType = kUTTypeImage as String
|
let imageContentType = kUTTypeImage as String
|
||||||
let videoContentType = kUTTypeMovie as String
|
|
||||||
let textContentType = kUTTypeText as String
|
let textContentType = kUTTypeText as String
|
||||||
let urlContentType = kUTTypeURL as String
|
let urlContentType = kUTTypeURL as String
|
||||||
let fileURLType = kUTTypeFileURL as String;
|
|
||||||
|
|
||||||
override func isContentValid() -> Bool {
|
override func isContentValid() -> Bool {
|
||||||
return true
|
return true
|
||||||
@@ -30,6 +28,9 @@ class ShareViewController: SLComposeServiceViewController {
|
|||||||
let lastIndexOfPoint = shareExtensionAppBundleIdentifier.lastIndex(of: ".");
|
let lastIndexOfPoint = shareExtensionAppBundleIdentifier.lastIndex(of: ".");
|
||||||
hostAppBundleIdentifier = String(shareExtensionAppBundleIdentifier[..<lastIndexOfPoint!]);
|
hostAppBundleIdentifier = String(shareExtensionAppBundleIdentifier[..<lastIndexOfPoint!]);
|
||||||
|
|
||||||
|
// loading custom AppGroupId from Build Settings or use group.<hostAppBundleIdentifier>
|
||||||
|
appGroupId = (Bundle.main.object(forInfoDictionaryKey: "AppGroupId") as? String) ?? "group.\(hostAppBundleIdentifier)";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
@@ -50,12 +51,8 @@ class ShareViewController: SLComposeServiceViewController {
|
|||||||
handleImages(content: content, attachment: attachment, index: index)
|
handleImages(content: content, attachment: attachment, index: index)
|
||||||
} else if attachment.hasItemConformingToTypeIdentifier(textContentType) {
|
} else if attachment.hasItemConformingToTypeIdentifier(textContentType) {
|
||||||
handleText(content: content, attachment: attachment, index: index)
|
handleText(content: content, attachment: attachment, index: index)
|
||||||
} else if attachment.hasItemConformingToTypeIdentifier(fileURLType) {
|
|
||||||
handleFiles(content: content, attachment: attachment, index: index)
|
|
||||||
} else if attachment.hasItemConformingToTypeIdentifier(urlContentType) {
|
} else if attachment.hasItemConformingToTypeIdentifier(urlContentType) {
|
||||||
handleUrl(content: content, attachment: attachment, index: index)
|
handleUrl(content: content, attachment: attachment, index: index)
|
||||||
} else if attachment.hasItemConformingToTypeIdentifier(videoContentType) {
|
|
||||||
handleVideos(content: content, attachment: attachment, index: index)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -142,65 +139,6 @@ class ShareViewController: SLComposeServiceViewController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func handleVideos (content: NSExtensionItem, attachment: NSItemProvider, index: Int) {
|
|
||||||
attachment.loadItem(forTypeIdentifier: videoContentType, options: nil) { [weak self] data, error in
|
|
||||||
|
|
||||||
if error == nil, let url = data as? URL, let this = self {
|
|
||||||
|
|
||||||
// Always copy
|
|
||||||
let fileName = this.getFileName(from: url, type: .video)
|
|
||||||
let newPath = FileManager.default
|
|
||||||
.containerURL(forSecurityApplicationGroupIdentifier: this.appGroupId)!
|
|
||||||
.appendingPathComponent(fileName)
|
|
||||||
let copied = this.copyFile(at: url, to: newPath)
|
|
||||||
if(copied) {
|
|
||||||
guard let sharedFile = this.getSharedMediaFile(forVideo: newPath) else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
this.sharedMedia.append(sharedFile)
|
|
||||||
}
|
|
||||||
|
|
||||||
// If this is the last item, save imagesData in userDefaults and redirect to host app
|
|
||||||
if index == (content.attachments?.count)! - 1 {
|
|
||||||
let userDefaults = UserDefaults(suiteName: this.appGroupId)
|
|
||||||
userDefaults?.set(this.toData(data: this.sharedMedia), forKey: this.sharedKey)
|
|
||||||
userDefaults?.synchronize()
|
|
||||||
this.redirectToHostApp(type: .media)
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
self?.dismissWithError()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private func handleFiles (content: NSExtensionItem, attachment: NSItemProvider, index: Int) {
|
|
||||||
attachment.loadItem(forTypeIdentifier: fileURLType, options: nil) { [weak self] data, error in
|
|
||||||
|
|
||||||
if error == nil, let url = data as? URL, let this = self {
|
|
||||||
|
|
||||||
// Always copy
|
|
||||||
let fileName = this.getFileName(from :url, type: .file)
|
|
||||||
let newPath = FileManager.default
|
|
||||||
.containerURL(forSecurityApplicationGroupIdentifier: this.appGroupId)!
|
|
||||||
.appendingPathComponent(fileName)
|
|
||||||
let copied = this.copyFile(at: url, to: newPath)
|
|
||||||
if (copied) {
|
|
||||||
this.sharedMedia.append(SharedMediaFile(path: newPath.absoluteString, thumbnail: nil, duration: nil, type: .file))
|
|
||||||
}
|
|
||||||
|
|
||||||
if index == (content.attachments?.count)! - 1 {
|
|
||||||
let userDefaults = UserDefaults(suiteName: this.appGroupId)
|
|
||||||
userDefaults?.set(this.toData(data: this.sharedMedia), forKey: this.sharedKey)
|
|
||||||
userDefaults?.synchronize()
|
|
||||||
this.redirectToHostApp(type: .file)
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
self?.dismissWithError()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private func dismissWithError() {
|
private func dismissWithError() {
|
||||||
print("[ERROR] Error loading data!")
|
print("[ERROR] Error loading data!")
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import 'package:jmap_dart_client/jmap/mail/email/keyword_identifier.dart';
|
|||||||
import 'package:jmap_dart_client/jmap/mail/mailbox/mailbox.dart';
|
import 'package:jmap_dart_client/jmap/mail/mailbox/mailbox.dart';
|
||||||
import 'package:model/model.dart';
|
import 'package:model/model.dart';
|
||||||
import 'package:permission_handler/permission_handler.dart';
|
import 'package:permission_handler/permission_handler.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/base/base_controller.dart';
|
||||||
import 'package:tmail_ui_user/features/composer/domain/model/contact_suggestion_source.dart';
|
import 'package:tmail_ui_user/features/composer/domain/model/contact_suggestion_source.dart';
|
||||||
import 'package:tmail_ui_user/features/composer/domain/model/email_request.dart';
|
import 'package:tmail_ui_user/features/composer/domain/model/email_request.dart';
|
||||||
@@ -317,6 +318,7 @@ class ComposerController extends BaseController {
|
|||||||
if (arguments.emailActionType == EmailActionType.edit) {
|
if (arguments.emailActionType == EmailActionType.edit) {
|
||||||
_getEmailContentAction(arguments);
|
_getEmailContentAction(arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
_initEmailAddress(arguments);
|
_initEmailAddress(arguments);
|
||||||
_initSubjectEmail(arguments);
|
_initSubjectEmail(arguments);
|
||||||
_initAttachments(arguments);
|
_initAttachments(arguments);
|
||||||
@@ -902,7 +904,40 @@ class ComposerController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<InlineImage> covertListSharedMediaFileToFile(List<SharedMediaFile> value) {
|
||||||
|
List<File> newFiles = List.empty(growable: true);
|
||||||
|
if (value.isNotEmpty) {
|
||||||
|
for (var element in value) {
|
||||||
|
newFiles.add(File(
|
||||||
|
Platform.isIOS
|
||||||
|
? element.type == SharedMediaType.FILE
|
||||||
|
? element.path.toString().replaceAll('file:/', '')
|
||||||
|
: element.path
|
||||||
|
: element.path,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final List<InlineImage> listInlineImage = newFiles.map(
|
||||||
|
(e) => InlineImage(
|
||||||
|
ImageSource.local,
|
||||||
|
fileInfo: FileInfo(
|
||||||
|
e.path.split('/').last,
|
||||||
|
e.path,
|
||||||
|
e.existsSync() ? e.lengthSync() : 0,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
).toList();
|
||||||
|
return listInlineImage;
|
||||||
|
}
|
||||||
|
|
||||||
void _getEmailContentAction(ComposerArguments arguments) async {
|
void _getEmailContentAction(ComposerArguments arguments) async {
|
||||||
|
if(arguments.listSharedMediaFile != null && arguments.listSharedMediaFile!.isNotEmpty){
|
||||||
|
final listInlineImage = covertListSharedMediaFileToFile(arguments.listSharedMediaFile!);
|
||||||
|
for (var e in listInlineImage) {
|
||||||
|
_uploadInlineAttachmentsAction(e.fileInfo!);
|
||||||
|
}
|
||||||
|
}
|
||||||
if(arguments.emailContents != null && arguments.emailContents!.isNotEmpty){
|
if(arguments.emailContents != null && arguments.emailContents!.isNotEmpty){
|
||||||
_emailContents = arguments.emailContents;
|
_emailContents = arguments.emailContents;
|
||||||
emailContentsViewState.value = Right(GetEmailContentSuccess(_emailContents!,[],[]));
|
emailContentsViewState.value = Right(GetEmailContentSuccess(_emailContents!,[],[]));
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
import 'package:jmap_dart_client/jmap/mail/email/email_address.dart';
|
import 'package:jmap_dart_client/jmap/mail/email/email_address.dart';
|
||||||
import 'package:jmap_dart_client/jmap/mail/mailbox/mailbox.dart';
|
import 'package:jmap_dart_client/jmap/mail/mailbox/mailbox.dart';
|
||||||
import 'package:model/model.dart';
|
import 'package:model/model.dart';
|
||||||
|
import 'package:receive_sharing_intent/receive_sharing_intent.dart';
|
||||||
import 'package:tmail_ui_user/main/routes/router_arguments.dart';
|
import 'package:tmail_ui_user/main/routes/router_arguments.dart';
|
||||||
|
|
||||||
class ComposerArguments extends RouterArguments {
|
class ComposerArguments extends RouterArguments {
|
||||||
final EmailActionType emailActionType;
|
final EmailActionType emailActionType;
|
||||||
final PresentationEmail? presentationEmail;
|
final PresentationEmail? presentationEmail;
|
||||||
final List<EmailContent>? emailContents;
|
final List<EmailContent>? emailContents;
|
||||||
|
final List<SharedMediaFile>? listSharedMediaFile;
|
||||||
final EmailAddress? emailAddress;
|
final EmailAddress? emailAddress;
|
||||||
final List<Attachment>? attachments;
|
final List<Attachment>? attachments;
|
||||||
final Role? mailboxRole;
|
final Role? mailboxRole;
|
||||||
@@ -18,6 +20,7 @@ class ComposerArguments extends RouterArguments {
|
|||||||
this.attachments,
|
this.attachments,
|
||||||
this.mailboxRole,
|
this.mailboxRole,
|
||||||
this.emailAddress,
|
this.emailAddress,
|
||||||
|
this.listSharedMediaFile,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -28,5 +31,6 @@ class ComposerArguments extends RouterArguments {
|
|||||||
attachments,
|
attachments,
|
||||||
mailboxRole,
|
mailboxRole,
|
||||||
emailAddress,
|
emailAddress,
|
||||||
|
listSharedMediaFile,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -3,9 +3,7 @@ import 'package:dartz/dartz.dart';
|
|||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter_downloader/flutter_downloader.dart';
|
import 'package:flutter_downloader/flutter_downloader.dart';
|
||||||
import 'package:jmap_dart_client/jmap/mail/email/email_address.dart';
|
import 'package:jmap_dart_client/jmap/mail/email/email_address.dart';
|
||||||
import 'package:model/account/account.dart';
|
import 'package:model/model.dart';
|
||||||
import 'package:model/oidc/request/oidc_request.dart';
|
|
||||||
import 'package:model/oidc/token_oidc.dart';
|
|
||||||
import 'package:tmail_ui_user/features/base/base_controller.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/caching/caching_manager.dart';
|
||||||
import 'package:tmail_ui_user/features/cleanup/domain/model/cleanup_rule.dart';
|
import 'package:tmail_ui_user/features/cleanup/domain/model/cleanup_rule.dart';
|
||||||
@@ -100,6 +98,11 @@ class HomeController extends BaseController {
|
|||||||
_emailReceiveManager.setPendingEmailAddress(EmailAddress(null, uri.path));
|
_emailReceiveManager.setPendingEmailAddress(EmailAddress(null, uri.path));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
_emailReceiveManager.receivingFileSharingStream.listen((listFile) {
|
||||||
|
log('HomeController::onInit(): SharedMediaFile: ${listFile.toString()}');
|
||||||
|
_emailReceiveManager.setPendingFileInfo(listFile);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _goToLogin({LoginArguments? arguments}) {
|
void _goToLogin({LoginArguments? arguments}) {
|
||||||
|
|||||||
+19
@@ -89,6 +89,7 @@ class MailboxDashBoardController extends ReloadableController {
|
|||||||
RouterArguments? routerArguments;
|
RouterArguments? routerArguments;
|
||||||
late StreamSubscription _connectivityStreamSubscription;
|
late StreamSubscription _connectivityStreamSubscription;
|
||||||
late StreamSubscription _emailReceiveManagerStreamSubscription;
|
late StreamSubscription _emailReceiveManagerStreamSubscription;
|
||||||
|
late StreamSubscription _fileReceiveManagerStreamSubscription;
|
||||||
|
|
||||||
final StreamController<Either<Failure, Success>> _progressStateController =
|
final StreamController<Either<Failure, Success>> _progressStateController =
|
||||||
StreamController<Either<Failure, Success>>.broadcast();
|
StreamController<Either<Failure, Success>>.broadcast();
|
||||||
@@ -110,6 +111,7 @@ class MailboxDashBoardController extends ReloadableController {
|
|||||||
void onInit() {
|
void onInit() {
|
||||||
_registerNetworkConnectivityState();
|
_registerNetworkConnectivityState();
|
||||||
_registerPendingEmailAddress();
|
_registerPendingEmailAddress();
|
||||||
|
_registerPendingFileInfo();
|
||||||
_initializeIsolateExecutor();
|
_initializeIsolateExecutor();
|
||||||
super.onInit();
|
super.onInit();
|
||||||
}
|
}
|
||||||
@@ -239,6 +241,22 @@ class MailboxDashBoardController extends ReloadableController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _registerPendingFileInfo() {
|
||||||
|
_fileReceiveManagerStreamSubscription =
|
||||||
|
_emailReceiveManager.pendingFileInfo.stream.listen((listFile) {
|
||||||
|
log('MailboxDashBoardController::_registerPendingFileInfo(): ${listFile.length}');
|
||||||
|
if (listFile.isNotEmpty) {
|
||||||
|
_emailReceiveManager.clearPendingFileInfo();
|
||||||
|
final arguments = ComposerArguments(
|
||||||
|
emailActionType: EmailActionType.edit,
|
||||||
|
mailboxRole: selectedMailbox.value?.role,
|
||||||
|
listSharedMediaFile: listFile,
|
||||||
|
);
|
||||||
|
goToComposer(arguments);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void _initializeIsolateExecutor() async {
|
void _initializeIsolateExecutor() async {
|
||||||
await _isolateExecutor.warmUp(log: BuildUtils.isDebugMode);
|
await _isolateExecutor.warmUp(log: BuildUtils.isDebugMode);
|
||||||
|
|
||||||
@@ -556,6 +574,7 @@ class MailboxDashBoardController extends ReloadableController {
|
|||||||
void onClose() {
|
void onClose() {
|
||||||
_emailReceiveManager.closeEmailReceiveManagerStream();
|
_emailReceiveManager.closeEmailReceiveManagerStream();
|
||||||
_emailReceiveManagerStreamSubscription.cancel();
|
_emailReceiveManagerStreamSubscription.cancel();
|
||||||
|
_fileReceiveManagerStreamSubscription.cancel();
|
||||||
_connectivityStreamSubscription.cancel();
|
_connectivityStreamSubscription.cancel();
|
||||||
_progressStateController.close();
|
_progressStateController.close();
|
||||||
_isolateExecutor.dispose();
|
_isolateExecutor.dispose();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"@@last_modified": "2022-07-27T12:01:37.344258",
|
"@@last_modified": "2022-08-03T00:27:26.944930",
|
||||||
"initializing_data": "Initializing data...",
|
"initializing_data": "Initializing data...",
|
||||||
"@initializing_data": {
|
"@initializing_data": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
|
|||||||
@@ -8,13 +8,16 @@ class EmailReceiveManager {
|
|||||||
BehaviorSubject<EmailAddress?> _pendingEmailAddressInfo = BehaviorSubject.seeded(null);
|
BehaviorSubject<EmailAddress?> _pendingEmailAddressInfo = BehaviorSubject.seeded(null);
|
||||||
BehaviorSubject<EmailAddress?> get pendingEmailAddressInfo => _pendingEmailAddressInfo;
|
BehaviorSubject<EmailAddress?> get pendingEmailAddressInfo => _pendingEmailAddressInfo;
|
||||||
|
|
||||||
|
BehaviorSubject<List<SharedMediaFile>> _pendingFileInfo = BehaviorSubject.seeded(List.empty(growable: true));
|
||||||
|
BehaviorSubject<List<SharedMediaFile>> get pendingFileInfo => _pendingFileInfo;
|
||||||
|
|
||||||
Stream<Uri?> get receivingSharingStream {
|
Stream<Uri?> get receivingSharingStream {
|
||||||
return Rx.merge([
|
return Rx.merge([
|
||||||
Stream.fromFuture(ReceiveSharingIntent.getInitialTextAsUri()),
|
Stream.fromFuture(ReceiveSharingIntent.getInitialTextAsUri()),
|
||||||
ReceiveSharingIntent.getTextStreamAsUri()
|
ReceiveSharingIntent.getTextStreamAsUri()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
Stream<List<SharedMediaFile>> get receivingSharingStream2 {
|
Stream<List<SharedMediaFile>> get receivingFileSharingStream {
|
||||||
return Rx.merge([
|
return Rx.merge([
|
||||||
Stream.fromFuture(ReceiveSharingIntent.getInitialMedia()),
|
Stream.fromFuture(ReceiveSharingIntent.getInitialMedia()),
|
||||||
ReceiveSharingIntent.getMediaStream()
|
ReceiveSharingIntent.getMediaStream()
|
||||||
@@ -37,4 +40,21 @@ class EmailReceiveManager {
|
|||||||
void closeEmailReceiveManagerStream() {
|
void closeEmailReceiveManagerStream() {
|
||||||
_pendingEmailAddressInfo.close();
|
_pendingEmailAddressInfo.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setPendingFileInfo(List<SharedMediaFile> list) async {
|
||||||
|
clearPendingFileInfo();
|
||||||
|
_pendingFileInfo.add(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
void clearPendingFileInfo() {
|
||||||
|
if(_pendingFileInfo.isClosed) {
|
||||||
|
_pendingFileInfo = BehaviorSubject.seeded(List.empty(growable: true));
|
||||||
|
} else {
|
||||||
|
_pendingFileInfo.add(List.empty(growable: true));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void closeFileSharingStream() {
|
||||||
|
_pendingFileInfo.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -146,7 +146,7 @@ dependencies:
|
|||||||
|
|
||||||
receive_sharing_intent:
|
receive_sharing_intent:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/ManhNTX/receive_sharing_intent.git
|
url: https://github.com/KasemJaffer/receive_sharing_intent.git
|
||||||
ref: master
|
ref: master
|
||||||
|
|
||||||
dropdown_button2: 1.4.0
|
dropdown_button2: 1.4.0
|
||||||
|
|||||||
Reference in New Issue
Block a user