marinofaggiana 4 years ago
parent
commit
5a854d06b3

+ 2 - 2
Cartfile.resolved

@@ -8,7 +8,7 @@ github "SwiftyJSON/SwiftyJSON" "5.0.0"
 github "WeTransfer/WeScan" "1.2.0"
 github "WenchaoD/FSCalendar" "2.8.0"
 github "dzenbot/DZNEmptyDataSet" "v1.8.1"
-github "getsentry/sentry-cocoa" "5.1.4"
+github "getsentry/sentry-cocoa" "5.1.5"
 github "huri000/QuickLayout" "3.0.0"
 github "huri000/SwiftEntryKit" "1.2.3"
 github "ivanbruel/MarkdownKit" "1.6"
@@ -20,7 +20,7 @@ github "marinofaggiana/AFNetworking" "2967678c3e0e98c9b8d7e06222ad12d1f49c26f2"
 github "marinofaggiana/KTVHTTPCache" "2.0.2"
 github "marinofaggiana/TOPasscodeViewController" "0.0.7"
 github "marinofaggiana/XLForm" "eb9381ad8129f60402bf412250fb31b95a628a08"
-github "nextcloud/ios-communication-library" "fe6097b8a7c75ec96a7a6303cf55bfc60ee53ead"
+github "nextcloud/ios-communication-library" "da73ae3c8e30eb2d8470d6ce6ecfaac1ca898e5a"
 github "realm/realm-cocoa" "v5.0.3"
 github "rechsteiner/Parchment" "v1.7.0"
 github "scenee/FloatingPanel" "v1.7.5"

+ 3 - 3
iOSClient/Share/NCShare.swift

@@ -154,14 +154,14 @@ class NCShare: UIViewController, UIGestureRecognizerDelegate, NCShareLinkCellDel
             alertController.addAction(UIAlertAction(title: NSLocalizedString("_cancel_", comment: ""), style: .default) { (action:UIAlertAction) in })
             let okAction = UIAlertAction(title: NSLocalizedString("_ok_", comment: ""), style: .default) { (action:UIAlertAction) in
                 let password = alertController.textFields?.first?.text
-                self.networking?.shareLink(password: password ?? "")
+                self.networking?.createShareLink(password: password ?? "")
             }
             okAction.isEnabled = false
             alertController.addAction(okAction)
             
             self.present(alertController, animated: true, completion:nil)
         } else if shares.firstShareLink == nil {
-            networking?.shareLink(password: "")
+            networking?.createShareLink(password: "")
         } else {
             tapMenu(with: shares.firstShareLink!, sender: sender)
         }
@@ -301,7 +301,7 @@ class NCShare: UIViewController, UIGestureRecognizerDelegate, NCShareLinkCellDel
         
         dropDown.selectionAction = { [weak self] (index, item) in
             let sharee = sharees[index]
-            self!.networking?.share(name: sharee.label, shareType: sharee.shareType, metadata: self!.metadata!)
+            self!.networking?.createShare(name: sharee.label, shareType: sharee.shareType, metadata: self!.metadata!)
         }
         
         dropDown.show()

+ 1 - 1
iOSClient/Share/NCShareLinkMenuView.swift

@@ -371,7 +371,7 @@ class NCShareLinkMenuView: UIView, UIGestureRecognizerDelegate, NCShareNetworkin
     // Add another link
     @IBAction func buttonAddAnotherLink(sender: UIButton) {
         
-        networking?.shareLink(password: "")
+        networking?.createShareLink(password: "")
     }
     
     // MARK: - Delegate networking

+ 19 - 20
iOSClient/Share/NCShareNetworking.swift

@@ -20,6 +20,8 @@
 //  You should have received a copy of the GNU General Public License
 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+ //NotificationCenter.default.postOnMainThread(name: k_notificationCenter_reloadDataSource, userInfo: ["serverUrl":self.metadata.serverUrl])
+
 import Foundation
 import NCCommunication
 
@@ -48,8 +50,6 @@ class NCShareNetworking: NSObject {
              if errorCode == 0 && shares != nil {
                 NCManageDatabase.sharedInstance.addShare(account: self.metadata.account, activeUrl: self.activeUrl, shares: shares!)
                 self.appDelegate.shares = NCManageDatabase.sharedInstance.getTableShares(account: self.metadata.account)
-                self.appDelegate.activeMain?.tableView?.reloadData()
-                self.appDelegate.activeFavorites?.tableView?.reloadData()
             } else {
                 NCContentPresenter.shared.messageNotification("_share_", description: errorDescription, delay: TimeInterval(k_dismissAfterSecond), type: NCContentPresenter.messageType.error, errorCode: 0)
             }
@@ -57,7 +57,7 @@ class NCShareNetworking: NSObject {
         }
     }
     
-    func shareLink(password: String?) {
+    func createShareLink(password: String?) {
         NCUtility.sharedInstance.startActivityIndicator(view: view)
         let filenamePath = CCUtility.returnFileNamePath(fromFileName: metadata.fileName, serverUrl: metadata.serverUrl, activeUrl: activeUrl)!
         NCCommunication.shared.createShareLink(path: filenamePath, password: password) { (account, share, errorCode, errorDescription) in
@@ -65,7 +65,6 @@ class NCShareNetworking: NSObject {
             if errorCode == 0 && share != nil {
                 NCManageDatabase.sharedInstance.addShare(account: self.metadata.account, activeUrl: self.activeUrl, shares: [share!])
                 self.appDelegate.shares = NCManageDatabase.sharedInstance.getTableShares(account: self.metadata.account)
-                NotificationCenter.default.postOnMainThread(name: k_notificationCenter_reloadDataSource, userInfo: ["serverUrl":self.metadata.serverUrl])
             } else if errorCode != 0 {
                 NCContentPresenter.shared.messageNotification("_share_", description: errorDescription, delay: TimeInterval(k_dismissAfterSecond), type: NCContentPresenter.messageType.error, errorCode: 0)
             }
@@ -73,6 +72,22 @@ class NCShareNetworking: NSObject {
         }
     }
     
+    func createShare(name: String, shareType: Int, metadata: tableMetadata) {
+        NCUtility.sharedInstance.startActivityIndicator(view: view)
+        let filenamePath = CCUtility.returnFileNamePath(fromFileName: metadata.fileName, serverUrl: metadata.serverUrl, activeUrl: activeUrl)!
+        var permission: Int = 1
+        if metadata.directory { permission = Int(k_max_folder_share_permission) } else { permission = Int(k_max_file_share_permission) }
+        NCCommunication.shared.createShare(path: filenamePath, shareType: shareType, shareWith: name, permissions: permission) { (account, share, errorCode, errorDescription) in
+            NCUtility.sharedInstance.stopActivityIndicator()
+            if errorCode == 0 && share != nil {
+                NCManageDatabase.sharedInstance.addShare(account: self.metadata.account, activeUrl: self.activeUrl, shares: [share!])
+                self.appDelegate.shares = NCManageDatabase.sharedInstance.getTableShares(account: self.metadata.account)
+            } else {
+                NCContentPresenter.shared.messageNotification("_share_", description: errorDescription, delay: TimeInterval(k_dismissAfterSecond), type: NCContentPresenter.messageType.error, errorCode: 0)
+            }
+        }
+    }
+    
     func unShare(idShare: Int) {
         NCUtility.sharedInstance.startActivityIndicator(view: view)
         NCCommunication.shared.deleteShare(idShare: idShare) { (account, errorCode, errorDescription) in
@@ -113,22 +128,6 @@ class NCShareNetworking: NSObject {
             }
         }
     }
-    
-    func share(name: String, shareType: Int, metadata: tableMetadata) {
-        NCUtility.sharedInstance.startActivityIndicator(view: view)
-        let filenamePath = CCUtility.returnFileNamePath(fromFileName: metadata.fileName, serverUrl: metadata.serverUrl, activeUrl: activeUrl)!
-        var permission: Int = 1
-        if metadata.directory { permission = Int(k_max_folder_share_permission) } else { permission = Int(k_max_file_share_permission) }
-        NCCommunication.shared.createShare(path: filenamePath, shareType: shareType, shareWith: name, permissions: permission) { (account, share, errorCode, errorDescription) in
-            NCUtility.sharedInstance.stopActivityIndicator()
-            if errorCode == 0 && share != nil {
-                NCManageDatabase.sharedInstance.addShare(account: self.metadata.account, activeUrl: self.activeUrl, shares: [share!])
-                self.appDelegate.shares = NCManageDatabase.sharedInstance.getTableShares(account: self.metadata.account)
-            } else {
-                NCContentPresenter.shared.messageNotification("_share_", description: errorDescription, delay: TimeInterval(k_dismissAfterSecond), type: NCContentPresenter.messageType.error, errorCode: 0)
-            }
-        }
-    }
 }
 
 protocol NCShareNetworkingDelegate {