Skip to content

Commit

Permalink
ios: fix the double text in edit sale
Browse files Browse the repository at this point in the history
  • Loading branch information
foxfriends committed Feb 2, 2019
1 parent d4944a4 commit 3d96762
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
1 change: 0 additions & 1 deletion ios/ConArtist/Components/FancyTextField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ class FancyTextField: UITextField {
formattedLabel.textColor = textColor
formattedLabel.textAlignment = textAlignment

// TODO: should this be done with autolayout instead?
underlineView.leftAnchor.constraint(equalTo: leftAnchor, constant: 10).isActive = true
underlineView.rightAnchor.constraint(equalTo: rightAnchor, constant: -10).isActive = true
underlineView.bottomAnchor.constraint(equalTo: bottomAnchor).isActive = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,15 @@ extension ProductTypeListViewController {
noteLabel.font = noteLabel.font.usingFeatures([.smallCaps])
priceField.format = { Money.parse(as: ConArtist.model.settings.value.currency, $0)?.toString() ?? $0 }
if let record = editingRecord {
infoTextView.text = record.info
selected.accept(record.products.compactMap { id in products.value.first { product in product.id == id } })
priceField.text = "\(record.price.numericValue)"
money.accept(record.price)
DispatchQueue.main.async {
// this part is delayed so that the loading does not override the text field color
self.infoTextView.text = record.info
self.selected.accept(record.products.compactMap { id in
self.products.value.first { product in product.id == id }
})
self.priceField.text = "\(record.price.numericValue)"
self.money.accept(record.price)
}
}
startAdjustingForKeyboard()
}
Expand Down

0 comments on commit 3d96762

Please sign in to comment.