TF-4378 Migrate scribe-mobile branch to master branch

This commit is contained in:
dab246
2026-03-16 11:45:14 +07:00
committed by Dat H. Pham
parent d0cc14beb4
commit 28d5036667
29 changed files with 223 additions and 189 deletions
@@ -23,7 +23,10 @@ class RichTextMobileTabletController extends GetxController {
try {
await htmlEditorApi?.webViewController.evaluateJavascript(source: '''
(() => {
document.getElementById('editor').focus();
const editor = document.getElementById('editor');
if (editor && typeof editor.focus === 'function') {
editor.focus();
}
})();''');
} catch (e) {
logWarning('RichTextMobileTabletController::focus:Exception: $e');
@@ -100,17 +100,17 @@ extension HandleAiScribeInComposerExtension on ComposerController {
HtmlUtils.saveSelection.name,
hasReturnValue: true,
);
return result;
return result?.toString() ?? '';
} else {
final result = await richTextMobileTabletController?.htmlEditorApi?.webViewController
.evaluateJavascript(
source: HtmlUtils.saveSelection.script,
);
return result;
return result?.toString() ?? '';
}
} catch (e) {
logWarning('$runtimeType::saveSelection:Exception = $e');
return "";
return '';
}
}
@@ -121,17 +121,17 @@ extension HandleAiScribeInComposerExtension on ComposerController {
HtmlUtils.restoreSelection.name,
hasReturnValue: true,
);
return result;
return result?.toString() ?? '';
} else {
final result = await richTextMobileTabletController?.htmlEditorApi?.webViewController
.evaluateJavascript(
source: HtmlUtils.restoreSelection.script,
);
return result;
return result?.toString() ?? '';
}
} catch (e) {
logWarning('$runtimeType::restoreSelection:Exception = $e');
return "";
return '';
}
}
@@ -142,17 +142,17 @@ extension HandleAiScribeInComposerExtension on ComposerController {
HtmlUtils.getSavedSelection.name,
hasReturnValue: true,
);
return result;
return result?.toString() ?? '';
} else {
final result = await richTextMobileTabletController?.htmlEditorApi?.webViewController
.evaluateJavascript(
source: HtmlUtils.getSavedSelection.script,
);
return result;
return result?.toString() ?? '';
}
} catch (e) {
logWarning('$runtimeType::getSavedSelection:Exception = $e');
return "";
return '';
}
}
@@ -176,12 +176,16 @@ extension HandleAiScribeInComposerExtension on ComposerController {
}
Future<void> unfocusEditor() async {
final editorApi = richTextMobileTabletController?.htmlEditorApi;
if (PlatformInfo.isIOS) {
await editorApi?.unfocus();
} else if (PlatformInfo.isAndroid) {
await editorApi?.hideKeyboard();
await editorApi?.unfocus();
try {
final editorApi = richTextMobileTabletController?.htmlEditorApi;
if (PlatformInfo.isIOS) {
await editorApi?.unfocus();
} else if (PlatformInfo.isAndroid) {
await editorApi?.hideKeyboard();
await editorApi?.unfocus();
}
} catch (e) {
logWarning('$runtimeType::unfocusEditor:Exception = $e');
}
}
@@ -239,7 +243,8 @@ extension HandleAiScribeInComposerExtension on ComposerController {
clearFocusRecipients();
clearFocusSubject();
if (isScribeMobile) {
final scribeMobile = isScribeMobile;
if (scribeMobile) {
await saveAndUnfocusForModal();
}
@@ -254,7 +259,7 @@ extension HandleAiScribeInComposerExtension on ComposerController {
preferredPlacement: ModalPlacement.top,
crossAxisAlignment: ModalCrossAxisAlignment.start,
onSelectAiScribeSuggestionAction: handleAiScribeSuggestionAction,
isScribeMobile: isScribeMobile,
isScribeMobile: scribeMobile,
);
}
@@ -12,7 +12,7 @@ class GetLinagoraEcosystemSuccess extends Success {
}
class GetLinagoraEcosystemFailure extends Failure {
final dynamic exception;
final Object exception;
GetLinagoraEcosystemFailure(this.exception);
@@ -3470,6 +3470,7 @@ class MailboxDashBoardController extends ReloadableController
twakeAppManager.setHasComposer(false);
paywallController?.onClose();
paywallController = null;
cachedLinagoraEcosystem = null;
_disposeWorkerObxVariables();
super.onClose();
}
@@ -20,10 +20,10 @@ extension SetupScribePromptUrlExtension on MailboxDashBoardController {
if (baseUrl != null && baseUrl.isNotEmpty) {
consumeState(interactor.execute(baseUrl));
} else {
logError('SetupScribePromptUrlExtension::loadLinagoraEcosystem: jmapUrl is null or empty');
logWarning('SetupScribePromptUrlExtension::loadLinagoraEcosystem: jmapUrl is null or empty');
}
} else {
logError('SetupScribePromptUrlExtension::loadLinagoraEcosystem: GetLinagoraEcosystemInteractor not found');
logWarning('SetupScribePromptUrlExtension::loadLinagoraEcosystem: GetLinagoraEcosystemInteractor not found');
}
}
@@ -33,7 +33,8 @@ extension SetupScribePromptUrlExtension on MailboxDashBoardController {
}
void handleGetLinagoraEcosystemFailure(GetLinagoraEcosystemFailure failure) {
logError('SetupScribePromptUrlExtension::handleGetLinagoraEcosystemFailure: GetScribePromptUrl failed - ${failure.exception}');
logWarning('SetupScribePromptUrlExtension::handleGetLinagoraEcosystemFailure: GetScribePromptUrl failed - ${failure.exception}');
cachedLinagoraEcosystem = null;
_applyScribePromptUrl(null);
}