mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-07-31 07:30:40 +00:00
don't register twice
This commit is contained in:
parent
ebbe6dc0af
commit
e3dcfa629f
@ -462,14 +462,16 @@ static NSString* const kBITAuthenticatorLastAuthenticatedVersionKey = @"BITAuthe
|
||||
}
|
||||
|
||||
- (void) registerObservers {
|
||||
__weak typeof(self) weakSelf = self;
|
||||
_appDidBecomeActiveObserver = [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidBecomeActiveNotification
|
||||
object:nil
|
||||
queue:NSOperationQueue.mainQueue
|
||||
usingBlock:^(NSNotification *note) {
|
||||
typeof(self) strongSelf = weakSelf;
|
||||
[strongSelf applicationDidBecomeActive:note];
|
||||
}];
|
||||
if(nil == _appDidBecomeActiveObserver) {
|
||||
__weak typeof(self) weakSelf = self;
|
||||
_appDidBecomeActiveObserver = [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidBecomeActiveNotification
|
||||
object:nil
|
||||
queue:NSOperationQueue.mainQueue
|
||||
usingBlock:^(NSNotification *note) {
|
||||
typeof(self) strongSelf = weakSelf;
|
||||
[strongSelf applicationDidBecomeActive:note];
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) unregisterObservers {
|
||||
|
Loading…
x
Reference in New Issue
Block a user