Skip to content

Commit

Permalink
v1.0.1 (2): Now prevents duplicate rows when repeating the discovery …
Browse files Browse the repository at this point in the history
…process
  • Loading branch information
tempelmann committed Feb 28, 2024
1 parent a237820 commit 844f2b7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Resources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.0.1</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>2</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
Expand Down
10 changes: 9 additions & 1 deletion SSDPDocument.m
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,15 @@ - (void)discoveryDidFindWithUuid:(NSString * _Nonnull)uuid name:(NSString * _Non
}
TreeNode *node = [self makeTreeNodeFrom:data withName:name];
node.value = uuid;
self.model.children = [self.model.children arrayByAddingObject:node];
NSMutableArray *existing = self.model.children.mutableCopy;
for (TreeNode *child in existing) { // remove existing entry in order to avoid duplicates when we repeat discovery
if ([child.name isEqualToString:node.name] && [child.value isEqualToString:node.value]) {
[existing removeObject:child];
break;
}
}
[existing addObject:node];
self.model.children = existing;
}

- (void)discoveryDidFinish {
Expand Down

0 comments on commit 844f2b7

Please sign in to comment.