Last active
August 25, 2019 06:40
-
-
Save DGh0st/c671154425c49178d9b3e68cf7da7ce8 to your computer and use it in GitHub Desktop.
SBLockscreenDateViewController implementation for iOS 10 (generated using a disassembler)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface SBLockScreenDateViewController : UIViewController <SBDateTimeOverrideObserver, _UISettingsKeyObserver> { | |
NSNumber* _timerToken; | |
BOOL _disablesUpdates; | |
_UILegibilitySettings* _legibilitySettings; | |
} | |
@property (assign,getter=isSubtitleHidden,nonatomic) BOOL subtitleHidden; | |
@property (nonatomic,retain) _UILegibilitySettings * legibilitySettings; | |
@property (readonly) unsigned long long hash; | |
@property (readonly) Class superclass; | |
@property (copy,readonly) NSString * description; | |
@property (copy,readonly) NSString * debugDescription; | |
-(void)controller:(id)arg1 didChangeOverrideDateFromDate:(id)arg2 ; | |
-(id)dateViewIfExists; | |
-(void)_updateLegibilityStrength; | |
-(void)_updateFormat; | |
-(void)_setDisablesUpdates:(BOOL)arg1 ; | |
-(void)_backlightChanged; | |
-(void)dealloc; | |
-(NSString *)description; | |
-(void)setView:(id)arg1 ; | |
-(void)loadView; | |
-(id)initWithNibName:(id)arg1 bundle:(id)arg2 ; | |
-(void)_updateView; | |
-(void)willMoveToParentViewController:(id)arg1 ; | |
-(void)settings:(id)arg1 changedValueForKey:(id)arg2 ; | |
-(void)setLegibilitySettings:(_UILegibilitySettings *)arg1 ; | |
-(_UILegibilitySettings *)legibilitySettings; | |
-(void)setCustomSubtitleView:(id)arg1 ; | |
-(BOOL)isSubtitleHidden; | |
-(void)setSubtitleHidden:(BOOL)arg1 ; | |
-(void)setContentAlpha:(double)arg1 withSubtitleVisible:(BOOL)arg2 ; | |
-(id)dateView; | |
-(void)_stopUpdateTimer; | |
-(void)_startUpdateTimer; | |
-(void)_addObservers; | |
@end | |
@implementation SBLockscreenDateViewController | |
-(id)initWithNibName:(id)arg1 bundle:(id)arg2 { | |
self = [super initWithNibName:arg1 bundle:arg2]; | |
if (self != nil) | |
[self _addObservers]; | |
return self; | |
} | |
-(void)dealloc { | |
[[SBDateTimeController sharedInstance] removeObserver:self]; | |
[self _stopUpdateTimer]; | |
[[[[SBPrototypeController sharedInstance] rootSettings] legibilitySettings] removeKeyObserver:self]; | |
[super dealloc]; | |
} | |
-(id)dateView { | |
return self.view; | |
} | |
-(id)dateViewIfExists { | |
if ([self isViewLoaded]) | |
return [self dateView]; | |
return nil; | |
} | |
-(BOOL)isSubtitleHidden { | |
return [[self dateViewIfExists] isSubtitleHidden]; | |
} | |
-(void)setSubtitleHidden:(BOOL)arg1 { | |
[[self dateView] setSubtitleHidden:arg1]; | |
} | |
-(void)setLegibilitySettings:(id)arg1 { | |
if (self->_legibilitySettings != arg1) { | |
[self->_legibilitySettings release]; | |
self->_legibilitySettings = [arg1 retain]; | |
[self _updateLegibilityStrength]; | |
[[self dateView] setLegibilitySettings:self->_legibilitySettings]; | |
} | |
} | |
-(void)setContentAlpha:(CGFloat)arg1 withSubtitleVisible:(BOOL)arg2 { | |
[[self dateViewIfExists] setContentAlpha:arg1 withSubtitleVisible:arg2]; | |
} | |
-(void)setCustomSubtitleView:(id)arg1 { | |
[[self dateViewIfExists] setCustomSubtitleView:arg1]; | |
} | |
-(void)loadView { | |
SBDateTimeController *dateTimeController = [SBDateTimeController sharedInstance]; | |
[dateTimeController addObserver:self]; | |
SBLockscreenDefaults *defaults = [[SBLockscreenDefaults alloc] init]; | |
BOOL useDashboard = [defaults useDashboard]; | |
[defaults release]; | |
SBFLockscreenDateView *lockscreenDateView = [[SBFLockscreenDateView alloc] initForDashboard:useDashboard withFrame:CGRectZero]; | |
[lockscreenDateView setUserInteractionEnabled:NO]; | |
[lockscreenDateView setLegibilitySettings:self->_legibilitySettings]; | |
self.view = lockscreenDateView; | |
[self _updateLegibilityStrength]; | |
NSDate *overrideDate = [dateTimeController overrideDate]; | |
if (overrideDate != nil) { | |
[lockscreenDateView setDate:overrideDate]; | |
} else { | |
[lockscreenDateView setDate:[SBPreciseClockTimer now]]; | |
if (!self->_disablesUpdates) | |
[self _startUpdateTimer]; | |
} | |
} | |
-(void)setView:(id)arg1 { | |
[super setView:arg1]; | |
if (arg1 == nil) | |
[self _stopUpdateTimer]; | |
} | |
-(void)willMoveToParentViewController:(id)arg1 { | |
if (arg1 == nil) | |
[self setView:nil]; | |
} | |
-(void)controller:(SBDateTimeController *)arg1 didChangeOverrideDateFromDate:(NSDate *)arg2 { | |
NSDate *overrideDate = [arg1 overrideDate]; | |
if (overrideDate != nil) | |
[self _stopUpdateTimer]; | |
else if (!self->_disablesUpdates) | |
[self _startUpdateTimer]; | |
if (!self->_disablesUpdates) | |
[self _updateFormat]; | |
} | |
-(void)settings:(id)arg1 changedValueForKey:(id)arg2 { | |
if ([arg1 isMemberOfClass:[SBLegibilitySettings class]]) | |
[self _updateLegibilityStrength]; | |
} | |
-(void)_setDisablesUpdates:(BOOL)arg1 { | |
if (self->_disablesUpdates != arg1) { | |
self->_disablesUpdates = arg1; | |
// bunch of logging using SBLogDashboard and oslog | |
if (self->_disablesUpdates) { | |
[self _stopUpdateTimer]; | |
} else { | |
[self _updateFormat]; | |
NSDate *overrideDate = [[SBDateTimeController sharedInstance] overrideDate]; | |
if (overrideDate != nil) | |
return; | |
[self _startUpdateTimer]; | |
} | |
} | |
} | |
-(void)_backlightChanged { | |
if ([[SBBacklightController sharedInstance] screenIsOn]) { | |
[self _disablesUpdates:NO]; | |
[[self dateViewIfExists] setDate:[[SBDateTimeController sharedInstance] currentDate]]; | |
} else { | |
[self _disablesUpdates:YES]; | |
} | |
} | |
-(void)_updateLegibilityStrength { | |
SBFLockscreenDateView *dateView = [self dateViewIfExists]; | |
SBLegibilitySettings *settings = [[[SBPrototypeController sharedInstance] rootSettings] legibilitySettings]; | |
CGFloat style = [[self legibilitySettings] style]; | |
[dateView setTimeLegibilityStrength:[settings timeStrengthForStyle:style]]; | |
[dateView setSubtitleLegibilityStrength:[settings dateStrengthForStyle:style]]; | |
} | |
-(void)_addObservers { | |
NSNotificationCenter *defaultCenter = [NSNotificationCenter defaultCenter]; | |
[defaultCenter addObserver:self selector:@selector(_updateFormat) name:BSDateTimeCacheChangedNotification object:nil]; | |
[defaultCenter addObserver:self selector:@selector(_backlightChanged) name:SBBacklightLevelChangedNotification object:nil]; | |
[defaultCenter addObserver:self selector:@selector(_updateView) name:UIContentSizeCategoryDidChangeNotification object:nil]; | |
[defaultCenter addObserver:self selector:@selector(_updateView) name:UIAccessibilityLargeTextChangedNotification object:nil]; | |
[[[[SBPrototypeController sharedInstance] rootSettings] legibilitySettings] addKeyObserverIfPrototyping:self]; | |
} | |
-(void)_updateFormat { | |
if (!self->_disablesUpdates) { | |
[[self dateViewIfExists] updateFormat]; | |
[self _updateView]; | |
} | |
} | |
-(void)_updateView { | |
if (self->_disablesUpdates) { | |
[self _stopUpdateTimer]; | |
} else { | |
NSDate *overrideDate = [[SBDateTimeController sharedInstance] overrideDate]; | |
if (overrideDate != nil) { | |
[[self dateViewIfExists] setDate:overrideDate]; | |
} else { | |
[[self dateViewIfExists] setDate:[SBPreciseClockTimer now]]; | |
[self _startUpdateTimer]; | |
} | |
} | |
} | |
-(void)_stopUpdateTimer { | |
if (self->_timerToken != nil) { | |
[[SBPreciseClockTimer sharedInstance] stopMinuteUpdatesForToken:self->_timerToken]; | |
[self->_timerToken release]; | |
self->_timerToken = nil; | |
} | |
} | |
-(void)_startUpdateTimer { | |
if (self->_timerToken == nil) { | |
self->_timerToken = (NSNumber *)[[[SBPreciseClockTimer sharedInstance] startMinuteUpdatesWithHandler:^{ | |
[self _updateView]; | |
}] retain]; | |
} | |
} | |
-(id)legibilitySettings { | |
return self->_legibilitySettings; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Remember this was generated using a disassembler so it may not be 100% accurate.