From f843acf12fb11a4ef7edae4e0755bf308a369ddc Mon Sep 17 00:00:00 2001 From: TrueZhuanjia Date: Sun, 20 Jul 2025 10:43:27 +0800 Subject: [PATCH] - hostView & host card fixes: add unpaired offline host to collection --- VoidLink/HostCardView.m | 14 ++++++++++---- .../ViewControllers/MainFrameViewController.m | 15 ++++++--------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/VoidLink/HostCardView.m b/VoidLink/HostCardView.m index b89c0ba5..3a1b1d0e 100644 --- a/VoidLink/HostCardView.m +++ b/VoidLink/HostCardView.m @@ -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]; diff --git a/VoidLink/ViewControllers/MainFrameViewController.m b/VoidLink/ViewControllers/MainFrameViewController.m index afd95aad..ab79384f 100644 --- a/VoidLink/ViewControllers/MainFrameViewController.m +++ b/VoidLink/ViewControllers/MainFrameViewController.m @@ -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) {