mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-21 13:50:29 +00:00
Cleanup code
This commit is contained in:
parent
a788f5e2d9
commit
f45d4ac4fb
@ -33,25 +33,17 @@
|
|||||||
|
|
||||||
@implementation ASRangeController
|
@implementation ASRangeController
|
||||||
|
|
||||||
#pragma mark - NSObject
|
|
||||||
|
|
||||||
+ (void)load {
|
|
||||||
static dispatch_once_t onceToken;
|
|
||||||
dispatch_once(&onceToken, ^{
|
|
||||||
[self registerLowMemoryNotification];
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark - Class
|
#pragma mark - Class
|
||||||
|
|
||||||
+ (ASWeakSet *)rangeControllers
|
+ (ASWeakSet *)allRangeControllersWeakSet
|
||||||
{
|
{
|
||||||
static ASWeakSet<ASRangeController *> *rangeController;
|
static ASWeakSet<ASRangeController *> *__allRangeControllersWeakSet;
|
||||||
static dispatch_once_t onceToken;
|
static dispatch_once_t onceToken;
|
||||||
dispatch_once(&onceToken, ^{
|
dispatch_once(&onceToken, ^{
|
||||||
rangeController = [[ASWeakSet alloc] init];
|
__allRangeControllersWeakSet = [[ASWeakSet alloc] init];
|
||||||
|
[self registerLowMemoryNotification];
|
||||||
});
|
});
|
||||||
return rangeController;
|
return __allRangeControllersWeakSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Lifecycle
|
#pragma mark - Lifecycle
|
||||||
@ -66,7 +58,7 @@
|
|||||||
_currentRangeMode = ASLayoutRangeModeInvalid;
|
_currentRangeMode = ASLayoutRangeModeInvalid;
|
||||||
_didUpdateCurrentRange = NO;
|
_didUpdateCurrentRange = NO;
|
||||||
|
|
||||||
[[self.class rangeControllers] addObject:self];
|
[[self.class allRangeControllersWeakSet] addObject:self];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@ -88,7 +80,7 @@
|
|||||||
+ (void)didReceiveMemoryWarning:(NSNotification *)notification
|
+ (void)didReceiveMemoryWarning:(NSNotification *)notification
|
||||||
{
|
{
|
||||||
#if ASRangeControllerAutomaticLowMemoryHandling
|
#if ASRangeControllerAutomaticLowMemoryHandling
|
||||||
ASWeakSet *rangeControllers = [self rangeControllers];
|
ASWeakSet *rangeControllers = [self allRangeControllersWeakSet];
|
||||||
for (ASRangeController *rangeController in rangeControllers) {
|
for (ASRangeController *rangeController in rangeControllers) {
|
||||||
if (rangeController.dataSource == nil) {
|
if (rangeController.dataSource == nil) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user