Skip to content

Commit 3b89b9c

Browse files
Merge pull request #1045 from Automattic/feature/preferences
Feature/preferences
2 parents a299fc3 + ad534e8 commit 3b89b9c

30 files changed

+933
-417
lines changed

External/Notepad/Theme.swift

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ import AppKit
1515
@objc
1616
class Theme: NSObject {
1717

18-
/// Default Font Size
19-
///
20-
private static let defaultFontSize = CGFloat(14)
21-
2218
/// Body Line Height Multiplier
2319
///
2420
private static let bodyLineHeightMultiplier = CGFloat(1.43)
@@ -96,12 +92,7 @@ private extension Theme {
9692
private extension Theme {
9793

9894
private static var fontSize: CGFloat {
99-
var fontSize = CGFloat(UserDefaults.standard.integer(forKey: "kFontSizePreferencesKey"))
100-
if fontSize == 0 {
101-
fontSize = defaultFontSize
102-
}
103-
104-
return fontSize
95+
Options.shared.fontSize
10596
}
10697

10798
private static var italicFont: NSFont {

RELEASE-NOTES.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
2.16
1010
-----
11-
11+
- Added preferences menu to centralize app options and customizations #1042
1212

1313
2.15.1
1414
-----

Simplenote.xcodeproj/project.pbxproj

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,8 +453,16 @@
453453
B5F807CD2481982B0048CBD7 /* Note+Simplenote.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F807CB2481982B0048CBD7 /* Note+Simplenote.swift */; };
454454
B5F807CF2481A2010048CBD7 /* Simperium+Simplenote.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F807CE2481A2010048CBD7 /* Simperium+Simplenote.swift */; };
455455
B5F807D02481A2010048CBD7 /* Simperium+Simplenote.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F807CE2481A2010048CBD7 /* Simperium+Simplenote.swift */; };
456+
BA0B43C926F2FCFC00B44A8C /* PreferencesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA0B43C826F2FCFC00B44A8C /* PreferencesViewController.swift */; };
457+
BA0B43CA26F2FCFC00B44A8C /* PreferencesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA0B43C826F2FCFC00B44A8C /* PreferencesViewController.swift */; };
458+
BA0B43D526F2FEA200B44A8C /* Preferences.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BA0B43D426F2FEA200B44A8C /* Preferences.storyboard */; };
459+
BA0B43D626F2FEA200B44A8C /* Preferences.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BA0B43D426F2FEA200B44A8C /* Preferences.storyboard */; };
460+
BA2C65CB26FE996100FA84E1 /* NSButton+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA2C65CA26FE996100FA84E1 /* NSButton+Extensions.swift */; };
461+
BA2C65CF26FE996A00FA84E1 /* NSButton+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA2C65CA26FE996100FA84E1 /* NSButton+Extensions.swift */; };
456462
BA4C6D16264CA8C000B723A7 /* SignupRemoteTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA4C6D15264CA8C000B723A7 /* SignupRemoteTests.swift */; };
457463
BA4C6D18264CAAF800B723A7 /* URLRequest+Simplenote.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA4C6D17264CAAF800B723A7 /* URLRequest+Simplenote.swift */; };
464+
BA553F0827065E20007737E9 /* FontSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA553F0727065E20007737E9 /* FontSettings.swift */; };
465+
BA553F0927065E20007737E9 /* FontSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA553F0727065E20007737E9 /* FontSettings.swift */; };
458466
BA5F020526BB57F000581E92 /* NSAlert+Simplenote.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA5F020426BB57F000581E92 /* NSAlert+Simplenote.swift */; };
459467
BA5F020626BB57F000581E92 /* NSAlert+Simplenote.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA5F020426BB57F000581E92 /* NSAlert+Simplenote.swift */; };
460468
BA938CEC26ACFF4A00BE5A1D /* Remote.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA938CEB26ACFF4A00BE5A1D /* Remote.swift */; };
@@ -841,8 +849,12 @@
841849
B5F5415325F0137100CAF52C /* MagicLinkAuthenticator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MagicLinkAuthenticator.swift; sourceTree = "<group>"; };
842850
B5F807CB2481982B0048CBD7 /* Note+Simplenote.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Note+Simplenote.swift"; sourceTree = "<group>"; };
843851
B5F807CE2481A2010048CBD7 /* Simperium+Simplenote.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Simperium+Simplenote.swift"; sourceTree = "<group>"; };
852+
BA0B43C826F2FCFC00B44A8C /* PreferencesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreferencesViewController.swift; sourceTree = "<group>"; };
853+
BA0B43D426F2FEA200B44A8C /* Preferences.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Preferences.storyboard; sourceTree = "<group>"; };
854+
BA2C65CA26FE996100FA84E1 /* NSButton+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSButton+Extensions.swift"; sourceTree = "<group>"; };
844855
BA4C6D15264CA8C000B723A7 /* SignupRemoteTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignupRemoteTests.swift; sourceTree = "<group>"; };
845856
BA4C6D17264CAAF800B723A7 /* URLRequest+Simplenote.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "URLRequest+Simplenote.swift"; sourceTree = "<group>"; };
857+
BA553F0727065E20007737E9 /* FontSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FontSettings.swift; sourceTree = "<group>"; };
846858
BA5F020426BB57F000581E92 /* NSAlert+Simplenote.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSAlert+Simplenote.swift"; sourceTree = "<group>"; };
847859
BA938CEB26ACFF4A00BE5A1D /* Remote.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Remote.swift; sourceTree = "<group>"; };
848860
BA938CED26AD055400BE5A1D /* AccountVerificationController+TestHelpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AccountVerificationController+TestHelpers.swift"; sourceTree = "<group>"; };
@@ -967,6 +979,7 @@
967979
B51E9FE322E64473004F16B4 /* Extensions */,
968980
B574CA71242D539400F8D02F /* Handlers */,
969981
463774DB171F111600E2E333 /* Models */,
982+
BA0B43B826F2FC2900B44A8C /* Preferences */,
970983
B502C1DB25BA2EA200145D6C /* Remote */,
971984
B57CB879244DEBD500BA7969 /* Settings */,
972985
B5C63355251E734100C8BF46 /* Storyboards */,
@@ -1267,6 +1280,7 @@
12671280
BAA0A88626B9F8B40006260E /* Date+Simplenote.swift */,
12681281
BA5F020426BB57F000581E92 /* NSAlert+Simplenote.swift */,
12691282
BAFB544F26CCA7F1006E037C /* NSProgressIndicator+Simplenote.swift */,
1283+
BA2C65CA26FE996100FA84E1 /* NSButton+Extensions.swift */,
12701284
);
12711285
name = Extensions;
12721286
sourceTree = "<group>";
@@ -1392,6 +1406,7 @@
13921406
children = (
13931407
B57CB873244DEBC300BA7969 /* Options.swift */,
13941408
B5469FC92587DE3F007ED7BE /* SortMode.swift */,
1409+
BA553F0727065E20007737E9 /* FontSettings.swift */,
13951410
);
13961411
name = Settings;
13971412
sourceTree = "<group>";
@@ -1647,6 +1662,15 @@
16471662
name = Controllers;
16481663
sourceTree = "<group>";
16491664
};
1665+
BA0B43B826F2FC2900B44A8C /* Preferences */ = {
1666+
isa = PBXGroup;
1667+
children = (
1668+
BA0B43C826F2FCFC00B44A8C /* PreferencesViewController.swift */,
1669+
BA0B43D426F2FEA200B44A8C /* Preferences.storyboard */,
1670+
);
1671+
name = Preferences;
1672+
sourceTree = "<group>";
1673+
};
16501674
/* End PBXGroup section */
16511675

16521676
/* Begin PBXNativeTarget section */
@@ -1818,6 +1842,7 @@
18181842
B5C7DD43243E4A8E00BEE354 /* CollaborateViewController.xib in Resources */,
18191843
B5A89195231ECB3C0007EDCB /* LICENSE in Resources */,
18201844
46F0E66717A3300B005BB4D1 /* Localizable.strings in Resources */,
1845+
BA0B43D526F2FEA200B44A8C /* Preferences.storyboard in Resources */,
18211846
B50F999224F98FFD00A1058D /* Main.storyboard in Resources */,
18221847
B5438012246358B700F34B1C /* Icons.xcassets in Resources */,
18231848
B529F7B824586DF800B168F1 /* MarkdownViewController.xib in Resources */,
@@ -1846,6 +1871,7 @@
18461871
37AE49CA1FFEBB0B00FCB165 /* markdown-dark.css in Resources */,
18471872
466FFF1717CC10A800399652 /* Localizable.strings in Resources */,
18481873
B529F7B924586DF800B168F1 /* MarkdownViewController.xib in Resources */,
1874+
BA0B43D626F2FEA200B44A8C /* Preferences.storyboard in Resources */,
18491875
B50F999324F98FFD00A1058D /* Main.storyboard in Resources */,
18501876
375581C320292AA800529D79 /* About.storyboard in Resources */,
18511877
37AE49C81FFEBB0B00FCB165 /* markdown-default.css in Resources */,
@@ -2065,6 +2091,7 @@
20652091
2614F1DF1405A0B10031AE94 /* Note.m in Sources */,
20662092
B586C062245CCD35009508EC /* SplitViewController.swift in Sources */,
20672093
2614F1E01405A0B10031AE94 /* Tag.m in Sources */,
2094+
BA2C65CB26FE996100FA84E1 /* NSButton+Extensions.swift in Sources */,
20682095
B58117E225B9E5D200927E0C /* AccountVerificationController.swift in Sources */,
20692096
B5009937242130F70037A431 /* UnicodeScalar+Simplenote.swift in Sources */,
20702097
B5985AD5242950B40044EDE9 /* NSColor+Simplenote.swift in Sources */,
@@ -2151,6 +2178,7 @@
21512178
3712FC8E1FE1ACAA008544AC /* Theme.swift in Sources */,
21522179
B5BB8CD424DB51670024E4C5 /* NSSearchField+Simplenote.swift in Sources */,
21532180
A6672FB325C7F12F00090DE3 /* NoteContentHelper.swift in Sources */,
2181+
BA553F0827065E20007737E9 /* FontSettings.swift in Sources */,
21542182
37D4DD6A20B3574D00C225EA /* WPAuthHandler.m in Sources */,
21552183
375D294821E033D1007AB25A /* html_blocks.c in Sources */,
21562184
71DCEBE7152E2ED1002744C0 /* NSMutableAttributedString+Styling.m in Sources */,
@@ -2185,6 +2213,7 @@
21852213
B5A9FE272576C40B0084F176 /* SplitItemMetrics.swift in Sources */,
21862214
B511799B242036BD005F8936 /* NSTextView+Simplenote.swift in Sources */,
21872215
B5ACE42E24785D8C00AB02C7 /* BackgroundView.swift in Sources */,
2216+
BA0B43C926F2FCFC00B44A8C /* PreferencesViewController.swift in Sources */,
21882217
B5DD0F912476309000C8DD41 /* NoteTableCellView.swift in Sources */,
21892218
46F0E66317A32269005BB4D1 /* SPTableView.m in Sources */,
21902219
375D293821E033D1007AB25A /* escape.c in Sources */,
@@ -2254,6 +2283,7 @@
22542283
B551187324E33BC2007B11E3 /* ClipView.swift in Sources */,
22552284
B5395E1E253F70E30068F1A6 /* MetricTableViewCell.swift in Sources */,
22562285
3712FC8D1FE1ACAA008544AC /* Style.swift in Sources */,
2286+
BA2C65CF26FE996A00FA84E1 /* NSButton+Extensions.swift in Sources */,
22572287
375D294121E033D1007AB25A /* html_smartypants.c in Sources */,
22582288
B5E061782450AEDA0076111A /* ToolbarView.swift in Sources */,
22592289
B502C1DE25BA2EB700145D6C /* AccountRemote.swift in Sources */,
@@ -2340,6 +2370,7 @@
23402370
B532F8A820C71C1000EA3506 /* WPAuthHandler.m in Sources */,
23412371
466FFEC117CC10A800399652 /* NSMutableAttributedString+Styling.m in Sources */,
23422372
B5BB8CD524DB51670024E4C5 /* NSSearchField+Simplenote.swift in Sources */,
2373+
BA553F0927065E20007737E9 /* FontSettings.swift in Sources */,
23432374
375D294921E033D1007AB25A /* html_blocks.c in Sources */,
23442375
B542FE5325D42EA600A3582D /* SPTextView.swift in Sources */,
23452376
B529F7B624586D8700B168F1 /* MarkdownViewController.swift in Sources */,
@@ -2374,6 +2405,7 @@
23742405
B503FF4924848D0B00066059 /* TagAttachmentCell.swift in Sources */,
23752406
466FFED417CC10A800399652 /* SPTableView.m in Sources */,
23762407
375D293921E033D1007AB25A /* escape.c in Sources */,
2408+
BA0B43CA26F2FCFC00B44A8C /* PreferencesViewController.swift in Sources */,
23772409
B53BF19D24ABDE7C00938C34 /* DateFormatter+Simplenote.swift in Sources */,
23782410
B58942FB24E5EE8E006EC232 /* NSWindowFrameAutosaveName+Simplenote.swift in Sources */,
23792411
B53BF1A124AC1FB800938C34 /* Version.swift in Sources */,

Simplenote/AccountDeletionController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class AccountDeletionController: NSObject {
1313
}
1414

1515
@objc
16-
func requestAccountDeletion(for user: SPUser, with window: Window) {
16+
func requestAccountDeletion(for user: SPUser, with window: NSWindow) {
1717
let alert = NSAlert(messageText: Constants.deleteAccount, informativeText: Constants.confirmAlertMessage(with: user.email))
1818

1919
alert.alertStyle = .critical
@@ -28,7 +28,7 @@ class AccountDeletionController: NSObject {
2828
}
2929

3030
@objc
31-
private func onConfirmAccountDeletion(for user: SPUser, for window: Window) {
31+
private func onConfirmAccountDeletion(for user: SPUser, for window: NSWindow) {
3232
AccountRemote().requestDelete(user) { [weak self] (result) in
3333
switch result {
3434
case .success:

Simplenote/AppKitConstants.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ enum AppKitConstants {
77
static let alpha0_0: CGFloat = 0
88
static let alpha0_05: CGFloat = 0.05
99
static let alpha0_1: CGFloat = 0.1
10+
static let alpha0_3: CGFloat = 0.3
1011
static let alpha0_4: CGFloat = 0.4
1112
static let alpha0_5: CGFloat = 0.5
1213
static let alpha0_6: CGFloat = 0.6

0 commit comments

Comments
 (0)