Skip to content

Commit

Permalink
Merge pull request #1145 from Infomaniak/pass-accent-color
Browse files Browse the repository at this point in the history
perf(ThreadListView): Stop observing AppStorage at cell level
  • Loading branch information
valentinperignon committed Nov 28, 2023
2 parents c76025a + e12afb8 commit b2f39a5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Mail/Views/Thread List/ThreadListCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,13 @@ struct ThreadListCell: View {
@EnvironmentObject private var splitViewManager: SplitViewManager
@EnvironmentObject private var mainViewState: MainViewState

@AppStorage(UserDefaults.shared.key(.accentColor)) private var accentColor = DefaultPreferences.accentColor

let viewModel: ThreadListViewModel
@ObservedObject var multipleSelectionViewModel: ThreadListMultipleSelectionViewModel

let thread: Thread

let threadDensity: ThreadDensity
let accentColor: AccentColor

let isSelected: Bool
let isMultiSelected: Bool
Expand Down Expand Up @@ -128,6 +127,7 @@ struct ThreadListCell_Previews: PreviewProvider {
multipleSelectionViewModel: ThreadListMultipleSelectionViewModel(),
thread: PreviewHelper.sampleThread,
threadDensity: .large,
accentColor: .pink,
isSelected: false,
isMultiSelected: false,
flushAlert: .constant(nil)
Expand Down
1 change: 1 addition & 0 deletions Mail/Views/Thread List/ThreadListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ struct ThreadListView: View {
multipleSelectionViewModel: multipleSelectionViewModel,
thread: thread,
threadDensity: threadDensity,
accentColor: accentColor,
isSelected: viewModel.selectedThread?.uid == thread.uid,
isMultiSelected: multipleSelectionViewModel.selectedItems.contains(thread),
flushAlert: $flushAlert)
Expand Down

0 comments on commit b2f39a5

Please sign in to comment.