mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2025-07-04 00:36:23 +00:00
Allow existing host to be updated via the Add PC dialog
This commit is contained in:
parent
5aff719984
commit
b15d61a5bf
@ -95,14 +95,23 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) addHostToDiscovery:(TemporaryHost *)host {
|
- (BOOL) addHostToDiscovery:(TemporaryHost *)host {
|
||||||
if (host.uuid.length > 0 && ![self isHostInDiscovery:host]) {
|
if (host.uuid.length == 0) {
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
TemporaryHost *existingHost = [self getHostInDiscovery:host.uuid];
|
||||||
|
if (existingHost != nil) {
|
||||||
|
// Update address of existing host
|
||||||
|
existingHost.address = existingHost.activeAddress = host.address;
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
else {
|
||||||
[_hostQueue addObject:host];
|
[_hostQueue addObject:host];
|
||||||
if (shouldDiscover) {
|
if (shouldDiscover) {
|
||||||
[_opQueue addOperation:[self createWorkerForHost:host]];
|
[_opQueue addOperation:[self createWorkerForHost:host]];
|
||||||
}
|
}
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
return NO;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) removeHostFromDiscovery:(TemporaryHost *)host {
|
- (void) removeHostFromDiscovery:(TemporaryHost *)host {
|
||||||
@ -133,14 +142,14 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) isHostInDiscovery:(TemporaryHost*)host {
|
- (TemporaryHost*) getHostInDiscovery:(NSString*)uuidString {
|
||||||
for (int i = 0; i < _hostQueue.count; i++) {
|
for (int i = 0; i < _hostQueue.count; i++) {
|
||||||
TemporaryHost* discoveredHost = [_hostQueue objectAtIndex:i];
|
TemporaryHost* discoveredHost = [_hostQueue objectAtIndex:i];
|
||||||
if (discoveredHost.uuid.length > 0 && [discoveredHost.uuid isEqualToString:host.uuid]) {
|
if (discoveredHost.uuid.length > 0 && [discoveredHost.uuid isEqualToString:uuidString]) {
|
||||||
return YES;
|
return discoveredHost;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NO;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSOperation*) createWorkerForHost:(TemporaryHost*)host {
|
- (NSOperation*) createWorkerForHost:(TemporaryHost*)host {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user