- hostView & host card fixes: add unpaired offline host to collection

This commit is contained in:
TrueZhuanjia
2025-07-20 10:43:27 +08:00
parent 25c4ca01de
commit f843acf12f
2 changed files with 16 additions and 13 deletions
+10 -4
View File
@@ -573,8 +573,12 @@ static const float REFRESH_CYCLE = 2.0f;
} else {
self.statusIcon.hidden = YES;
}
bool hostPaired = host.pairState == PairStatePaired;
_hostIconView.tintColor = [ThemeManager lowProfileGray];
lockIconView.hidden = YES;
lockIconView.tintColor = [ThemeManager lowProfileGray];
lockIconView.hidden = hostPaired;
_appButton.hidden = YES;
_launchButton.hidden = YES;
_pairButton.hidden = YES;
@@ -583,13 +587,15 @@ static const float REFRESH_CYCLE = 2.0f;
if (@available(iOS 13.0, *)) {
UIImageSymbolConfiguration *config = [UIImageSymbolConfiguration configurationWithPointSize:buttonHeight/3.45 weight:UIImageSymbolWeightBold];
UIImage *templateImage = [UIImage systemImageNamed:@"power" withConfiguration:config];
UIImage *coloredImage = [templateImage imageWithTintColor:defaultBlue renderingMode:UIImageRenderingModeAlwaysOriginal];
UIImage *coloredImage = [templateImage imageWithTintColor:hostPaired ? defaultBlue : [ThemeManager textColorGray] renderingMode:UIImageRenderingModeAlwaysOriginal];
[self.wakeupButton setImage:coloredImage forState:UIControlStateNormal];
} else {
// Fallback on earlier versions
}
self.wakeupButton.backgroundColor = [ThemeManager textTintColorWithAlpha];
[self.wakeupButton setTitleColor:defaultBlue forState:UIControlStateNormal];
self.wakeupButton.backgroundColor = hostPaired ? [ThemeManager textTintColorWithAlpha] : [[ThemeManager textColorGray] colorWithAlphaComponent:0.2];
[self.wakeupButton setTitleColor: hostPaired ? defaultBlue : [ThemeManager textColorGray] forState:UIControlStateNormal];
break;
case StateUnknown:
_hostSpinner.color = [UIColor whiteColor];
@@ -1544,10 +1544,11 @@ static NSMutableSet* hostList;
#endif
[self updateTitle];
// [self.view addSubview:hostScrollView];
// if ([hostList count] == 1) [self hostClicked:[hostList anyObject] view:nil]; // auto click for single host
[self retrieveSavedHosts];
_discMan = [[DiscoveryManager alloc] initWithHosts:[hostList allObjects] andCallback:self];
//if([SettingsViewController isLandscapeNow] != _streamConfig.width > _streamConfig.height)
//[self simulateSettingsButtonPress]; //force expand setting view if orientation changed since last quit from app.
@@ -1809,11 +1810,6 @@ static NSMutableSet* hostList;
[self.view addSubview:self.collectionView];
[self initHostCollection];
if(!_enteredAppView) [self switchToHostView];
[self retrieveSavedHosts];
_discMan = [[DiscoveryManager alloc] initWithHosts:[hostList allObjects] andCallback:self];
}
- (void)viewDidDisappear:(BOOL)animated
@@ -1903,7 +1899,8 @@ static NSMutableSet* hostList;
NSArray* sortedHostList = [[hostList allObjects] sortedArrayUsingSelector:@selector(compareName:)];
for (TemporaryHost* comp in sortedHostList) {
if(comp.state == StateOnline || comp.pairState == PairStatePaired || comp.pairState == PairStateUnknown) [self.hostCollectionVC addHost:comp];
// if(comp.state == StateOnline || comp.pairState == PairStatePaired || comp.pairState == PairStateUnknown) [self.hostCollectionVC addHost:comp];
[self.hostCollectionVC addHost:comp];
// Start jobs to decode the box art in advance
for (TemporaryApp* app in comp.appList) {