Skip to content

Commit

Permalink
Make sure themes are reset when updating from previous version
Browse files Browse the repository at this point in the history
  • Loading branch information
nark committed Apr 8, 2020
1 parent 6e76a31 commit 6edd830
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
4 changes: 1 addition & 3 deletions Sources/WCBoardThreadController.m
Original file line number Diff line number Diff line change
Expand Up @@ -390,9 +390,7 @@ - (void)reloadDataAndSelectPost:(WCBoardPost *)selectPost {
#pragma mark -
#pragma mark Reload CSS Template

- (void)reloadTemplate {
NSLog(@"Thread reloadTemplate");

- (void)reloadTemplate {
WITemplateBundle *template;

template = [WITemplateBundle templateWithPath:_templatePath];
Expand Down
8 changes: 2 additions & 6 deletions Sources/WCBoards.m
Original file line number Diff line number Diff line change
Expand Up @@ -323,19 +323,15 @@ - (void)appleInterfaceThemeChanged:(NSNotification *) notification {



- (void)_themeDidChange {
NSLog(@"_themeDidChange");

- (void)_themeDidChange {
NSDictionary *theme;
NSString *templatePath;
WITemplateBundle *templateBundle;

theme = [[WCSettings settings] themeWithIdentifier:[[WCSettings settings] objectForKey:WCTheme]];
templateBundle = [[WCSettings settings] templateBundleWithIdentifier:[theme objectForKey:WCThemesTemplate]];
templatePath = [templateBundle bundlePath];

NSLog(@"theme : %@", [theme valueForKey:WCThemesName]);


[_threadController setFont:WIFontFromString([theme objectForKey:WCThemesBoardsFont])];
[_threadController setTextColor:WIColorFromString([theme objectForKey:WCThemesBoardsTextColor])];
[_threadController setBackgroundColor:WIColorFromString([theme objectForKey:WCThemesBoardsBackgroundColor])];
Expand Down
15 changes: 14 additions & 1 deletion Sources/WCSettings.m
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,20 @@ - (void)_upgrade {
// if(![self objectForKey:WCApplicationMenuEnabled])
// [self setObject:[NSNumber numberWithBool:NO] forKey:WCApplicationMenuEnabled];

NSLog(@"upgrade");
NSLog(@"Upgrade settings...");

if (![self boolForKey:@"WCMigratedTo_2_5__31"]) {
NSLog(@"Upgrade settings to 2_5__31...");

// make sure to reset old versions themes
[self removeObjectForKey:WCThemes];
[self setString:[NSApp darkModeEnabled] ? darkThemeIdentifier : lightThemeIdentifier forKey:WCTheme];

[self setObject:[NSArray arrayWithObjects: [self _defaultLightTheme], [self _defaultDarkTheme], NULL]
forKey:WCThemes];

[self setBool:true forKey:@"WCMigratedTo_2_5__31"];
}
}


Expand Down
2 changes: 1 addition & 1 deletion en.lproj/PublicChatWindow.xib
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@
<point key="canvasLocation" x="116" y="87"/>
</window>
<segmentedControl verticalHuggingPriority="750" id="691">
<rect key="frame" x="-5" y="0.0" width="84" height="23"/>
<rect key="frame" x="-5.5" y="0.0" width="85" height="23"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<segmentedCell key="cell" borderStyle="border" alignment="left" style="texturedSquare" trackingMode="selectAny" id="692">
<font key="font" metaFont="system"/>
Expand Down

0 comments on commit 6edd830

Please sign in to comment.