Merge pull request #2273 from stuartbreckenridge/master
Adds a separate pane for viewing preferences
This commit is contained in:
commit
39548f9420
|
@ -10,7 +10,8 @@ import SwiftUI
|
||||||
enum PreferencePane: Int, CaseIterable {
|
enum PreferencePane: Int, CaseIterable {
|
||||||
case general = 0
|
case general = 0
|
||||||
case accounts = 1
|
case accounts = 1
|
||||||
case advanced = 2
|
case viewing = 2
|
||||||
|
case advanced = 3
|
||||||
|
|
||||||
var description: String {
|
var description: String {
|
||||||
switch self {
|
switch self {
|
||||||
|
@ -18,6 +19,8 @@ enum PreferencePane: Int, CaseIterable {
|
||||||
return "General"
|
return "General"
|
||||||
case .accounts:
|
case .accounts:
|
||||||
return "Accounts"
|
return "Accounts"
|
||||||
|
case .viewing:
|
||||||
|
return "Appearance"
|
||||||
case .advanced:
|
case .advanced:
|
||||||
return "Advanced"
|
return "Advanced"
|
||||||
}
|
}
|
||||||
|
@ -38,6 +41,9 @@ struct MacPreferencesView: View {
|
||||||
case .accounts:
|
case .accounts:
|
||||||
AccountsPreferencesView()
|
AccountsPreferencesView()
|
||||||
.environmentObject(defaults)
|
.environmentObject(defaults)
|
||||||
|
case .viewing:
|
||||||
|
LayoutPreferencesView()
|
||||||
|
.environmentObject(defaults)
|
||||||
case .advanced:
|
case .advanced:
|
||||||
AdvancedPreferencesView()
|
AdvancedPreferencesView()
|
||||||
.environmentObject(defaults)
|
.environmentObject(defaults)
|
||||||
|
@ -56,7 +62,7 @@ struct MacPreferencesView: View {
|
||||||
}.foregroundColor(
|
}.foregroundColor(
|
||||||
preferencePane == .general ? Color("AccentColor") : Color.gray
|
preferencePane == .general ? Color("AccentColor") : Color.gray
|
||||||
)
|
)
|
||||||
}).frame(width: 70)
|
}).frame(width: 70, height: 50)
|
||||||
Button(action: {
|
Button(action: {
|
||||||
preferencePane = .accounts
|
preferencePane = .accounts
|
||||||
}, label: {
|
}, label: {
|
||||||
|
@ -67,7 +73,18 @@ struct MacPreferencesView: View {
|
||||||
}.foregroundColor(
|
}.foregroundColor(
|
||||||
preferencePane == .accounts ? Color("AccentColor") : Color.gray
|
preferencePane == .accounts ? Color("AccentColor") : Color.gray
|
||||||
)
|
)
|
||||||
}).frame(width: 70)
|
}).frame(width: 70, height: 50)
|
||||||
|
Button(action: {
|
||||||
|
preferencePane = .viewing
|
||||||
|
}, label: {
|
||||||
|
VStack {
|
||||||
|
Image(systemName: "eyeglasses")
|
||||||
|
.font(.title2)
|
||||||
|
Text("Viewing")
|
||||||
|
}.foregroundColor(
|
||||||
|
preferencePane == .viewing ? Color("AccentColor") : Color.gray
|
||||||
|
)
|
||||||
|
}).frame(width: 70, height: 50)
|
||||||
Button(action: {
|
Button(action: {
|
||||||
preferencePane = .advanced
|
preferencePane = .advanced
|
||||||
}, label: {
|
}, label: {
|
||||||
|
@ -78,7 +95,7 @@ struct MacPreferencesView: View {
|
||||||
}.foregroundColor(
|
}.foregroundColor(
|
||||||
preferencePane == .advanced ? Color("AccentColor") : Color.gray
|
preferencePane == .advanced ? Color("AccentColor") : Color.gray
|
||||||
)
|
)
|
||||||
}).frame(width: 70)
|
}).frame(width: 70, height: 50)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,9 +10,7 @@ import SwiftUI
|
||||||
struct GeneralPreferencesView: View {
|
struct GeneralPreferencesView: View {
|
||||||
|
|
||||||
@EnvironmentObject private var defaults: AppDefaults
|
@EnvironmentObject private var defaults: AppDefaults
|
||||||
@Environment(\.colorScheme) private var colorScheme
|
|
||||||
@StateObject private var preferences = GeneralPreferencesModel()
|
@StateObject private var preferences = GeneralPreferencesModel()
|
||||||
private let colorPalettes = UserInterfaceColorPalette.allCases
|
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
Form {
|
Form {
|
||||||
|
@ -42,15 +40,6 @@ struct GeneralPreferencesView: View {
|
||||||
|
|
||||||
Toggle("Hide Unread Count in Dock", isOn: $defaults.hideDockUnreadCount)
|
Toggle("Hide Unread Count in Dock", isOn: $defaults.hideDockUnreadCount)
|
||||||
|
|
||||||
Divider()
|
|
||||||
|
|
||||||
Picker("Appearance", selection: $defaults.userInterfaceColorPalette, content: {
|
|
||||||
ForEach(colorPalettes, id: \.self, content: {
|
|
||||||
Text($0.description)
|
|
||||||
})
|
|
||||||
}).pickerStyle(RadioGroupPickerStyle())
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
.frame(width: 400, alignment: .center)
|
.frame(width: 400, alignment: .center)
|
||||||
.lineLimit(2)
|
.lineLimit(2)
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
//
|
||||||
|
// LayoutPreferencesView.swift
|
||||||
|
// Multiplatform macOS
|
||||||
|
//
|
||||||
|
// Created by Stuart Breckenridge on 17/7/20.
|
||||||
|
// Copyright © 2020 Ranchero Software. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
struct LayoutPreferencesView: View {
|
||||||
|
|
||||||
|
@EnvironmentObject var defaults: AppDefaults
|
||||||
|
private let colorPalettes = UserInterfaceColorPalette.allCases
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
Form {
|
||||||
|
Picker("Appearance", selection: $defaults.userInterfaceColorPalette, content: {
|
||||||
|
ForEach(colorPalettes, id: \.self, content: {
|
||||||
|
Text($0.description)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
Divider()
|
||||||
|
|
||||||
|
Text("Timeline: ")
|
||||||
|
Picker("Number of Lines", selection: $defaults.timelineNumberOfLines, content: {
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
.frame(width: 400, alignment: .center)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct SwiftUIView_Previews: PreviewProvider {
|
||||||
|
static var previews: some View {
|
||||||
|
LayoutPreferencesView()
|
||||||
|
}
|
||||||
|
}
|
|
@ -11,6 +11,7 @@
|
||||||
172199C924AB228900A31D04 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 172199C824AB228900A31D04 /* SettingsView.swift */; };
|
172199C924AB228900A31D04 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 172199C824AB228900A31D04 /* SettingsView.swift */; };
|
||||||
172199ED24AB2E0100A31D04 /* SafariView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 172199EC24AB2E0100A31D04 /* SafariView.swift */; };
|
172199ED24AB2E0100A31D04 /* SafariView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 172199EC24AB2E0100A31D04 /* SafariView.swift */; };
|
||||||
172199F124AB716900A31D04 /* SidebarToolbarModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 172199F024AB716900A31D04 /* SidebarToolbarModifier.swift */; };
|
172199F124AB716900A31D04 /* SidebarToolbarModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 172199F024AB716900A31D04 /* SidebarToolbarModifier.swift */; };
|
||||||
|
1727B39924C1368D00A4DBDC /* LayoutPreferencesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1727B39824C1368D00A4DBDC /* LayoutPreferencesView.swift */; };
|
||||||
1729529324AA1CAA00D65E66 /* AccountsPreferencesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1729529024AA1CAA00D65E66 /* AccountsPreferencesView.swift */; };
|
1729529324AA1CAA00D65E66 /* AccountsPreferencesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1729529024AA1CAA00D65E66 /* AccountsPreferencesView.swift */; };
|
||||||
1729529424AA1CAA00D65E66 /* AdvancedPreferencesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1729529124AA1CAA00D65E66 /* AdvancedPreferencesView.swift */; };
|
1729529424AA1CAA00D65E66 /* AdvancedPreferencesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1729529124AA1CAA00D65E66 /* AdvancedPreferencesView.swift */; };
|
||||||
1729529524AA1CAA00D65E66 /* GeneralPreferencesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1729529224AA1CAA00D65E66 /* GeneralPreferencesView.swift */; };
|
1729529524AA1CAA00D65E66 /* GeneralPreferencesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1729529224AA1CAA00D65E66 /* GeneralPreferencesView.swift */; };
|
||||||
|
@ -1802,6 +1803,7 @@
|
||||||
172199C824AB228900A31D04 /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
|
172199C824AB228900A31D04 /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
|
||||||
172199EC24AB2E0100A31D04 /* SafariView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SafariView.swift; sourceTree = "<group>"; };
|
172199EC24AB2E0100A31D04 /* SafariView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SafariView.swift; sourceTree = "<group>"; };
|
||||||
172199F024AB716900A31D04 /* SidebarToolbarModifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarToolbarModifier.swift; sourceTree = "<group>"; };
|
172199F024AB716900A31D04 /* SidebarToolbarModifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarToolbarModifier.swift; sourceTree = "<group>"; };
|
||||||
|
1727B39824C1368D00A4DBDC /* LayoutPreferencesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LayoutPreferencesView.swift; sourceTree = "<group>"; };
|
||||||
1729529024AA1CAA00D65E66 /* AccountsPreferencesView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccountsPreferencesView.swift; sourceTree = "<group>"; };
|
1729529024AA1CAA00D65E66 /* AccountsPreferencesView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccountsPreferencesView.swift; sourceTree = "<group>"; };
|
||||||
1729529124AA1CAA00D65E66 /* AdvancedPreferencesView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AdvancedPreferencesView.swift; sourceTree = "<group>"; };
|
1729529124AA1CAA00D65E66 /* AdvancedPreferencesView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AdvancedPreferencesView.swift; sourceTree = "<group>"; };
|
||||||
1729529224AA1CAA00D65E66 /* GeneralPreferencesView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneralPreferencesView.swift; sourceTree = "<group>"; };
|
1729529224AA1CAA00D65E66 /* GeneralPreferencesView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneralPreferencesView.swift; sourceTree = "<group>"; };
|
||||||
|
@ -2541,6 +2543,14 @@
|
||||||
path = Settings;
|
path = Settings;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
1727B37624C1365300A4DBDC /* Viewing */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
1727B39824C1368D00A4DBDC /* LayoutPreferencesView.swift */,
|
||||||
|
);
|
||||||
|
path = Viewing;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
1729528F24AA1A4F00D65E66 /* Preferences */ = {
|
1729528F24AA1A4F00D65E66 /* Preferences */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
@ -2555,6 +2565,7 @@
|
||||||
children = (
|
children = (
|
||||||
1769E2FD24BC589E000E1E8E /* General */,
|
1769E2FD24BC589E000E1E8E /* General */,
|
||||||
1769E31F24BC58A4000E1E8E /* Accounts */,
|
1769E31F24BC58A4000E1E8E /* Accounts */,
|
||||||
|
1727B37624C1365300A4DBDC /* Viewing */,
|
||||||
1769E32024BC58AD000E1E8E /* Advanced */,
|
1769E32024BC58AD000E1E8E /* Advanced */,
|
||||||
);
|
);
|
||||||
path = "Preference Panes";
|
path = "Preference Panes";
|
||||||
|
@ -4255,46 +4266,46 @@
|
||||||
TargetAttributes = {
|
TargetAttributes = {
|
||||||
51314636235A7BBE00387FDC = {
|
51314636235A7BBE00387FDC = {
|
||||||
CreatedOnToolsVersion = 11.2;
|
CreatedOnToolsVersion = 11.2;
|
||||||
DevelopmentTeam = SHJK2V3AJG;
|
DevelopmentTeam = FQLBNX3GP7;
|
||||||
LastSwiftMigration = 1120;
|
LastSwiftMigration = 1120;
|
||||||
ProvisioningStyle = Automatic;
|
ProvisioningStyle = Automatic;
|
||||||
};
|
};
|
||||||
513C5CE5232571C2003D4054 = {
|
513C5CE5232571C2003D4054 = {
|
||||||
CreatedOnToolsVersion = 11.0;
|
CreatedOnToolsVersion = 11.0;
|
||||||
DevelopmentTeam = SHJK2V3AJG;
|
DevelopmentTeam = FQLBNX3GP7;
|
||||||
ProvisioningStyle = Automatic;
|
ProvisioningStyle = Automatic;
|
||||||
};
|
};
|
||||||
518B2ED12351B3DD00400001 = {
|
518B2ED12351B3DD00400001 = {
|
||||||
CreatedOnToolsVersion = 11.2;
|
CreatedOnToolsVersion = 11.2;
|
||||||
DevelopmentTeam = SHJK2V3AJG;
|
DevelopmentTeam = FQLBNX3GP7;
|
||||||
ProvisioningStyle = Automatic;
|
ProvisioningStyle = Automatic;
|
||||||
TestTargetID = 840D617B2029031C009BC708;
|
TestTargetID = 840D617B2029031C009BC708;
|
||||||
};
|
};
|
||||||
51C0513C24A77DF800194D5E = {
|
51C0513C24A77DF800194D5E = {
|
||||||
CreatedOnToolsVersion = 12.0;
|
CreatedOnToolsVersion = 12.0;
|
||||||
DevelopmentTeam = SHJK2V3AJG;
|
DevelopmentTeam = FQLBNX3GP7;
|
||||||
ProvisioningStyle = Automatic;
|
ProvisioningStyle = Automatic;
|
||||||
};
|
};
|
||||||
51C0514324A77DF800194D5E = {
|
51C0514324A77DF800194D5E = {
|
||||||
CreatedOnToolsVersion = 12.0;
|
CreatedOnToolsVersion = 12.0;
|
||||||
DevelopmentTeam = SHJK2V3AJG;
|
DevelopmentTeam = FQLBNX3GP7;
|
||||||
ProvisioningStyle = Automatic;
|
ProvisioningStyle = Automatic;
|
||||||
};
|
};
|
||||||
6581C73220CED60000F4AD34 = {
|
6581C73220CED60000F4AD34 = {
|
||||||
DevelopmentTeam = SHJK2V3AJG;
|
DevelopmentTeam = FQLBNX3GP7;
|
||||||
ProvisioningStyle = Automatic;
|
ProvisioningStyle = Automatic;
|
||||||
};
|
};
|
||||||
65ED3FA2235DEF6C0081F399 = {
|
65ED3FA2235DEF6C0081F399 = {
|
||||||
DevelopmentTeam = SHJK2V3AJG;
|
DevelopmentTeam = FQLBNX3GP7;
|
||||||
ProvisioningStyle = Automatic;
|
ProvisioningStyle = Automatic;
|
||||||
};
|
};
|
||||||
65ED4090235DEF770081F399 = {
|
65ED4090235DEF770081F399 = {
|
||||||
DevelopmentTeam = SHJK2V3AJG;
|
DevelopmentTeam = FQLBNX3GP7;
|
||||||
ProvisioningStyle = Automatic;
|
ProvisioningStyle = Automatic;
|
||||||
};
|
};
|
||||||
840D617B2029031C009BC708 = {
|
840D617B2029031C009BC708 = {
|
||||||
CreatedOnToolsVersion = 9.3;
|
CreatedOnToolsVersion = 9.3;
|
||||||
DevelopmentTeam = SHJK2V3AJG;
|
DevelopmentTeam = FQLBNX3GP7;
|
||||||
ProvisioningStyle = Automatic;
|
ProvisioningStyle = Automatic;
|
||||||
SystemCapabilities = {
|
SystemCapabilities = {
|
||||||
com.apple.BackgroundModes = {
|
com.apple.BackgroundModes = {
|
||||||
|
@ -4304,7 +4315,7 @@
|
||||||
};
|
};
|
||||||
849C645F1ED37A5D003D8FC0 = {
|
849C645F1ED37A5D003D8FC0 = {
|
||||||
CreatedOnToolsVersion = 8.2.1;
|
CreatedOnToolsVersion = 8.2.1;
|
||||||
DevelopmentTeam = SHJK2V3AJG;
|
DevelopmentTeam = FQLBNX3GP7;
|
||||||
ProvisioningStyle = Automatic;
|
ProvisioningStyle = Automatic;
|
||||||
SystemCapabilities = {
|
SystemCapabilities = {
|
||||||
com.apple.HardenedRuntime = {
|
com.apple.HardenedRuntime = {
|
||||||
|
@ -4314,7 +4325,7 @@
|
||||||
};
|
};
|
||||||
849C64701ED37A5D003D8FC0 = {
|
849C64701ED37A5D003D8FC0 = {
|
||||||
CreatedOnToolsVersion = 8.2.1;
|
CreatedOnToolsVersion = 8.2.1;
|
||||||
DevelopmentTeam = SHJK2V3AJG;
|
DevelopmentTeam = FQLBNX3GP7;
|
||||||
ProvisioningStyle = Automatic;
|
ProvisioningStyle = Automatic;
|
||||||
TestTargetID = 849C645F1ED37A5D003D8FC0;
|
TestTargetID = 849C645F1ED37A5D003D8FC0;
|
||||||
};
|
};
|
||||||
|
@ -5238,6 +5249,7 @@
|
||||||
51919FB724AABCA100541E64 /* IconImageView.swift in Sources */,
|
51919FB724AABCA100541E64 /* IconImageView.swift in Sources */,
|
||||||
51B54A6924B54A490014348B /* IconView.swift in Sources */,
|
51B54A6924B54A490014348B /* IconView.swift in Sources */,
|
||||||
51E498FA24A808BA00B667CB /* SingleFaviconDownloader.swift in Sources */,
|
51E498FA24A808BA00B667CB /* SingleFaviconDownloader.swift in Sources */,
|
||||||
|
1727B39924C1368D00A4DBDC /* LayoutPreferencesView.swift in Sources */,
|
||||||
51E4993F24A8713B00B667CB /* ArticleStatusSyncTimer.swift in Sources */,
|
51E4993F24A8713B00B667CB /* ArticleStatusSyncTimer.swift in Sources */,
|
||||||
51E4993724A8680E00B667CB /* Reachability.swift in Sources */,
|
51E4993724A8680E00B667CB /* Reachability.swift in Sources */,
|
||||||
51B80F4424BE58BF00C6C32D /* SharingServiceDelegate.swift in Sources */,
|
51B80F4424BE58BF00C6C32D /* SharingServiceDelegate.swift in Sources */,
|
||||||
|
|
Loading…
Reference in New Issue