ソースを参照

fix and ready for NC 15

Marino Faggiana 6 年 前
コミット
d59eb4aa2d

+ 3 - 0
iOSClient/CCGlobal.h

@@ -329,6 +329,9 @@
 #define k_layout_view_trash                             @"LayoutTrash"
 #define k_layout_view_offline                           @"LayoutOffline"
 
+// Nextcloud version
+#define k_nextcloud_version_15_0                        15
+
 // -----------------------------------------------------------------------------------------------------------
 // -----------------------------------------------------------------------------------------------------------
 

+ 2 - 1
iOSClient/Library/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.m

@@ -709,7 +709,8 @@ NSString const *OCWebDAVModificationDateKey	= @"modificationdate";
     } else if (permissions > 0) {
         self.postStringForShare = [NSString stringWithFormat:@"permissions=%ld",(long)permissions];
     } else {
-        self.postStringForShare = [NSString stringWithFormat:@"hidedownload=%i",hideDownload];
+        if (hideDownload) self.postStringForShare = [NSString stringWithFormat:@"hideDownload=true"];
+        else self.postStringForShare = [NSString stringWithFormat:@"hideDownload=false"];
     }
     
     [request setHTTPBody:[_postStringForShare dataUsingEncoding:NSUTF8StringEncoding]];

+ 3 - 1
iOSClient/Library/OCCommunicationLib/OCWebDavClient/Parsers/OCXMLSharedParser.m

@@ -195,7 +195,9 @@
             _currentShared.shareWithDisplayName = @"";
         }
         
-    } 
+    } else if ([elementName isEqualToString:@"hide_download"]) {
+        _currentShared.hideDownload = [_xmlChars boolValue];
+    }
 }
 
 - (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string {

+ 7 - 6
iOSClient/Share/CCShareOC.m

@@ -73,12 +73,13 @@
     [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
     [section addFormRow:row];
  
-#if TARGET_OS_SIMULATOR
-    row = [XLFormRowDescriptor formRowDescriptorWithTag:@"hideDownload" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_share_link_hide_download_", nil)];
-    [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
-    [section addFormRow:row];
-#endif
-    
+    tableCapabilities *capabilities = [[NCManageDatabase sharedInstance] getCapabilites];
+    if (capabilities != nil && capabilities.versionMajor >= k_nextcloud_version_15_0) {
+        row = [XLFormRowDescriptor formRowDescriptorWithTag:@"hideDownload" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_share_link_hide_download_", nil)];
+        [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
+        [section addFormRow:row];
+    }
+        
     // Expiration date
     
     section = [XLFormSectionDescriptor formSection];