Skip to content
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
12 changes: 8 additions & 4 deletions lib/cubits/comments/comments_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -979,8 +979,10 @@ comments length is ${state.comments.length}

for (int i = startIndex; i < totalComments; i++) {
final Comment cmt = state.comments.elementAt(i);

if (cmt.isRoot && (cmt.deleted || cmt.dead) == false) {
final bool isIgnored =
_preferenceCubit.state.areCollapsedCommentsIgnored &&
cmt.isCollapsedByUser;
if (!isIgnored && cmt.isRoot && (cmt.deleted || cmt.dead) == false) {
unawaited(
scrollTo(index: i + 1, alignment: 0.15, duration: AppDurations.ms400),
);
Expand Down Expand Up @@ -1018,8 +1020,10 @@ comments length is ${state.comments.length}

for (int i = startIndex; i >= 0; i--) {
final Comment cmt = state.comments.elementAt(i);

if (cmt.isRoot && (cmt.deleted || cmt.dead) == false) {
final bool isIgnored =
_preferenceCubit.state.areCollapsedCommentsIgnored &&
cmt.isCollapsedByUser;
if (!isIgnored && cmt.isRoot && (cmt.deleted || cmt.dead) == false) {
unawaited(
scrollTo(index: i + 1, alignment: 0.15, duration: AppDurations.ms400),
);
Expand Down
3 changes: 3 additions & 0 deletions lib/cubits/preference/preference_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ class PreferenceState extends Equatable {

bool get areSkipButtonsEnabled => _isOn<SkipButtonsPreference>();

bool get areCollapsedCommentsIgnored =>
_isOn<SkipButtonsIgnoreCollapsedCommentsPreference>();

bool get isNotificationEnabled => _isOn<NotificationModePreference>();

bool get isRichStoryTileEnabled => _isOn<RichStoryTilePreference>();
Expand Down
35 changes: 31 additions & 4 deletions lib/models/preference.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,13 @@ abstract final class Preference<T> extends Equatable with SettingsDisplayable {
const PersistCollapseStateAcrossSessions(),
const PreserveCollapseStateAfterScreenExit(),
const ReaderModePreference(),
const SkipButtonsPreference(),
const SplitViewPreference(),
const CollapseModePreference(),
const CustomTabPreference(),
const WebViewBottomSheetPreference(),
const DividerPlaceholder(label: 'Thread Navigation'),
const SkipButtonsPreference(),
const SkipButtonsIgnoreCollapsedCommentsPreference(),
const DividerPlaceholder(label: 'Look And Feel'),
const EyeCandyPreference(),
const DynamicColorPreference(),
Expand Down Expand Up @@ -199,7 +201,32 @@ final class SkipButtonsPreference extends BooleanPreference {

@override
String get subtitle =>
'''display floating buttons on the thread screen that let you jump to the previous or next root comment.''';
'''show floating buttons on the thread screen to navigate to the previous or next root comment.''';
}

final class SkipButtonsIgnoreCollapsedCommentsPreference
extends BooleanPreference {
const SkipButtonsIgnoreCollapsedCommentsPreference({bool? val})
: super(
val: val ?? _skipButtonsIgnoreCollapsedCommentsPreferenceDefaultValue,
);

static const bool _skipButtonsIgnoreCollapsedCommentsPreferenceDefaultValue =
true;

@override
SkipButtonsIgnoreCollapsedCommentsPreference copyWith({required bool? val}) {
return SkipButtonsIgnoreCollapsedCommentsPreference(val: val);
}

@override
String get key => 'skipButtonsIgnoreCollapsedCommentsPreference';

@override
String get title => 'Skip over Collapsed Comments';

@override
String get subtitle => '''skip over collapsed comments during navigation.''';
}

final class SplitViewPreference extends BooleanPreference {
Expand Down Expand Up @@ -615,7 +642,7 @@ final class MarkReadStoriesModePreference extends BooleanPreference {
String get key => 'markReadStoriesMode';

@override
String get title => 'Mark Read Stories';
String get title => 'Gray Out Read Stories';

@override
String get subtitle => 'grey out stories you have read.';
Expand All @@ -638,7 +665,7 @@ final class HideStoryInsteadOfMarkingGray extends BooleanPreference {
String get key => 'hideStoryInsteadOfMarkingGray';

@override
String get title => 'Hide Story Instead Of Marking Gray';
String get title => 'Hide Read Stories';

@override
String get subtitle =>
Expand Down
32 changes: 18 additions & 14 deletions lib/screens/settings/settings_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -244,20 +244,24 @@ class _SettingsViewState extends State<SettingsView>
const TabBarSettings(),
const TextScaleFactorSettings(),
const Divider(),
StoryTile(
shouldShowWebPreview: preferenceState.isRichStoryTileEnabled,
shouldShowMetadata: preferenceState.isMetadataEnabled,
shouldShowUrl: preferenceState.isUrlEnabled,
shouldShowFavicon: preferenceState.isFaviconEnabled,
shouldShowPreviewImage:
preferenceState.isStoryTilePreviewImageEnabled,
isExpandedTileEnabled: preferenceState.isExpandedTileEnabled,
isIndexedStoryTileEnabled:
preferenceState.isIndexedStoryTileEnabled,
isImageLeftAligned: preferenceState.isPreviewImageLeftAligned,
index: 0,
story: Story.placeholder(),
onTap: () => LinkUtils.launch(Constants.guidelineLink, context),
AnimatedSize(
duration: AppDurations.ms300,
child: StoryTile(
shouldShowWebPreview: preferenceState.isRichStoryTileEnabled,
shouldShowMetadata: preferenceState.isMetadataEnabled,
shouldShowUrl: preferenceState.isUrlEnabled,
shouldShowFavicon: preferenceState.isFaviconEnabled,
shouldShowPreviewImage:
preferenceState.isStoryTilePreviewImageEnabled,
isExpandedTileEnabled: preferenceState.isExpandedTileEnabled,
isIndexedStoryTileEnabled:
preferenceState.isIndexedStoryTileEnabled,
isImageLeftAligned: preferenceState.isPreviewImageLeftAligned,
index: 0,
story: Story.placeholder(),
onTap: () =>
LinkUtils.launch(Constants.guidelineLink, context),
),
),
const Divider(),
for (final Preference<dynamic> preference
Expand Down
2 changes: 1 addition & 1 deletion lib/screens/widgets/link_preview/image_wrapped_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class ImageWrapText extends StatelessWidget {
child: Container(
color: Theme.of(context).colorScheme.surfaceContainerLow,
width: imageWidth,
height: imageHeight - 8,
height: imageHeight - 10,
child: image,
),
),
Expand Down