revert recent changes to relevant files to test if that fixes hidden message bug (#1455)

This commit is contained in:
ggurdin 2025-01-15 12:38:39 -05:00 committed by GitHub
parent 8a272ae7c1
commit c1041dda70
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 17 additions and 33 deletions

View file

@ -46,7 +46,9 @@ class MessageTextUtil {
start: globalIndex,
end: startIndex,
hideContent: false,
selected: (isSelected?.call(token) ?? false) && !hasHiddenContent,
// selected: (isSelected?.call(token) ?? false) && !hasHiddenContent,
highlight:
(isSelected?.call(token) ?? false) && !hasHiddenContent,
),
);
}
@ -57,7 +59,10 @@ class MessageTextUtil {
end: endIndex,
token: token,
hideContent: hideContent,
selected: (isSelected?.call(token) ?? false) &&
// selected: (isSelected?.call(token) ?? false) &&
// !hideContent &&
// !hasHiddenContent,
highlight: (isSelected?.call(token) ?? false) &&
!hideContent &&
!hasHiddenContent,
),

View file

@ -3,12 +3,10 @@ import 'package:flutter/material.dart';
import 'package:collection/collection.dart';
import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/pangea/analytics/controllers/message_analytics_controller.dart';
import 'package:fluffychat/pangea/events/event_wrappers/pangea_message_event.dart';
import 'package:fluffychat/pangea/events/models/pangea_token_model.dart';
import 'package:fluffychat/pangea/events/utils/message_text_util.dart';
import 'package:fluffychat/pangea/toolbar/enums/activity_type_enum.dart';
import 'package:fluffychat/widgets/matrix.dart';
/// Question - does this need to be stateful or does this work?
@ -71,7 +69,7 @@ class MessageTokenText extends StatelessWidget {
class TokenPosition {
final int start;
final int end;
final bool selected;
final bool highlight;
final bool hideContent;
final PangeaToken? token;
@ -79,7 +77,7 @@ class TokenPosition {
required this.start,
required this.end,
required this.hideContent,
required this.selected,
required this.highlight,
this.token,
});
}
@ -178,19 +176,6 @@ class MessageTextWidget extends StatelessWidget {
text: TextSpan(
children:
tokenPositions.mapIndexed((int i, TokenPosition tokenPosition) {
final shouldDo = tokenPosition.token?.shouldDoActivity(
a: ActivityTypeEnum.wordMeaning,
feature: null,
tag: null,
) ??
false;
final didMeaningActivity =
tokenPosition.token?.didActivitySuccessfully(
ActivityTypeEnum.wordMeaning,
) ??
true;
final substring = messageCharacters
.skip(tokenPosition.start)
.take(tokenPosition.end - tokenPosition.start)
@ -214,13 +199,11 @@ class MessageTextWidget extends StatelessWidget {
text: substring,
style: style.merge(
TextStyle(
backgroundColor: tokenPosition.selected
? AppConfig.primaryColor.withAlpha(80)
: (isSelected != null && shouldDo)
? !didMeaningActivity
? AppConfig.success.withAlpha(60)
: AppConfig.gold.withAlpha(60)
: Colors.transparent,
backgroundColor: tokenPosition.highlight
? Theme.of(context).brightness == Brightness.light
? Colors.black.withAlpha(100)
: Colors.white.withAlpha(100)
: Colors.transparent,
),
),
);

View file

@ -82,10 +82,7 @@ class OverlayMessage extends StatelessWidget {
if (ownMessage) {
color = displayEvent.status.isError
? Colors.redAccent
: Color.alphaBlend(
Colors.white.withAlpha(180),
ThemeData.dark().colorScheme.primary,
);
: theme.colorScheme.primary;
}
final noBubble = {
@ -99,9 +96,8 @@ class OverlayMessage extends StatelessWidget {
MessageTypes.Audio,
}.contains(event.messageType);
final textColor = ownMessage
? ThemeData.dark().colorScheme.onPrimary
: theme.colorScheme.onSurface;
final textColor =
ownMessage ? theme.colorScheme.onPrimary : theme.colorScheme.onSurface;
return Material(
color: color,