mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-05 03:53:44 +02:00
Fix for deleted networks not being removed from the network details list on macOS
This commit is contained in:
parent
cdc289fa9c
commit
9a6c3e05ad
1 changed files with 28 additions and 0 deletions
|
@ -58,8 +58,36 @@ BOOL hasNetworkWithID(NSArray<Network*> *list, UInt64 nwid)
|
||||||
self.visible = NO;
|
self.visible = NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSInteger)findNetworkWithID:(UInt64)networkId
|
||||||
|
{
|
||||||
|
for(int i = 0; i < [_networkList count]; ++i) {
|
||||||
|
Network *nw = [_networkList objectAtIndex:i];
|
||||||
|
|
||||||
|
if(nw.nwid == networkId) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NSNotFound;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void)deleteNetworkFromList:(NSString *)nwid {
|
- (void)deleteNetworkFromList:(NSString *)nwid {
|
||||||
[self.netMonitor deleteSavedNetwork:nwid];
|
[self.netMonitor deleteSavedNetwork:nwid];
|
||||||
|
|
||||||
|
UInt64 netid = 0;
|
||||||
|
NSScanner *scanner = [NSScanner scannerWithString:nwid];
|
||||||
|
[scanner scanHexLongLong:&netid];
|
||||||
|
for (Network *n in _networkList) {
|
||||||
|
if (n.nwid == netid) {
|
||||||
|
NSInteger index = [self findNetworkWithID:netid];
|
||||||
|
|
||||||
|
if (index != NSNotFound) {
|
||||||
|
[_networkList removeObjectAtIndex:index];
|
||||||
|
[_tableView reloadData];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setNetworks:(NSArray<Network *> *)list {
|
- (void)setNetworks:(NSArray<Network *> *)list {
|
||||||
|
|
Loading…
Add table
Reference in a new issue