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

Re-organizing settings page and addition of post/comment previews #890

Merged
merged 12 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from 10 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 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- Added ability to collapse post in post page
- Added ability to change app language in settings
- Added ability to show/hide read posts in user settings
- Added post and comment previews to settings, and reorganized settings page

## 0.2.6 - 2023-11-22
### Fixed
Expand Down
2 changes: 1 addition & 1 deletion lib/core/enums/local_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ enum LocalSettings {
/// -------------------------- Feed Related Settings --------------------------
// Default Listing/Sort Settings
defaultFeedListingType(name: 'setting_general_default_listing_type', label: 'Default Feed Type'),
defaultFeedSortType(name: 'setting_general_default_sort_type', label: 'Default Sort Type'),
defaultFeedSortType(name: 'setting_general_default_sort_type', label: 'Default Feed Sort Type'),

// NSFW Settings
hideNsfwPosts(name: 'setting_general_hide_nsfw_posts', label: 'Hide NSFW Posts from Feed'),
Expand Down
87 changes: 87 additions & 0 deletions lib/feed/utils/post.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,90 @@ Future<PostView> createPost({required int communityId, required String name, Str

return postResponse.postView;
}

/// Creates a placeholder post from the given parameters. This is mainly used to display a preview of the post
/// with the applied settings on Settings -> Appearance -> Posts page.
Future<PostViewMedia> createExamplePost({
String? postTitle,
String? postUrl,
String? postBody,
String? postThumbnailUrl,
bool? locked,
bool? nsfw,
bool? pinned,
String? personName,
String? personDisplayName,
String? communityName,
String? instanceUrl,
int? commentCount,
int? scoreCount,
bool? saved,
bool? read,
}) async {
PostView postView = PostView(
post: Post(
id: 1,
name: postTitle ?? 'Example Title',
url: postUrl,
body: postBody,
thumbnailUrl: postThumbnailUrl,
creatorId: 1,
communityId: 1,
removed: false,
locked: locked ?? false,
published: DateTime.now(),
deleted: false,
nsfw: nsfw ?? false,
apId: '',
local: false,
languageId: 0,
featuredCommunity: pinned ?? false,
featuredLocal: false,
),
creator: Person(
id: 1,
name: personName ?? 'Example Username',
displayName: personDisplayName ?? 'Example Name',
banned: false,
published: DateTime.now(),
actorId: '',
local: false,
deleted: false,
botAccount: false,
instanceId: 1,
),
community: Community(
id: 1,
name: communityName ?? 'Example Community',
title: '',
removed: false,
published: DateTime.now(),
deleted: false,
nsfw: false,
actorId: instanceUrl ?? 'https://thunder.lemmy',
local: false,
hidden: false,
postingRestrictedToMods: false,
instanceId: 1,
),
creatorBannedFromCommunity: false,
counts: PostAggregates(
id: 1,
postId: 1,
comments: commentCount ?? 0,
score: scoreCount ?? 0,
upvotes: 0,
downvotes: 0,
published: DateTime.now(),
),
subscribed: SubscribedType.notSubscribed,
saved: saved ?? false,
read: read ?? false,
creatorBlocked: false,
unreadComments: 0,
);

List<PostViewMedia> postViewMedias = await parsePostViews([postView]);

return Future.value(postViewMedias.first);
}
123 changes: 118 additions & 5 deletions lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"about": "About",
"@about": {
"description": "About settings category."
},
"accessibility": "Accessibility",
"@accessibility": {},
"accessibilityProfilesDescription": "Accessibility profiles allows applying several settings at once to accomodate a particular accessibility requirement.",
Expand Down Expand Up @@ -37,6 +41,10 @@
"@appLanguage": {
"description": "Language selection in settings."
},
"appearance": "Appearance",
"@appearance": {
"description": "Title of Appearance in Settings -> Appearance"
},
"applied": "Applied",
"@applied": {},
"apply": "Apply",
Expand Down Expand Up @@ -69,6 +77,18 @@
"@cantBlockAdmin": {},
"cantBlockYourself": "You may not block yourself.",
"@cantBlockYourself": {},
"cardView": "Card View",
"@cardView": {
"description": "Label for the card view option in Setting -> Appearance -> Posts"
},
"cardViewDescription": "Enable card view to adjust settings",
"@cardViewDescription": {
"description": "Description for the card view subcategory in Setting -> Appearance -> Posts"
},
"cardViewSettings": "Card View Settings",
"@cardViewSettings": {
"description": "Subcategory in Setting -> Appearance -> Posts"
},
"changeSort": "Change Sort",
"@changeSort": {},
"clearSearch": "Clear Search",
Expand All @@ -78,12 +98,28 @@
"@clearedUserPreferences": {},
"close": "Close",
"@close": {},
"collapseCommentPreview": "Collapse Comment Preview",
"@collapseCommentPreview": {
"description": "Semantic label for the collapse button in Setting -> Appearance -> Comments"
},
"collapsePost": "Collapse post",
"@collapsePost": {},
"collapsePostPreview": "Collapse Post Preview",
"@collapsePostPreview": {
"description": "Semantic label for the collapse button in Setting -> Appearance -> Posts"
},
"combineNavAndFab": "Floating Action Button will be shown between navigation buttons.",
"@combineNavAndFab": {},
"comment": "Comment",
"@comment": {},
"commentBehaviourSettings": "Comments",
"@commentBehaviourSettings": {
"description": "Subcategory in Setting -> General"
},
"commentPreview": "Show a preview of the comments with the given settings",
"@commentPreview": {
"description": "Description for the comment preview in Setting -> Appearance -> Comments"
},
"commentReported": "The comment has been marked for review.",
"@commentReported": {},
"commentSavedAsDraft": "Comment saved as draft",
Expand All @@ -97,8 +133,28 @@
"communities": "Communities",
"community": "Community",
"@community": {},
"compactView": "Compact View",
"@compactView": {
"description": "Label for the compact view option in Setting -> Appearance -> Posts"
},
"compactViewDescription": "Enable compact view to adjust settings",
"@compactViewDescription": {
"description": "Description for the compact view subcategory in Setting -> Appearance -> Posts"
},
"compactViewSettings": "Compact View Settings",
"@compactViewSettings": {
"description": "Subcategory in Setting -> Appearance -> Posts"
},
"confirmLogOut": "Log out?",
"@confirmLogOut": {},
"confirmResetCommentPreferences": "This will reset all comment preferences. Are you sure you want to proceed?",
"@confirmResetCommentPreferences": {
"description": "Description for reset preferences dialog in Setting -> Appearance -> Comments"
},
"confirmResetPostPreferences": "This will reset all post preferences. Are you sure you want to proceed?",
"@confirmResetPostPreferences": {
"description": "Description for reset preferences dialog in Setting -> Appearance -> Posts"
},
"controversial": "Controversial",
"@controversial": {},
"copiedToClipboard": "Copied to clipboard",
Expand Down Expand Up @@ -127,6 +183,10 @@
"@currentSinglePress": {},
"customizeSwipeActions": "Customize swipe actions (tap to change)",
"@customizeSwipeActions": {},
"debug": "Debug",
"@debug": {
"description": "Debug settings category."
},
"delete": "Delete",
"@delete": {},
"dimReadPosts": "Read posts will be grayed out",
Expand Down Expand Up @@ -167,10 +227,18 @@
"@exceptionProcessingUri": {
"description": "An unspecified error during link processing."
},
"expandCommentPreview": "Expand Comment Preview",
"@expandCommentPreview": {
"description": "Semantic label for the expand button in Setting -> Appearance -> Comments"
},
"expandOptions": "Expand options",
"@expandOptions": {},
"expandPost": "Expand post",
"@expandPost": {},
"expandPostPreview": "Expand Post Preview",
"@expandPostPreview": {
"description": "Semantic label for the expand button in Setting -> Appearance -> Posts"
},
"failedToBlock": "Failed to block: {errorMessage}",
"@failedToBlock": {},
"failedToLoadBlocks": "Could not load blocks: {errorMessage}",
Expand All @@ -179,18 +247,34 @@
"@failedToUnblock": {},
"feed": "Feed",
"@feed": {},
"feedBehaviourSettings": "Feed",
"@feedBehaviourSettings": {
"description": "Subcategory in Setting -> General"
},
"feedTypeAndSorts": "Default Feed Type and Sorting",
"@feedTypeAndSorts": {
"description": "Subcategory in Setting -> General"
},
"fetchAccountError": "Could not determine account",
"@fetchAccountError": {},
"filters": "Filters",
"@filters": {
"description": "Category to describe various filters (user, community, instance blocking)"
},
"floatingActionButton": "Floating Action Button",
"@floatingActionButton": {
"description": "Floating Action Button settings category."
},
"fullScreenNavigationSwipeDescription": "Swipe anywhere to go back when left-to-right gestures are disabled",
"@fullScreenNavigationSwipeDescription": {},
"general": "General",
"@general": {
"description": "General settings category."
},
"generalSettings": "General Settings",
"@generalSettings": {
"description": "Subcategory in Settings"
},
"gestures": "Gestures",
"@gestures": {},
"gettingStarted": "Getting Started",
Expand Down Expand Up @@ -238,6 +322,10 @@
"link": "{count, plural, zero {Link} one {Link} other {Links} } ",
"@link": {},
"linkActions": "Link Actions",
"linksBehaviourSettings": "Links",
"@linksBehaviourSettings": {
"description": "Subcategory in Setting -> General"
},
"loadMorePlural": "Load {count} more replies…",
"@loadMorePlural": {},
"loadMoreSingular": "Load {count} more reply…",
Expand Down Expand Up @@ -309,6 +397,10 @@
"@notifications": {
"description": "Message formatting for notifications count."
},
"notificationsBehaviourSettings": "Notifications",
"@notificationsBehaviourSettings": {
"description": "Subcategory in Setting -> General"
},
"off": "off",
"@off": {},
"ok": "OK",
Expand Down Expand Up @@ -336,15 +428,23 @@
"password": "Password",
"@password": {},
"pending": "Pending",
"@pending": {
"description": "Describes the subscription status for 'Pending'"
"@pending": {
"description": "Describes the subscription status for 'Pending'"
},
"postBehaviourSettings": "Posts",
"@postBehaviourSettings": {
"description": "Subcategory in Setting -> General"
},
"postBody": "Post Body",
"@postBody": {},
"postLocked": "Post locked. No replies allowed.",
"@postLocked": {},
"postNSFW": "Mark as NSFW",
"@postNSFW": {},
"postPreview": "Show a preview of the post with the given settings",
"@postPreview": {
"description": "Description for the post preview in Setting -> Appearance -> Posts"
},
"postSavedAsDraft": "Post saved as draft",
"@postSavedAsDraft": {},
"postSwipeGesturesHint": "Looking to use buttons instead? Change what buttons appear on post cards in general settings.",
Expand All @@ -357,6 +457,10 @@
"@postURL": {},
"postUploadImageError": "Could not upload image",
"@postUploadImageError": {},
"postViewType": "Post View Type",
"@postViewType": {
"description": "Label for the post view type (compact/card) in Setting -> Appearance -> Posts"
},
"posts": "Posts",
"@posts": {},
"preview": "Preview",
Expand Down Expand Up @@ -395,6 +499,11 @@
"@report": {},
"reportComment": "Report Comment",
"@reportComment": {},
"reset": "Reset",
"@reset": {
"description": "Label for the reset button in Setting -> Appearance -> Posts/Comments"
},
"resetPreferences": "Reset Preferences",
"restore": "Restore",
"@restore": {},
"restoredCommentFromDraft": "Restored comment from draft",
Expand Down Expand Up @@ -510,6 +619,10 @@
"tapToExit": "Press back twice to exit",
"@tapToExit": {},
"text": "Text",
"theming": "Theming",
"@theming": {
"description": "Title of Theming in Settings -> Appearance -> Theming"
},
"timeoutComments": "Error: Timeout when attempting to fetch comments",
"@timeoutComments": {},
"timeoutErrorMessage": "There was a timeout waiting for a response.",
Expand Down Expand Up @@ -592,13 +705,13 @@
"@userProfiles": {
"description": "Settings related to user profiles."
},
"username": "Username",
"@username": {},
"users": "Users",
"userSettingDescription": "These settings sync with your Lemmy account and are only applied on a per-account basis.",
"@userSettingDescription": {
"description": "Description which explains that the settings are applied globally to the current user."
},
"username": "Username",
"@username": {},
"users": "Users",
"viewAllComments": "View all comments",
"@viewAllComments": {},
"visitCommunity": "Visit Community",
Expand Down
Loading
Loading