Merge pull request #2274 from stuartbreckenridge/master
Adds timeline preview to viewing pane / improves dark/light changes on iOS
This commit is contained in:
commit
a6268b297f
|
@ -134,7 +134,13 @@ final class AppDefaults: ObservableObject {
|
||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
AppDefaults.store.set(newValue.rawValue, forKey: Key.userInterfaceColorPalette)
|
AppDefaults.store.set(newValue.rawValue, forKey: Key.userInterfaceColorPalette)
|
||||||
objectWillChange.send()
|
#if os(macOS)
|
||||||
|
self.objectWillChange.send()
|
||||||
|
#else
|
||||||
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5, execute: {
|
||||||
|
self.objectWillChange.send()
|
||||||
|
})
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ struct MainApp: App {
|
||||||
.onAppear { refreshProgress.startup() }
|
.onAppear { refreshProgress.startup() }
|
||||||
.environmentObject(refreshProgress)
|
.environmentObject(refreshProgress)
|
||||||
.environmentObject(defaults)
|
.environmentObject(defaults)
|
||||||
.modifier(PreferredColorSchemeModifier(preferredColorScheme: defaults.userInterfaceColorPalette))
|
.preferredColorScheme(AppDefaults.userInterfaceColorScheme)
|
||||||
}
|
}
|
||||||
.commands {
|
.commands {
|
||||||
CommandGroup(after: .newItem, addition: {
|
CommandGroup(after: .newItem, addition: {
|
||||||
|
|
|
@ -94,7 +94,8 @@ struct SidebarToolbarModifier: ViewModifier {
|
||||||
AddFolderView()
|
AddFolderView()
|
||||||
}
|
}
|
||||||
if viewModel.sheetToShow == .settings {
|
if viewModel.sheetToShow == .settings {
|
||||||
SettingsView().modifier(PreferredColorSchemeModifier(preferredColorScheme: defaults.userInterfaceColorPalette))
|
SettingsView()
|
||||||
|
.preferredColorScheme(AppDefaults.userInterfaceColorScheme)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -12,30 +12,84 @@ struct LayoutPreferencesView: View {
|
||||||
|
|
||||||
@EnvironmentObject var defaults: AppDefaults
|
@EnvironmentObject var defaults: AppDefaults
|
||||||
private let colorPalettes = UserInterfaceColorPalette.allCases
|
private let colorPalettes = UserInterfaceColorPalette.allCases
|
||||||
|
private let sampleTitle = "Lorem dolor sed viverra ipsum. Gravida rutrum quisque non tellus. Rutrum tellus pellentesque eu tincidunt tortor. Sed blandit libero volutpat sed cras ornare. Et netus et malesuada fames ac. Ultrices eros in cursus turpis massa tincidunt dui ut ornare. Lacus sed viverra tellus in. Sollicitudin ac orci phasellus egestas. Purus in mollis nunc sed. Sollicitudin ac orci phasellus egestas tellus rutrum tellus pellentesque. Interdum consectetur libero id faucibus nisl tincidunt eget."
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
Form {
|
|
||||||
Picker("Appearance", selection: $defaults.userInterfaceColorPalette, content: {
|
|
||||||
ForEach(colorPalettes, id: \.self, content: {
|
|
||||||
Text($0.description)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
Divider()
|
VStack {
|
||||||
|
Form {
|
||||||
Text("Timeline: ")
|
Picker("Appearance", selection: $defaults.userInterfaceColorPalette, content: {
|
||||||
Picker("Number of Lines", selection: $defaults.timelineNumberOfLines, content: {
|
ForEach(colorPalettes, id: \.self, content: {
|
||||||
ForEach(1..<6, content: { i in
|
Text($0.description)
|
||||||
Text(String(i))
|
})
|
||||||
.tag(Double(i))
|
|
||||||
})
|
})
|
||||||
}).padding(.leading, 16)
|
|
||||||
Slider(value: $defaults.timelineIconDimensions, in: 20...60, step: 10, minimumValueLabel: Text("Small"), maximumValueLabel: Text("Large"), label: {
|
Divider()
|
||||||
Text("Icon Size")
|
|
||||||
}).padding(.leading, 16)
|
Text("Timeline: ")
|
||||||
}
|
Picker("Number of Lines", selection: $defaults.timelineNumberOfLines, content: {
|
||||||
.frame(width: 400, alignment: .center)
|
ForEach(1..<6, content: { i in
|
||||||
|
Text(String(i))
|
||||||
|
.tag(Double(i))
|
||||||
|
})
|
||||||
|
}).padding(.leading, 16)
|
||||||
|
Slider(value: $defaults.timelineIconDimensions, in: 20...60, step: 10, minimumValueLabel: Text("Small"), maximumValueLabel: Text("Large"), label: {
|
||||||
|
Text("Icon size")
|
||||||
|
}).padding(.leading, 16)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
timelineRowPreview
|
||||||
|
.frame(width: 300)
|
||||||
|
.padding()
|
||||||
|
.overlay(
|
||||||
|
RoundedRectangle(cornerRadius: 8, style: .continuous)
|
||||||
|
.stroke(Color.gray, lineWidth: 1)
|
||||||
|
)
|
||||||
|
.animation(.default)
|
||||||
|
|
||||||
|
Text("PREVIEW")
|
||||||
|
.font(.caption)
|
||||||
|
.tracking(0.3)
|
||||||
|
Spacer()
|
||||||
|
|
||||||
|
}.frame(width: 400, height: 300, alignment: .center)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ViewBuilder
|
||||||
|
var timelineRowPreview: some View {
|
||||||
|
HStack(alignment: .top) {
|
||||||
|
Image(systemName: "circle.fill")
|
||||||
|
.resizable()
|
||||||
|
.frame(width: 10, height: 10, alignment: .top)
|
||||||
|
.foregroundColor(.accentColor)
|
||||||
|
|
||||||
|
Image(systemName: "paperplane.circle")
|
||||||
|
.resizable()
|
||||||
|
.frame(width: CGFloat(defaults.timelineIconDimensions), height: CGFloat(defaults.timelineIconDimensions), alignment: .top)
|
||||||
|
.foregroundColor(.accentColor)
|
||||||
|
|
||||||
|
VStack(alignment: .leading, spacing: 4) {
|
||||||
|
Text(sampleTitle)
|
||||||
|
.font(.headline)
|
||||||
|
.lineLimit(Int(defaults.timelineNumberOfLines))
|
||||||
|
HStack {
|
||||||
|
Text("Feed Name")
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
.font(.footnote)
|
||||||
|
Spacer()
|
||||||
|
Text("10:31")
|
||||||
|
.font(.footnote)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SwiftUIView_Previews: PreviewProvider {
|
struct SwiftUIView_Previews: PreviewProvider {
|
||||||
|
|
Loading…
Reference in New Issue