Merge branch 'master' of github.com:limelight-stream/limelight-ios

Conflicts:
	Limelight/ViewControllers/StreamFrameViewController.m
This commit is contained in:
Cameron Gutman
2015-01-09 16:14:50 -05:00
2 changed files with 22 additions and 6 deletions
+4
View File
@@ -50,21 +50,25 @@
- (void) retrieveAssetForApp:(App*)app useCache:(BOOL)useCache { - (void) retrieveAssetForApp:(App*)app useCache:(BOOL)useCache {
UIImage* appImage = nil; UIImage* appImage = nil;
if (useCache) { if (useCache) {
@synchronized(_imageCache) {
UIImage* cachedImage = [_imageCache objectForKey:app.appId]; UIImage* cachedImage = [_imageCache objectForKey:app.appId];
if (cachedImage != nil) { if (cachedImage != nil) {
appImage = cachedImage; appImage = cachedImage;
app.appImage = appImage; app.appImage = appImage;
} }
} }
}
if (appImage == nil) { if (appImage == nil) {
HttpManager* hMan = [[HttpManager alloc] initWithHost:_host.address uniqueId:_uniqueId deviceName:deviceName cert:_cert]; HttpManager* hMan = [[HttpManager alloc] initWithHost:_host.address uniqueId:_uniqueId deviceName:deviceName cert:_cert];
NSData* appAsset = [hMan executeRequestSynchronously:[hMan newAppAssetRequestWithAppId:app.appId]]; NSData* appAsset = [hMan executeRequestSynchronously:[hMan newAppAssetRequestWithAppId:app.appId]];
appImage = [UIImage imageWithData:appAsset]; appImage = [UIImage imageWithData:appAsset];
app.appImage = appImage; app.appImage = appImage;
if (appImage != nil) { if (appImage != nil) {
@synchronized(_imageCache) {
[_imageCache setObject:appImage forKey:app.appId]; [_imageCache setObject:appImage forKey:app.appId];
} }
} }
}
[self performSelectorOnMainThread:@selector(sendCallBackForApp:) withObject:app waitUntilDone:NO]; [self performSelectorOnMainThread:@selector(sendCallBackForApp:) withObject:app waitUntilDone:NO];
} }
@@ -57,14 +57,26 @@
[self returnToMainFrame]; [self returnToMainFrame];
} }
- (void)edgeSwiped {
[_streamMan stopStream];
[self returnToMainFrame];
}
- (void) connectionStarted { - (void) connectionStarted {
NSLog(@"Connection started"); NSLog(@"Connection started");
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[self.spinner stopAnimating]; [self.spinner stopAnimating];
[self.stageLabel setText:@"Waiting for first frame..."]; [self.stageLabel setText:@"Waiting for first frame..."];
[self.stageLabel sizeToFit]; [self.stageLabel sizeToFit];
});
[(StreamView*)self.view setupOnScreenControls: _controllerSupport]; [(StreamView*)self.view setupOnScreenControls: _controllerSupport];
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];
}
});
} }
- (void)connectionTerminated:(long)errorCode { - (void)connectionTerminated:(long)errorCode {