Diego Waxemberg 412c5c2516 new ui is almost fully functional
- add hosts
- pair to host
- get app list
- launch app
- resume app
2014-10-26 02:15:53 -04:00

46 lines
1.2 KiB
Objective-C

//
// AppManager.m
// Limelight
//
// Created by Diego Waxemberg on 10/25/14.
// Copyright (c) 2014 Limelight Stream. All rights reserved.
//
#import "AppManager.h"
@implementation AppManager {
App* _app;
HttpManager* _hMan;
id<AppAssetCallback> _callback;
}
+ (void) retrieveAppAssets:(NSArray*)apps withManager:(HttpManager*)hMan andCallback:(id<AppAssetCallback>)callback {
for (App* app in apps) {
AppManager* manager = [[AppManager alloc] initWithApp:app httpManager:hMan andCallback:callback];
[manager retrieveAsset];
}
}
- (id) initWithApp:(App*)app httpManager:(HttpManager*)hMan andCallback:(id<AppAssetCallback>)callback {
self = [super init];
_app = app;
_hMan = hMan;
_callback = callback;
return self;
}
- (void) retrieveAsset {
NSData* appAsset = [_hMan executeRequestSynchronously:[_hMan newAppAssetRequestWithAppId:_app.appId]];
UIImage* appImage = [UIImage imageWithData:appAsset];
_app.appImage = appImage;
NSLog(@"App Name: %@ id:%@ image: %@", _app.appName, _app.appId, _app.appImage);
[self performSelectorOnMainThread:@selector(sendCallBack) withObject:self waitUntilDone:NO];
}
- (void) sendCallBack {
[_callback receivedAssetForApp:_app];
}
@end