Only create and use the correct rich text controller for each platform

This commit is contained in:
dab246
2024-04-23 23:26:17 +07:00
committed by Dat H. Pham
parent a2e6b78576
commit 36ab6b1ccc
8 changed files with 139 additions and 111 deletions
@@ -214,9 +214,12 @@ class ComposerBindings extends BaseBindings {
@override
void bindingsController() {
Get.lazyPut(() => RichTextMobileTabletController());
if (PlatformInfo.isWeb) {
Get.lazyPut(() => RichTextWebController());
} else {
Get.lazyPut(() => RichTextMobileTabletController());
}
Get.lazyPut(() => UploadController(Get.find<UploadAttachmentInteractor>()));
Get.lazyPut(() => RichTextWebController());
Get.lazyPut(() => ComposerController(
Get.find<LocalFilePickerInteractor>(),
Get.find<LocalImagePickerInteractor>(),
@@ -225,7 +228,6 @@ class ComposerBindings extends BaseBindings {
Get.find<UploadController>(),
Get.find<RemoveComposerCacheOnWebInteractor>(),
Get.find<SaveComposerCacheOnWebInteractor>(),
Get.find<RichTextWebController>(),
Get.find<DownloadImageAsBase64Interactor>(),
Get.find<TransformHtmlEmailContentInteractor>(),
Get.find<GetAlwaysReadReceiptSettingInteractor>(),
@@ -235,9 +237,12 @@ class ComposerBindings extends BaseBindings {
}
void dispose() {
if (PlatformInfo.isWeb) {
Get.delete<RichTextWebController>();
} else {
Get.delete<RichTextMobileTabletController>();
}
Get.delete<UploadController>();
Get.delete<RichTextWebController>();
Get.delete<RichTextMobileTabletController>();
Get.delete<ComposerController>();
}
}