foreground host update timer
This commit is contained in:
1 parent
51e915b598
commit
56c589f042
2 files changed
+18
-7
No files matched your search
@@ -75,6 +75,8 @@
|
|||||||
StreamFrameViewController* streamFrameViewController;
|
StreamFrameViewController* streamFrameViewController;
|
||||||
id navBarAppearanceStandard;
|
id navBarAppearanceStandard;
|
||||||
|
|
||||||
|
NSTimer *_foregroundHostUpdateTimer;
|
||||||
|
|
||||||
#if TARGET_OS_TV
|
#if TARGET_OS_TV
|
||||||
UITapGestureRecognizer* _menuRecognizer;
|
UITapGestureRecognizer* _menuRecognizer;
|
||||||
#endif
|
#endif
|
||||||
@@ -1639,7 +1641,12 @@ static NSMutableSet* hostList;
|
|||||||
{
|
{
|
||||||
if (!_background) {
|
if (!_background) {
|
||||||
// This will kick off box art caching
|
// This will kick off box art caching
|
||||||
|
|
||||||
|
|
||||||
|
_foregroundHostUpdateTimer = [NSTimer scheduledTimerWithTimeInterval:10 repeats:YES block:^(NSTimer *timer) {
|
||||||
[self updateHosts];
|
[self updateHosts];
|
||||||
|
}];
|
||||||
|
|
||||||
|
|
||||||
// Reset state first so we can rediscover hosts that were deleted before
|
// Reset state first so we can rediscover hosts that were deleted before
|
||||||
[_discMan resetDiscoveryState];
|
[_discMan resetDiscoveryState];
|
||||||
@@ -1744,7 +1751,12 @@ static NSMutableSet* hostList;
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void)viewWillDisappear:(BOOL)animated{
|
||||||
|
NSLog(@"willDisappear");
|
||||||
|
[super viewWillDisappear:animated];
|
||||||
|
[_foregroundHostUpdateTimer invalidate];
|
||||||
|
_foregroundHostUpdateTimer = nil;
|
||||||
|
}
|
||||||
|
|
||||||
- (void)viewWillAppear:(BOOL)animated
|
- (void)viewWillAppear:(BOOL)animated
|
||||||
{
|
{
|
||||||
@@ -1863,13 +1875,12 @@ static NSMutableSet* hostList;
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)updateHosts {
|
- (void)updateHosts {
|
||||||
Log(LOG_I, @"Updating hosts...");
|
Log(LOG_I, @"Updating hosts %f", CACurrentMediaTime());
|
||||||
@synchronized (hostList) {
|
@synchronized (hostList) {
|
||||||
// Sort the host list in alphabetical order
|
// Sort the host list in alphabetical order
|
||||||
NSArray* sortedHostList = [[hostList allObjects] sortedArrayUsingSelector:@selector(compareName:)];
|
NSArray* sortedHostList = [[hostList allObjects] sortedArrayUsingSelector:@selector(compareName:)];
|
||||||
for (TemporaryHost* comp in sortedHostList) {
|
for (TemporaryHost* comp in sortedHostList) {
|
||||||
if(comp.state == StateOnline || comp.pairState == PairStatePaired) [self.hostCollectionVC addHost:comp];
|
if(comp.state == StateOnline || comp.pairState == PairStatePaired || comp.pairState == PairStateUnknown) [self.hostCollectionVC addHost:comp];
|
||||||
|
|
||||||
|
|
||||||
// new host card test
|
// new host card test
|
||||||
// if([comp.name isEqualToString: @"ASRockPC"]) {
|
// if([comp.name isEqualToString: @"ASRockPC"]) {
|
||||||
|
|||||||
@@ -746,7 +746,7 @@
|
|||||||
#if !TARGET_OS_TV
|
#if !TARGET_OS_TV
|
||||||
// Terminate the stream if the app is inactive for 60 seconds
|
// Terminate the stream if the app is inactive for 60 seconds
|
||||||
Log(LOG_I, @"Starting inactivity termination timer");
|
Log(LOG_I, @"Starting inactivity termination timer");
|
||||||
_inactivityTimer = [NSTimer scheduledTimerWithTimeInterval:1800
|
_inactivityTimer = [NSTimer scheduledTimerWithTimeInterval:18000
|
||||||
target:self
|
target:self
|
||||||
selector:@selector(inactiveTimerExpired:)
|
selector:@selector(inactiveTimerExpired:)
|
||||||
userInfo:nil
|
userInfo:nil
|
||||||
@@ -773,14 +773,14 @@
|
|||||||
|
|
||||||
// This fires when the home button is pressed
|
// This fires when the home button is pressed
|
||||||
- (void)applicationDidEnterBackground:(UIApplication *)application {
|
- (void)applicationDidEnterBackground:(UIApplication *)application {
|
||||||
|
/*
|
||||||
Log(LOG_I, @"Terminating stream immediately for backgrounding");
|
Log(LOG_I, @"Terminating stream immediately for backgrounding");
|
||||||
|
|
||||||
if (_inactivityTimer != nil) {
|
if (_inactivityTimer != nil) {
|
||||||
[_inactivityTimer invalidate];
|
[_inactivityTimer invalidate];
|
||||||
_inactivityTimer = nil;
|
_inactivityTimer = nil;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
// [self returnToMainFrame];
|
// [self returnToMainFrame];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user