Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TF-3399 Fix can not click on body of composer in SamSung A3 #3403

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions lib/features/composer/presentation/composer_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ class ComposerController extends BaseController
SignatureStatus _identityContentOnOpenPolicy = SignatureStatus.editedAvailable;
int? _savedEmailDraftHash;
bool _restoringSignatureButton = false;
GlobalKey? responsiveContainerKey;

@visibleForTesting
bool get restoringSignatureButton => _restoringSignatureButton;
Expand Down Expand Up @@ -230,6 +231,7 @@ class ComposerController extends BaseController
super.onInit();
if (PlatformInfo.isWeb) {
richTextWebController = getBinding<RichTextWebController>();
responsiveContainerKey = GlobalKey();
} else {
richTextMobileTabletController = getBinding<RichTextMobileTabletController>();
}
Expand Down Expand Up @@ -269,6 +271,7 @@ class ComposerController extends BaseController
_beforeReconnectManager.removeListener(onBeforeReconnect);
if (PlatformInfo.isWeb) {
richTextWebController = null;
responsiveContainerKey = null;
} else {
richTextMobileTabletController = null;
}
Expand Down Expand Up @@ -392,12 +395,6 @@ class ComposerController extends BaseController
}
});
});

if (richTextWebController != null) {
ever(richTextWebController!.formattingOptionsState, (_) {
richTextWebController!.editorController.setFocus();
});
}
}

void _triggerBrowserEventListener() {
Expand Down Expand Up @@ -525,6 +522,7 @@ class ComposerController extends BaseController

KeyEventResult _subjectEmailInputOnKeyListener(FocusNode node, KeyEvent event) {
if (event is KeyDownEvent && event.logicalKey == LogicalKeyboardKey.tab) {
subjectEmailInputFocusNode?.unfocus();
richTextWebController?.editorController.setFocus();
return KeyEventResult.handled;
}
Expand Down Expand Up @@ -1486,6 +1484,9 @@ class ComposerController extends BaseController
}

void displayScreenTypeComposerAction(ScreenDisplayMode displayMode) async {
if (screenDisplayMode.value == ScreenDisplayMode.minimize) {
_isEmailBodyLoaded = false;
}
if (richTextWebController != null && screenDisplayMode.value != ScreenDisplayMode.minimize) {
final textCurrent = await richTextWebController!.editorController.getText();
richTextWebController!.editorController.setText(textCurrent);
Expand Down Expand Up @@ -1955,7 +1956,6 @@ class ComposerController extends BaseController
return false;
}


void handleInitHtmlEditorWeb(String initContent) async {
if (_isEmailBodyLoaded) return;
log('ComposerController::handleInitHtmlEditorWeb:');
Expand All @@ -1980,9 +1980,7 @@ class ComposerController extends BaseController
richTextWebController?.closeAllMenuPopup();
}

void handleOnMouseDownHtmlEditorWeb(BuildContext context) {
Navigator.maybePop(context);
FocusScope.of(context).unfocus();
void handleOnMouseDownHtmlEditorWeb() {
_collapseAllRecipient();
_autoCreateEmailTag();
}
Expand Down
6 changes: 3 additions & 3 deletions lib/features/composer/presentation/composer_view_web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ class ComposerView extends GetWidget<ComposerController> {
child: Padding(
padding: ComposerStyle.mobileEditorPadding,
child: Obx(() => WebEditorView(
key: controller.responsiveContainerKey,
editorController: controller.richTextWebController!.editorController,
arguments: controller.composerArguments.value,
contentViewState: controller.emailContentsViewState.value,
Expand All @@ -196,7 +197,6 @@ class ComposerView extends GetWidget<ComposerController> {
onMouseDown: controller.handleOnMouseDownHtmlEditorWeb,
onEditorSettings: controller.richTextWebController!.onEditorSettingsChange,
onEditorTextSizeChanged: controller.richTextWebController!.onEditorTextSizeChanged,
width: constraints.maxWidth,
height: constraints.maxHeight,
onDragEnter: controller.handleOnDragEnterHtmlEditorWeb,
onPasteImageSuccessAction: (listFileUpload) => controller.handleOnPasteImageSuccessAction(
Expand Down Expand Up @@ -448,6 +448,7 @@ class ComposerView extends GetWidget<ComposerController> {
padding: ComposerStyle.desktopEditorPadding,
child: Obx(() {
return WebEditorView(
key: controller.responsiveContainerKey,
editorController: controller.richTextWebController!.editorController,
arguments: controller.composerArguments.value,
contentViewState: controller.emailContentsViewState.value,
Expand All @@ -458,7 +459,6 @@ class ComposerView extends GetWidget<ComposerController> {
onMouseDown: controller.handleOnMouseDownHtmlEditorWeb,
onEditorSettings: controller.richTextWebController?.onEditorSettingsChange,
onEditorTextSizeChanged: controller.richTextWebController?.onEditorTextSizeChanged,
width: constraints.maxWidth,
height: constraints.maxHeight,
onDragEnter: controller.handleOnDragEnterHtmlEditorWeb,
onPasteImageSuccessAction: (listFileUpload) => controller.handleOnPasteImageSuccessAction(
Expand Down Expand Up @@ -728,6 +728,7 @@ class ComposerView extends GetWidget<ComposerController> {
child: Padding(
padding: ComposerStyle.tabletEditorPadding,
child: Obx(() => WebEditorView(
key: controller.responsiveContainerKey,
editorController: controller.richTextWebController!.editorController,
arguments: controller.composerArguments.value,
contentViewState: controller.emailContentsViewState.value,
Expand All @@ -738,7 +739,6 @@ class ComposerView extends GetWidget<ComposerController> {
onMouseDown: controller.handleOnMouseDownHtmlEditorWeb,
onEditorSettings: controller.richTextWebController!.onEditorSettingsChange,
onEditorTextSizeChanged: controller.richTextWebController!.onEditorTextSizeChanged,
width: constraints.maxWidth,
height: constraints.maxHeight,
onDragEnter: controller.handleOnDragEnterHtmlEditorWeb,
onPasteImageSuccessAction: (listFileUpload) => controller.handleOnPasteImageSuccessAction(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,11 @@ class RichTextWebController extends BaseRichTextController {
: FormattingOptionsState.enabled;

formattingOptionsState.value = newState;

if (isFormattingOptionsEnabled) {
FocusManager.instance.primaryFocus?.unfocus();
editorController.setFocus();
}
}

bool get isFormattingOptionsEnabled => formattingOptionsState.value == FormattingOptionsState.enabled;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class WebEditorView extends StatelessWidget with EditorViewMixin {
final OnMouseDownEditorAction? onMouseDown;
final OnEditorSettingsChange? onEditorSettings;
final OnEditorTextSizeChanged? onEditorTextSizeChanged;
final double? width;
final double? height;
final OnDragEnterListener? onDragEnter;
final OnPasteImageSuccessAction? onPasteImageSuccessAction;
Expand All @@ -49,7 +48,6 @@ class WebEditorView extends StatelessWidget with EditorViewMixin {
this.onMouseDown,
this.onEditorSettings,
this.onEditorTextSizeChanged,
this.width,
this.height,
this.onDragEnter,
this.onPasteImageSuccessAction,
Expand Down Expand Up @@ -78,7 +76,6 @@ class WebEditorView extends StatelessWidget with EditorViewMixin {
onMouseDown: onMouseDown,
onEditorSettings: onEditorSettings,
onEditorTextSizeChanged: onEditorTextSizeChanged,
width: width,
height: height,
onDragEnter: onDragEnter,
onPasteImageSuccessAction: onPasteImageSuccessAction,
Expand Down Expand Up @@ -106,7 +103,6 @@ class WebEditorView extends StatelessWidget with EditorViewMixin {
onMouseDown: onMouseDown,
onEditorSettings: onEditorSettings,
onEditorTextSizeChanged: onEditorTextSizeChanged,
width: width,
height: height,
onDragEnter: onDragEnter,
onPasteImageSuccessAction: onPasteImageSuccessAction,
Expand Down Expand Up @@ -134,7 +130,6 @@ class WebEditorView extends StatelessWidget with EditorViewMixin {
onMouseDown: onMouseDown,
onEditorSettings: onEditorSettings,
onEditorTextSizeChanged: onEditorTextSizeChanged,
width: width,
height: height,
onDragEnter: onDragEnter,
onPasteImageSuccessAction: onPasteImageSuccessAction,
Expand Down Expand Up @@ -171,7 +166,6 @@ class WebEditorView extends StatelessWidget with EditorViewMixin {
onMouseDown: onMouseDown,
onEditorSettings: onEditorSettings,
onEditorTextSizeChanged: onEditorTextSizeChanged,
width: width,
height: height,
onDragEnter: onDragEnter,
onPasteImageSuccessAction: onPasteImageSuccessAction,
Expand Down Expand Up @@ -203,7 +197,6 @@ class WebEditorView extends StatelessWidget with EditorViewMixin {
onMouseDown: onMouseDown,
onEditorSettings: onEditorSettings,
onEditorTextSizeChanged: onEditorTextSizeChanged,
width: width,
height: height,
onDragEnter: onDragEnter,
onPasteImageSuccessAction: onPasteImageSuccessAction,
Expand All @@ -225,7 +218,6 @@ class WebEditorView extends StatelessWidget with EditorViewMixin {
onMouseDown: onMouseDown,
onEditorSettings: onEditorSettings,
onEditorTextSizeChanged: onEditorTextSizeChanged,
width: width,
height: height,
onDragEnter: onDragEnter,
onPasteImageSuccessAction: onPasteImageSuccessAction,
Expand Down
Loading
Loading