diff --git a/lib/features/composer/presentation/composer_bindings.dart b/lib/features/composer/presentation/composer_bindings.dart index 5ab28cdf1..b50df01b4 100644 --- a/lib/features/composer/presentation/composer_bindings.dart +++ b/lib/features/composer/presentation/composer_bindings.dart @@ -72,40 +72,53 @@ import 'package:uuid/uuid.dart'; class ComposerBindings extends BaseBindings { + final String? composerId; + + ComposerBindings({this.composerId}); + @override void bindingsDataSourceImpl() { Get.lazyPut(() => AttachmentUploadDataSourceImpl( - Get.find(), + Get.find(tag: composerId), Get.find(), - Get.find() - )); - Get.lazyPut(() => ComposerDataSourceImpl(Get.find(), Get.find())); - Get.lazyPut(() => ContactDataSourceImpl(Get.find())); + Get.find(), + ), tag: composerId); + Get.lazyPut(() => ComposerDataSourceImpl( + Get.find(), + Get.find(), + ), tag: composerId); + Get.lazyPut(() => ContactDataSourceImpl( + Get.find(), + ), tag: composerId); Get.lazyPut(() => MailboxDataSourceImpl( Get.find(), Get.find(), - Get.find())); + Get.find(), + ), tag: composerId); Get.lazyPut(() => MailboxCacheDataSourceImpl( - Get.find(), - Get.find())); + Get.find(), + Get.find(), + ), tag: composerId); Get.lazyPut(() => EmailDataSourceImpl( Get.find(), - Get.find())); + Get.find(), + ), tag: composerId); Get.lazyPut(() => HtmlDataSourceImpl( Get.find(), - Get.find())); + Get.find(), + ), tag: composerId); Get.lazyPut(() => StateDataSourceImpl( Get.find(), Get.find(), - Get.find() - )); + Get.find(), + ), tag: composerId); Get.lazyPut(() => PrintFileDataSourceImpl( Get.find(), Get.find(), Get.find(), Get.find(), - Get.find() - )); + Get.find(), + ), tag: composerId); Get.lazyPut(() => EmailHiveCacheDataSourceImpl( Get.find(), Get.find(), @@ -114,127 +127,197 @@ class ComposerBindings extends BaseBindings { Get.find(), Get.find(), Get.find(), - Get.find())); + Get.find(), + ), tag: composerId); Get.lazyPut(() => EmailLocalStorageDataSourceImpl( Get.find(), - Get.find())); + Get.find(), + ), tag: composerId); Get.lazyPut(() => EmailSessionStorageDatasourceImpl( Get.find(), - Get.find())); + Get.find(), + ), tag: composerId); } @override void bindingsDataSource() { - Get.lazyPut(() => Get.find()); - Get.lazyPut(() => Get.find()); - Get.lazyPut(() => Get.find()); - Get.lazyPut(() => Get.find()); - Get.lazyPut(() => Get.find()); - Get.lazyPut(() => Get.find()); - Get.lazyPut(() => Get.find()); - Get.lazyPut(() => Get.find()); + Get.lazyPut( + () => Get.find(tag: composerId), + tag: composerId, + ); + Get.lazyPut( + () => Get.find(tag: composerId), + tag: composerId, + ); + Get.lazyPut( + () => Get.find(tag: composerId), + tag: composerId, + ); + Get.lazyPut( + () => Get.find(tag: composerId), + tag: composerId, + ); + Get.lazyPut( + () => Get.find(tag: composerId), + tag: composerId, + ); + Get.lazyPut( + () => Get.find(tag: composerId), + tag: composerId, + ); + Get.lazyPut( + () => Get.find(tag: composerId), + tag: composerId, + ); + Get.lazyPut( + () => Get.find(tag: composerId), + tag: composerId, + ); } @override void bindingsRepositoryImpl() { Get.lazyPut(() => ComposerRepositoryImpl( - Get.find(), - Get.find(), - Get.find(), + Get.find(tag: composerId), + Get.find(tag: composerId), + Get.find(tag: composerId), Get.find(), Get.find(), - )); - Get.lazyPut(() => ContactRepositoryImpl(Get.find())); + ), tag: composerId); + Get.lazyPut( + () => ContactRepositoryImpl(Get.find(tag: composerId)), + tag: composerId, + ); Get.lazyPut(() => MailboxRepositoryImpl( { - DataSourceType.network: Get.find(), - DataSourceType.local: Get.find() + DataSourceType.network: Get.find(tag: composerId), + DataSourceType.local: Get.find(tag: composerId) }, - Get.find(), - )); + Get.find(tag: composerId), + ), tag: composerId); Get.lazyPut(() => EmailRepositoryImpl( { - DataSourceType.network: Get.find(), - DataSourceType.hiveCache: Get.find(), - DataSourceType.local: Get.find(), - DataSourceType.session: Get.find(), + DataSourceType.network: Get.find(tag: composerId), + DataSourceType.hiveCache: Get.find(tag: composerId), + DataSourceType.local: Get.find(tag: composerId), + DataSourceType.session: Get.find(tag: composerId), }, - Get.find(), - Get.find(), - Get.find(), - )); + Get.find(tag: composerId), + Get.find(tag: composerId), + Get.find(tag: composerId), + ), tag: composerId); } @override void bindingsRepository() { - Get.lazyPut(() => Get.find()); - Get.lazyPut(() => Get.find()); - Get.lazyPut(() => Get.find()); - Get.lazyPut(() => Get.find()); + Get.lazyPut( + () => Get.find(tag: composerId), + tag: composerId, + ); + Get.lazyPut( + () => Get.find(tag: composerId), + tag: composerId, + ); + Get.lazyPut( + () => Get.find(tag: composerId), + tag: composerId, + ); + Get.lazyPut( + () => Get.find(tag: composerId), + tag: composerId, + ); } @override void bindingsInteractor() { - Get.lazyPut(() => LocalFilePickerInteractor()); - Get.lazyPut(() => LocalImagePickerInteractor()); - Get.lazyPut(() => UploadAttachmentInteractor(Get.find())); - Get.lazyPut(() => GetEmailContentInteractor(Get.find())); - Get.lazyPut(() => RemoveComposerCacheOnWebInteractor(Get.find())); + Get.lazyPut( + () => LocalFilePickerInteractor(), + tag: composerId, + ); + Get.lazyPut( + () => LocalImagePickerInteractor(), + tag: composerId, + ); + Get.lazyPut( + () => UploadAttachmentInteractor(Get.find(tag: composerId)), + tag: composerId, + ); + Get.lazyPut( + () => GetEmailContentInteractor(Get.find(tag: composerId)), + tag: composerId, + ); + Get.lazyPut( + () => RemoveComposerCacheOnWebInteractor(Get.find(tag: composerId)), + tag: composerId, + ); Get.lazyPut(() => SaveComposerCacheOnWebInteractor( - Get.find(), - Get.find(), - )); - Get.lazyPut(() => DownloadImageAsBase64Interactor(Get.find())); - Get.lazyPut(() => TransformHtmlEmailContentInteractor(Get.find())); + Get.find(tag: composerId), + Get.find(tag: composerId), + ), tag: composerId); + Get.lazyPut( + () => DownloadImageAsBase64Interactor(Get.find(tag: composerId)), + tag: composerId, + ); + Get.lazyPut( + () => TransformHtmlEmailContentInteractor(Get.find(tag: composerId)), + tag: composerId, + ); Get.lazyPut(() => CreateNewAndSendEmailInteractor( - Get.find(), - Get.find(), - )); + Get.find(tag: composerId), + Get.find(tag: composerId), + ), tag: composerId); Get.lazyPut(() => CreateNewAndSaveEmailToDraftsInteractor( - Get.find(), - Get.find(), - )); - Get.lazyPut(() => RestoreEmailInlineImagesInteractor( - Get.find())); - Get.lazyPut(() => PrintEmailInteractor( - Get.find())); + Get.find(tag: composerId), + Get.find(tag: composerId), + ), tag: composerId); + Get.lazyPut( + () => RestoreEmailInlineImagesInteractor(Get.find(tag: composerId)), + tag: composerId, + ); + Get.lazyPut( + () => PrintEmailInteractor(Get.find(tag: composerId)), + tag: composerId, + ); - IdentityInteractorsBindings().dependencies(); + IdentityInteractorsBindings(composerId: composerId).dependencies(); PreferencesInteractorsBindings().dependencies(); } @override void bindingsController() { if (PlatformInfo.isWeb) { - Get.lazyPut(() => RichTextWebController()); + Get.lazyPut(() => RichTextWebController(), tag: composerId); } else { - Get.lazyPut(() => RichTextMobileTabletController()); + Get.lazyPut(() => RichTextMobileTabletController(), tag: composerId); } - Get.lazyPut(() => UploadController(Get.find())); + Get.lazyPut( + () => UploadController(Get.find(tag: composerId)), + tag: composerId, + ); Get.lazyPut(() => ComposerController( - Get.find(), - Get.find(), - Get.find(), - Get.find(), - Get.find(), - Get.find(), - Get.find(), - Get.find(), - Get.find(), - Get.find(), - Get.find(), - Get.find(), - Get.find(), - )); + Get.find(tag: composerId), + Get.find(tag: composerId), + Get.find(tag: composerId), + Get.find(tag: composerId), + Get.find(tag: composerId), + Get.find(tag: composerId), + Get.find(tag: composerId), + Get.find(tag: composerId), + Get.find(tag: composerId), + Get.find(tag: composerId), + Get.find(tag: composerId), + Get.find(tag: composerId), + Get.find(tag: composerId), + ), tag: composerId); } void dispose() { if (PlatformInfo.isWeb) { - Get.delete(); + Get.delete(tag: composerId); } else { - Get.delete(); + Get.delete(tag: composerId); } - Get.delete(); - Get.delete(); + Get.delete(tag: composerId); + Get.delete(tag: composerId); } } \ No newline at end of file diff --git a/lib/features/composer/presentation/composer_view_web.dart b/lib/features/composer/presentation/composer_view_web.dart index 1e36d3dce..b492fc962 100644 --- a/lib/features/composer/presentation/composer_view_web.dart +++ b/lib/features/composer/presentation/composer_view_web.dart @@ -28,7 +28,12 @@ import 'package:tmail_ui_user/features/composer/presentation/widgets/web/toolbar class ComposerView extends GetWidget { - const ComposerView({Key? key}) : super(key: key); + final String? composerId; + + const ComposerView({super.key, this.composerId}); + + @override + ComposerController get controller => Get.find(tag: composerId); @override Widget build(BuildContext context) { diff --git a/lib/features/manage_account/presentation/profiles/identities/identity_interactors_bindings.dart b/lib/features/manage_account/presentation/profiles/identities/identity_interactors_bindings.dart index 7e3addd7d..0bbd1cbee 100644 --- a/lib/features/manage_account/presentation/profiles/identities/identity_interactors_bindings.dart +++ b/lib/features/manage_account/presentation/profiles/identities/identity_interactors_bindings.dart @@ -24,6 +24,10 @@ import 'package:tmail_ui_user/main/exceptions/remote_exception_thrower.dart'; class IdentityInteractorsBindings extends InteractorsBindings { + final String? composerId; + + IdentityInteractorsBindings({this.composerId}); + @override void dependencies() { _bindingsUtils(); @@ -32,12 +36,18 @@ class IdentityInteractorsBindings extends InteractorsBindings { @override void bindingsDataSource() { - Get.lazyPut(() => Get.find()); - Get.lazyPut(() => Get.find()); + Get.lazyPut( + () => Get.find(tag: composerId), + tag: composerId, + ); + Get.lazyPut( + () => Get.find(tag: composerId), + tag: composerId, + ); } void _bindingsUtils() { - Get.lazyPut(() => IdentityUtils()); + Get.lazyPut(() => IdentityUtils(), tag: composerId); } @override @@ -45,41 +55,70 @@ class IdentityInteractorsBindings extends InteractorsBindings { Get.lazyPut(() => IdentityDataSourceImpl( Get.find(), Get.find(), - Get.find())); + Get.find() + ), tag: composerId); Get.lazyPut(() => LocalIdentityCreatorDataSourceImpl( Get.find() - )); + ), tag: composerId); } @override void bindingsInteractor() { Get.lazyPut(() => GetAllIdentitiesInteractor( - Get.find(), - Get.find())); - Get.lazyPut(() => CreateNewIdentityInteractor(Get.find())); + Get.find(tag: composerId), + Get.find(tag: composerId) + ), tag: composerId); + Get.lazyPut( + () => CreateNewIdentityInteractor(Get.find(tag: composerId)), + tag: composerId, + ); Get.lazyPut(() => CreateNewDefaultIdentityInteractor( - Get.find(), - Get.find())); - Get.lazyPut(() => DeleteIdentityInteractor(Get.find())); - Get.lazyPut(() => EditIdentityInteractor(Get.find())); + Get.find(tag: composerId), + Get.find(tag: composerId) + ), tag: composerId); + Get.lazyPut( + () => DeleteIdentityInteractor(Get.find(tag: composerId)), + tag: composerId, + ); + Get.lazyPut( + () => EditIdentityInteractor(Get.find(tag: composerId)), + tag: composerId, + ); Get.lazyPut(() => EditDefaultIdentityInteractor( - Get.find(), - Get.find())); - Get.lazyPut(() => TransformHtmlSignatureInteractor(Get.find())); - Get.lazyPut(() => SaveIdentityCacheOnWebInteractor(Get.find())); + Get.find(tag: composerId), + Get.find(tag: composerId) + ), tag: composerId); + Get.lazyPut( + () => TransformHtmlSignatureInteractor(Get.find(tag: composerId)), + tag: composerId, + ); + Get.lazyPut( + () => SaveIdentityCacheOnWebInteractor(Get.find(tag: composerId)), + tag: composerId, + ); } @override void bindingsRepository() { - Get.lazyPut(() => Get.find()); - Get.lazyPut(() => Get.find()); + Get.lazyPut( + () => Get.find(tag: composerId), + tag: composerId, + ); + Get.lazyPut( + () => Get.find(tag: composerId), + tag: composerId, + ); } @override void bindingsRepositoryImpl() { - Get.lazyPut(() => IdentityRepositoryImpl(Get.find())); - Get.lazyPut(() => IdentityCreatorRepositoryImpl( - Get.find() - )); + Get.lazyPut( + () => IdentityRepositoryImpl(Get.find(tag: composerId)), + tag: composerId, + ); + Get.lazyPut( + () => IdentityCreatorRepositoryImpl(Get.find(tag: composerId)), + tag: composerId, + ); } } \ No newline at end of file