Skip to content

Commit

Permalink
feat: emoji mute
Browse files Browse the repository at this point in the history
  • Loading branch information
poppingmoon committed Oct 23, 2024
1 parent 12c0443 commit bdbcae0
Show file tree
Hide file tree
Showing 20 changed files with 537 additions and 55 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 @@ -63,6 +63,7 @@ media: "Media"
mentionToRemoteWarning: "This note includes mentions to remote users"
moved: "Moved"
muted: "Muted"
mutedEmojis: "Muted emojis"
nFiles:
one: "{n} file"
other: "{n} files"
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: 54609 (1761 per locale)
/// Strings: 54610 (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 @@ -131,6 +131,7 @@ class TranslationsAriaEnUs {
String get mentionToRemoteWarning => 'This note includes mentions to remote users';
String get moved => 'Moved';
String get muted => 'Muted';
String get mutedEmojis => 'Muted emojis';
String nFiles({required num n}) => (_root.$meta.cardinalResolver ?? PluralResolvers.cardinal('en'))(n,
one: '${n} file',
other: '${n} files',
Expand Down
1 change: 1 addition & 0 deletions lib/model/account_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class AccountSettings with _$AccountSettings {
// Mute
@Default([]) List<MuteWord> mutedWords,
@Default([]) List<MuteWord> hardMutedWords,
@Default([]) List<String> mutedEmojis,

// UserSelectDialog
@Default([]) List<String> recentlyUsedUsers,
Expand Down
36 changes: 33 additions & 3 deletions lib/model/account_settings.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ mixin _$AccountSettings {
bool get keepOriginalUploading => throw _privateConstructorUsedError;
bool get keepOriginalFilename => throw _privateConstructorUsedError; // Mute
List<MuteWord> get mutedWords => throw _privateConstructorUsedError;
List<MuteWord> get hardMutedWords =>
List<MuteWord> get hardMutedWords => throw _privateConstructorUsedError;
List<String> get mutedEmojis =>
throw _privateConstructorUsedError; // UserSelectDialog
List<String> get recentlyUsedUsers =>
throw _privateConstructorUsedError; // PostForm
Expand Down Expand Up @@ -89,6 +90,7 @@ abstract class $AccountSettingsCopyWith<$Res> {
bool keepOriginalFilename,
List<MuteWord> mutedWords,
List<MuteWord> hardMutedWords,
List<String> mutedEmojis,
List<String> recentlyUsedUsers,
List<String> hashtags});
}
Expand Down Expand Up @@ -129,6 +131,7 @@ class _$AccountSettingsCopyWithImpl<$Res, $Val extends AccountSettings>
Object? keepOriginalFilename = null,
Object? mutedWords = null,
Object? hardMutedWords = null,
Object? mutedEmojis = null,
Object? recentlyUsedUsers = null,
Object? hashtags = null,
}) {
Expand Down Expand Up @@ -217,6 +220,10 @@ class _$AccountSettingsCopyWithImpl<$Res, $Val extends AccountSettings>
? _value.hardMutedWords
: hardMutedWords // ignore: cast_nullable_to_non_nullable
as List<MuteWord>,
mutedEmojis: null == mutedEmojis
? _value.mutedEmojis
: mutedEmojis // ignore: cast_nullable_to_non_nullable
as List<String>,
recentlyUsedUsers: null == recentlyUsedUsers
? _value.recentlyUsedUsers
: recentlyUsedUsers // ignore: cast_nullable_to_non_nullable
Expand Down Expand Up @@ -259,6 +266,7 @@ abstract class _$$AccountSettingsImplCopyWith<$Res>
bool keepOriginalFilename,
List<MuteWord> mutedWords,
List<MuteWord> hardMutedWords,
List<String> mutedEmojis,
List<String> recentlyUsedUsers,
List<String> hashtags});
}
Expand Down Expand Up @@ -297,6 +305,7 @@ class __$$AccountSettingsImplCopyWithImpl<$Res>
Object? keepOriginalFilename = null,
Object? mutedWords = null,
Object? hardMutedWords = null,
Object? mutedEmojis = null,
Object? recentlyUsedUsers = null,
Object? hashtags = null,
}) {
Expand Down Expand Up @@ -385,6 +394,10 @@ class __$$AccountSettingsImplCopyWithImpl<$Res>
? _value._hardMutedWords
: hardMutedWords // ignore: cast_nullable_to_non_nullable
as List<MuteWord>,
mutedEmojis: null == mutedEmojis
? _value._mutedEmojis
: mutedEmojis // ignore: cast_nullable_to_non_nullable
as List<String>,
recentlyUsedUsers: null == recentlyUsedUsers
? _value._recentlyUsedUsers
: recentlyUsedUsers // ignore: cast_nullable_to_non_nullable
Expand Down Expand Up @@ -422,13 +435,15 @@ class _$AccountSettingsImpl implements _AccountSettings {
this.keepOriginalFilename = true,
final List<MuteWord> mutedWords = const [],
final List<MuteWord> hardMutedWords = const [],
final List<String> mutedEmojis = const [],
final List<String> recentlyUsedUsers = const [],
final List<String> hashtags = const []})
: _pinnedEmojisForReaction = pinnedEmojisForReaction,
_pinnedEmojis = pinnedEmojis,
_recentlyUsedEmojis = recentlyUsedEmojis,
_mutedWords = mutedWords,
_hardMutedWords = hardMutedWords,
_mutedEmojis = mutedEmojis,
_recentlyUsedUsers = recentlyUsedUsers,
_hashtags = hashtags;

Expand Down Expand Up @@ -533,6 +548,15 @@ class _$AccountSettingsImpl implements _AccountSettings {
return EqualUnmodifiableListView(_hardMutedWords);
}

final List<String> _mutedEmojis;
@override
@JsonKey()
List<String> get mutedEmojis {
if (_mutedEmojis is EqualUnmodifiableListView) return _mutedEmojis;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_mutedEmojis);
}

// UserSelectDialog
final List<String> _recentlyUsedUsers;
// UserSelectDialog
Expand All @@ -558,7 +582,7 @@ class _$AccountSettingsImpl implements _AccountSettings {

@override
String toString() {
return 'AccountSettings(keepCw: $keepCw, rememberNoteVisibility: $rememberNoteVisibility, defaultNoteVisibility: $defaultNoteVisibility, defaultNoteLocalOnly: $defaultNoteLocalOnly, rememberRenoteVisibility: $rememberRenoteVisibility, defaultRenoteVisibility: $defaultRenoteVisibility, defaultRenoteLocalOnly: $defaultRenoteLocalOnly, reactionAcceptance: $reactionAcceptance, visibility: $visibility, localOnly: $localOnly, renoteVisibility: $renoteVisibility, renoteLocalOnly: $renoteLocalOnly, pinnedEmojisForReaction: $pinnedEmojisForReaction, pinnedEmojis: $pinnedEmojis, recentlyUsedEmojis: $recentlyUsedEmojis, defaultReaction: $defaultReaction, uploadFolder: $uploadFolder, keepOriginalUploading: $keepOriginalUploading, keepOriginalFilename: $keepOriginalFilename, mutedWords: $mutedWords, hardMutedWords: $hardMutedWords, recentlyUsedUsers: $recentlyUsedUsers, hashtags: $hashtags)';
return 'AccountSettings(keepCw: $keepCw, rememberNoteVisibility: $rememberNoteVisibility, defaultNoteVisibility: $defaultNoteVisibility, defaultNoteLocalOnly: $defaultNoteLocalOnly, rememberRenoteVisibility: $rememberRenoteVisibility, defaultRenoteVisibility: $defaultRenoteVisibility, defaultRenoteLocalOnly: $defaultRenoteLocalOnly, reactionAcceptance: $reactionAcceptance, visibility: $visibility, localOnly: $localOnly, renoteVisibility: $renoteVisibility, renoteLocalOnly: $renoteLocalOnly, pinnedEmojisForReaction: $pinnedEmojisForReaction, pinnedEmojis: $pinnedEmojis, recentlyUsedEmojis: $recentlyUsedEmojis, defaultReaction: $defaultReaction, uploadFolder: $uploadFolder, keepOriginalUploading: $keepOriginalUploading, keepOriginalFilename: $keepOriginalFilename, mutedWords: $mutedWords, hardMutedWords: $hardMutedWords, mutedEmojis: $mutedEmojis, recentlyUsedUsers: $recentlyUsedUsers, hashtags: $hashtags)';
}

@override
Expand Down Expand Up @@ -609,6 +633,8 @@ class _$AccountSettingsImpl implements _AccountSettings {
.equals(other._mutedWords, _mutedWords) &&
const DeepCollectionEquality()
.equals(other._hardMutedWords, _hardMutedWords) &&
const DeepCollectionEquality()
.equals(other._mutedEmojis, _mutedEmojis) &&
const DeepCollectionEquality()
.equals(other._recentlyUsedUsers, _recentlyUsedUsers) &&
const DeepCollectionEquality().equals(other._hashtags, _hashtags));
Expand Down Expand Up @@ -639,6 +665,7 @@ class _$AccountSettingsImpl implements _AccountSettings {
keepOriginalFilename,
const DeepCollectionEquality().hash(_mutedWords),
const DeepCollectionEquality().hash(_hardMutedWords),
const DeepCollectionEquality().hash(_mutedEmojis),
const DeepCollectionEquality().hash(_recentlyUsedUsers),
const DeepCollectionEquality().hash(_hashtags)
]);
Expand Down Expand Up @@ -683,6 +710,7 @@ abstract class _AccountSettings implements AccountSettings {
final bool keepOriginalFilename,
final List<MuteWord> mutedWords,
final List<MuteWord> hardMutedWords,
final List<String> mutedEmojis,
final List<String> recentlyUsedUsers,
final List<String> hashtags}) = _$AccountSettingsImpl;

Expand Down Expand Up @@ -731,7 +759,9 @@ abstract class _AccountSettings implements AccountSettings {
@override
List<MuteWord> get mutedWords;
@override
List<MuteWord> get hardMutedWords; // UserSelectDialog
List<MuteWord> get hardMutedWords;
@override
List<String> get mutedEmojis; // UserSelectDialog
@override
List<String> get recentlyUsedUsers; // PostForm
@override
Expand Down
5 changes: 5 additions & 0 deletions lib/model/account_settings.g.dart

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

3 changes: 2 additions & 1 deletion lib/model/mfm_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class MfmConfig with _$MfmConfig {
double scale,
double opacity,
TextStyle fallbackTextStyle,
) emojiBuilder,
) customEmojiBuilder,
required Widget Function(String emoji, TextStyle style) unicodeEmojiBuilder,
required Widget Function(
String username,
String? host,
Expand Down
Loading

0 comments on commit bdbcae0

Please sign in to comment.