瀏覽代碼

change option on id

Marino Faggiana 8 年之前
父節點
當前提交
4d188f7a8c
共有 3 個文件被更改,包括 34 次插入6 次删除
  1. 1 0
      iOSClient/CCGlobal.h
  2. 1 1
      iOSClient/FileSystem/CCMetadata.h
  3. 32 5
      iOSClient/Networking/OCNetworking.m

+ 1 - 0
iOSClient/CCGlobal.h

@@ -218,6 +218,7 @@ extern NSString *const BKPasscodeKeychainServiceName;
 #define actionSettingFavorite                           @"settingFavorite"
 #define actionShare                                     @"share"
 #define actionShareWith                                 @"shareWith"
+#define actionSubscribingNextcloudServer                @"subscribingNextcloudServer"
 #define actionUnShare                                   @"unShare"
 #define actionUpdateShare                               @"updateShare"
 #define actionUploadFile                                @"uploadFile"

+ 1 - 1
iOSClient/FileSystem/CCMetadata.h

@@ -86,7 +86,7 @@
 @property (nonatomic, strong) NSString *fileNamePrint;
 @property (nonatomic, strong) NSString *identifier;
 @property (nonatomic, strong) CCMetadata *metadata;
-@property (nonatomic, strong) NSString *options;
+@property (nonatomic, strong) id options;
 @property (nonatomic, strong) NSString *password;
 @property (nonatomic, strong) NSString *pathFolder;
 @property NSInteger priority;

+ 32 - 5
iOSClient/Networking/OCNetworking.m

@@ -235,12 +235,13 @@
     NSInteger width = 0, height = 0;
     
     NSString *directoryUser = [CCUtility getDirectoryActiveUser:_activeUser activeUrl:_activeUrl];
+    NSString *dimOfThumbnail = (NSString *)_metadataNet.options;
     
-    if ([_metadataNet.options.lowercaseString isEqualToString:@"xs"])      { width = 32;   height = 32;  ext = @"ico"; }
-    else if ([_metadataNet.options.lowercaseString isEqualToString:@"s"])  { width = 64;   height = 64;  ext = @"ico"; }
-    else if ([_metadataNet.options.lowercaseString isEqualToString:@"m"])  { width = 128;  height = 128; ext = @"ico"; }
-    else if ([_metadataNet.options.lowercaseString isEqualToString:@"l"])  { width = 640;  height = 640; ext = @"pvw"; }
-    else if ([_metadataNet.options.lowercaseString isEqualToString:@"xl"]) { width = 1024; height = 1024; ext = @"pvw"; }
+    if ([dimOfThumbnail.lowercaseString isEqualToString:@"xs"])      { width = 32;   height = 32;  ext = @"ico"; }
+    else if ([dimOfThumbnail.lowercaseString isEqualToString:@"s"])  { width = 64;   height = 64;  ext = @"ico"; }
+    else if ([dimOfThumbnail.lowercaseString isEqualToString:@"m"])  { width = 128;  height = 128; ext = @"ico"; }
+    else if ([dimOfThumbnail.lowercaseString isEqualToString:@"l"])  { width = 640;  height = 640; ext = @"pvw"; }
+    else if ([dimOfThumbnail.lowercaseString isEqualToString:@"xl"]) { width = 1024; height = 1024; ext = @"pvw"; }
     
     if ([[NSFileManager defaultManager] fileExistsAtPath:[NSString stringWithFormat:@"%@/%@.%@", directoryUser, _metadataNet.fileNameLocal, ext]]) {
         
@@ -1217,6 +1218,32 @@
     }];
 }
 
+- (void)subscribingNextcloudServer
+{
+    OCCommunication *communication = [CCNetworking sharedNetworking].sharedOCCommunication;
+    
+    [communication setCredentialsWithUser:_activeUser andPassword:_activePassword];
+    [communication setUserAgent:[CCUtility getUserAgent]];
+    
+    [communication subscribingNextcloudServerPush:_metadataNet.serverUrl pushTokenHash:@"" devicePublicKey:@"" onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
+        
+        [self complete];
+        
+    } failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
+        
+        NSInteger errorCode = response.statusCode;
+        if (errorCode == 0)
+            errorCode = error.code;
+    
+        // Request trusted certificated
+        if ([error code] == NSURLErrorServerCertificateUntrusted)
+            [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:[error localizedDescription] viewController:(UIViewController *)self.delegate delegate:self];
+        
+        [self complete];
+    }];
+
+}
+
 #pragma --------------------------------------------------------------------------------------------
 #pragma mark =====  User Profile =====
 #pragma --------------------------------------------------------------------------------------------