fix pollers not start when app goes foreground
This commit is contained in:
parent
a332f88fda
commit
9213e2b770
|
@ -177,6 +177,7 @@ static NSTimeInterval launchStartedAt;
|
||||||
|
|
||||||
// Loki: Stop pollers
|
// Loki: Stop pollers
|
||||||
[self stopPoller];
|
[self stopPoller];
|
||||||
|
[self stopClosedGroupPoller];
|
||||||
[self stopOpenGroupPollers];
|
[self stopOpenGroupPollers];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,6 +199,7 @@ static NSTimeInterval launchStartedAt;
|
||||||
|
|
||||||
// Loki: Stop pollers
|
// Loki: Stop pollers
|
||||||
[self stopPoller];
|
[self stopPoller];
|
||||||
|
[self stopClosedGroupPoller];
|
||||||
[self stopOpenGroupPollers];
|
[self stopOpenGroupPollers];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -752,6 +754,7 @@ static NSTimeInterval launchStartedAt;
|
||||||
|
|
||||||
// Loki: Start pollers
|
// Loki: Start pollers
|
||||||
[self startPollerIfNeeded];
|
[self startPollerIfNeeded];
|
||||||
|
[self startClosedGroupPollerIfNeeded];
|
||||||
[self startOpenGroupPollersIfNeeded];
|
[self startOpenGroupPollersIfNeeded];
|
||||||
|
|
||||||
// Loki: Get device links
|
// Loki: Get device links
|
||||||
|
@ -1261,6 +1264,7 @@ static NSTimeInterval launchStartedAt;
|
||||||
|
|
||||||
// Loki: Start pollers
|
// Loki: Start pollers
|
||||||
[self startPollerIfNeeded];
|
[self startPollerIfNeeded];
|
||||||
|
[self startClosedGroupPollerIfNeeded];
|
||||||
[self startOpenGroupPollersIfNeeded];
|
[self startOpenGroupPollersIfNeeded];
|
||||||
|
|
||||||
// Loki: Get device links
|
// Loki: Get device links
|
||||||
|
@ -1380,10 +1384,11 @@ static NSTimeInterval launchStartedAt;
|
||||||
|
|
||||||
- (void)startPollerIfNeeded
|
- (void)startPollerIfNeeded
|
||||||
{
|
{
|
||||||
if (self.poller != nil) { return; }
|
if (self.poller == nil) {
|
||||||
NSString *userPublicKey = OWSIdentityManager.sharedManager.identityKeyPair.hexEncodedPublicKey;
|
NSString *userPublicKey = OWSIdentityManager.sharedManager.identityKeyPair.hexEncodedPublicKey;
|
||||||
if (userPublicKey == nil) { return; }
|
if (userPublicKey == nil) { return; }
|
||||||
self.poller = [[LKPoller alloc] init];
|
self.poller = [[LKPoller alloc] init];
|
||||||
|
}
|
||||||
[self.poller startIfNeeded];
|
[self.poller startIfNeeded];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1391,10 +1396,11 @@ static NSTimeInterval launchStartedAt;
|
||||||
|
|
||||||
- (void)startClosedGroupPollerIfNeeded
|
- (void)startClosedGroupPollerIfNeeded
|
||||||
{
|
{
|
||||||
if (self.closedGroupPoller != nil) { return; }
|
if (self.closedGroupPoller == nil) {
|
||||||
NSString *userPublicKey = OWSIdentityManager.sharedManager.identityKeyPair.hexEncodedPublicKey;
|
NSString *userPublicKey = OWSIdentityManager.sharedManager.identityKeyPair.hexEncodedPublicKey;
|
||||||
if (userPublicKey == nil) { return; }
|
if (userPublicKey == nil) { return; }
|
||||||
self.closedGroupPoller = [[LKClosedGroupPoller alloc] init];
|
self.closedGroupPoller = [[LKClosedGroupPoller alloc] init];
|
||||||
|
}
|
||||||
[self.closedGroupPoller startIfNeeded];
|
[self.closedGroupPoller startIfNeeded];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1414,6 +1420,7 @@ static NSTimeInterval launchStartedAt;
|
||||||
[SSKEnvironment.shared.identityManager clearIdentityKey];
|
[SSKEnvironment.shared.identityManager clearIdentityKey];
|
||||||
[LKSnodeAPI clearSnodePool];
|
[LKSnodeAPI clearSnodePool];
|
||||||
[self stopPoller];
|
[self stopPoller];
|
||||||
|
[self stopClosedGroupPoller];
|
||||||
[self stopOpenGroupPollers];
|
[self stopOpenGroupPollers];
|
||||||
[LKPublicChatManager.shared stopPollers];
|
[LKPublicChatManager.shared stopPollers];
|
||||||
bool wasUnlinked = [NSUserDefaults.standardUserDefaults boolForKey:@"wasUnlinked"];
|
bool wasUnlinked = [NSUserDefaults.standardUserDefaults boolForKey:@"wasUnlinked"];
|
||||||
|
|
|
@ -682,6 +682,7 @@ typedef NS_ENUM(NSInteger, HomeViewControllerSection) {
|
||||||
[LKSnodeAPI clearSnodePool];
|
[LKSnodeAPI clearSnodePool];
|
||||||
AppDelegate *appDelegate = (AppDelegate *)UIApplication.sharedApplication.delegate;
|
AppDelegate *appDelegate = (AppDelegate *)UIApplication.sharedApplication.delegate;
|
||||||
[appDelegate stopPoller];
|
[appDelegate stopPoller];
|
||||||
|
[appDelegate stopClosedGroupPoller];
|
||||||
[appDelegate stopOpenGroupPollers];
|
[appDelegate stopOpenGroupPollers];
|
||||||
[SSKEnvironment.shared.tsAccountManager resetForReregistration];
|
[SSKEnvironment.shared.tsAccountManager resetForReregistration];
|
||||||
UIViewController *rootViewController = [[OnboardingController new] initialViewController];
|
UIViewController *rootViewController = [[OnboardingController new] initialViewController];
|
||||||
|
|
Loading…
Reference in New Issue