Skip to content

Commit

Permalink
use badge for historical message indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
tommyxchow committed Dec 23, 2024
1 parent 817289a commit 80837be
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 44 deletions.
15 changes: 15 additions & 0 deletions lib/models/irc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,21 @@ class IRCMessage {
}
}

final isHistorical = tags['historical'] == '1';
if (isHistorical) {
span.add(
WidgetSpan(
child: Tooltip(
message: 'Historical message',
preferBelow: false,
triggerMode: TooltipTriggerMode.tap,
child: Icon(Icons.history_rounded, size: badgeSize),
),
),
);
span.add(const TextSpan(text: ' '));
}

final sourceChannelId = tags['source-room-id'] ?? tags['room-id'];
final sourceChannelUser = channelIdToUserTwitch != null
? channelIdToUserTwitch[sourceChannelId]
Expand Down
9 changes: 0 additions & 9 deletions lib/screens/channel/chat/widgets/chat_message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -456,15 +456,6 @@ class ChatMessage extends StatelessWidget {
child: coloredMessage,
);

final isHistorical = ircMessage.tags['historical'] == '1';

if (chatStore.settings.darkenRecentMessages && isHistorical) {
return Opacity(
opacity: 0.5,
child: finalMessage,
);
}

return finalMessage;
},
);
Expand Down
9 changes: 0 additions & 9 deletions lib/screens/settings/chat_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -372,15 +372,6 @@ class _ChatSettingsState extends State<ChatSettings> {
onChanged: (newValue) =>
settingsStore.showRecentMessages = newValue,
),
SettingsListSwitch(
title: 'Darken historical recent messages',
subtitle: const Text(
'Makes historical recent messages 50% opacity to distinguish them from live messages.',
),
value: settingsStore.darkenRecentMessages,
onChanged: (newValue) =>
settingsStore.darkenRecentMessages = newValue,
),
],
),
);
Expand Down
6 changes: 0 additions & 6 deletions lib/screens/settings/stores/settings_store.dart
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ abstract class _SettingsStoreBase with Store {

// Recent messages defaults
static const defaultShowRecentMessages = false;
static const defaultDarkenRecentMessages = true;

// Message sizing options
@JsonKey(defaultValue: defaultBadgeScale)
Expand Down Expand Up @@ -301,10 +300,6 @@ abstract class _SettingsStoreBase with Store {
@observable
var showRecentMessages = defaultShowRecentMessages;

@JsonKey(defaultValue: defaultDarkenRecentMessages)
@observable
var darkenRecentMessages = defaultDarkenRecentMessages;

@JsonKey(defaultValue: defaultMutedWords)
@observable
List<String> mutedWords = defaultMutedWords;
Expand Down Expand Up @@ -358,7 +353,6 @@ abstract class _SettingsStoreBase with Store {
showFFZBadges = defaultShowFFZBadges;

showRecentMessages = defaultShowRecentMessages;
darkenRecentMessages = defaultDarkenRecentMessages;
}

// * Other settings
Expand Down
20 changes: 0 additions & 20 deletions lib/screens/settings/stores/settings_store.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 80837be

Please sign in to comment.