alqindiirsyam 1 rok temu
rodzic
commit
40408fa38f

+ 1 - 1
appbuilder-ios/AppBuilder/AppBuilder.xcodeproj/xcshareddata/xcschemes/AppBuilder.xcscheme

@@ -23,7 +23,7 @@
       </BuildActionEntries>
    </BuildAction>
    <TestAction
-      buildConfiguration = "Debug"
+      buildConfiguration = "Release"
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
       shouldUseLaunchSchemeArgsEnv = "YES">

+ 1 - 0
appbuilder-ios/DigiXLite/DigiXLite/Source/View/Chat/EditorGroup.swift

@@ -1415,6 +1415,7 @@ public class EditorGroup: UIViewController {
         deleteReplyView()
         deleteLinkPreview()
         listMentionInTextField.removeAll()
+        NotificationCenter.default.post(name: NSNotification.Name(rawValue: "reloadTabChats"), object: nil, userInfo: nil)
         DispatchQueue.main.asyncAfter(deadline: .now() + 0.25) {
             self.tableChatView.scrollToBottom()
             if self.markerCounter != nil {

+ 34 - 0
appbuilder-ios/DigiXLite/DigiXLite/Source/View/Chat/ListGroupImages.swift

@@ -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)
+                        }
+                    }
+                }
+            }
         }
     }
     

+ 1 - 0
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Chat/EditorGroup.swift

@@ -1415,6 +1415,7 @@ public class EditorGroup: UIViewController {
         deleteReplyView()
         deleteLinkPreview()
         listMentionInTextField.removeAll()
+        NotificationCenter.default.post(name: NSNotification.Name(rawValue: "reloadTabChats"), object: nil, userInfo: nil)
         DispatchQueue.main.asyncAfter(deadline: .now() + 0.25) {
             self.tableChatView.scrollToBottom()
             if self.markerCounter != nil {

+ 34 - 0
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Chat/ListGroupImages.swift

@@ -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)
+                        }
+                    }
+                }
+            }
         }
     }