@@ -386,26 +386,30 @@ - (void) updateStatus {
386386
387387 BNCLogDebug (@" Start updateStatus." );
388388 BNCPerformBlockOnMainThreadAsync (^{ self.statusTextField .stringValue = @" " ; });
389- /*
390- NSMutableDictionary<NSString*, XGServer*>*statusServers = [NSMutableDictionary new];
391- for (XGAServer*server in XGASettings.shared.servers.objectEnumerator) {
392- if (server.server.length > 0)
393- statusServers[server.server] = server;
394- }
395- */
389+
390+ // Create new bots as needed:
396391 NSArray <XGAGitHubSyncTask*>* syncTasks = XGASettings.shared .gitHubSyncTasks ;
397392 NSDictionary <NSString *, XGServer*>*statusServers = XGASettings.shared .servers ;
398393 for (XGAGitHubSyncTask*task in syncTasks) {
399394 if (task.xcodeServer .length != 0 && statusServers[task.xcodeServer] != nil )
400395 [self updateSyncBots: task];
401396 }
397+
398+ // Update the status:
399+ NSMutableArray *statusArray = [NSMutableArray new ];
402400 for (XGAServer*server in statusServers.objectEnumerator ) {
403- [self updateXcodeServerStatus: server];
401+ NSArray *a = [self updateXcodeServerStatus: server];
402+ if (a) [statusArray addObjectsFromArray: a];
404403 }
405- if (syncTasks.count == 0 && statusServers.count == 0 ) {
406- // Update with 'nil' to add content for an empty display:
407- [self updateXcodeServerStatus: nil ];
404+ if (statusArray.count == 0 ) {
405+ XGAStatusViewItem *status = [XGAStatusViewItem new ];
406+ status.statusImage = [NSImage imageNamed: @" RoundBlue" ];
407+ status.statusSummary = [APFormattedString boldText: @" < No Xcode servers added yet >" ];
408+ [statusArray addObject: status];
408409 }
410+ BNCPerformBlockOnMainThreadAsync (^{
411+ self.arrayController .content = statusArray;
412+ });
409413 BNCLogDebug (@" End updateStatus." );
410414
411415 self.lastUpdateDate = [NSDate date ];
@@ -446,7 +450,7 @@ - (void) updateSyncBots:(XGAGitHubSyncTask*)syncTask {
446450 }
447451}
448452
449- - (void ) updateXcodeServerStatus : (XGServer*)server {
453+ - (NSArray * ) updateXcodeServerStatus : (XGServer*)server {
450454 NSError *error = nil ;
451455 NSMutableArray *statusArray = [NSMutableArray new ];
452456 if (server.server .length > 0 ) {
@@ -468,17 +472,12 @@ - (void) updateXcodeServerStatus:(XGServer*)server {
468472 }
469473 if (statusArray.count == 0 ) {
470474 XGAStatusViewItem *status = [XGAStatusViewItem new ];
475+ status.server = server.server ;
471476 status.statusImage = [NSImage imageNamed: @" RoundBlue" ];
472- if (server.server .length > 0 ) {
473- status.statusSummary = [APFormattedString boldText: @" < No Xcode bots found >" ];
474- } else {
475- status.statusSummary = [APFormattedString boldText: @" < No Xcode servers added yet >" ];
476- }
477+ status.statusSummary = [APFormattedString boldText: @" < No Xcode bots found >" ];
477478 [statusArray addObject: status];
478479 }
479- BNCPerformBlockOnMainThreadAsync (^{
480- self.arrayController .content = statusArray;
481- });
480+ return statusArray;
482481}
483482
484483@end
0 commit comments