mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-02-16 10:31:02 +00:00
fixed long clicking host on iPads and made applist appear immediately after the apps are known
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
@protocol HostCallback <NSObject>
|
||||
|
||||
- (void) hostClicked:(Host*)host;
|
||||
- (void) hostLongClicked:(Host*)host;
|
||||
- (void) hostLongClicked:(Host*)host view:(UIView*)view;
|
||||
- (void) addHostClicked;
|
||||
|
||||
@end
|
||||
|
||||
@@ -134,7 +134,7 @@ static const int LABEL_DY = 20;
|
||||
|
||||
|
||||
- (void) hostLongClicked {
|
||||
[_callback hostLongClicked:_host];
|
||||
[_callback hostLongClicked:_host view:self];
|
||||
}
|
||||
|
||||
- (void) hostClicked {
|
||||
|
||||
@@ -67,14 +67,15 @@ static StreamConfiguration* streamConfig;
|
||||
- (void)alreadyPaired {
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self updateApps];
|
||||
NSLog(@"Setting _computerNameButton.title: %@", _selectedHost.name);
|
||||
_computerNameButton.title = _selectedHost.name;
|
||||
});
|
||||
HttpManager* hMan = [[HttpManager alloc] initWithHost:_selectedHost.address uniqueId:_uniqueId deviceName:deviceName cert:_cert];
|
||||
NSData* appListResp = [hMan executeRequestSynchronously:[hMan newAppListRequest]];
|
||||
appList = [HttpManager getAppListFromXML:appListResp];
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self updateApps];
|
||||
});
|
||||
[AppManager retrieveAppAssets:appList withManager:hMan andCallback:self];
|
||||
});
|
||||
}
|
||||
@@ -117,7 +118,7 @@ static StreamConfiguration* streamConfig;
|
||||
});
|
||||
}
|
||||
|
||||
- (void)hostLongClicked:(Host *)host {
|
||||
- (void)hostLongClicked:(Host *)host view:(UIView *)view {
|
||||
NSLog(@"Long clicked host: %@", host.name);
|
||||
UIAlertController* longClickAlert = [UIAlertController alertControllerWithTitle:host.name message:@"" preferredStyle:UIAlertControllerStyleActionSheet];
|
||||
if (host.online) {
|
||||
@@ -145,14 +146,21 @@ static StreamConfiguration* streamConfig;
|
||||
}]];
|
||||
}
|
||||
[longClickAlert addAction:[UIAlertAction actionWithTitle:@"Remove Host" style:UIAlertActionStyleDestructive handler:^(UIAlertAction* action) {
|
||||
@synchronized(hostList) {
|
||||
[hostList removeObject:host];
|
||||
}
|
||||
[_discMan removeHostFromDiscovery:host];
|
||||
DataManager* dataMan = [[DataManager alloc] init];
|
||||
[dataMan removeHost:host];
|
||||
@synchronized(hostList) {
|
||||
[hostList removeObject:host];
|
||||
}
|
||||
[self updateAllHosts:[hostList allObjects]];
|
||||
|
||||
}]];
|
||||
[longClickAlert addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil]];
|
||||
|
||||
// these two lines are required for iPad support of UIAlertSheet
|
||||
longClickAlert.popoverPresentationController.sourceView = view;
|
||||
|
||||
longClickAlert.popoverPresentationController.sourceRect = CGRectMake(view.bounds.size.width / 2.0, view.bounds.size.height / 2.0, 1.0, 1.0); // center of the view
|
||||
[self presentViewController:longClickAlert animated:YES completion:^{
|
||||
[self updateHosts];
|
||||
}];
|
||||
|
||||
Reference in New Issue
Block a user