fix unable to remove on-line paired host
This commit is contained in:
1 parent
b106e60880
commit
8371c9fedd
1 file changed
+39
-6
@@ -554,7 +554,7 @@ static NSMutableSet* hostList;
|
|||||||
}]];
|
}]];
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
[longClickAlert addAction:[UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"Remove Host"] style:UIAlertActionStyleDestructive handler:^(UIAlertAction* action) {
|
[longClickAlert addAction:[UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"Remove Host"] style:UIAlertActionStyleDestructive handler:^(UIAlertAction* action) { // host removed here
|
||||||
[self->_discMan removeHostFromDiscovery:host];
|
[self->_discMan removeHostFromDiscovery:host];
|
||||||
DataManager* dataMan = [[DataManager alloc] init];
|
DataManager* dataMan = [[DataManager alloc] init];
|
||||||
[dataMan removeHost:host];
|
[dataMan removeHost:host];
|
||||||
@@ -1108,9 +1108,41 @@ static NSMutableSet* hostList;
|
|||||||
|
|
||||||
//recordedScreenWidth = CGRectGetWidth([[UIScreen mainScreen] bounds]);
|
//recordedScreenWidth = CGRectGetWidth([[UIScreen mainScreen] bounds]);
|
||||||
hostScrollView = [[ComputerScrollView alloc] init];
|
hostScrollView = [[ComputerScrollView alloc] init];
|
||||||
[self reloadScrollHostView];
|
CGFloat screenWidthInPoints = CGRectGetWidth([[UIScreen mainScreen] bounds]);
|
||||||
if ([hostList count] == 1) [self hostClicked:[hostList anyObject] view:nil]; //move auto click here from reloadScrollHostView, resolving select new host bug.
|
CGFloat screenHeightInPoints = CGRectGetHeight([[UIScreen mainScreen] bounds]);
|
||||||
|
|
||||||
|
// deal with scroll host view reload after device orientation change here:
|
||||||
|
bool isLandscape = screenWidthInPoints > screenHeightInPoints;
|
||||||
|
CGFloat realViewFrameWidth = self.view.frame.size.width > self.view.frame.size.height ? self.view.frame.size.width : self.view.frame.size.height;
|
||||||
|
CGFloat realViewFrameHeight = self.view.frame.size.width < self.view.frame.size.height ? self.view.frame.size.width : self.view.frame.size.height;
|
||||||
|
if(!isLandscape) {
|
||||||
|
CGFloat tmpLength = realViewFrameWidth;
|
||||||
|
realViewFrameWidth = realViewFrameHeight;
|
||||||
|
realViewFrameHeight = tmpLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
// implementations for initializing hostScrollView from original moonlight-iOS
|
||||||
|
hostScrollView.frame = CGRectMake(0, self.navigationController.navigationBar.frame.origin.y + self.navigationController.navigationBar.frame.size.height, realViewFrameWidth, realViewFrameHeight / 2);
|
||||||
|
[hostScrollView setShowsHorizontalScrollIndicator:NO];
|
||||||
|
hostScrollView.delaysContentTouches = NO;
|
||||||
|
|
||||||
|
self.collectionView.delaysContentTouches = NO;
|
||||||
|
self.collectionView.allowsMultipleSelection = NO;
|
||||||
|
#if !TARGET_OS_TV
|
||||||
|
self.collectionView.multipleTouchEnabled = NO;
|
||||||
|
#else
|
||||||
|
// This is the only way to get long press events on a UICollectionViewCell :(
|
||||||
|
UILongPressGestureRecognizer* cellLongPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleCollectionViewLongPress:)];
|
||||||
|
cellLongPress.delaysTouchesBegan = YES;
|
||||||
|
[self.collectionView addGestureRecognizer:cellLongPress];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
[self retrieveSavedHosts];
|
||||||
|
_discMan = [[DiscoveryManager alloc] initWithHosts:[hostList allObjects] andCallback:self];
|
||||||
|
[self updateTitle];
|
||||||
|
[self.view addSubview:hostScrollView];
|
||||||
|
|
||||||
|
if ([hostList count] == 1) [self hostClicked:[hostList anyObject] view:nil]; // auto click for single host
|
||||||
//if([SettingsViewController isLandscapeNow] != _streamConfig.width > _streamConfig.height)
|
//if([SettingsViewController isLandscapeNow] != _streamConfig.width > _streamConfig.height)
|
||||||
//[self simulateSettingsButtonPress]; //force expand setting view if orientation changed since last quit from app.
|
//[self simulateSettingsButtonPress]; //force expand setting view if orientation changed since last quit from app.
|
||||||
//[self simulateSettingsButtonPress]; //force expand setting view if orientation changed since last quit from app.
|
//[self simulateSettingsButtonPress]; //force expand setting view if orientation changed since last quit from app.
|
||||||
@@ -1123,7 +1155,7 @@ static NSMutableSet* hostList;
|
|||||||
}
|
}
|
||||||
|
|
||||||
-(void)reloadScrollHostView{
|
-(void)reloadScrollHostView{
|
||||||
[hostScrollView removeFromSuperview];
|
[hostScrollView removeFromSuperview]; // mandatory for scroll view refresh after orientation change and clicking "select new host"
|
||||||
CGFloat screenWidthInPoints = CGRectGetWidth([[UIScreen mainScreen] bounds]);
|
CGFloat screenWidthInPoints = CGRectGetWidth([[UIScreen mainScreen] bounds]);
|
||||||
CGFloat screenHeightInPoints = CGRectGetHeight([[UIScreen mainScreen] bounds]);
|
CGFloat screenHeightInPoints = CGRectGetHeight([[UIScreen mainScreen] bounds]);
|
||||||
|
|
||||||
@@ -1152,8 +1184,9 @@ static NSMutableSet* hostList;
|
|||||||
[self.collectionView addGestureRecognizer:cellLongPress];
|
[self.collectionView addGestureRecognizer:cellLongPress];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
[self retrieveSavedHosts];
|
// the reloadScrollHostView method cannnot copy what all viewDidLoad does for initializing the host scroll view, the following 2 lines of codes must be annotated, or there'll be issues with deleting hosts.
|
||||||
_discMan = [[DiscoveryManager alloc] initWithHosts:[hostList allObjects] andCallback:self];
|
//[self retrieveSavedHosts];
|
||||||
|
//_discMan = [[DiscoveryManager alloc] initWithHosts:[hostList allObjects] andCallback:self];
|
||||||
[self updateTitle];
|
[self updateTitle];
|
||||||
[self.view addSubview:hostScrollView];
|
[self.view addSubview:hostScrollView];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user