Skip to content

Commit

Permalink
feat: add option to always show all reactions
Browse files Browse the repository at this point in the history
  • Loading branch information
poppingmoon committed Oct 27, 2024
1 parent 9a20871 commit abc64f8
Show file tree
Hide file tree
Showing 12 changed files with 57 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/i18n/aria/aria.i18n.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ addTab: "Add tab"
alwaysExpandCw: "Always expand content warning"
alwaysExpandLongNote: "Always expand long note"
alwaysExpandMediaInSubNote: "Always expand media in sub note"
alwaysShowAllReactions: "Always show all reactions"
alwaysShowTabHeader: "Always show tab info"
authenticate: "Authenticate"
authenticated: "Authenticated"
Expand Down
2 changes: 1 addition & 1 deletion lib/i18n/strings.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/// To regenerate, run: `dart run slang`
///
/// Locales: 31
/// Strings: 54619 (1761 per locale)
/// Strings: 54620 (1761 per locale)
// coverage:ignore-file
// ignore_for_file: type=lint, unused_import
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/strings_en_US.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class TranslationsAriaEnUs {
String get alwaysExpandCw => 'Always expand content warning';
String get alwaysExpandLongNote => 'Always expand long note';
String get alwaysExpandMediaInSubNote => 'Always expand media in sub note';
String get alwaysShowAllReactions => 'Always show all reactions';
String get alwaysShowTabHeader => 'Always show tab info';
String get authenticate => 'Authenticate';
String get authenticated => 'Authenticated';
Expand Down
1 change: 1 addition & 0 deletions lib/model/general_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class GeneralSettings with _$GeneralSettings {
@Default(false) bool alwaysExpandLongNote,
@Default(false) bool alwaysExpandMediaInSubNote,
@Default(false) bool mergeReactionsByName,
@Default(false) bool alwaysShowAllReactions,
MediaListWithOneImageAppearance? mediaListWithOneImageAppearance,
@Default(BoxFit.contain) BoxFit thumbnailBoxFit,
@Default(EmojiStyle.twemoji) EmojiStyle emojiStyle,
Expand Down
24 changes: 23 additions & 1 deletion lib/model/general_settings.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ mixin _$GeneralSettings {
bool get alwaysExpandLongNote => throw _privateConstructorUsedError;
bool get alwaysExpandMediaInSubNote => throw _privateConstructorUsedError;
bool get mergeReactionsByName => throw _privateConstructorUsedError;
bool get alwaysShowAllReactions => throw _privateConstructorUsedError;
MediaListWithOneImageAppearance? get mediaListWithOneImageAppearance =>
throw _privateConstructorUsedError;
BoxFit get thumbnailBoxFit => throw _privateConstructorUsedError;
Expand Down Expand Up @@ -160,6 +161,7 @@ abstract class $GeneralSettingsCopyWith<$Res> {
bool alwaysExpandLongNote,
bool alwaysExpandMediaInSubNote,
bool mergeReactionsByName,
bool alwaysShowAllReactions,
MediaListWithOneImageAppearance? mediaListWithOneImageAppearance,
BoxFit thumbnailBoxFit,
EmojiStyle emojiStyle,
Expand Down Expand Up @@ -259,6 +261,7 @@ class _$GeneralSettingsCopyWithImpl<$Res, $Val extends GeneralSettings>
Object? alwaysExpandLongNote = null,
Object? alwaysExpandMediaInSubNote = null,
Object? mergeReactionsByName = null,
Object? alwaysShowAllReactions = null,
Object? mediaListWithOneImageAppearance = freezed,
Object? thumbnailBoxFit = null,
Object? emojiStyle = null,
Expand Down Expand Up @@ -421,6 +424,10 @@ class _$GeneralSettingsCopyWithImpl<$Res, $Val extends GeneralSettings>
? _value.mergeReactionsByName
: mergeReactionsByName // ignore: cast_nullable_to_non_nullable
as bool,
alwaysShowAllReactions: null == alwaysShowAllReactions
? _value.alwaysShowAllReactions
: alwaysShowAllReactions // ignore: cast_nullable_to_non_nullable
as bool,
mediaListWithOneImageAppearance: freezed ==
mediaListWithOneImageAppearance
? _value.mediaListWithOneImageAppearance
Expand Down Expand Up @@ -687,6 +694,7 @@ abstract class _$$GeneralSettingsImplCopyWith<$Res>
bool alwaysExpandLongNote,
bool alwaysExpandMediaInSubNote,
bool mergeReactionsByName,
bool alwaysShowAllReactions,
MediaListWithOneImageAppearance? mediaListWithOneImageAppearance,
BoxFit thumbnailBoxFit,
EmojiStyle emojiStyle,
Expand Down Expand Up @@ -784,6 +792,7 @@ class __$$GeneralSettingsImplCopyWithImpl<$Res>
Object? alwaysExpandLongNote = null,
Object? alwaysExpandMediaInSubNote = null,
Object? mergeReactionsByName = null,
Object? alwaysShowAllReactions = null,
Object? mediaListWithOneImageAppearance = freezed,
Object? thumbnailBoxFit = null,
Object? emojiStyle = null,
Expand Down Expand Up @@ -946,6 +955,10 @@ class __$$GeneralSettingsImplCopyWithImpl<$Res>
? _value.mergeReactionsByName
: mergeReactionsByName // ignore: cast_nullable_to_non_nullable
as bool,
alwaysShowAllReactions: null == alwaysShowAllReactions
? _value.alwaysShowAllReactions
: alwaysShowAllReactions // ignore: cast_nullable_to_non_nullable
as bool,
mediaListWithOneImageAppearance: freezed ==
mediaListWithOneImageAppearance
? _value.mediaListWithOneImageAppearance
Expand Down Expand Up @@ -1207,6 +1220,7 @@ class _$GeneralSettingsImpl implements _GeneralSettings {
this.alwaysExpandLongNote = false,
this.alwaysExpandMediaInSubNote = false,
this.mergeReactionsByName = false,
this.alwaysShowAllReactions = false,
this.mediaListWithOneImageAppearance,
this.thumbnailBoxFit = BoxFit.contain,
this.emojiStyle = EmojiStyle.twemoji,
Expand Down Expand Up @@ -1349,6 +1363,9 @@ class _$GeneralSettingsImpl implements _GeneralSettings {
@JsonKey()
final bool mergeReactionsByName;
@override
@JsonKey()
final bool alwaysShowAllReactions;
@override
final MediaListWithOneImageAppearance? mediaListWithOneImageAppearance;
@override
@JsonKey()
Expand Down Expand Up @@ -1521,7 +1538,7 @@ class _$GeneralSettingsImpl implements _GeneralSettings {

@override
String toString() {
return 'GeneralSettings(locale: $locale, collapseRenotes: $collapseRenotes, sensitive: $sensitive, highlightSensitiveMedia: $highlightSensitiveMedia, animatedMfm: $animatedMfm, advancedMfm: $advancedMfm, showReactionsCount: $showReactionsCount, loadRawImages: $loadRawImages, instanceTicker: $instanceTicker, showNoteCreatedAt: $showNoteCreatedAt, showAvatarsInNote: $showAvatarsInNote, showAvatarsInSubNote: $showAvatarsInSubNote, squareAvatars: $squareAvatars, showAvatarDecorations: $showAvatarDecorations, showQuoteButtonInNoteFooter: $showQuoteButtonInNoteFooter, showLikeButtonInNoteFooter: $showLikeButtonInNoteFooter, showClipButtonInNoteFooter: $showClipButtonInNoteFooter, showTranslateButtonInNoteFooter: $showTranslateButtonInNoteFooter, showNoteReactionsViewer: $showNoteReactionsViewer, showSubNoteReactionsViewer: $showSubNoteReactionsViewer, showNoteFooter: $showNoteFooter, showSubNoteFooter: $showSubNoteFooter, alwaysExpandCw: $alwaysExpandCw, alwaysExpandLongNote: $alwaysExpandLongNote, alwaysExpandMediaInSubNote: $alwaysExpandMediaInSubNote, mergeReactionsByName: $mergeReactionsByName, mediaListWithOneImageAppearance: $mediaListWithOneImageAppearance, thumbnailBoxFit: $thumbnailBoxFit, emojiStyle: $emojiStyle, fontFamily: $fontFamily, fontSize: $fontSize, lineHeight: $lineHeight, avatarScale: $avatarScale, reactionsDisplayScale: $reactionsDisplayScale, limitWidthOfReaction: $limitWidthOfReaction, noteFooterScale: $noteFooterScale, noteVerticalPadding: $noteVerticalPadding, noteHorizontalPadding: $noteHorizontalPadding, publicNoteBackgroundColor: $publicNoteBackgroundColor, homeNoteBackgroundColor: $homeNoteBackgroundColor, followersNoteBackgroundColor: $followersNoteBackgroundColor, specifiedNoteBackgroundColor: $specifiedNoteBackgroundColor, emojiPickerUseDialog: $emojiPickerUseDialog, emojiPickerScale: $emojiPickerScale, emojiPickerAutofocus: $emojiPickerAutofocus, emojiPickerKeepOpen: $emojiPickerKeepOpen, dataSaverMedia: $dataSaverMedia, dataSaverAvatar: $dataSaverAvatar, dataSaverUrlPreview: $dataSaverUrlPreview, disableDataSaverWhenOnWifi: $disableDataSaverWhenOnWifi, reduceAnimation: $reduceAnimation, disableShowingAnimatedImages: $disableShowingAnimatedImages, enableEmojiFadeIn: $enableEmojiFadeIn, forceShowAds: $forceShowAds, useGroupedNotifications: $useGroupedNotifications, showTimelineTabBarAtBottom: $showTimelineTabBarAtBottom, showMenuButtonInTabBar: $showMenuButtonInTabBar, showHomeFAB: $showHomeFAB, showNotificationsFAB: $showNotificationsFAB, showShowPostFormFAB: $showShowPostFormFAB, showTabHeaderInOneLine: $showTabHeaderInOneLine, alwaysShowTabHeader: $alwaysShowTabHeader, showTimelineLastViewedAt: $showTimelineLastViewedAt, showPopupOnNewNote: $showPopupOnNewNote, vibrateNote: $vibrateNote, vibrateNotification: $vibrateNotification, enableInfiniteScroll: $enableInfiniteScroll, keepScreenOn: $keepScreenOn, enableHorizontalSwipe: $enableHorizontalSwipe, openSensitiveMediaOnDoubleTap: $openSensitiveMediaOnDoubleTap, noteTapAction: $noteTapAction, noteDoubleTapAction: $noteDoubleTapAction, noteLongPressAction: $noteLongPressAction, confirmBeforePost: $confirmBeforePost, confirmBeforeReact: $confirmBeforeReact, confirmBeforeFollow: $confirmBeforeFollow, confirmWhenRevealingSensitiveMedia: $confirmWhenRevealingSensitiveMedia, launchMode: $launchMode, enablePredictiveBack: $enablePredictiveBack, themeMode: $themeMode, lightThemeId: $lightThemeId, darkThemeId: $darkThemeId)';
return 'GeneralSettings(locale: $locale, collapseRenotes: $collapseRenotes, sensitive: $sensitive, highlightSensitiveMedia: $highlightSensitiveMedia, animatedMfm: $animatedMfm, advancedMfm: $advancedMfm, showReactionsCount: $showReactionsCount, loadRawImages: $loadRawImages, instanceTicker: $instanceTicker, showNoteCreatedAt: $showNoteCreatedAt, showAvatarsInNote: $showAvatarsInNote, showAvatarsInSubNote: $showAvatarsInSubNote, squareAvatars: $squareAvatars, showAvatarDecorations: $showAvatarDecorations, showQuoteButtonInNoteFooter: $showQuoteButtonInNoteFooter, showLikeButtonInNoteFooter: $showLikeButtonInNoteFooter, showClipButtonInNoteFooter: $showClipButtonInNoteFooter, showTranslateButtonInNoteFooter: $showTranslateButtonInNoteFooter, showNoteReactionsViewer: $showNoteReactionsViewer, showSubNoteReactionsViewer: $showSubNoteReactionsViewer, showNoteFooter: $showNoteFooter, showSubNoteFooter: $showSubNoteFooter, alwaysExpandCw: $alwaysExpandCw, alwaysExpandLongNote: $alwaysExpandLongNote, alwaysExpandMediaInSubNote: $alwaysExpandMediaInSubNote, mergeReactionsByName: $mergeReactionsByName, alwaysShowAllReactions: $alwaysShowAllReactions, mediaListWithOneImageAppearance: $mediaListWithOneImageAppearance, thumbnailBoxFit: $thumbnailBoxFit, emojiStyle: $emojiStyle, fontFamily: $fontFamily, fontSize: $fontSize, lineHeight: $lineHeight, avatarScale: $avatarScale, reactionsDisplayScale: $reactionsDisplayScale, limitWidthOfReaction: $limitWidthOfReaction, noteFooterScale: $noteFooterScale, noteVerticalPadding: $noteVerticalPadding, noteHorizontalPadding: $noteHorizontalPadding, publicNoteBackgroundColor: $publicNoteBackgroundColor, homeNoteBackgroundColor: $homeNoteBackgroundColor, followersNoteBackgroundColor: $followersNoteBackgroundColor, specifiedNoteBackgroundColor: $specifiedNoteBackgroundColor, emojiPickerUseDialog: $emojiPickerUseDialog, emojiPickerScale: $emojiPickerScale, emojiPickerAutofocus: $emojiPickerAutofocus, emojiPickerKeepOpen: $emojiPickerKeepOpen, dataSaverMedia: $dataSaverMedia, dataSaverAvatar: $dataSaverAvatar, dataSaverUrlPreview: $dataSaverUrlPreview, disableDataSaverWhenOnWifi: $disableDataSaverWhenOnWifi, reduceAnimation: $reduceAnimation, disableShowingAnimatedImages: $disableShowingAnimatedImages, enableEmojiFadeIn: $enableEmojiFadeIn, forceShowAds: $forceShowAds, useGroupedNotifications: $useGroupedNotifications, showTimelineTabBarAtBottom: $showTimelineTabBarAtBottom, showMenuButtonInTabBar: $showMenuButtonInTabBar, showHomeFAB: $showHomeFAB, showNotificationsFAB: $showNotificationsFAB, showShowPostFormFAB: $showShowPostFormFAB, showTabHeaderInOneLine: $showTabHeaderInOneLine, alwaysShowTabHeader: $alwaysShowTabHeader, showTimelineLastViewedAt: $showTimelineLastViewedAt, showPopupOnNewNote: $showPopupOnNewNote, vibrateNote: $vibrateNote, vibrateNotification: $vibrateNotification, enableInfiniteScroll: $enableInfiniteScroll, keepScreenOn: $keepScreenOn, enableHorizontalSwipe: $enableHorizontalSwipe, openSensitiveMediaOnDoubleTap: $openSensitiveMediaOnDoubleTap, noteTapAction: $noteTapAction, noteDoubleTapAction: $noteDoubleTapAction, noteLongPressAction: $noteLongPressAction, confirmBeforePost: $confirmBeforePost, confirmBeforeReact: $confirmBeforeReact, confirmBeforeFollow: $confirmBeforeFollow, confirmWhenRevealingSensitiveMedia: $confirmWhenRevealingSensitiveMedia, launchMode: $launchMode, enablePredictiveBack: $enablePredictiveBack, themeMode: $themeMode, lightThemeId: $lightThemeId, darkThemeId: $darkThemeId)';
}

@override
Expand Down Expand Up @@ -1585,6 +1602,7 @@ class _$GeneralSettingsImpl implements _GeneralSettings {
other.alwaysExpandMediaInSubNote ==
alwaysExpandMediaInSubNote) &&
(identical(other.mergeReactionsByName, mergeReactionsByName) || other.mergeReactionsByName == mergeReactionsByName) &&
(identical(other.alwaysShowAllReactions, alwaysShowAllReactions) || other.alwaysShowAllReactions == alwaysShowAllReactions) &&
(identical(other.mediaListWithOneImageAppearance, mediaListWithOneImageAppearance) || other.mediaListWithOneImageAppearance == mediaListWithOneImageAppearance) &&
(identical(other.thumbnailBoxFit, thumbnailBoxFit) || other.thumbnailBoxFit == thumbnailBoxFit) &&
(identical(other.emojiStyle, emojiStyle) || other.emojiStyle == emojiStyle) &&
Expand Down Expand Up @@ -1673,6 +1691,7 @@ class _$GeneralSettingsImpl implements _GeneralSettings {
alwaysExpandLongNote,
alwaysExpandMediaInSubNote,
mergeReactionsByName,
alwaysShowAllReactions,
mediaListWithOneImageAppearance,
thumbnailBoxFit,
emojiStyle,
Expand Down Expand Up @@ -1777,6 +1796,7 @@ abstract class _GeneralSettings implements GeneralSettings {
final bool alwaysExpandLongNote,
final bool alwaysExpandMediaInSubNote,
final bool mergeReactionsByName,
final bool alwaysShowAllReactions,
final MediaListWithOneImageAppearance? mediaListWithOneImageAppearance,
final BoxFit thumbnailBoxFit,
final EmojiStyle emojiStyle,
Expand Down Expand Up @@ -1893,6 +1913,8 @@ abstract class _GeneralSettings implements GeneralSettings {
@override
bool get mergeReactionsByName;
@override
bool get alwaysShowAllReactions;
@override
MediaListWithOneImageAppearance? get mediaListWithOneImageAppearance;
@override
BoxFit get thumbnailBoxFit;
Expand Down
2 changes: 2 additions & 0 deletions lib/model/general_settings.g.dart

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

5 changes: 5 additions & 0 deletions lib/provider/general_settings_notifier_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,11 @@ class GeneralSettingsNotifier extends _$GeneralSettingsNotifier {
await _save();
}

Future<void> setAlwaysShowAllReactions(bool alwaysShowAllReactions) async {
state = state.copyWith(alwaysShowAllReactions: alwaysShowAllReactions);
await _save();
}

Future<void> setMediaListWithOneImageAppearance(
MediaListWithOneImageAppearance? mediaListWithOneImageAppearance,
) async {
Expand Down
2 changes: 1 addition & 1 deletion lib/provider/general_settings_notifier_provider.g.dart

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

7 changes: 7 additions & 0 deletions lib/view/page/settings/note_display_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,13 @@ class NoteDisplayPage extends HookConsumerWidget {
.read(generalSettingsNotifierProvider.notifier)
.setMergeReactionsByName(value),
),
SwitchListTile(
title: Text(t.aria.alwaysShowAllReactions),
value: settings.alwaysShowAllReactions,
onChanged: (value) => ref
.read(generalSettingsNotifierProvider.notifier)
.setAlwaysShowAllReactions(value),
),
ListTile(
title: Text(t.misskey.emojiStyle),
subtitle: Text(
Expand Down
5 changes: 5 additions & 0 deletions lib/view/widget/note_detailed_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ class NoteDetailedWidget extends HookConsumerWidget {
},
),
);
final showAllReactions = ref.watch(
generalSettingsNotifierProvider
.select((settings) => settings.alwaysShowAllReactions),
);
final colors =
ref.watch(misskeyColorsProvider(Theme.of(context).brightness));
final style = DefaultTextStyle.of(context).style;
Expand Down Expand Up @@ -545,6 +549,7 @@ class NoteDetailedWidget extends HookConsumerWidget {
ReactionsViewer(
account: account,
noteId: appearNote.id,
showAllReactions: showAllReactions,
),
NoteFooter(
account: account,
Expand Down
5 changes: 5 additions & 0 deletions lib/view/widget/note_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ class NoteWidget extends HookConsumerWidget {
isRenote &&
(isMyRenote || isMyNote || appearNote.myReaction != null),
);
final showAllReactions = ref.watch(
generalSettingsNotifierProvider
.select((settings) => settings.alwaysShowAllReactions),
);
final backgroundColor = this.backgroundColor ??
ref.watch(
generalSettingsNotifierProvider.select(
Expand Down Expand Up @@ -591,6 +595,7 @@ class NoteWidget extends HookConsumerWidget {
ReactionsViewer(
account: account,
noteId: appearNote.id,
showAllReactions: showAllReactions,
note: this.note,
),
if (showFooter)
Expand Down
5 changes: 5 additions & 0 deletions lib/view/widget/sub_note_content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ class SubNoteContent extends HookConsumerWidget {
generalSettingsNotifierProvider
.select((settings) => settings.alwaysExpandMediaInSubNote),
);
final showAllReactions = ref.watch(
generalSettingsNotifierProvider
.select((settings) => settings.alwaysShowAllReactions),
);
final colors =
ref.watch(misskeyColorsProvider(Theme.of(context).brightness));
final isCollapsed = useState(isLong);
Expand Down Expand Up @@ -232,6 +236,7 @@ class SubNoteContent extends HookConsumerWidget {
ReactionsViewer(
account: account,
noteId: noteId,
showAllReactions: showAllReactions,
note: this.note,
),
],
Expand Down

0 comments on commit abc64f8

Please sign in to comment.