- make wakeup button available as long as the host has valid mac address
This commit is contained in:
1 parent
7b9bbba3fd
commit
a44e9c87d7
2 files changed
+8
-4
No files matched your search
@@ -522,6 +522,7 @@ static const float REFRESH_CYCLE = 2.0f;
|
|||||||
backgroundLayer.hidden = !(host.state == StateOnline && host.pairState == PairStatePaired);
|
backgroundLayer.hidden = !(host.state == StateOnline && host.pairState == PairStatePaired);
|
||||||
|
|
||||||
BOOL hostPaired = host.pairState == PairStatePaired;
|
BOOL hostPaired = host.pairState == PairStatePaired;
|
||||||
|
bool hasValidMac = host.mac != nil && ![host.mac isEqualToString:@"00:00:00:00:00:00"];
|
||||||
|
|
||||||
switch (host.state) {
|
switch (host.state) {
|
||||||
case StateOnline:
|
case StateOnline:
|
||||||
@@ -628,8 +629,8 @@ static const float REFRESH_CYCLE = 2.0f;
|
|||||||
} else {
|
} else {
|
||||||
// Fallback on earlier versions
|
// Fallback on earlier versions
|
||||||
}
|
}
|
||||||
self.wakeupButton.backgroundColor = hostPaired ? [ThemeManager textTintColorWithAlpha] : [[ThemeManager textColorGray] colorWithAlphaComponent:0.2];
|
self.wakeupButton.backgroundColor = hasValidMac ? [ThemeManager textTintColorWithAlpha] : [[ThemeManager textColorGray] colorWithAlphaComponent:0.2];
|
||||||
[self.wakeupButton setTitleColor: hostPaired ? defaultBlue : [ThemeManager textColorGray] forState:UIControlStateNormal];
|
[self.wakeupButton setTitleColor: hasValidMac ? defaultBlue : [ThemeManager textColorGray] forState:UIControlStateNormal];
|
||||||
break;
|
break;
|
||||||
default:break;
|
default:break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -409,10 +409,13 @@ static NSMutableSet* hostList;
|
|||||||
|
|
||||||
- (void)wakeupButtonTappedForHost:(TemporaryHost *)host{
|
- (void)wakeupButtonTappedForHost:(TemporaryHost *)host{
|
||||||
_selectedHost = host;
|
_selectedHost = host;
|
||||||
if ((host.state == StateOffline || host.state == StateUnknown) && host.pairState == PairStatePaired) {
|
bool hasValidMac = host.mac != nil && ![host.mac isEqualToString:@"00:00:00:00:00:00"];
|
||||||
|
|
||||||
|
if ((host.state == StateOffline || host.state == StateUnknown)) {
|
||||||
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 (!hasValidMac) {
|
||||||
wolAlert.message = [LocalizationHelper localizedStringForKey: @"Host MAC unknown, unable to send WOL Packet"];
|
wolAlert.message = [LocalizationHelper localizedStringForKey: @"Host MAC unknown, unable to send WOL Packet"];
|
||||||
} else {
|
} else {
|
||||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||||
|
|||||||
Reference in new issue
Block a user