Skip to content

Commit

Permalink
Changed tag initializer
Browse files Browse the repository at this point in the history
  • Loading branch information
michalrentka committed Nov 28, 2023
1 parent e6e6dfe commit e42bade
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Zotero/Models/Tag.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ struct Tag: Identifiable, Equatable, Hashable {

var id: String { return self.name }

init(name: String, color: String, emojiGroup: String?) {
init(name: String, color: String) {
self.name = name
self.color = color
self.emojiGroup = emojiGroup
self.emojiGroup = EmojiExtractor.extractFirstContiguousGroup(from: name)
self.type = .manual
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct TagPickerActionHandler: ViewModelActionHandler {
private func add(name: String, in viewModel: ViewModel<TagPickerActionHandler>) {
guard let snapshot = viewModel.state.snapshot else { return }
self.update(viewModel: viewModel) { state in
let tag = Tag(name: name, color: "", emojiGroup: EmojiExtractor.extractFirstContiguousGroup(from: name))
let tag = Tag(name: name, color: "")
state.tags = snapshot

let index = state.tags.index(of: tag, sortedBy: { $0.name.caseInsensitiveCompare($1.name) == .orderedAscending })
Expand Down

0 comments on commit e42bade

Please sign in to comment.