From 9e054973c8bfbad588203b7d436e60ee928e1b8e Mon Sep 17 00:00:00 2001 From: Diego Waxemberg Date: Fri, 9 Jan 2015 15:17:19 -0500 Subject: [PATCH 1/2] Fixed a concurrent modification error in caching app images --- Limelight/Network/AppManager.m | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Limelight/Network/AppManager.m b/Limelight/Network/AppManager.m index 13455dc..f597fb6 100644 --- a/Limelight/Network/AppManager.m +++ b/Limelight/Network/AppManager.m @@ -50,10 +50,12 @@ - (void) retrieveAssetForApp:(App*)app useCache:(BOOL)useCache { UIImage* appImage = nil; if (useCache) { - UIImage* cachedImage = [_imageCache objectForKey:app.appId]; - if (cachedImage != nil) { - appImage = cachedImage; - app.appImage = appImage; + @synchronized(_imageCache) { + UIImage* cachedImage = [_imageCache objectForKey:app.appId]; + if (cachedImage != nil) { + appImage = cachedImage; + app.appImage = appImage; + } } } if (appImage == nil) { @@ -62,7 +64,9 @@ appImage = [UIImage imageWithData:appAsset]; app.appImage = appImage; if (appImage != nil) { - [_imageCache setObject:appImage forKey:app.appId]; + @synchronized(_imageCache) { + [_imageCache setObject:appImage forKey:app.appId]; + } } } [self performSelectorOnMainThread:@selector(sendCallBackForApp:) withObject:app waitUntilDone:NO]; From 6f9c16a54834005d5a976e50325f566d8d8236a0 Mon Sep 17 00:00:00 2001 From: Diego Waxemberg Date: Fri, 9 Jan 2015 15:22:12 -0500 Subject: [PATCH 2/2] added swipe detection to stop streaming --- .../ViewControllers/StreamFrameViewController.m | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Limelight/ViewControllers/StreamFrameViewController.m b/Limelight/ViewControllers/StreamFrameViewController.m index 92b63d9..482d919 100644 --- a/Limelight/ViewControllers/StreamFrameViewController.m +++ b/Limelight/ViewControllers/StreamFrameViewController.m @@ -57,14 +57,26 @@ [self returnToMainFrame]; } +- (void)edgeSwiped { + [_streamMan stopStream]; + [self returnToMainFrame]; +} + - (void) connectionStarted { NSLog(@"Connection started"); dispatch_async(dispatch_get_main_queue(), ^{ [self.spinner stopAnimating]; [self.stageLabel setText:@"Waiting for first frame..."]; [self.stageLabel sizeToFit]; + [(StreamView*)self.view setupOnScreenControls]; + UIScreenEdgePanGestureRecognizer* swipeGesture = [[UIScreenEdgePanGestureRecognizer alloc] initWithTarget:self action:@selector(edgeSwiped)]; + swipeGesture.edges = UIRectEdgeLeft; + if (swipeGesture == nil) { + NSLog(@"An error occured trying to create UIScreenEdgePanGestureRecognizer"); + } else { + [self.view addGestureRecognizer:swipeGesture]; + } }); - [(StreamView*)self.view setupOnScreenControls]; } - (void)connectionTerminated:(long)errorCode {