mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-06-16 21:50:57 +00:00
new ui is almost fully functional
- add hosts - pair to host - get app list - launch app - resume app
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
//
|
||||
// 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
|
||||
Reference in New Issue
Block a user