message: Store tag in background (mac)
diff: @@ -25,10 +25,11 @@ extension Notification.Name {
  // MARK: Public
  func update(with viewItems: [ViewItem]) {
  - self.tags = build(from: viewItems)
  - print("==== Tag data source \(self.tags.map {$0.name})")
  - NotificationCenter.default.post(name: .TagStorageChangedNotification,
  - object: tags)
  + build(from: viewItems) {[weak self] tags in
  + guard let strongSelf = self else { return }
  + strongSelf.tags = tags
  + NotificationCenter.default.post(name: .TagStorageChangedNotification, object: tags)
  + }
  }
  func filter(with text: String) -> [Tag] {
  @@ -48,18 +49,23 @@ extension Notification.Name {
  extension TagStorage {
  - fileprivate func build(from viewItems: [ViewItem]) -> [Tag] {
  + fileprivate func build(from viewItems: [ViewItem], complete: @escaping ([Tag]) -> Void) {
  + DispatchQueue.global(qos: .background).async {[weak self] in
  + guard let strongSelf = self else { return }
  var tags = viewItems.map { Tag(viewItem: $0) }
  // We have to add new tags manually
  // It's a bug in Library
  // There is no new tags, even it synced properly, until we open the TimeEntryEditor again
  - newTags.forEach { tag in
  + strongSelf.newTags.forEach { tag in
  if !tags.contains(where: { $0.name == tag.name }) {
  tags.append(tag)
  }
  }
  - return tags
  + DispatchQueue.main.async {
  + complete(tags)
  + }
  + }
  }
  }
  