Cleanup unneccessary error handling in the updatePasswordImage function
This commit is contained in:
parent
f0eb9c47ed
commit
9a3131943f
1 changed files with 8 additions and 19 deletions
|
|
@ -322,27 +322,16 @@ class PasswordDetailTableViewController: UITableViewController, UIGestureRecogni
|
||||||
newUrlString = "https://\(urlString)"
|
newUrlString = "https://\(urlString)"
|
||||||
}
|
}
|
||||||
|
|
||||||
guard let url = URL(string: newUrlString) else {
|
try? FavIcon.downloadPreferred(newUrlString) { [weak self] result in
|
||||||
return
|
if case let .success(image) = result {
|
||||||
}
|
let indexPath = IndexPath(row: 0, section: 0)
|
||||||
|
self?.passwordImage = image
|
||||||
do {
|
self?.tableView.reloadRows(at: [indexPath], with: UITableViewRowAnimation.automatic)
|
||||||
try FavIcon.downloadPreferred(url) { [weak self] result in
|
let imageData = UIImageJPEGRepresentation(image, 1)
|
||||||
switch result {
|
if let entity = self?.passwordEntity {
|
||||||
case .success(let image):
|
self?.passwordStore.updateImage(passwordEntity: entity, image: imageData)
|
||||||
let indexPath = IndexPath(row: 0, section: 0)
|
|
||||||
self?.passwordImage = image
|
|
||||||
self?.tableView.reloadRows(at: [indexPath], with: UITableViewRowAnimation.automatic)
|
|
||||||
let imageData = UIImageJPEGRepresentation(image, 1)
|
|
||||||
if let entity = self?.passwordEntity {
|
|
||||||
self?.passwordStore.updateImage(passwordEntity: entity, image: imageData)
|
|
||||||
}
|
|
||||||
case .failure(let error):
|
|
||||||
print(error)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch {
|
|
||||||
print(error)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue