这是indexloc提供的服务,不要输入任何密码
Skip to content

feat: make note paddings configurable #147

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

Merged
merged 2 commits into from
May 12, 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
1 change: 1 addition & 0 deletions lib/i18n/aria/aria.i18n.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ invalidListFormat: "List format is invalid"
jumpTo: "Jump to {x}"
keepOpen: "Keep open"
loginWithAccessToken: "Sign in with an access token"
margin: "Margin"
mentionToRemoteWarning: "This note contains mentions to remote users"
moved: "Moved"
muted: "Muted"
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/aria/aria_ja-JP.i18n.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ invalidListFormat: "リストの形式が正しくありません"
jumpTo: "{x}にジャンプ"
keepOpen: "開いたままにする"
loginWithAccessToken: "アクセストークンでログイン"
margin: "余白"
mentionToRemoteWarning: "リモートユーザーへのメンションが含まれています"
moved: "移動しました"
muted: "ミュート中"
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/aria/aria_ja-KS.i18n.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ invalidListFormat: "リストの形式が間違ってるみたいや"
jumpTo: "{x}にジャンプ"
keepOpen: "開けたまんまにする"
loginWithAccessToken: "アクセストークンでログイン"
margin: "余白"
mentionToRemoteWarning: "リモートユーザーへのメンションがあるで"
moved: "移したで"
muted: "ミュート中"
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: 50731 (1636 per locale)
/// Strings: 50734 (1636 per locale)

// coverage:ignore-file
// ignore_for_file: type=lint
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 @@ -103,6 +103,7 @@ class _StringsAriaEnUs {
String jumpTo({required Object x}) => 'Jump to ${x}';
String get keepOpen => 'Keep open';
String get loginWithAccessToken => 'Sign in with an access token';
String get margin => 'Margin';
String get mentionToRemoteWarning => 'This note contains mentions to remote users';
String get moved => 'Moved';
String get muted => 'Muted';
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/strings_ja_JP.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class _StringsAriaJaJp extends _StringsAriaEnUs {
@override String jumpTo({required Object x}) => '${x}にジャンプ';
@override String get keepOpen => '開いたままにする';
@override String get loginWithAccessToken => 'アクセストークンでログイン';
@override String get margin => '余白';
@override String get mentionToRemoteWarning => 'リモートユーザーへのメンションが含まれています';
@override String get moved => '移動しました';
@override String get muted => 'ミュート中';
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/strings_ja_KS.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class _StringsAriaJaKs extends _StringsAriaEnUs {
@override String jumpTo({required Object x}) => '${x}にジャンプ';
@override String get keepOpen => '開けたまんまにする';
@override String get loginWithAccessToken => 'アクセストークンでログイン';
@override String get margin => '余白';
@override String get mentionToRemoteWarning => 'リモートユーザーへのメンションがあるで';
@override String get moved => '移したで';
@override String get muted => 'ミュート中';
Expand Down
7 changes: 7 additions & 0 deletions lib/model/general_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ const minReactionsDisplayScale = 0.1;
const maxReactionsDisplayScale = 3.0;
const minNoteFooterScale = 0.5;
const maxNoteFooterScale = 2.0;
const defaultNoteVerticalPadding = 12.0;
const maxNoteVerticalPadding = 36.0;
const minNoteHorizontalPadding = 8.0;
const defaultNoteHorizontalPadding = 12.0;
const maxNoteHorizontalPadding = 36.0;
const minEmojiPickerScale = 0.1;
const maxEmojiPickerScale = 3.0;

Expand Down Expand Up @@ -52,6 +57,8 @@ class GeneralSettings with _$GeneralSettings {
@Default(1.0) double reactionsDisplayScale,
@Default(true) bool limitWidthOfReaction,
@Default(1.0) double noteFooterScale,
@Default(defaultNoteVerticalPadding) double noteVerticalPadding,
@Default(defaultNoteHorizontalPadding) double noteHorizontalPadding,

// Emoji picker
@Default(false) bool emojiPickerUseDialog,
Expand Down
48 changes: 46 additions & 2 deletions lib/model/general_settings.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ mixin _$GeneralSettings {
double get fontSize => throw _privateConstructorUsedError;
double get reactionsDisplayScale => throw _privateConstructorUsedError;
bool get limitWidthOfReaction => throw _privateConstructorUsedError;
double get noteFooterScale =>
double get noteFooterScale => throw _privateConstructorUsedError;
double get noteVerticalPadding => throw _privateConstructorUsedError;
double get noteHorizontalPadding =>
throw _privateConstructorUsedError; // Emoji picker
bool get emojiPickerUseDialog => throw _privateConstructorUsedError;
double get emojiPickerScale => throw _privateConstructorUsedError;
Expand Down Expand Up @@ -126,6 +128,8 @@ abstract class $GeneralSettingsCopyWith<$Res> {
double reactionsDisplayScale,
bool limitWidthOfReaction,
double noteFooterScale,
double noteVerticalPadding,
double noteHorizontalPadding,
bool emojiPickerUseDialog,
double emojiPickerScale,
bool emojiPickerAutofocus,
Expand Down Expand Up @@ -197,6 +201,8 @@ class _$GeneralSettingsCopyWithImpl<$Res, $Val extends GeneralSettings>
Object? reactionsDisplayScale = null,
Object? limitWidthOfReaction = null,
Object? noteFooterScale = null,
Object? noteVerticalPadding = null,
Object? noteHorizontalPadding = null,
Object? emojiPickerUseDialog = null,
Object? emojiPickerScale = null,
Object? emojiPickerAutofocus = null,
Expand Down Expand Up @@ -339,6 +345,14 @@ class _$GeneralSettingsCopyWithImpl<$Res, $Val extends GeneralSettings>
? _value.noteFooterScale
: noteFooterScale // ignore: cast_nullable_to_non_nullable
as double,
noteVerticalPadding: null == noteVerticalPadding
? _value.noteVerticalPadding
: noteVerticalPadding // ignore: cast_nullable_to_non_nullable
as double,
noteHorizontalPadding: null == noteHorizontalPadding
? _value.noteHorizontalPadding
: noteHorizontalPadding // ignore: cast_nullable_to_non_nullable
as double,
emojiPickerUseDialog: null == emojiPickerUseDialog
? _value.emojiPickerUseDialog
: emojiPickerUseDialog // ignore: cast_nullable_to_non_nullable
Expand Down Expand Up @@ -493,6 +507,8 @@ abstract class _$$GeneralSettingsImplCopyWith<$Res>
double reactionsDisplayScale,
bool limitWidthOfReaction,
double noteFooterScale,
double noteVerticalPadding,
double noteHorizontalPadding,
bool emojiPickerUseDialog,
double emojiPickerScale,
bool emojiPickerAutofocus,
Expand Down Expand Up @@ -562,6 +578,8 @@ class __$$GeneralSettingsImplCopyWithImpl<$Res>
Object? reactionsDisplayScale = null,
Object? limitWidthOfReaction = null,
Object? noteFooterScale = null,
Object? noteVerticalPadding = null,
Object? noteHorizontalPadding = null,
Object? emojiPickerUseDialog = null,
Object? emojiPickerScale = null,
Object? emojiPickerAutofocus = null,
Expand Down Expand Up @@ -704,6 +722,14 @@ class __$$GeneralSettingsImplCopyWithImpl<$Res>
? _value.noteFooterScale
: noteFooterScale // ignore: cast_nullable_to_non_nullable
as double,
noteVerticalPadding: null == noteVerticalPadding
? _value.noteVerticalPadding
: noteVerticalPadding // ignore: cast_nullable_to_non_nullable
as double,
noteHorizontalPadding: null == noteHorizontalPadding
? _value.noteHorizontalPadding
: noteHorizontalPadding // ignore: cast_nullable_to_non_nullable
as double,
emojiPickerUseDialog: null == emojiPickerUseDialog
? _value.emojiPickerUseDialog
: emojiPickerUseDialog // ignore: cast_nullable_to_non_nullable
Expand Down Expand Up @@ -853,6 +879,8 @@ class _$GeneralSettingsImpl implements _GeneralSettings {
this.reactionsDisplayScale = 1.0,
this.limitWidthOfReaction = true,
this.noteFooterScale = 1.0,
this.noteVerticalPadding = defaultNoteVerticalPadding,
this.noteHorizontalPadding = defaultNoteHorizontalPadding,
this.emojiPickerUseDialog = false,
this.emojiPickerScale = 1.0,
this.emojiPickerAutofocus = true,
Expand Down Expand Up @@ -971,6 +999,12 @@ class _$GeneralSettingsImpl implements _GeneralSettings {
@override
@JsonKey()
final double noteFooterScale;
@override
@JsonKey()
final double noteVerticalPadding;
@override
@JsonKey()
final double noteHorizontalPadding;
// Emoji picker
@override
@JsonKey()
Expand Down Expand Up @@ -1062,7 +1096,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, emojiStyle: $emojiStyle, fontFamily: $fontFamily, fontSize: $fontSize, reactionsDisplayScale: $reactionsDisplayScale, limitWidthOfReaction: $limitWidthOfReaction, noteFooterScale: $noteFooterScale, emojiPickerUseDialog: $emojiPickerUseDialog, emojiPickerScale: $emojiPickerScale, emojiPickerAutofocus: $emojiPickerAutofocus, emojiPickerKeepOpen: $emojiPickerKeepOpen, dataSaverMedia: $dataSaverMedia, dataSaverAvatar: $dataSaverAvatar, dataSaverUrlPreview: $dataSaverUrlPreview, disableDataSaverWhenOnWifi: $disableDataSaverWhenOnWifi, disableShowingAnimatedImages: $disableShowingAnimatedImages, forceShowAds: $forceShowAds, useGroupedNotifications: $useGroupedNotifications, showTimelineTabBarOnBottom: $showTimelineTabBarOnBottom, showTimelineLastViewedAt: $showTimelineLastViewedAt, vibrateNote: $vibrateNote, vibrateNotification: $vibrateNotification, enableInfiniteScroll: $enableInfiniteScroll, keepScreenOn: $keepScreenOn, enableHorizontalSwipe: $enableHorizontalSwipe, openSensitiveMediaOnDoubleTap: $openSensitiveMediaOnDoubleTap, noteTapAction: $noteTapAction, noteDoubleTapAction: $noteDoubleTapAction, noteLongPressAction: $noteLongPressAction, confirmBeforePost: $confirmBeforePost, confirmBeforeReact: $confirmBeforeReact, confirmBeforeFollow: $confirmBeforeFollow, 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, emojiStyle: $emojiStyle, fontFamily: $fontFamily, fontSize: $fontSize, reactionsDisplayScale: $reactionsDisplayScale, limitWidthOfReaction: $limitWidthOfReaction, noteFooterScale: $noteFooterScale, noteVerticalPadding: $noteVerticalPadding, noteHorizontalPadding: $noteHorizontalPadding, emojiPickerUseDialog: $emojiPickerUseDialog, emojiPickerScale: $emojiPickerScale, emojiPickerAutofocus: $emojiPickerAutofocus, emojiPickerKeepOpen: $emojiPickerKeepOpen, dataSaverMedia: $dataSaverMedia, dataSaverAvatar: $dataSaverAvatar, dataSaverUrlPreview: $dataSaverUrlPreview, disableDataSaverWhenOnWifi: $disableDataSaverWhenOnWifi, disableShowingAnimatedImages: $disableShowingAnimatedImages, forceShowAds: $forceShowAds, useGroupedNotifications: $useGroupedNotifications, showTimelineTabBarOnBottom: $showTimelineTabBarOnBottom, showTimelineLastViewedAt: $showTimelineLastViewedAt, vibrateNote: $vibrateNote, vibrateNotification: $vibrateNotification, enableInfiniteScroll: $enableInfiniteScroll, keepScreenOn: $keepScreenOn, enableHorizontalSwipe: $enableHorizontalSwipe, openSensitiveMediaOnDoubleTap: $openSensitiveMediaOnDoubleTap, noteTapAction: $noteTapAction, noteDoubleTapAction: $noteDoubleTapAction, noteLongPressAction: $noteLongPressAction, confirmBeforePost: $confirmBeforePost, confirmBeforeReact: $confirmBeforeReact, confirmBeforeFollow: $confirmBeforeFollow, themeMode: $themeMode, lightThemeId: $lightThemeId, darkThemeId: $darkThemeId)';
}

@override
Expand Down Expand Up @@ -1128,6 +1162,8 @@ class _$GeneralSettingsImpl implements _GeneralSettings {
other.reactionsDisplayScale == reactionsDisplayScale) &&
(identical(other.limitWidthOfReaction, limitWidthOfReaction) || other.limitWidthOfReaction == limitWidthOfReaction) &&
(identical(other.noteFooterScale, noteFooterScale) || other.noteFooterScale == noteFooterScale) &&
(identical(other.noteVerticalPadding, noteVerticalPadding) || other.noteVerticalPadding == noteVerticalPadding) &&
(identical(other.noteHorizontalPadding, noteHorizontalPadding) || other.noteHorizontalPadding == noteHorizontalPadding) &&
(identical(other.emojiPickerUseDialog, emojiPickerUseDialog) || other.emojiPickerUseDialog == emojiPickerUseDialog) &&
(identical(other.emojiPickerScale, emojiPickerScale) || other.emojiPickerScale == emojiPickerScale) &&
(identical(other.emojiPickerAutofocus, emojiPickerAutofocus) || other.emojiPickerAutofocus == emojiPickerAutofocus) &&
Expand Down Expand Up @@ -1190,6 +1226,8 @@ class _$GeneralSettingsImpl implements _GeneralSettings {
reactionsDisplayScale,
limitWidthOfReaction,
noteFooterScale,
noteVerticalPadding,
noteHorizontalPadding,
emojiPickerUseDialog,
emojiPickerScale,
emojiPickerAutofocus,
Expand Down Expand Up @@ -1266,6 +1304,8 @@ abstract class _GeneralSettings implements GeneralSettings {
final double reactionsDisplayScale,
final bool limitWidthOfReaction,
final double noteFooterScale,
final double noteVerticalPadding,
final double noteHorizontalPadding,
final bool emojiPickerUseDialog,
final double emojiPickerScale,
final bool emojiPickerAutofocus,
Expand Down Expand Up @@ -1356,6 +1396,10 @@ abstract class _GeneralSettings implements GeneralSettings {
bool get limitWidthOfReaction;
@override
double get noteFooterScale;
@override
double get noteVerticalPadding;
@override
double get noteHorizontalPadding;
@override // Emoji picker
bool get emojiPickerUseDialog;
@override
Expand Down
7 changes: 7 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.

1 change: 0 additions & 1 deletion lib/provider/check_word_mute_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ bool checkWordMute(
String noteId, {
bool hardMute = false,
}) {
ref.keepAlive();
final note = ref.watch(noteProvider(account, noteId));
final i = ref.watch(iNotifierProvider(account)).valueOrNull;
if (note == null || i == null || note.userId == i.id) {
Expand Down
2 changes: 1 addition & 1 deletion lib/provider/check_word_mute_provider.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 @@ -195,6 +195,16 @@ class GeneralSettingsNotifier extends _$GeneralSettingsNotifier {
await _save();
}

Future<void> setNoteVerticalPadding(double noteVerticalPadding) async {
state = state.copyWith(noteVerticalPadding: noteVerticalPadding);
await _save();
}

Future<void> setNoteHorizontalPadding(double noteHorizontalPadding) async {
state = state.copyWith(noteHorizontalPadding: noteHorizontalPadding);
await _save();
}

Future<void> setEmojiPickerUseDialog(bool emojiPickerUseDialog) async {
state = state.copyWith(emojiPickerUseDialog: emojiPickerUseDialog);
await _save();
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.

Loading