|
@@ -174,6 +174,13 @@ class ListGroupImages: UIViewController, UITableViewDataSource, UITableViewDeleg
|
|
|
blurEffectView.frame = CGRect(x: 0, y: 0, width: containerImages.frame.size.width, height: containerImages.frame.size.height)
|
|
|
blurEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
|
|
|
containerImages.addSubview(blurEffectView)
|
|
|
+ let imageDownload = UIImageView(image: UIImage(systemName: "arrow.down.circle.fill", withConfiguration: UIImage.SymbolConfiguration(pointSize: 50, weight: .bold, scale: .default)))
|
|
|
+ containerImages.addSubview(blurEffectView)
|
|
|
+ containerImages.addSubview(imageDownload)
|
|
|
+ imageDownload.tintColor = .black.withAlphaComponent(0.3)
|
|
|
+ imageDownload.translatesAutoresizingMaskIntoConstraints = false
|
|
|
+ imageDownload.centerXAnchor.constraint(equalTo: containerImages.centerXAnchor).isActive = true
|
|
|
+ imageDownload.centerYAnchor.constraint(equalTo: containerImages.centerYAnchor).isActive = true
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -317,6 +324,33 @@ class ListGroupImages: UIViewController, UITableViewDataSource, UITableViewDeleg
|
|
|
viewMultipleSelect.subviews.forEach({ $0.removeFromSuperview() })
|
|
|
addSubviewMultipleSelect()
|
|
|
tableView.reloadRows(at: [indexPath], with: .none)
|
|
|
+ } else {
|
|
|
+ let nsDocumentDirectory = FileManager.SearchPathDirectory.documentDirectory
|
|
|
+ let nsUserDomainMask = FileManager.SearchPathDomainMask.userDomainMask
|
|
|
+ let paths = NSSearchPathForDirectoriesInDomains(nsDocumentDirectory, nsUserDomainMask, true)
|
|
|
+ if let dirPath = paths.first {
|
|
|
+ let imageId = listGroupingImages[indexPath.row].imageId
|
|
|
+ let imageURL = URL(fileURLWithPath: dirPath).appendingPathComponent(imageId)
|
|
|
+ if !FileManager.default.fileExists(atPath: imageURL.path) {
|
|
|
+ Download().startHTTP(forKey: listGroupingImages[indexPath.row].imageId) { (name, progress) in
|
|
|
+ guard progress == 100 else {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ let imageURL = URL(fileURLWithPath: dirPath).appendingPathComponent(self.listGroupingImages[indexPath.row].imageId)
|
|
|
+ let image = UIImage(contentsOfFile: imageURL.path)
|
|
|
+ let save = UserDefaults.standard.bool(forKey: "saveToGallery")
|
|
|
+ if save {
|
|
|
+ UIImageWriteToSavedPhotosAlbum(image!, nil, nil, nil)
|
|
|
+ }
|
|
|
+
|
|
|
+ DispatchQueue.main.async { [self] in
|
|
|
+ tableView.reloadRows(at: [indexPath], with: .none)
|
|
|
+ updateEditor!(listGroupingImages, [:], false)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|