Stop using CoreData-backed objects in any non-DataManager code

This commit is contained in:
Cameron Gutman 2015-12-01 20:31:24 -08:00
parent 4ba71db7b2
commit 5ea92a7b48
27 changed files with 126 additions and 85 deletions

View File

@ -7,7 +7,6 @@
//
#import "App.h"
#import "Host.h"
@implementation App

View File

@ -7,7 +7,7 @@
//
#import <Foundation/Foundation.h>
#import "Host.h"
#import "TemporaryHost.h"
@interface TemporaryApp : NSObject
@ -15,6 +15,6 @@
@property (nullable, nonatomic, retain) NSData *image;
@property (nullable, nonatomic, retain) NSString *name;
@property (nonatomic) BOOL isRunning;
@property (nullable, nonatomic, retain) Host *host;
@property (nullable, nonatomic, retain) TemporaryHost *host;
@end

View File

@ -0,0 +1,26 @@
//
// TemporaryHost.h
// Moonlight
//
// Created by Cameron Gutman on 12/1/15.
// Copyright © 2015 Moonlight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "Utils.h"
@interface TemporaryHost : NSObject
@property (nonatomic) BOOL online;
@property (nonatomic) PairState pairState;
@property (nonatomic, nullable) NSString * activeAddress;
@property (nullable, nonatomic, retain) NSString *address;
@property (nullable, nonatomic, retain) NSString *externalAddress;
@property (nullable, nonatomic, retain) NSString *localAddress;
@property (nullable, nonatomic, retain) NSString *mac;
@property (nullable, nonatomic, retain) NSString *name;
@property (nullable, nonatomic, retain) NSString *uuid;
@property (nullable, nonatomic, retain) NSSet *appList;
@end

View File

@ -0,0 +1,13 @@
//
// TemporaryHost.m
// Moonlight
//
// Created by Cameron Gutman on 12/1/15.
// Copyright © 2015 Moonlight Stream. All rights reserved.
//
#import "TemporaryHost.h"
@implementation TemporaryHost
@end

View File

@ -7,20 +7,20 @@
//
#import <Foundation/Foundation.h>
#import "App.h"
#import "TemporaryApp.h"
#import "HttpManager.h"
#import "Host.h"
#import "TemporaryHost.h"
@protocol AppAssetCallback <NSObject>
- (void) receivedAssetForApp:(App*)app;
- (void) receivedAssetForApp:(TemporaryApp*)app;
@end
@interface AppAssetManager : NSObject
- (id) initWithCallback:(id<AppAssetCallback>)callback;
- (void) retrieveAssetsFromHost:(Host*)host;
- (void) retrieveAssetsFromHost:(TemporaryHost*)host;
- (void) stopRetrieving;
@end

View File

@ -28,8 +28,8 @@ static const int MAX_REQUEST_COUNT = 4;
return self;
}
- (void) retrieveAssetsFromHost:(Host*)host {
for (App* app in host.appList) {
- (void) retrieveAssetsFromHost:(TemporaryHost*)host {
for (TemporaryApp* app in host.appList) {
if (app.image == nil) {
AppAssetRetriever* retriever = [[AppAssetRetriever alloc] init];
retriever.app = app;
@ -45,7 +45,7 @@ static const int MAX_REQUEST_COUNT = 4;
[_opQueue cancelAllOperations];
}
- (void) sendCallBackForApp:(App*)app {
- (void) sendCallBackForApp:(TemporaryApp*)app {
[_callback receivedAssetForApp:app];
}

View File

@ -7,14 +7,14 @@
//
#import <Foundation/Foundation.h>
#import "Host.h"
#import "App.h"
#import "TemporaryHost.h"
#import "TemporaryApp.h"
#import "AppAssetManager.h"
@interface AppAssetRetriever : NSOperation
@property (nonatomic) Host* host;
@property (nonatomic) App* app;
@property (nonatomic) TemporaryHost* host;
@property (nonatomic) TemporaryApp* app;
@property (nonatomic) id<AppAssetCallback> callback;
@end

View File

@ -36,7 +36,7 @@ static const int MAX_ATTEMPTS = 5;
[self performSelectorOnMainThread:@selector(sendCallbackForApp:) withObject:self.app waitUntilDone:NO];
}
- (void) sendCallbackForApp:(App*)app {
- (void) sendCallbackForApp:(TemporaryApp*)app {
[self.callback receivedAssetForApp:app];
}

View File

@ -8,7 +8,7 @@
#import <Foundation/Foundation.h>
#import "MDNSManager.h"
#import "Host.h"
#import "TemporaryHost.h"
@protocol DiscoveryCallback <NSObject>
@ -22,8 +22,8 @@
- (void) startDiscovery;
- (void) stopDiscovery;
- (void) stopDiscoveryBlocking;
- (BOOL) addHostToDiscovery:(Host*)host;
- (void) removeHostFromDiscovery:(Host*)host;
- (void) discoverHost:(NSString*)hostAddress withCallback:(void (^)(Host*, NSString*))callback;
- (BOOL) addHostToDiscovery:(TemporaryHost*)host;
- (void) removeHostFromDiscovery:(TemporaryHost*)host;
- (void) discoverHost:(NSString*)hostAddress withCallback:(void (^)(TemporaryHost*, NSString*))callback;
@end

View File

@ -17,7 +17,6 @@
@implementation DiscoveryManager {
NSMutableArray* _hostQueue;
NSMutableArray* _discoveredHosts;
id<DiscoveryCallback> _callback;
MDNSManager* _mdnsMan;
NSOperationQueue* _opQueue;
@ -35,7 +34,7 @@
shouldDiscover = NO;
_hostQueue = [NSMutableArray array];
DataManager* dataMan = [[DataManager alloc] init];
for (Host* host in hosts)
for (TemporaryHost* host in hosts)
{
if (![self addHostToDiscovery:host])
{
@ -54,12 +53,12 @@
return self;
}
- (void) discoverHost:(NSString *)hostAddress withCallback:(void (^)(Host *, NSString*))callback {
- (void) discoverHost:(NSString *)hostAddress withCallback:(void (^)(TemporaryHost *, NSString*))callback {
HttpManager* hMan = [[HttpManager alloc] initWithHost:hostAddress uniqueId:_uniqueId deviceName:deviceName cert:_cert];
ServerInfoResponse* serverInfoResponse = [[ServerInfoResponse alloc] init];
[hMan executeRequestSynchronously:[HttpRequest requestForResponse:serverInfoResponse withUrlRequest:[hMan newServerInfoRequest] fallbackError:401 fallbackRequest:[hMan newHttpServerInfoRequest]]];
Host* host = nil;
TemporaryHost* host = nil;
if ([serverInfoResponse isStatusOk]) {
DataManager* dataMan = [[DataManager alloc] init];
host = [dataMan createHost];
@ -82,7 +81,7 @@
Log(LOG_I, @"Starting discovery");
shouldDiscover = YES;
[_mdnsMan searchForHosts];
for (Host* host in _hostQueue) {
for (TemporaryHost* host in _hostQueue) {
[_opQueue addOperation:[self createWorkerForHost:host]];
}
}
@ -103,7 +102,7 @@
Log(LOG_I, @"All discovery workers stopped");
}
- (BOOL) addHostToDiscovery:(Host *)host {
- (BOOL) addHostToDiscovery:(TemporaryHost *)host {
if (host.uuid.length > 0 && ![self isHostInDiscovery:host]) {
[_hostQueue addObject:host];
if (shouldDiscover) {
@ -114,7 +113,7 @@
return NO;
}
- (void) removeHostFromDiscovery:(Host *)host {
- (void) removeHostFromDiscovery:(TemporaryHost *)host {
for (DiscoveryWorker* worker in [_opQueue operations]) {
if ([worker getHost] == host) {
[worker cancel];
@ -128,7 +127,7 @@
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
DataManager* dataMan = [[DataManager alloc] init];
// Discover the hosts before adding to eliminate duplicates
for (Host* host in hosts) {
for (TemporaryHost* host in hosts) {
Log(LOG_I, @"Found host through MDNS: %@:", host.name);
// Since this is on a background thread, we do not need to use the opQueue
DiscoveryWorker* worker = (DiscoveryWorker*)[self createWorkerForHost:host];
@ -145,9 +144,9 @@
});
}
- (BOOL) isHostInDiscovery:(Host*)host {
- (BOOL) isHostInDiscovery:(TemporaryHost*)host {
for (int i = 0; i < _hostQueue.count; i++) {
Host* discoveredHost = [_hostQueue objectAtIndex:i];
TemporaryHost* discoveredHost = [_hostQueue objectAtIndex:i];
if (discoveredHost.uuid.length > 0 && [discoveredHost.uuid isEqualToString:host.uuid]) {
return YES;
}
@ -155,7 +154,7 @@
return NO;
}
- (NSOperation*) createWorkerForHost:(Host*)host {
- (NSOperation*) createWorkerForHost:(TemporaryHost*)host {
DiscoveryWorker* worker = [[DiscoveryWorker alloc] initWithHost:host uniqueId:_uniqueId cert:_cert];
return worker;
}

View File

@ -7,12 +7,12 @@
//
#import <Foundation/Foundation.h>
#import "Host.h"
#import "TemporaryHost.h"
@interface DiscoveryWorker : NSOperation
- (id) initWithHost:(Host*)host uniqueId:(NSString*)uniqueId cert:(NSData*)cert;
- (id) initWithHost:(TemporaryHost*)host uniqueId:(NSString*)uniqueId cert:(NSData*)cert;
- (void) discoverHost;
- (Host*) getHost;
- (TemporaryHost*) getHost;
@end

View File

@ -13,14 +13,14 @@
#import "HttpRequest.h"
@implementation DiscoveryWorker {
Host* _host;
TemporaryHost* _host;
NSString* _uniqueId;
NSData* _cert;
}
static const float POLL_RATE = 2.0f; // Poll every 2 seconds
- (id) initWithHost:(Host*)host uniqueId:(NSString*)uniqueId cert:(NSData*)cert {
- (id) initWithHost:(TemporaryHost*)host uniqueId:(NSString*)uniqueId cert:(NSData*)cert {
self = [super init];
_host = host;
_uniqueId = uniqueId;
@ -28,7 +28,7 @@ static const float POLL_RATE = 2.0f; // Poll every 2 seconds
return self;
}
- (Host*) getHost {
- (TemporaryHost*) getHost {
return _host;
}

View File

@ -7,7 +7,6 @@
//
#import <Foundation/Foundation.h>
#import "Host.h"
#import "HttpResponse.h"
#import "HttpRequest.h"

View File

@ -9,7 +9,7 @@
#import "HttpManager.h"
#import "HttpRequest.h"
#import "CryptoManager.h"
#import "App.h"
#import "TemporaryApp.h"
#include <libxml2/libxml/xmlreader.h>
#include <string.h>

View File

@ -7,7 +7,6 @@
//
#import <Foundation/Foundation.h>
#import "Host.h"
static NSString* TAG_STATUS_CODE = @"status_code";
static NSString* TAG_STATUS_MESSAGE = @"status_message";

View File

@ -7,7 +7,7 @@
//
#import "HttpResponse.h"
#import "App.h"
#import "TemporaryApp.h"
#import <libxml2/libxml/xmlreader.h>
@implementation HttpResponse {

View File

@ -7,7 +7,7 @@
//
#import "MDNSManager.h"
#import "Host.h"
#import "TemporaryHost.h"
#import "DataManager.h"
@implementation MDNSManager {
@ -50,7 +50,7 @@ static NSString* NV_SERVICE_TYPE = @"_nvstream._tcp";
DataManager* dataMan = [[DataManager alloc] init];
for (NSNetService* service in services) {
if (service.hostName != nil) {
Host* host = [dataMan createHost];
TemporaryHost* host = [dataMan createHost];
host.activeAddress = host.address = service.hostName;
host.name = host.address;
[hosts addObject:host];

View File

@ -7,6 +7,7 @@
//
#import "HttpResponse.h"
#import "TemporaryHost.h"
#define TAG_HOSTNAME @"hostname"
#define TAG_EXTERNAL_IP @"ExternalIP"
@ -18,7 +19,7 @@
@interface ServerInfoResponse : HttpResponse <Response>
- (void) populateWithData:(NSData *)data;
- (void) populateHost:(Host*)host;
- (void) populateHost:(TemporaryHost*)host;
@end

View File

@ -17,7 +17,7 @@
[super parseData];
}
- (void) populateHost:(Host*)host {
- (void) populateHost:(TemporaryHost*)host {
host.name = [[self getStringTag:TAG_HOSTNAME] trim];
host.externalAddress = [[self getStringTag:TAG_EXTERNAL_IP] trim];
host.localAddress = [[self getStringTag:TAG_LOCAL_IP] trim];

View File

@ -7,10 +7,10 @@
//
#import <Foundation/Foundation.h>
#import "Host.h"
#import "TemporaryHost.h"
@interface WakeOnLanManager : NSObject
+ (void) wakeHost:(Host*)host;
+ (void) wakeHost:(TemporaryHost*)host;
@end

View File

@ -18,7 +18,7 @@
static const int numPorts = 5;
static const int ports[numPorts] = {7, 9, 47998, 47999, 48000};
+ (void) wakeHost:(Host*)host {
+ (void) wakeHost:(TemporaryHost*)host {
NSData* wolPayload = [WakeOnLanManager createPayload:host];
CFDataRef dataPayload = CFDataCreate(kCFAllocatorDefault, [wolPayload bytes], [wolPayload length]);
CFSocketRef wolSocket = CFSocketCreate(kCFAllocatorDefault, PF_INET, SOCK_DGRAM, IPPROTO_UDP, 0, NULL, NULL);
@ -56,7 +56,7 @@ static const int ports[numPorts] = {7, 9, 47998, 47999, 48000};
CFRelease(dataPayload);
}
+ (NSData*) createPayload:(Host*)host {
+ (NSData*) createPayload:(TemporaryHost*)host {
NSMutableData* payload = [[NSMutableData alloc] initWithCapacity:102];
// 6 bytes of FF

View File

@ -7,17 +7,17 @@
//
#import <UIKit/UIKit.h>
#import "App.h"
#import "TemporaryApp.h"
@protocol AppCallback <NSObject>
- (void) appClicked:(App*) app;
- (void) appClicked:(TemporaryApp*) app;
@end
@interface UIAppView : UIView
- (id) initWithApp:(App*)app cache:(NSCache*)cache andCallback:(id<AppCallback>)callback;
- (id) initWithApp:(TemporaryApp*)app cache:(NSCache*)cache andCallback:(id<AppCallback>)callback;
- (void) updateAppImage;
@end

View File

@ -9,7 +9,7 @@
#import "UIAppView.h"
@implementation UIAppView {
App* _app;
TemporaryApp* _app;
UIButton* _appButton;
UILabel* _appLabel;
UIImageView* _appOverlay;
@ -19,7 +19,7 @@
static UIImage* noImage;
- (id) initWithApp:(App*)app cache:(NSCache*)cache andCallback:(id<AppCallback>)callback {
- (id) initWithApp:(TemporaryApp*)app cache:(NSCache*)cache andCallback:(id<AppCallback>)callback {
self = [super init];
_app = app;
_callback = callback;

View File

@ -7,19 +7,19 @@
//
#import <UIKit/UIKit.h>
#import "Host.h"
#import "TemporaryHost.h"
@protocol HostCallback <NSObject>
- (void) hostClicked:(Host*)host view:(UIView*)view;
- (void) hostLongClicked:(Host*)host view:(UIView*)view;
- (void) hostClicked:(TemporaryHost*)host view:(UIView*)view;
- (void) hostLongClicked:(TemporaryHost*)host view:(UIView*)view;
- (void) addHostClicked;
@end
@interface UIComputerView : UIView
- (id) initWithComputer:(Host*)host andCallback:(id<HostCallback>)callback;
- (id) initWithComputer:(TemporaryHost*)host andCallback:(id<HostCallback>)callback;
- (id) initForAddWithCallback:(id<HostCallback>)callback;
@end

View File

@ -9,7 +9,7 @@
#import "UIComputerView.h"
@implementation UIComputerView {
Host* _host;
TemporaryHost* _host;
UIButton* _hostButton;
UILabel* _hostLabel;
UILabel* _hostStatus;
@ -72,7 +72,7 @@ static const int LABEL_DY = 20;
return self;
}
- (id) initWithComputer:(Host*)host andCallback:(id<HostCallback>)callback {
- (id) initWithComputer:(TemporaryHost*)host andCallback:(id<HostCallback>)callback {
self = [self init];
_host = host;
_callback = callback;
@ -123,7 +123,7 @@ static const int LABEL_DY = 20;
self.frame = CGRectMake(x, y, width, height);
}
- (void) updateContentsForHost:(Host*)host {
- (void) updateContentsForHost:(TemporaryHost*)host {
_hostLabel.text = _host.name;
_hostLabel.textColor = [UIColor whiteColor];
[_hostLabel sizeToFit];

View File

@ -15,7 +15,6 @@
#import "Utils.h"
#import "UIComputerView.h"
#import "UIAppView.h"
#import "App.h"
#import "SettingsViewController.h"
#import "DataManager.h"
#import "Settings.h"
@ -30,7 +29,7 @@
@implementation MainFrameViewController {
NSOperationQueue* _opQueue;
Host* _selectedHost;
TemporaryHost* _selectedHost;
NSString* _uniqueId;
NSData* _cert;
DiscoveryManager* _discMan;
@ -80,7 +79,7 @@ static NSMutableSet* hostList;
// Capture the host here because it can change once we
// leave the main thread
Host* host = _selectedHost;
TemporaryHost* host = _selectedHost;
if ([host.appList count] > 0) {
usingCachedAppList = true;
@ -159,11 +158,11 @@ static NSMutableSet* hostList;
});
}
- (void) mergeAppLists:(NSArray*) newList forHost:(Host*)host {
- (void) mergeAppLists:(NSArray*) newList forHost:(TemporaryHost*)host {
DataManager* database = [[DataManager alloc] init];
for (TemporaryApp* app in newList) {
BOOL appAlreadyInList = NO;
for (App* savedApp in host.appList) {
for (TemporaryApp* savedApp in host.appList) {
if ([app.id isEqualToString:savedApp.id]) {
savedApp.name = app.name;
savedApp.isRunning = app.isRunning;
@ -181,9 +180,9 @@ static NSMutableSet* hostList;
do {
appWasRemoved = NO;
for (App* app in host.appList) {
for (TemporaryApp* app in host.appList) {
appWasRemoved = YES;
for (App* mergedApp in newList) {
for (TemporaryApp* mergedApp in newList) {
if ([mergedApp.id isEqualToString:app.id]) {
appWasRemoved = NO;
break;
@ -212,7 +211,7 @@ static NSMutableSet* hostList;
[self.view addSubview:hostScrollView];
}
- (void) receivedAssetForApp:(App*)app {
- (void) receivedAssetForApp:(TemporaryApp*)app {
// Update the box art cache now so we don't have to do it
// on the main thread
[self updateBoxArtCacheForApp:app];
@ -230,7 +229,7 @@ static NSMutableSet* hostList;
[self presentViewController:alert animated:YES completion:nil];
}
- (void) hostClicked:(Host *)host view:(UIView *)view {
- (void) hostClicked:(TemporaryHost *)host view:(UIView *)view {
// Treat clicks on offline hosts to be long clicks
// This shows the context menu with wake, delete, etc. rather
// than just hanging for a while and failing as we would in this
@ -296,7 +295,7 @@ static NSMutableSet* hostList;
});
}
- (void)hostLongClicked:(Host *)host view:(UIView *)view {
- (void)hostLongClicked:(TemporaryHost *)host view:(UIView *)view {
Log(LOG_D, @"Long clicked host: %@", host.name);
UIAlertController* longClickAlert = [UIAlertController alertControllerWithTitle:host.name message:@"" preferredStyle:UIAlertControllerStyleActionSheet];
if (!host.online) {
@ -322,8 +321,8 @@ static NSMutableSet* hostList;
[dataMan removeHost:host];
@synchronized(hostList) {
[hostList removeObject:host];
[self updateAllHosts:[hostList allObjects]];
}
[self updateAllHosts:[hostList allObjects]];
}]];
[longClickAlert addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil]];
@ -345,7 +344,7 @@ static NSMutableSet* hostList;
[alertController addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction* action){
NSString* hostAddress = ((UITextField*)[[alertController textFields] objectAtIndex:0]).text;
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
[_discMan discoverHost:hostAddress withCallback:^(Host* host, NSString* error){
[_discMan discoverHost:hostAddress withCallback:^(TemporaryHost* host, NSString* error){
if (host != nil) {
DataManager* dataMan = [[DataManager alloc] init];
[dataMan saveData];
@ -369,7 +368,7 @@ static NSMutableSet* hostList;
[self presentViewController:alertController animated:YES completion:nil];
}
- (void) appClicked:(App *)app {
- (void) appClicked:(TemporaryApp *)app {
Log(LOG_D, @"Clicked app: %@", app.name);
_streamConfig = [[StreamConfiguration alloc] init];
_streamConfig.host = app.host.activeAddress;
@ -389,7 +388,7 @@ static NSMutableSet* hostList;
[[self revealViewController] revealToggle:self];
}
App* currentApp = [self findRunningApp:app.host];
TemporaryApp* currentApp = [self findRunningApp:app.host];
if (currentApp != nil) {
UIAlertController* alertController = [UIAlertController
alertControllerWithTitle: app.name
@ -455,8 +454,8 @@ static NSMutableSet* hostList;
}
}
- (App*) findRunningApp:(Host*)host {
for (App* app in host.appList) {
- (TemporaryApp*) findRunningApp:(TemporaryHost*)host {
for (TemporaryApp* app in host.appList) {
if (app.isRunning) {
return app;
}
@ -605,7 +604,7 @@ static NSMutableSet* hostList;
[hostList addObjectsFromArray:hosts];
// Initialize the non-persistent host state
for (Host* host in hostList) {
for (TemporaryHost* host in hostList) {
if (host.activeAddress == nil) {
host.activeAddress = host.localAddress;
}
@ -622,7 +621,7 @@ static NSMutableSet* hostList;
- (void) updateAllHosts:(NSArray *)hosts {
dispatch_async(dispatch_get_main_queue(), ^{
Log(LOG_D, @"New host list:");
for (Host* host in hosts) {
for (TemporaryHost* host in hosts) {
Log(LOG_D, @"Host: \n{\n\t name:%@ \n\t address:%@ \n\t localAddress:%@ \n\t externalAddress:%@ \n\t uuid:%@ \n\t mac:%@ \n\t pairState:%d \n\t online:%d \n\t activeAddress:%@ \n}", host.name, host.address, host.localAddress, host.externalAddress, host.uuid, host.mac, host.pairState, host.online, host.activeAddress);
}
@synchronized(hostList) {
@ -642,7 +641,7 @@ static NSMutableSet* hostList;
@synchronized (hostList) {
// Sort the host list in alphabetical order
NSArray* sortedHostList = [[hostList allObjects] sortedArrayUsingSelector:@selector(compareName:)];
for (Host* comp in sortedHostList) {
for (TemporaryHost* comp in sortedHostList) {
compView = [[UIComputerView alloc] initWithComputer:comp andCallback:self];
compView.center = CGPointMake([self getCompViewX:compView addComp:addComp prevEdge:prevEdge], hostScrollView.frame.size.height / 2);
prevEdge = compView.frame.origin.x + compView.frame.size.width;
@ -667,7 +666,7 @@ static NSMutableSet* hostList;
// This function forces immediate decoding of the UIImage, rather
// than the default lazy decoding that results in janky scrolling.
+ (UIImage*) loadBoxArtForCaching:(App*)app {
+ (UIImage*) loadBoxArtForCaching:(TemporaryApp*)app {
CGImageSourceRef source = CGImageSourceCreateWithData((__bridge CFDataRef)app.image, NULL);
CGImageRef cgImage = CGImageSourceCreateImageAtIndex(source, 0, (__bridge CFDictionaryRef)@{(id)kCGImageSourceShouldCacheImmediately: (id)kCFBooleanTrue});
@ -680,7 +679,7 @@ static NSMutableSet* hostList;
return boxArt;
}
- (void) updateBoxArtCacheForApp:(App*)app {
- (void) updateBoxArtCacheForApp:(TemporaryApp*)app {
if (app.image == nil) {
[_boxArtCache removeObjectForKey:app];
}
@ -689,7 +688,7 @@ static NSMutableSet* hostList;
}
}
- (void) updateAppsForHost:(Host*)host {
- (void) updateAppsForHost:(TemporaryHost*)host {
if (host != _selectedHost) {
Log(LOG_W, @"Mismatched host during app update");
return;
@ -715,12 +714,12 @@ static NSMutableSet* hostList;
// Start 2 jobs
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
for (App* app in firstHalf) {
for (TemporaryApp* app in firstHalf) {
[self updateBoxArtCacheForApp:app];
}
});
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
for (App* app in secondHalf) {
for (TemporaryApp* app in secondHalf) {
[self updateBoxArtCacheForApp:app];
}
});
@ -732,7 +731,7 @@ static NSMutableSet* hostList;
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
UICollectionViewCell* cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"AppCell" forIndexPath:indexPath];
App* app = _sortedAppList[indexPath.row];
TemporaryApp* app = _sortedAppList[indexPath.row];
UIAppView* appView = [[UIAppView alloc] initWithApp:app cache:_boxArtCache andCallback:self];
[appView updateAppImage];

View File

@ -9,6 +9,7 @@
/* Begin PBXBuildFile section */
9832D1361BBCD5C50036EF48 /* TemporaryApp.m in Sources */ = {isa = PBXBuildFile; fileRef = 9832D1351BBCD5C50036EF48 /* TemporaryApp.m */; };
987140041B04542F00AB57D5 /* libmoonlight-common.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FB1E43101AE8B0F200AFF679 /* libmoonlight-common.a */; };
98D5856D1C0EA79600F6CC00 /* TemporaryHost.m in Sources */ = {isa = PBXBuildFile; fileRef = 98D5856C1C0EA79600F6CC00 /* TemporaryHost.m */; };
9E5D600B1A5A5A3900689918 /* Apache License.txt in Resources */ = {isa = PBXBuildFile; fileRef = 9E5D5FF81A5A5A3900689918 /* Apache License.txt */; };
9E5D600C1A5A5A3900689918 /* Roboto-Black.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9E5D5FF91A5A5A3900689918 /* Roboto-Black.ttf */; };
9E5D600E1A5A5A3900689918 /* Roboto-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9E5D5FFB1A5A5A3900689918 /* Roboto-Bold.ttf */; };
@ -98,6 +99,8 @@
9832D1341BBCD5C50036EF48 /* TemporaryApp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TemporaryApp.h; path = Database/TemporaryApp.h; sourceTree = "<group>"; };
9832D1351BBCD5C50036EF48 /* TemporaryApp.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TemporaryApp.m; path = Database/TemporaryApp.m; sourceTree = "<group>"; };
98A03B4519F3514B00861ACA /* moonlight-common.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = "moonlight-common.xcodeproj"; path = "limelight-common-c/moonlight-common.xcodeproj"; sourceTree = "<group>"; };
98D5856B1C0EA79600F6CC00 /* TemporaryHost.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TemporaryHost.h; path = Database/TemporaryHost.h; sourceTree = "<group>"; };
98D5856C1C0EA79600F6CC00 /* TemporaryHost.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TemporaryHost.m; path = Database/TemporaryHost.m; sourceTree = "<group>"; };
9E5D5FF81A5A5A3900689918 /* Apache License.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "Apache License.txt"; sourceTree = "<group>"; };
9E5D5FF91A5A5A3900689918 /* Roboto-Black.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Roboto-Black.ttf"; sourceTree = "<group>"; };
9E5D5FFB1A5A5A3900689918 /* Roboto-Bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Roboto-Bold.ttf"; sourceTree = "<group>"; };
@ -733,6 +736,8 @@
FBD349611A0089F6002D2A60 /* DataManager.m */,
9832D1341BBCD5C50036EF48 /* TemporaryApp.h */,
9832D1351BBCD5C50036EF48 /* TemporaryApp.m */,
98D5856B1C0EA79600F6CC00 /* TemporaryHost.h */,
98D5856C1C0EA79600F6CC00 /* TemporaryHost.m */,
);
name = Database;
sourceTree = "<group>";
@ -855,6 +860,7 @@
FB89462D19F646E200339C8A /* MDNSManager.m in Sources */,
FB89462B19F646E200339C8A /* StreamView.m in Sources */,
FB4678FA1A55FFAD00377732 /* DiscoveryManager.m in Sources */,
98D5856D1C0EA79600F6CC00 /* TemporaryHost.m in Sources */,
FB89463519F646E200339C8A /* MainFrameViewController.m in Sources */,
FBD1C8E21A8AD71400C6703C /* Logger.m in Sources */,
FB1D599A1BBCCD7E00F482CA /* AppCollectionView.m in Sources */,