Merge pull request #8 from xzzpig/wol
feat: Allow WOL during host detection
This commit is contained in:
2 files changed
+6
-7
No files matched your search
@@ -521,6 +521,8 @@ static const float REFRESH_CYCLE = 2.0f;
|
|||||||
_hostNameLabel.text = host.name;
|
_hostNameLabel.text = host.name;
|
||||||
backgroundLayer.hidden = !(host.state == StateOnline && host.pairState == PairStatePaired);
|
backgroundLayer.hidden = !(host.state == StateOnline && host.pairState == PairStatePaired);
|
||||||
|
|
||||||
|
BOOL hostPaired = host.pairState == PairStatePaired;
|
||||||
|
|
||||||
switch (host.state) {
|
switch (host.state) {
|
||||||
case StateOnline:
|
case StateOnline:
|
||||||
[_hostSpinner stopAnimating];
|
[_hostSpinner stopAnimating];
|
||||||
@@ -576,8 +578,6 @@ static const float REFRESH_CYCLE = 2.0f;
|
|||||||
self.statusIcon.hidden = YES;
|
self.statusIcon.hidden = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hostPaired = host.pairState == PairStatePaired;
|
|
||||||
|
|
||||||
_hostIconView.tintColor = [ThemeManager lowProfileGray];
|
_hostIconView.tintColor = [ThemeManager lowProfileGray];
|
||||||
lockIconView.tintColor = [ThemeManager lowProfileGray];
|
lockIconView.tintColor = [ThemeManager lowProfileGray];
|
||||||
lockIconView.hidden = hostPaired;
|
lockIconView.hidden = hostPaired;
|
||||||
@@ -620,17 +620,16 @@ static const float REFRESH_CYCLE = 2.0f;
|
|||||||
_pairButton.hidden = YES;
|
_pairButton.hidden = YES;
|
||||||
_wakeupButton.hidden = NO;
|
_wakeupButton.hidden = NO;
|
||||||
|
|
||||||
[_wakeupButton setTitleColor:[ThemeManager textColorGray] forState:UIControlStateNormal]; // theme
|
|
||||||
if (@available(iOS 13.0, *)) {
|
if (@available(iOS 13.0, *)) {
|
||||||
UIImageSymbolConfiguration *config = [UIImageSymbolConfiguration configurationWithPointSize:buttonHeight/3.45 weight:UIImageSymbolWeightBold];
|
UIImageSymbolConfiguration *config = [UIImageSymbolConfiguration configurationWithPointSize:buttonHeight/3.45 weight:UIImageSymbolWeightBold];
|
||||||
UIImage *templateImage = [UIImage systemImageNamed:@"power" withConfiguration:config];
|
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];
|
[self.wakeupButton setImage:coloredImage forState:UIControlStateNormal];
|
||||||
} else {
|
} else {
|
||||||
// Fallback on earlier versions
|
// Fallback on earlier versions
|
||||||
}
|
}
|
||||||
self.wakeupButton.backgroundColor = [[ThemeManager textColorGray] colorWithAlphaComponent:0.2];
|
self.wakeupButton.backgroundColor = hostPaired ? [ThemeManager textTintColorWithAlpha] : [[ThemeManager textColorGray] colorWithAlphaComponent:0.2];
|
||||||
[self.wakeupButton setTitleColor:[ThemeManager textColorGray] forState:UIControlStateNormal];
|
[self.wakeupButton setTitleColor: hostPaired ? defaultBlue : [ThemeManager textColorGray] forState:UIControlStateNormal];
|
||||||
break;
|
break;
|
||||||
default:break;
|
default:break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -409,7 +409,7 @@ static NSMutableSet* hostList;
|
|||||||
|
|
||||||
- (void)wakeupButtonTappedForHost:(TemporaryHost *)host{
|
- (void)wakeupButtonTappedForHost:(TemporaryHost *)host{
|
||||||
_selectedHost = 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];
|
UIAlertController* wolAlert = [UIAlertController alertControllerWithTitle:[LocalizationHelper localizedStringForKey:@"Wake-On-LAN"] message:@"" preferredStyle:UIAlertControllerStyleAlert];
|
||||||
[wolAlert addAction:[UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"Ok"] style:UIAlertActionStyleDefault handler:nil]];
|
[wolAlert addAction:[UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"Ok"] style:UIAlertActionStyleDefault handler:nil]];
|
||||||
if (host.mac == nil || [host.mac isEqualToString:@"00:00:00:00:00:00"]) {
|
if (host.mac == nil || [host.mac isEqualToString:@"00:00:00:00:00:00"]) {
|
||||||
|
|||||||
Reference in new issue
Block a user