Merge pull request #8 from xzzpig/wol
feat: Allow WOL during host detection
This commit is contained in:
@@ -521,6 +521,8 @@ static const float REFRESH_CYCLE = 2.0f;
|
||||
_hostNameLabel.text = host.name;
|
||||
backgroundLayer.hidden = !(host.state == StateOnline && host.pairState == PairStatePaired);
|
||||
|
||||
BOOL hostPaired = host.pairState == PairStatePaired;
|
||||
|
||||
switch (host.state) {
|
||||
case StateOnline:
|
||||
[_hostSpinner stopAnimating];
|
||||
@@ -576,8 +578,6 @@ static const float REFRESH_CYCLE = 2.0f;
|
||||
self.statusIcon.hidden = YES;
|
||||
}
|
||||
|
||||
bool hostPaired = host.pairState == PairStatePaired;
|
||||
|
||||
_hostIconView.tintColor = [ThemeManager lowProfileGray];
|
||||
lockIconView.tintColor = [ThemeManager lowProfileGray];
|
||||
lockIconView.hidden = hostPaired;
|
||||
@@ -620,17 +620,16 @@ static const float REFRESH_CYCLE = 2.0f;
|
||||
_pairButton.hidden = YES;
|
||||
_wakeupButton.hidden = NO;
|
||||
|
||||
[_wakeupButton setTitleColor:[ThemeManager textColorGray] forState:UIControlStateNormal]; // theme
|
||||
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:[ThemeManager textColorGray] 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 textColorGray] colorWithAlphaComponent:0.2];
|
||||
[self.wakeupButton setTitleColor:[ThemeManager textColorGray] forState:UIControlStateNormal];
|
||||
self.wakeupButton.backgroundColor = hostPaired ? [ThemeManager textTintColorWithAlpha] : [[ThemeManager textColorGray] colorWithAlphaComponent:0.2];
|
||||
[self.wakeupButton setTitleColor: hostPaired ? defaultBlue : [ThemeManager textColorGray] forState:UIControlStateNormal];
|
||||
break;
|
||||
default:break;
|
||||
}
|
||||
|
||||
@@ -409,7 +409,7 @@ static NSMutableSet* hostList;
|
||||
|
||||
- (void)wakeupButtonTappedForHost:(TemporaryHost *)host{
|
||||
_selectedHost = host;
|
||||
if (host.state == StateOffline && host.pairState == PairStatePaired) {
|
||||
if ((host.state == StateOffline || host.state == StateUnknown) && host.pairState == PairStatePaired) {
|
||||
UIAlertController* wolAlert = [UIAlertController alertControllerWithTitle:[LocalizationHelper localizedStringForKey:@"Wake-On-LAN"] message:@"" preferredStyle:UIAlertControllerStyleAlert];
|
||||
[wolAlert addAction:[UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"Ok"] style:UIAlertActionStyleDefault handler:nil]];
|
||||
if (host.mac == nil || [host.mac isEqualToString:@"00:00:00:00:00:00"]) {
|
||||
|
||||
Reference in New Issue
Block a user