Skip to content

Commit 020bc1d

Browse files
committed
#2485: Remove unncessary dark mode check.
1 parent d0fc907 commit 020bc1d

File tree

1 file changed

+8
-51
lines changed

1 file changed

+8
-51
lines changed

Source/SPAboutController.m

Lines changed: 8 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -39,27 +39,17 @@
3939
static NSString *SPAboutPanelNibName = @"AboutPanel";
4040
static NSString *SPShortVersionHashKey = @"SPVersionShortHash";
4141

42-
static BOOL isOSAtLeast10_14 = NO;
43-
4442
@interface SPAboutController ()
4543

46-
- (BOOL)_isInDarkMode;
4744
- (void)_setVersionLabel:(BOOL)isNightly;
48-
- (NSAttributedString *)_getCreditsText;
49-
- (NSAttributedString *)_getLicenseText;
50-
- (NSAttributedString *)_applyTextAttributes:(NSMutableAttributedString *)text;
45+
- (NSMutableAttributedString *)_loadRtfResource:(NSString *)filename;
5146

5247
@end
5348

5449
@implementation SPAboutController
5550

5651
#pragma mark -
5752

58-
+ (void)initialize
59-
{
60-
isOSAtLeast10_14 = [SPOSInfo isOSVersionAtLeastMajor:10 minor:14 patch:0];
61-
}
62-
6353
- (id)init
6454
{
6555
return [super initWithWindowNibName:SPAboutPanelNibName];
@@ -80,10 +70,10 @@ - (void)awakeFromNib
8070
[self _setVersionLabel:isSnapshotBuild];
8171

8272
// Set the credits
83-
[[appCreditsTextView textStorage] appendAttributedString:[self _getCreditsText]];
73+
[[appCreditsTextView textStorage] appendAttributedString:[self _loadRtfResource:SPCreditsFilename]];
8474

8575
// Set the license
86-
[[appLicenseTextView textStorage] appendAttributedString:[self _getLicenseText]];
76+
[[appLicenseTextView textStorage] appendAttributedString:[self _loadRtfResource:SPLicenseFilename]];
8777
}
8878

8979
#pragma mark -
@@ -109,19 +99,6 @@ - (IBAction)closeApplicationLicenseSheet:(id)sender;
10999
#pragma mark -
110100
#pragma mark Private API
111101

112-
- (BOOL)_isInDarkMode
113-
{
114-
if (isOSAtLeast10_14) {
115-
NSString *match = [[NSAppearance currentAppearance] bestMatchFromAppearancesWithNames:@[NSAppearanceNameAqua, NSAppearanceNameDarkAqua]];
116-
117-
if ([NSAppearanceNameDarkAqua isEqualToString:match]) {
118-
return YES;
119-
}
120-
}
121-
122-
return NO;
123-
}
124-
125102
/**
126103
* Set the UI version labels.
127104
*
@@ -154,35 +131,15 @@ - (void)_setVersionLabel:(BOOL)isSnapshotBuild
154131
}
155132

156133
/**
157-
* Returns the credits string to display in the about dialog.
134+
* Loads the resource with the supplied name and sets any necessary string attributes.
158135
*/
159-
- (NSAttributedString *)_getCreditsText
136+
- (NSAttributedString *)_loadRtfResource:(NSString *)filename
160137
{
161-
NSMutableAttributedString *credits = [[NSMutableAttributedString alloc] initWithPath:[[NSBundle mainBundle] pathForResource:SPCreditsFilename ofType:@"rtf"] documentAttributes:nil];
162-
163-
return [[self _applyTextAttributes:credits] autorelease];
164-
}
138+
NSMutableAttributedString *resouece = [[NSMutableAttributedString alloc] initWithPath:[[NSBundle mainBundle] pathForResource:filename ofType:@"rtf"] documentAttributes:nil];
165139

166-
/**
167-
* Returns the license string to display in the about dialog.
168-
*/
169-
- (NSAttributedString *)_getLicenseText
170-
{
171-
NSMutableAttributedString *license = [[NSMutableAttributedString alloc] initWithPath:[[NSBundle mainBundle] pathForResource:SPLicenseFilename ofType:@"rtf"] documentAttributes:nil];
172-
173-
return [[self _applyTextAttributes:license] autorelease];
174-
}
175-
176-
/**
177-
*
178-
*/
179-
- (NSAttributedString *)_applyTextAttributes:(NSMutableAttributedString *)text
180-
{
181-
if ([self _isInDarkMode]) {
182-
[text addAttribute:NSForegroundColorAttributeName value:[NSColor textColor] range:NSMakeRange(0, [text length])];
183-
}
140+
[resouece addAttribute:NSForegroundColorAttributeName value:[NSColor textColor] range:NSMakeRange(0, [resouece length])];
184141

185-
return text;
142+
return [resouece autorelease];
186143
}
187144

188145
@end

0 commit comments

Comments
 (0)