Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: merge reactions by name #451

Merged
merged 2 commits into from
Oct 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 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 Expand Up @@ -61,6 +62,7 @@ loginWithAccessToken: "Sign in with an access token"
margin: "Margin"
media: "Media"
mentionToRemoteWarning: "This note includes mentions to remote users"
mergeReactionsByName: "Merge reactions with the same name"
moved: "Moved"
muted: "Muted"
mutedEmojis: "Muted emojis"
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: 54618 (1761 per locale)
/// Strings: 54620 (1761 per locale)

// coverage:ignore-file
// ignore_for_file: type=lint, unused_import
Expand Down
2 changes: 2 additions & 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 Expand Up @@ -129,6 +130,7 @@ class TranslationsAriaEnUs {
String get margin => 'Margin';
String get media => 'Media';
String get mentionToRemoteWarning => 'This note includes mentions to remote users';
String get mergeReactionsByName => 'Merge reactions with the same name';
String get moved => 'Moved';
String get muted => 'Muted';
String get mutedEmojis => 'Muted emojis';
Expand Down
2 changes: 2 additions & 0 deletions lib/model/general_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ class GeneralSettings with _$GeneralSettings {
@Default(false) bool alwaysExpandCw,
@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
46 changes: 45 additions & 1 deletion lib/model/general_settings.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ mixin _$GeneralSettings {
bool get alwaysExpandCw => throw _privateConstructorUsedError;
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 @@ -158,6 +160,8 @@ abstract class $GeneralSettingsCopyWith<$Res> {
bool alwaysExpandCw,
bool alwaysExpandLongNote,
bool alwaysExpandMediaInSubNote,
bool mergeReactionsByName,
bool alwaysShowAllReactions,
MediaListWithOneImageAppearance? mediaListWithOneImageAppearance,
BoxFit thumbnailBoxFit,
EmojiStyle emojiStyle,
Expand Down Expand Up @@ -256,6 +260,8 @@ class _$GeneralSettingsCopyWithImpl<$Res, $Val extends GeneralSettings>
Object? alwaysExpandCw = null,
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 @@ -414,6 +420,14 @@ class _$GeneralSettingsCopyWithImpl<$Res, $Val extends GeneralSettings>
? _value.alwaysExpandMediaInSubNote
: alwaysExpandMediaInSubNote // ignore: cast_nullable_to_non_nullable
as bool,
mergeReactionsByName: null == mergeReactionsByName
? _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 @@ -679,6 +693,8 @@ abstract class _$$GeneralSettingsImplCopyWith<$Res>
bool alwaysExpandCw,
bool alwaysExpandLongNote,
bool alwaysExpandMediaInSubNote,
bool mergeReactionsByName,
bool alwaysShowAllReactions,
MediaListWithOneImageAppearance? mediaListWithOneImageAppearance,
BoxFit thumbnailBoxFit,
EmojiStyle emojiStyle,
Expand Down Expand Up @@ -775,6 +791,8 @@ class __$$GeneralSettingsImplCopyWithImpl<$Res>
Object? alwaysExpandCw = null,
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 @@ -933,6 +951,14 @@ class __$$GeneralSettingsImplCopyWithImpl<$Res>
? _value.alwaysExpandMediaInSubNote
: alwaysExpandMediaInSubNote // ignore: cast_nullable_to_non_nullable
as bool,
mergeReactionsByName: null == mergeReactionsByName
? _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 @@ -1193,6 +1219,8 @@ class _$GeneralSettingsImpl implements _GeneralSettings {
this.alwaysExpandCw = false,
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 @@ -1332,6 +1360,12 @@ class _$GeneralSettingsImpl implements _GeneralSettings {
@JsonKey()
final bool alwaysExpandMediaInSubNote;
@override
@JsonKey()
final bool mergeReactionsByName;
@override
@JsonKey()
final bool alwaysShowAllReactions;
@override
final MediaListWithOneImageAppearance? mediaListWithOneImageAppearance;
@override
@JsonKey()
Expand Down Expand Up @@ -1504,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, 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 @@ -1567,6 +1601,8 @@ class _$GeneralSettingsImpl implements _GeneralSettings {
(identical(other.alwaysExpandMediaInSubNote, alwaysExpandMediaInSubNote) ||
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 @@ -1654,6 +1690,8 @@ class _$GeneralSettingsImpl implements _GeneralSettings {
alwaysExpandCw,
alwaysExpandLongNote,
alwaysExpandMediaInSubNote,
mergeReactionsByName,
alwaysShowAllReactions,
mediaListWithOneImageAppearance,
thumbnailBoxFit,
emojiStyle,
Expand Down Expand Up @@ -1757,6 +1795,8 @@ abstract class _GeneralSettings implements GeneralSettings {
final bool alwaysExpandCw,
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 @@ -1871,6 +1911,10 @@ abstract class _GeneralSettings implements GeneralSettings {
@override
bool get alwaysExpandMediaInSubNote;
@override
bool get mergeReactionsByName;
@override
bool get alwaysShowAllReactions;
@override
MediaListWithOneImageAppearance? get mediaListWithOneImageAppearance;
@override
BoxFit get thumbnailBoxFit;
Expand Down
4 changes: 4 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.

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

Future<void> setMergeReactionsByName(bool mergeReactionsByName) async {
state = state.copyWith(mergeReactionsByName: mergeReactionsByName);
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.

14 changes: 14 additions & 0 deletions lib/view/page/settings/note_display_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,20 @@ class NoteDisplayPage extends HookConsumerWidget {
.read(generalSettingsNotifierProvider.notifier)
.setAlwaysExpandMediaInSubNote(value),
),
SwitchListTile(
title: Text(t.aria.mergeReactionsByName),
value: settings.mergeReactionsByName,
onChanged: (value) => ref
.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
Loading
Loading