Skip to content

Commit 844f2b7

Browse files
committed
v1.0.1 (2): Now prevents duplicate rows when repeating the discovery process
1 parent a237820 commit 844f2b7

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

Resources/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838
<key>CFBundlePackageType</key>
3939
<string>APPL</string>
4040
<key>CFBundleShortVersionString</key>
41-
<string>1.0</string>
41+
<string>1.0.1</string>
4242
<key>CFBundleVersion</key>
43-
<string>1</string>
43+
<string>2</string>
4444
<key>LSApplicationCategoryType</key>
4545
<string>public.app-category.utilities</string>
4646
<key>LSMinimumSystemVersion</key>

SSDPDocument.m

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,15 @@ - (void)discoveryDidFindWithUuid:(NSString * _Nonnull)uuid name:(NSString * _Non
100100
}
101101
TreeNode *node = [self makeTreeNodeFrom:data withName:name];
102102
node.value = uuid;
103-
self.model.children = [self.model.children arrayByAddingObject:node];
103+
NSMutableArray *existing = self.model.children.mutableCopy;
104+
for (TreeNode *child in existing) { // remove existing entry in order to avoid duplicates when we repeat discovery
105+
if ([child.name isEqualToString:node.name] && [child.value isEqualToString:node.value]) {
106+
[existing removeObject:child];
107+
break;
108+
}
109+
}
110+
[existing addObject:node];
111+
self.model.children = existing;
104112
}
105113

106114
- (void)discoveryDidFinish {

0 commit comments

Comments
 (0)