Merge branch 'mkirk/dark-theme-toggle' into release/2.30.2

pull/1/head
Michael Kirk 7 years ago
commit d3d5dd71af

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "dark-theme-off-24@1x.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "dark-theme-off-24@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "dark-theme-off-24@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 472 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 994 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "dark-theme-on-24@1x.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "dark-theme-on-24@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "dark-theme-on-24@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 704 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

@ -195,15 +195,6 @@ NS_ASSUME_NONNULL_BEGIN
}
[contents addSection:censorshipSection];
OWSTableSection *themeSection = [OWSTableSection new];
themeSection.headerTitle = NSLocalizedString(@"THEME_SECTION", nil);
[themeSection addItem:[OWSTableItem switchItemWithText:NSLocalizedString(@"SETTINGS_ADVANCED_DARK_THEME",
@"Label for setting that enables dark theme.")
isOn:[Theme isDarkThemeEnabled]
target:weakSelf
selector:@selector(didToggleThemeSwitch:)]];
[contents addSection:themeSection];
self.contents = contents;
}
@ -285,13 +276,6 @@ NS_ASSUME_NONNULL_BEGIN
[self updateTableContents];
}
- (void)didToggleThemeSwitch:(UISwitch *)sender
{
[Theme setIsDarkThemeEnabled:sender.isOn];
[self updateTableContents];
}
@end
NS_ASSUME_NONNULL_END

@ -85,7 +85,7 @@
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemStop
target:self
action:@selector(dismissWasPressed:)];
[self updateRightBarButtonForTheme];
[self observeNotifications];
self.title = NSLocalizedString(@"SETTINGS_NAV_BAR_TITLE", @"Title for settings activity");
@ -467,6 +467,44 @@
[RegistrationUtils showReregistrationUIFromViewController:self];
}
#pragma mark - Dark Theme
- (UIBarButtonItem *)darkThemeBarButton
{
UIBarButtonItem *barButtonItem;
if (Theme.isDarkThemeEnabled) {
barButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"ic_dark_theme_on"]
style:UIBarButtonItemStylePlain
target:self
action:@selector(didPressDisableDarkTheme:)];
} else {
barButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"ic_dark_theme_off"]
style:UIBarButtonItemStylePlain
target:self
action:@selector(didPressEnableDarkTheme:)];
}
return barButtonItem;
}
- (void)didPressEnableDarkTheme:(id)sender
{
[Theme setIsDarkThemeEnabled:YES];
[self updateRightBarButtonForTheme];
[self updateTableContents];
}
- (void)didPressDisableDarkTheme:(id)sender
{
[Theme setIsDarkThemeEnabled:NO];
[self updateRightBarButtonForTheme];
[self updateTableContents];
}
- (void)updateRightBarButtonForTheme
{
self.navigationItem.rightBarButtonItem = [self darkThemeBarButton];
}
#pragma mark - Socket Status Notifications
- (void)observeNotifications

Loading…
Cancel
Save