Skip to content

Commit

Permalink
feat: make buttons in timelines page customizable
Browse files Browse the repository at this point in the history
  • Loading branch information
poppingmoon committed Oct 28, 2024
1 parent 6b9f8c1 commit 9b316f5
Show file tree
Hide file tree
Showing 10 changed files with 631 additions and 256 deletions.
9 changes: 5 additions & 4 deletions lib/i18n/aria/aria.i18n.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ authenticate: "Authenticate"
authenticated: "Authenticated"
avatarSize: "Avatar size"
background: "Background"
buttonTypes: "Button types"
confirmBeforeFollow: "Confirm before follow"
confirmBeforePost: "Confirm before post"
confirmBeforeReact: "Confirm before react"
Expand Down Expand Up @@ -100,6 +101,7 @@ playAudio: "Play audio"
playVideo: "Play video"
pleaseCopyResponse: "Please copy this response"
postConfirm: "Are you sure you want to post this note?"
postForm: "Posting form"
reactionConfirm: "Are you sure you want to add a reaction?"
recentlyUsedEmojis: "Recently used emojis"
renoteConfirm: "Are you sure you want to renote this note?"
Expand All @@ -116,19 +118,17 @@ showAvatarsInNote: "Show avatars in notes"
showAvatarsInSubNote: "Show avatars in sub notes"
showEntireImage: "Show entire image"
showExpandedImage: "Show expanded image"
showHomeFAB: "Show home floating action button"
showImage: "Show image"
showLikeButtonInNoteFooter: "Add \"Like\" to note action menu"
showMenuButtonInTabBar: "Show menu button in tab bar"
showNoteCreatedAt: "Show creation date of notes"
showNoteFooter: "Show action buttons in notes"
showNoteReactionsViewer: "Show reactions viewers in notes"
showNotificationsFAB: "Show notifications floating action button"
showPopupOnNewNote: "Show popup on new note"
showPostForm: "Show post form"
showQuoteButtonInNoteFooter: "Add \"Quote\" to note action menu"
showSelfRenotes: "Show self-renotes"
showShowPostFormFAB: "Show mini post form floating action button"
showSmallButtons: "Show small buttons"
showSquaredButtons: "Show squared buttons"
showStackTrace: "Show stack trace"
showSubNoteFooter: "Show action buttons in subnotes"
showSubNoteReactionsViewer: "Show reactions viewers in subnotes"
Expand All @@ -144,6 +144,7 @@ tabType: "Tab type"
tabs: "Tabs"
tapToShow: "Tap to show"
timeMachine: "Time machine"
timelinesPageButtons: "Timelines page buttons"
unfavorited: "Removed from favorites"
unfollowConfirm(rich): "Are you sure you want to unfollow {name}?"
untilDate: "Until"
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: 54621 (1761 per locale)
/// Strings: 54622 (1762 per locale)
// coverage:ignore-file
// ignore_for_file: type=lint, unused_import
Expand Down
9 changes: 5 additions & 4 deletions lib/i18n/strings_en_US.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class TranslationsAriaEnUs {
String get authenticated => 'Authenticated';
String get avatarSize => 'Avatar size';
String get background => 'Background';
String get buttonTypes => 'Button types';
String get confirmBeforeFollow => 'Confirm before follow';
String get confirmBeforePost => 'Confirm before post';
String get confirmBeforeReact => 'Confirm before react';
Expand Down Expand Up @@ -180,6 +181,7 @@ class TranslationsAriaEnUs {
String get playVideo => 'Play video';
String get pleaseCopyResponse => 'Please copy this response';
String get postConfirm => 'Are you sure you want to post this note?';
String get postForm => 'Posting form';
String get reactionConfirm => 'Are you sure you want to add a reaction?';
String get recentlyUsedEmojis => 'Recently used emojis';
String get renoteConfirm => 'Are you sure you want to renote this note?';
Expand All @@ -205,19 +207,17 @@ class TranslationsAriaEnUs {
String get showAvatarsInSubNote => 'Show avatars in sub notes';
String get showEntireImage => 'Show entire image';
String get showExpandedImage => 'Show expanded image';
String get showHomeFAB => 'Show home floating action button';
String get showImage => 'Show image';
String get showLikeButtonInNoteFooter => 'Add "Like" to note action menu';
String get showMenuButtonInTabBar => 'Show menu button in tab bar';
String get showNoteCreatedAt => 'Show creation date of notes';
String get showNoteFooter => 'Show action buttons in notes';
String get showNoteReactionsViewer => 'Show reactions viewers in notes';
String get showNotificationsFAB => 'Show notifications floating action button';
String get showPopupOnNewNote => 'Show popup on new note';
String get showPostForm => 'Show post form';
String get showQuoteButtonInNoteFooter => 'Add "Quote" to note action menu';
String get showSelfRenotes => 'Show self-renotes';
String get showShowPostFormFAB => 'Show mini post form floating action button';
String get showSmallButtons => 'Show small buttons';
String get showSquaredButtons => 'Show squared buttons';
String get showStackTrace => 'Show stack trace';
String get showSubNoteFooter => 'Show action buttons in subnotes';
String get showSubNoteReactionsViewer => 'Show reactions viewers in subnotes';
Expand All @@ -233,6 +233,7 @@ class TranslationsAriaEnUs {
String get tabs => 'Tabs';
String get tapToShow => 'Tap to show';
String get timeMachine => 'Time machine';
String get timelinesPageButtons => 'Timelines page buttons';
String get unfavorited => 'Removed from favorites';
TextSpan unfollowConfirm({required InlineSpan name}) => TextSpan(children: [
const TextSpan(text: 'Are you sure you want to unfollow '),
Expand Down
40 changes: 37 additions & 3 deletions lib/model/general_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ const defaultNoteHorizontalPadding = 12.0;
const maxNoteHorizontalPadding = 36.0;
const minEmojiPickerScale = 0.1;
const maxEmojiPickerScale = 3.0;
const defaultTimelinesPageButtonTypes = [
TimelinesPageButtonType.menu,
TimelinesPageButtonType.home,
TimelinesPageButtonType.notifications,
TimelinesPageButtonType.postForm,
TimelinesPageButtonType.note,
];

@freezed
class GeneralSettings with _$GeneralSettings {
Expand Down Expand Up @@ -98,9 +105,10 @@ class GeneralSettings with _$GeneralSettings {
@Default(false) bool useGroupedNotifications,
@Default(false) bool showTimelineTabBarAtBottom,
@Default(false) bool showMenuButtonInTabBar,
@Default(true) bool showHomeFAB,
@Default(true) bool showNotificationsFAB,
@Default(true) bool showShowPostFormFAB,
@Default(defaultTimelinesPageButtonTypes)
List<TimelinesPageButtonType?> timelinesPageButtonTypes,
@Default(false) bool showSmallTimelinesPageButtons,
@Default(false) bool showSquaredTimelinesPageButtons,
@Default(true) bool showTabHeaderInOneLine,
@Default(false) bool alwaysShowTabHeader,
@Default(true) bool showTimelineLastViewedAt,
Expand Down Expand Up @@ -176,3 +184,29 @@ class ColorConverter extends JsonConverter<Color, int> {
return color.value;
}
}

enum TimelinesPageButtonType {
announcements,
antennas,
channels,
clips,
drive,
explore,
favorites,
gallery,
games,
home,
instanceInfo,
lists,
lookup,
menu,
note,
notifications,
pages,
play,
postForm,
profile,
reload,
search,
settings,
}
Loading

0 comments on commit 9b316f5

Please sign in to comment.