Skip to content

Commit

Permalink
Add default local name and remote path (#306)
Browse files Browse the repository at this point in the history
  • Loading branch information
njooma authored Nov 26, 2024
1 parent c9bc4fa commit 9547947
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions lib/src/robot/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,23 @@ class RobotClient {
/// ```
Future<void> refresh() async {
final rpb.ResourceNamesResponse response = await _client.resourceNames(rpb.ResourceNamesRequest());
if (setEquals(response.resources.toSet(), resourceNames.toSet())) {
final responseNames = response.resources.map((rn) {
if (rn.remotePath.isEmpty) {
rn.remotePath.addAll(rn.name.split(':')..removeLast());
}
if (rn.localName.isEmpty) {
rn.localName = rn.name.split(':').last;
}
return rn;
});
if (setEquals(responseNames.toSet(), resourceNames.toSet())) {
resourceNames.forEach((element) {
_resetResourceChannel(element);
});
return;
}
final manager = ResourceManager();
for (ResourceName name in response.resources) {
for (ResourceName name in responseNames) {
if (![resourceTypeComponent, resourceTypeService].contains(name.type)) {
continue;
}
Expand All @@ -176,7 +185,7 @@ class RobotClient {
continue;
}
}
resourceNames = response.resources;
resourceNames = responseNames.toList();
if (_manager.resources != manager.resources) {
_manager = manager;
}
Expand Down

0 comments on commit 9547947

Please sign in to comment.