Skip to content

Commit

Permalink
Tap to collapse
Browse files Browse the repository at this point in the history
  • Loading branch information
Sjmarf committed Dec 12, 2024
1 parent 59ce59d commit 84985eb
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Mlem/App/Configuration/User Settings/CodableSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ struct CodableSettings: Codable {
self.comment_behaviors_collapseChildren = false
self.comment_compact = settings.compactComments
self.comment_defaultSort = settings.commentSort
self.comment_gestures_tapToCollapse = true
self.comment_gestures_tapToCollapse = settings.tapCommentsToCollapse
self.comment_jumpButton = settings.jumpButton
self.comment_showCreatorInstance = true
self.comment_maxDepth = 8
Expand Down
2 changes: 2 additions & 0 deletions Mlem/App/Configuration/User Settings/Settings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class Settings: ObservableObject {
@AppStorage("comment.jumpButton") var jumpButton: CommentJumpButtonLocation = .bottomTrailing
@AppStorage("comment.sort") var commentSort: ApiCommentSortType = .top
@AppStorage("comment.maxDepth") var maxCommentDepth: Int = 8
@AppStorage("comment.gestures.tapToCollapse") var tapCommentsToCollapse: Bool = true

@AppStorage("status.bypassImageProxyShown") var bypassImageProxyShown: Bool = false

Expand Down Expand Up @@ -143,6 +144,7 @@ class Settings: ObservableObject {
jumpButton = settings.comment_jumpButton
commentSort = settings.comment_defaultSort
maxCommentDepth = settings.comment_maxDepth
tapCommentsToCollapse = settings.comment_gestures_tapToCollapse
bypassImageProxyShown = settings.status_bypassImageProxyShown
autoBypassImageProxy = settings.privacy_autoBypassImageProxy
sidebarVisibleByDefault = settings.navigation_sidebarVisibleByDefault
Expand Down
2 changes: 2 additions & 0 deletions Mlem/App/Views/Root/Tabs/Settings/CommentSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ struct CommentSettingsView: View {
@Environment(Palette.self) var palette

@Setting(\.compactComments) var compactComments
@Setting(\.tapCommentsToCollapse) var tapCommentsToCollapse
@Setting(\.maxCommentDepth) var maxCommentDepth

var body: some View {
Form {
Section {
Toggle("Compact Comments", isOn: $compactComments)
Toggle("Tap to Collapse", isOn: $tapCommentsToCollapse)
}
Section {
NavigationLink(
Expand Down
3 changes: 2 additions & 1 deletion Mlem/App/Views/Shared/CommentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ struct CommentView: View {
@Environment(\.communityContext) var communityContext: (any Community1Providing)?

@Setting(\.compactComments) var compactComments
@Setting(\.tapCommentsToCollapse) var tapCommentsToCollapse
@Setting(\.moderatorActionGrouping) var moderatorActionGrouping

private let indent: CGFloat = 10
Expand All @@ -34,7 +35,7 @@ struct CommentView: View {
} else {
content
.onTapGesture {
if let comment = comment as? CommentWrapper {
if tapCommentsToCollapse, let comment = comment as? CommentWrapper {
withAnimation {
comment.collapsed.toggle()
}
Expand Down
9 changes: 6 additions & 3 deletions Mlem/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -1444,6 +1444,9 @@
},
"Tap and hold items to add, remove or rearrange them." : {

},
"Tap to Collapse" : {

},
"Tap to show slur filter regex." : {

Expand Down Expand Up @@ -1493,10 +1496,10 @@
}
}
},
"The name that is displayed on your profile. This is not the same as your username, which cannot be changed." : {
"The name shown in the account switcher." : {

},
"The name shown in the account switcher." : {
"The name that is displayed on your profile. This is not the same as your username, which cannot be changed." : {

},
"The number of child comments that are shown in a chain before the \"More Replies\" button is shown." : {
Expand Down Expand Up @@ -1874,4 +1877,4 @@
}
},
"version" : "1.0"
}
}

0 comments on commit 84985eb

Please sign in to comment.