Browse Source

new view share

marinofaggiana 5 years ago
parent
commit
1a8684dafb

+ 1 - 1
iOSClient/CCGlobal.h

@@ -81,7 +81,7 @@
 
 // Database Realm
 #define k_databaseDefault                               @"nextcloud.realm"
-#define k_databaseSchemaVersion                         56
+#define k_databaseSchemaVersion                         57
 
 // Intro selector
 #define k_intro_login                                   0

+ 0 - 2
iOSClient/Database/NCDatabase.swift

@@ -398,9 +398,7 @@ class tableShare: Object {
     @objc dynamic var permissions: Int = 0
     @objc dynamic var serverUrl = ""
     @objc dynamic var sharedDate: NSDate? = nil
-    @objc dynamic var shareLink = ""
     @objc dynamic var shareType: Int = 0
-    @objc dynamic var shareUserAndGroup = ""
     @objc dynamic var shareWith = ""
     @objc dynamic var shareWithDisplayName = ""
     @objc dynamic var storage: Int = 0

+ 2 - 3
iOSClient/Select/NCSelect.swift

@@ -164,10 +164,9 @@ class NCSelect: UIViewController, UIGestureRecognizerDelegate, NCListCellDelegat
             collectionView.collectionViewLayout = gridLayout
         }
         
-        // get shares
-        shares = NCManageDatabase.sharedInstance.getTableShares(account: appDelegate.activeAccount, serverUrl: serverUrl)
-        
         loadDatasource(withLoadFolder: true)
+
+        shares = NCManageDatabase.sharedInstance.getTableShares(account: appDelegate.activeAccount, serverUrl: serverUrl)
     }
     
     override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {

+ 9 - 9
iOSClient/Share/NCShare.swift

@@ -336,7 +336,7 @@ extension NCShare: UITableViewDataSource {
         let shares = NCManageDatabase.sharedInstance.getTableShares(metadata: metadata!)
         let tableShare = shares.share![indexPath.row]
         
-        if tableShare.shareLink != "" {
+        if tableShare.shareType == Int(shareTypeLink.rawValue) {
             if let cell = tableView.dequeueReusableCell(withIdentifier: "cellLink", for: indexPath) as? NCShareLinkCell {
                 cell.tableShare = tableShare
                 cell.delegate = self
@@ -463,39 +463,39 @@ class NCShareLinkMenuView: UIView, UIGestureRecognizerDelegate {
         
         // Allow editing
         if tableShare != nil && tableShare!.permissions > 1 {
-            switchAllowEditing.setOn(true, animated: true)
+            switchAllowEditing.setOn(true, animated: false)
         } else {
-            switchAllowEditing.setOn(false, animated: true)
+            switchAllowEditing.setOn(false, animated: false)
         }
         
         // Hide download
         if tableShare != nil && tableShare!.hideDownload {
-            switchHideDownload.setOn(true, animated: true)
+            switchHideDownload.setOn(true, animated: false)
         } else {
-            switchHideDownload.setOn(false, animated: true)
+            switchHideDownload.setOn(false, animated: false)
         }
         
         // Password protect
         if tableShare != nil && tableShare!.shareWith.count > 0 {
-            switchPasswordProtect.setOn(true, animated: true)
+            switchPasswordProtect.setOn(true, animated: false)
             fieldPasswordProtect.isEnabled = true
             fieldPasswordProtect.text = tableShare!.shareWith
         } else {
-            switchPasswordProtect.setOn(false, animated: true)
+            switchPasswordProtect.setOn(false, animated: false)
             fieldPasswordProtect.isEnabled = false
             fieldPasswordProtect.text = ""
         }
         
         // Set expiration date
         if tableShare != nil && tableShare!.expirationDate != nil {
-            switchSetExpirationDate.setOn(true, animated: true)
+            switchSetExpirationDate.setOn(true, animated: false)
             switchSetExpirationDate.isEnabled = true
             let dateFormatter = DateFormatter()
             dateFormatter.formatterBehavior = .behavior10_4
             dateFormatter.dateStyle = .short
             fieldSetExpirationDate.text = dateFormatter.string(from: tableShare!.expirationDate! as Date)
         } else {
-            switchSetExpirationDate.setOn(false, animated: true)
+            switchSetExpirationDate.setOn(false, animated: false)
             switchSetExpirationDate.isEnabled = false
             fieldSetExpirationDate.text = ""
         }

+ 2 - 1
iOSClient/Shares/NCShares.m

@@ -180,13 +180,14 @@
 {
     NSString *shareString;
     
+      /*
     // Unshare Link
     if (tableShare.shareLink.length > 0) {
         
         shareString = tableShare.shareLink;
     }
     
-    /*
+  
     // Unshare User&Group
     NSArray *shareUserAndGroup = [tableShare.shareUserAndGroup componentsSeparatedByString:@","];
     for (NSString *share in shareUserAndGroup) {