Merge pull request #847 from pangeachat/dont-combine-it-and-igc

Dont combine it and igc
pull/1476/head
ggurdin 1 year ago committed by GitHub
commit 262b448df3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1419,7 +1419,7 @@ class ChatController extends State<ChatPageWithRoom>
void onSelectMessage(Event event) {
// #Pangea
if (choreographer.itController.isOpen) {
if (choreographer.itController.willOpen) {
return;
}
// Pangea#

@ -321,6 +321,7 @@ class ChatInputRow extends StatelessWidget {
// #Pangea
// hintText: L10n.of(context)!.writeAMessage,
hintText: hintText(),
disabledBorder: InputBorder.none,
// Pangea#
hintMaxLines: 1,
border: InputBorder.none,

@ -478,6 +478,8 @@ class InputBar extends StatelessWidget {
// builder: (context, controller, focusNode) => TextField(
builder: (context, _, focusNode) => TextField(
enableSuggestions: false,
readOnly:
controller != null && controller!.choreographer.isRunningIT,
// Pangea#
controller: controller,
focusNode: focusNode,

@ -68,7 +68,7 @@ class Choreographer {
}
void send(BuildContext context) {
if (isFetching) return;
if (!canSendMessage) return;
if (pangeaController.subscriptionController.subscriptionStatus ==
SubscriptionStatus.showPaywall) {
@ -92,7 +92,7 @@ class Choreographer {
}
Future<void> _sendWithIGC(BuildContext context) async {
if (!igc.canSendMessage) {
if (!canSendMessage) {
igc.showFirstMatch(context);
return;
}
@ -255,13 +255,16 @@ class Choreographer {
}
startLoading();
// if getting language assistance after finishing IT,
// reset the itController
if (choreoMode == ChoreoMode.it &&
itController.isTranslationDone &&
!onlyTokensAndLanguageDetection) {
// debugger(when: kDebugMode);
itController.clear();
}
await (choreoMode == ChoreoMode.it && !itController.isTranslationDone
await (isRunningIT
? itController.getTranslationData(_useCustomInput)
: igc.getIGCTextData(
onlyTokensAndLanguageDetection: onlyTokensAndLanguageDetection,
@ -418,7 +421,7 @@ class Choreographer {
setState();
}
giveInputFocus() {
void giveInputFocus() {
Future.delayed(Duration.zero, () {
chatController.inputFocus.requestFocus();
});
@ -478,6 +481,9 @@ class Choreographer {
bool get _noChange =>
_lastChecked != null && _lastChecked == _textController.text;
bool get isRunningIT =>
choreoMode == ChoreoMode.it && !itController.isTranslationDone;
void startLoading() {
_lastChecked = _textController.text;
isFetching = true;
@ -505,8 +511,6 @@ class Choreographer {
}
}
bool get showIsError => !itController.isOpen && errorService.isError;
LayerLinkAndKey get itBarLinkAndKey =>
MatrixState.pAnyState.layerLinkAndKey(itBarTransformTargetKey);
@ -570,7 +574,7 @@ class Choreographer {
return AssistanceState.noMessage;
}
if (igc.igcTextData?.matches.isNotEmpty ?? false) {
if ((igc.igcTextData?.matches.isNotEmpty ?? false) || isRunningIT) {
return AssistanceState.fetched;
}
@ -584,4 +588,20 @@ class Choreographer {
return AssistanceState.complete;
}
bool get canSendMessage {
if (isFetching) return false;
if (errorService.isError) return true;
if (itEnabled && isRunningIT) return false;
final hasITMatches =
igc.igcTextData!.matches.any((match) => match.isITStart);
final hasIGCMatches =
igc.igcTextData!.matches.any((match) => !match.isITStart);
if ((itEnabled && hasITMatches) || (igcEnabled && hasIGCMatches)) {
return false;
}
return true;
}
}

@ -192,18 +192,4 @@ class IgcController {
// Not sure why this is here
// MatrixState.pAnyState.closeOverlay();
}
bool get canSendMessage {
if (choreographer.isFetching) return false;
if (igcTextData == null ||
choreographer.errorService.isError ||
igcTextData!.matches.isEmpty) {
return true;
}
return !((choreographer.itEnabled &&
igcTextData!.matches.any((match) => match.isOutOfTargetMatch)) ||
(choreographer.igcEnabled &&
igcTextData!.matches.any((match) => !match.isOutOfTargetMatch)));
}
}

@ -68,9 +68,10 @@ class ITController {
}
void closeIT() {
//if they close it before completing, just put their text back
//PTODO - explore using last itStep
choreographer.textController.text = sourceText ?? "";
// if the user hasn't gone through any IT steps, reset the text
if (completedITSteps.isEmpty && sourceText != null) {
choreographer.textController.text = sourceText!;
}
clear();
}

@ -6,7 +6,7 @@ description: Learn a language while texting your friends.
# Pangea#
publish_to: none
# On version bump also increase the build number for F-Droid
version: 1.22.7+3557
version: 1.22.8+3558
environment:
sdk: ">=3.0.0 <4.0.0"

Loading…
Cancel
Save