don't allow send + make send button red while running IT
This commit is contained in:
parent
cf1f79147a
commit
49588b91cf
2 changed files with 21 additions and 5 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -571,7 +571,7 @@ class Choreographer {
|
|||
return AssistanceState.noMessage;
|
||||
}
|
||||
|
||||
if (igc.igcTextData?.matches.isNotEmpty ?? false) {
|
||||
if ((igc.igcTextData?.matches.isNotEmpty ?? false) || isRunningIT) {
|
||||
return AssistanceState.fetched;
|
||||
}
|
||||
|
||||
|
|
@ -585,4 +585,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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -202,8 +202,8 @@ class IgcController {
|
|||
}
|
||||
|
||||
return !((choreographer.itEnabled &&
|
||||
igcTextData!.matches.any((match) => match.isOutOfTargetMatch)) ||
|
||||
igcTextData!.matches.any((match) => match.isITStart)) ||
|
||||
(choreographer.igcEnabled &&
|
||||
igcTextData!.matches.any((match) => !match.isOutOfTargetMatch)));
|
||||
igcTextData!.matches.any((match) => !match.isITStart)));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue