Skip to content

Commit ae20916

Browse files
committed
fix: hide changes for hidden folders when hidden folders are hidden
Signed-off-by: Tommy van der Vorst <tommy@pixelspark.nl>
1 parent 4658030 commit ae20916

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

Sushitrain/ChangesView.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ struct ChangesView: View {
1919
var peer: SushitrainPeer?
2020
}
2121

22+
@ObservedObject var userSettings: AppUserSettings
23+
2224
@State private var changes: [ChangeInfo] = []
2325
@Environment(AppState.self) private var appState
2426

@@ -69,6 +71,11 @@ struct ChangesView: View {
6971
.task {
7072
await self.update()
7173
}
74+
.onChange(of: userSettings.hideHiddenFolders) { _, _ in
75+
Task {
76+
await self.update()
77+
}
78+
}
7279
.onChange(of: appState.lastChanges) { _, _ in
7380
Task {
7481
await self.update()
@@ -121,8 +128,11 @@ struct ChangesView: View {
121128
#endif
122129

123130
private func update() async {
124-
self.changes = appState.lastChanges.map { change in
131+
self.changes = appState.lastChanges.compactMap { change in
125132
let folder = appState.client.folder(withID: change.folderID)
133+
if let f = folder, f.isHidden == true && userSettings.hideHiddenFolders {
134+
return nil
135+
}
126136
let entry = try? folder?.getFileInformation(change.path)
127137
let peer = appState.client.peer(withShortID: change.shortID)
128138
return ChangeInfo(

Sushitrain/StartView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ struct StartView: View {
398398
self.folderIssuesSection()
399399

400400
Section("Manage files and folders") {
401-
NavigationLink(destination: ChangesView()) {
401+
NavigationLink(destination: ChangesView(userSettings: appState.userSettings)) {
402402
Label("Recent changes", systemImage: "clock.arrow.2.circlepath").badge(changesCount)
403403
}.disabled(changesCount == 0)
404404
}

0 commit comments

Comments
 (0)