ish/app/AboutNavigationController.m
Saagar Jha 52e94fd361 Make preference updates thread-safe
Most of the code assumed it was called on the main thread, but we need
to make this explicit now because preference updates will be driven off
the UI as well.
2022-01-23 11:02:11 -08:00

36 lines
991 B
Objective-C

//
// AboutNavigationController.m
// iSH
//
// Created by Theodore Dubois on 10/6/19.
//
#import "AboutNavigationController.h"
#import "UserPreferences.h"
#import "NSObject+SaneKVO.h"
@interface AboutNavigationController ()
@end
@implementation AboutNavigationController
- (void)viewDidLoad {
[super viewDidLoad];
[UserPreferences.shared observe:@[@"theme"] options:NSKeyValueObservingOptionInitial
owner:self usingBlock:^(typeof(self) self) {
dispatch_async(dispatch_get_main_queue(), ^{
if (@available(iOS 13, *)) {
UIKeyboardAppearance appearance = UserPreferences.shared.theme.keyboardAppearance;
if (appearance == UIKeyboardAppearanceDark) {
self.overrideUserInterfaceStyle = UIUserInterfaceStyleDark;
} else {
self.overrideUserInterfaceStyle = UIUserInterfaceStyleLight;
}
}
});
}];
}
@end