don't allow send + make send button red while running IT

pull/1476/head
ggurdin 1 year ago
parent cf1f79147a
commit 49588b91cf
No known key found for this signature in database
GPG Key ID: A01CB41737CBB478

@ -68,7 +68,7 @@ class Choreographer {
} }
void send(BuildContext context) { void send(BuildContext context) {
if (isFetching) return; if (!canSendMessage) return;
if (pangeaController.subscriptionController.subscriptionStatus == if (pangeaController.subscriptionController.subscriptionStatus ==
SubscriptionStatus.showPaywall) { SubscriptionStatus.showPaywall) {
@ -92,7 +92,7 @@ class Choreographer {
} }
Future<void> _sendWithIGC(BuildContext context) async { Future<void> _sendWithIGC(BuildContext context) async {
if (!igc.canSendMessage) { if (!canSendMessage) {
igc.showFirstMatch(context); igc.showFirstMatch(context);
return; return;
} }
@ -571,7 +571,7 @@ class Choreographer {
return AssistanceState.noMessage; return AssistanceState.noMessage;
} }
if (igc.igcTextData?.matches.isNotEmpty ?? false) { if ((igc.igcTextData?.matches.isNotEmpty ?? false) || isRunningIT) {
return AssistanceState.fetched; return AssistanceState.fetched;
} }
@ -585,4 +585,20 @@ class Choreographer {
return AssistanceState.complete; 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;
}
} }

@ -202,8 +202,8 @@ class IgcController {
} }
return !((choreographer.itEnabled && return !((choreographer.itEnabled &&
igcTextData!.matches.any((match) => match.isOutOfTargetMatch)) || igcTextData!.matches.any((match) => match.isITStart)) ||
(choreographer.igcEnabled && (choreographer.igcEnabled &&
igcTextData!.matches.any((match) => !match.isOutOfTargetMatch))); igcTextData!.matches.any((match) => !match.isITStart)));
} }
} }

Loading…
Cancel
Save