marinofaggiana 4 жил өмнө
parent
commit
81750b5974

+ 1 - 13
iOSClient/Networking/NCService.swift

@@ -90,19 +90,7 @@ class NCService: NSObject {
                             }
                         }
                     }
-                    /*
-                    OCNetworking.sharedManager()?.downloadContents(ofUrl: avatarUrl, completion: { (data, message, errorCode) in
-                        if errorCode == 0 {
-                            if let image = UIImage(data: data!) {
-                                try? FileManager.default.removeItem(atPath: fileNamePath)
-                                if let data = image.pngData() {
-                                    try? data.write(to: URL(fileURLWithPath: fileNamePath))
-                                }
-                            }
-                        }
-                    })
-                    */
-                    
+                  
                     DispatchQueue.main.async {
                         NotificationCenter.default.post(name: NSNotification.Name(rawValue: k_notificationCenter_changeUserProfile), object: nil)
                     }

+ 1 - 1
iOSClient/Networking/OCNetworking.h

@@ -44,7 +44,7 @@
 
 - (NSURLSessionTask *)downloadWithAccount:(NSString *)account fileNameServerUrl:(NSString *)fileNameServerUrl fileNameLocalPath:(NSString *)fileNameLocalPath encode:(BOOL)encode communication:(OCCommunication *)communication completion:(void (^)(NSString *account, int64_t length, NSString *etag, NSDate *date, NSString *message, NSInteger errorCode))completion;
 - (NSURLSessionTask *)downloadWithAccount:(NSString *)account url:(NSString *)url fileNameLocalPath:(NSString *)fileNameLocalPath encode:(BOOL)encode completion:(void (^)(NSString *account, NSString *message, NSInteger errorCode))completion;
-- (NSURLSessionTask *)uploadWithAccount:(NSString *)account fileNameServerUrl:(NSString *)fileNameServerUrl fileNameLocalPath:(NSString *)fileNameLocalPath encode:(BOOL)encode communication:(OCCommunication *)communication progress:(void(^)(NSProgress *progress))uploadProgress completion:(void(^)(NSString *account, NSString *ocId, NSString *etag, NSDate *date, NSString *message, NSInteger errorCode))completion;
+
 
 #pragma mark ===== Share =====
 

+ 0 - 424
iOSClient/Networking/OCNetworking.m

@@ -140,144 +140,6 @@
     }];
 }
 
-/*
-- (void)serverStatusUrl:(NSString *)serverUrl completion:(void(^)(NSString *serverProductName, NSInteger versionMajor, NSInteger versionMicro, NSInteger versionMinor, BOOL extendedSupport,NSString *message, NSInteger errorCode))completion
-{
-    NSString *urlTest = [serverUrl stringByAppendingString:k_serverStatus];
-    
-    // Remove stored cookies
-    NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
-    for (NSHTTPCookie *cookie in [storage cookies])
-    {
-        [storage deleteCookie:cookie];
-    }
-    
-    NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:urlTest] cachePolicy:0 timeoutInterval:20.0];
-    [request addValue:[CCUtility getUserAgent] forHTTPHeaderField:@"User-Agent"];
-    [request addValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
-    
-    NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
-    NSURLSession *session = [NSURLSession sessionWithConfiguration:configuration delegate:self delegateQueue:nil];
-    
-    NSURLSessionDataTask *task = [session dataTaskWithRequest:request completionHandler: ^(NSData *data, NSURLResponse *response, NSError *error) {
-        
-        if (error) {
-                
-            NSString *message;
-            NSInteger errorCode;
-                
-            NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse*)response;
-            errorCode = httpResponse.statusCode;
-                
-            if (errorCode == 0 || (errorCode >= 200 && errorCode < 300))
-                errorCode = error.code;
-                
-            // Error
-            if (errorCode == 503)
-                message = NSLocalizedString(@"_server_error_retry_", nil);
-            else
-                message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
-            
-            dispatch_sync(dispatch_get_main_queue(), ^{
-                completion(nil, 0, 0, 0, false, message, errorCode);
-            });
-            
-        } else {
-                
-            NSString *serverProductName = @"";
-            NSString *serverVersion = @"0.0.0";
-            NSString *serverVersionString = @"0.0.0";
-                
-            NSInteger versionMajor = 0;
-            NSInteger versionMicro = 0;
-            NSInteger versionMinor = 0;
-                
-            BOOL extendedSupport = FALSE;
-                
-            NSError *error;
-            NSDictionary *jsongParsed = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:&error];
-                
-            if (error) {
-                dispatch_sync(dispatch_get_main_queue(), ^{
-                    completion(nil, 0, 0, 0, extendedSupport, NSLocalizedString(@"_no_nextcloud_found_", nil), k_CCErrorInternalError);
-                });
-            } else {
-                
-                serverProductName = [[jsongParsed valueForKey:@"productname"] lowercaseString];
-                serverVersion = [jsongParsed valueForKey:@"version"];
-                serverVersionString = [jsongParsed valueForKey:@"versionstring"];
-                
-                NSArray *arrayVersion = [serverVersionString componentsSeparatedByString:@"."];
-                
-                if (arrayVersion.count == 1) {
-                    versionMajor = [arrayVersion[0] integerValue];
-                } else if (arrayVersion.count == 2) {
-                    versionMajor = [arrayVersion[0] integerValue];
-                    versionMinor = [arrayVersion[1] integerValue];
-                } else if (arrayVersion.count >= 3) {
-                    versionMajor = [arrayVersion[0] integerValue];
-                    versionMinor = [arrayVersion[1] integerValue];
-                    versionMicro = [arrayVersion[2] integerValue];
-                }
-                
-                extendedSupport = [[jsongParsed valueForKey:@"extendedSupport"] boolValue];
-                dispatch_sync(dispatch_get_main_queue(), ^{
-                    completion(serverProductName, versionMajor, versionMicro, versionMinor, extendedSupport, nil, 0);
-                });
-            }
-        }
-    }];
-    
-    [task resume];
-}
-*/
-/*
-- (void)downloadContentsOfUrl:(NSString *)serverUrl completion:(void(^)(NSData *data, NSString *message, NSInteger errorCode))completion
-{
-    // Remove stored cookies
-    NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
-    for (NSHTTPCookie *cookie in [storage cookies])
-    {
-        [storage deleteCookie:cookie];
-    }
-    
-    NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:serverUrl] cachePolicy:0 timeoutInterval:20.0];
-    [request addValue:[CCUtility getUserAgent] forHTTPHeaderField:@"User-Agent"];
-    [request addValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
-    
-    NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
-    NSURLSession *session = [NSURLSession sessionWithConfiguration:configuration delegate:self delegateQueue:nil];
-    
-    NSURLSessionDataTask *task = [session dataTaskWithRequest:request completionHandler: ^(NSData *data, NSURLResponse *response, NSError *error) {
-        dispatch_sync(dispatch_get_main_queue(), ^{
-            if (error) {
-                
-                NSString *message;
-                NSInteger errorCode;
-                
-                NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse*)response;
-                errorCode = httpResponse.statusCode;
-                
-                if (errorCode == 0 || (errorCode >= 200 && errorCode < 300))
-                    errorCode = error.code;
-                
-                // Error
-                if (errorCode == 503)
-                    message = NSLocalizedString(@"_server_error_retry_", nil);
-                else
-                    message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
-                
-                completion(nil, message, errorCode);
-            } else {
-                completion(data, nil, 0);
-            }
-        });
-    }];
-    
-    [task resume];
-}
-*/
-
 - (void)getAppPassword:(NSString *)serverUrl username:(NSString *)username password:(NSString *)password completion:(void(^)(NSString *token, NSString *message, NSInteger errorCode))completion
 {
     NSData *authData = [[NSString stringWithFormat:@"%@:%@", username, password] dataUsingEncoding:NSUTF8StringEncoding];
@@ -452,255 +314,6 @@
     return sessionTask;
 }
 
-- (NSURLSessionTask *)uploadWithAccount:(NSString *)account fileNameServerUrl:(NSString *)fileNameServerUrl fileNameLocalPath:(NSString *)fileNameLocalPath encode:(BOOL)encode communication:(OCCommunication *)communication progress:(void(^)(NSProgress *progress))uploadProgress completion:(void(^)(NSString *account, NSString *ocId, NSString *etag, NSDate *date, NSString *message, NSInteger errorCode))completion
-{    
-    tableAccount *tableAccount = [[NCManageDatabase sharedInstance] getAccountWithPredicate:[NSPredicate predicateWithFormat:@"account == %@", account]];
-    if (tableAccount == nil) {
-        completion(account, nil, nil, nil, NSLocalizedString(@"_error_user_not_available_", nil), k_CCErrorUserNotAvailble);
-    } else if ([CCUtility getPassword:account].length == 0) {
-        completion(account, nil, nil, nil, NSLocalizedString(@"_bad_username_password_", nil), kOCErrorServerUnauthorized);
-    } else if ([CCUtility getCertificateError:account]) {
-        completion(account, nil, nil, nil, NSLocalizedString(@"_ssl_certificate_untrusted_", nil), NSURLErrorServerCertificateUntrusted);
-    }
-    
-    [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:[CCUtility getPassword:account]];
-    [communication setUserAgent:[CCUtility getUserAgent]];
-    
-    NSURLSessionTask *sessionTask = [communication uploadFileSession:fileNameLocalPath toDestiny:fileNameServerUrl encode:encode onCommunication:communication progress:^(NSProgress *progress) {
-        uploadProgress(progress);
-        //float percent = roundf (progress.fractionCompleted * 100);
-    } successRequest:^(NSURLResponse *response, NSString *redirectedServer) {
-    
-        NSDictionary *fields = [(NSHTTPURLResponse*)response allHeaderFields];
-
-        NSString *ocId = [CCUtility removeForbiddenCharactersFileSystem:[fields objectForKey:@"OC-FileId"]];
-        NSString *etag = [CCUtility removeForbiddenCharactersFileSystem:[fields objectForKey:@"OC-ETag"]];
-        NSDate *date = [CCUtility dateEnUsPosixFromCloud:[fields objectForKey:@"Date"]];
-        
-        completion(account, ocId, etag, date, nil, 0);
-        
-    } failureRequest:^(NSURLResponse *response, NSString *redirectedServer, NSError *error) {
-        
-        NSString *message;
-        NSInteger errorCode = ((NSHTTPURLResponse*)response).statusCode;
-        
-        if (errorCode == 0 || (errorCode >= 200 && errorCode < 300))
-            errorCode = error.code;
-        
-        // Server Unauthorized
-        if (errorCode == kOCErrorServerUnauthorized || errorCode == kOCErrorServerForbidden) {
-#ifndef EXTENSION
-            [[NCNetworkingCheckRemoteUser shared] checkRemoteUserWithAccount:account];
-#endif
-        } else if (errorCode == NSURLErrorServerCertificateUntrusted) {
-            [CCUtility setCertificateError:account error:YES];
-        }
-        
-        // Error
-        if (errorCode == 503)
-            message = NSLocalizedString(@"_server_error_retry_", nil);
-        else
-            message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
-        
-        completion(account, nil, nil, nil, message, errorCode);
-        
-    } failureBeforeRequest:^(NSError *error) {
-        completion(account, nil, nil, nil, error.description, error.code);
-    }];
-    
-    return sessionTask;
-}
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ===== WebDav =====
-#pragma --------------------------------------------------------------------------------------------
-/*
-- (void)readFileWithAccount:(NSString *)account serverUrl:(NSString *)serverUrl fileName:(NSString *)fileName completion:(void(^)(NSString *account, tableMetadata *metadata, NSString *message, NSInteger errorCode))completion
-{
-    tableAccount *tableAccount = [[NCManageDatabase sharedInstance] getAccountWithPredicate:[NSPredicate predicateWithFormat:@"account == %@", account]];
-    if (tableAccount == nil) {
-        completion(account, nil, NSLocalizedString(@"_error_user_not_available_", nil), k_CCErrorUserNotAvailble);
-    } else if ([CCUtility getPassword:account].length == 0) {
-        completion(account, nil, NSLocalizedString(@"_bad_username_password_", nil), kOCErrorServerUnauthorized);
-    } else if ([CCUtility getCertificateError:account]) {
-        completion(account, nil, NSLocalizedString(@"_ssl_certificate_untrusted_", nil), NSURLErrorServerCertificateUntrusted);
-    }
-    
-    NSString *fileNamePath;
-
-    if (fileName) {
-        fileNamePath = [NSString stringWithFormat:@"%@/%@", serverUrl, fileName];
-    } else {
-        fileName= @".";
-        fileNamePath = serverUrl;
-    }
-    
-    OCCommunication *communication = [OCNetworking sharedManager].sharedOCCommunication;
-
-    [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:[CCUtility getPassword:account]];
-    [communication setUserAgent:[CCUtility getUserAgent]];
-    [communication readFile:fileNamePath onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer) {
-        
-        BOOL isFolderEncrypted = [CCUtility isFolderEncrypted:serverUrl account:account];
-            
-        if ([items count] > 0) {
-            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-                tableMetadata *metadata = [tableMetadata new];
-                
-                OCFileDto *itemDto = [items objectAtIndex:0];
-                
-                metadata = [CCUtility trasformedOCFileToCCMetadata:itemDto fileName:fileName serverUrl:serverUrl account:account isFolderEncrypted:isFolderEncrypted];
-                
-                dispatch_async(dispatch_get_main_queue(), ^{
-                    completion(account, metadata, nil, 0);
-                });
-            });
-        // BUG 1038 item == 0
-        } else {
-                
-            [[NCContentPresenter shared] messageNotification:@"Server error" description:@"Read File WebDAV : [items NULL] please fix" delay:k_dismissAfterSecond type:messageTypeError errorCode:k_CCErrorInternalError];
-            completion(account, nil, NSLocalizedString(@"Read File WebDAV : [items NULL] please fix", nil), k_CCErrorInternalError);
-        }
-        
-    } failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
-        
-        NSString *message;
-        NSInteger errorCode = response.statusCode;
-        
-        if (errorCode == 0 || (errorCode >= 200 && errorCode < 300))
-            errorCode = error.code;
-        
-        // Server Unauthorized
-        if (errorCode == kOCErrorServerUnauthorized || errorCode == kOCErrorServerForbidden) {
-            [[OCNetworking sharedManager] checkRemoteUser:account function:@"read file or folder" errorCode:errorCode];
-        } else if (errorCode == NSURLErrorServerCertificateUntrusted) {
-            [CCUtility setCertificateError:account error:YES];
-        }
-        
-        // Error
-        if (errorCode == 503)
-            message = NSLocalizedString(@"_server_error_retry_", nil);
-        else
-            message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
-        
-        completion(account, nil, message, errorCode);
-    }];
-}
-
-- (void)readFolderWithAccount:(NSString *)account serverUrl:(NSString *)serverUrl  depth:(NSString *)depth completion:(void(^)(NSString *account, NSArray *metadatas, tableMetadata *metadataFolder, NSString *message, NSInteger errorCode))completion
-{
-    tableAccount *tableAccount = [[NCManageDatabase sharedInstance] getAccountWithPredicate:[NSPredicate predicateWithFormat:@"account == %@", account]];
-    if (tableAccount == nil) {
-        completion(account, nil, nil, NSLocalizedString(@"_error_user_not_available_", nil), k_CCErrorUserNotAvailble);
-    } else if ([CCUtility getPassword:account].length == 0) {
-        completion(account, nil, nil, NSLocalizedString(@"_bad_username_password_", nil), kOCErrorServerUnauthorized);
-    } else if ([CCUtility getCertificateError:account]) {
-        completion(account, nil, nil, NSLocalizedString(@"_ssl_certificate_untrusted_", nil), NSURLErrorServerCertificateUntrusted);
-    }
-    
-    NSString *url = tableAccount.url;
-    
-    OCCommunication *communication = [OCNetworking sharedManager].sharedOCCommunication;
-
-    [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:[CCUtility getPassword:account]];
-    [communication setUserAgent:[CCUtility getUserAgent]];
-    [communication readFolder:serverUrl depth:depth withUserSessionToken:nil onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *token) {
-        
-        // Check items > 0
-        if ([items count] == 0) {
-                
-            [[NCContentPresenter shared] messageNotification:@"Server error" description:@"Read Folder WebDAV : [items NULL] please fix" delay:k_dismissAfterSecond type:messageTypeError errorCode:k_CCErrorInternalError];
-            completion(account, nil, nil, NSLocalizedString(@"Read Folder WebDAV : [items NULL] please fix", nil), k_CCErrorInternalError);
-
-        } else {
-            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-                BOOL showHiddenFiles = [CCUtility getShowHiddenFiles];
-                BOOL isFolderEncrypted = [CCUtility isFolderEncrypted:serverUrl account:account];
-                
-                // directory [0]
-                OCFileDto *itemDtoFolder = [items objectAtIndex:0];
-                //NSDate *date = [NSDate dateWithTimeIntervalSince1970:itemDtoDirectory.date];
-                
-                NSMutableArray *metadatas = [NSMutableArray new];
-                tableMetadata *metadataFolder = [tableMetadata new];
-                
-                NSString *serverUrlFolder;
-
-                // Metadata . (self Folder)
-                if ([serverUrl isEqualToString:[CCUtility getHomeServerUrlActiveUrl:url]]) {
-                    
-                    // root folder
-                    serverUrlFolder = k_serverUrl_root;
-                    metadataFolder = [CCUtility trasformedOCFileToCCMetadata:itemDtoFolder fileName:@"." serverUrl:serverUrlFolder  account:account isFolderEncrypted:isFolderEncrypted];
-                    
-                } else {
-                    
-                    serverUrlFolder = [CCUtility deletingLastPathComponentFromServerUrl:serverUrl];
-                    metadataFolder = [CCUtility trasformedOCFileToCCMetadata:itemDtoFolder fileName:[serverUrl lastPathComponent] serverUrl:serverUrlFolder  account:account isFolderEncrypted:isFolderEncrypted];
-                }
-                
-                // Add metadata folder
-                (void)[[NCManageDatabase sharedInstance] addDirectoryWithEncrypted:itemDtoFolder.isEncrypted favorite:itemDtoFolder.isFavorite ocId:itemDtoFolder.ocId permissions:itemDtoFolder.permissions serverUrl:serverUrl richWorkspace:nil account:account];
-
-                NSArray *itemsSortedArray = [items sortedArrayUsingComparator:^NSComparisonResult(id a, id b) {
-                    
-                    NSString *first = [(OCFileDto*)a fileName];
-                    NSString *second = [(OCFileDto*)b fileName];
-                    return [[first lowercaseString] compare:[second lowercaseString]];
-                }];
-                
-                for (NSUInteger i=1; i < [itemsSortedArray count]; i++) {
-                    
-                    OCFileDto *itemDto = [itemsSortedArray objectAtIndex:i];
-                    NSString *fileName = [itemDto.fileName stringByReplacingOccurrencesOfString:@"/" withString:@""];
-                    
-                    // Skip hidden files
-                    if (fileName.length > 0) {
-                        if (!showHiddenFiles && [[fileName substringToIndex:1] isEqualToString:@"."])
-                            continue;
-                    } else {
-                        continue;
-                    }
-                    
-                    if (itemDto.isDirectory) {
-                        (void)[[NCManageDatabase sharedInstance] addDirectoryWithEncrypted:itemDto.isEncrypted favorite:itemDto.isFavorite ocId:itemDto.ocId permissions:itemDto.permissions serverUrl:[CCUtility stringAppendServerUrl:serverUrl addFileName:fileName] richWorkspace: nil account:account];
-                    }
-                    
-                    [metadatas addObject:[CCUtility trasformedOCFileToCCMetadata:itemDto fileName:itemDto.fileName serverUrl:serverUrl  account:account isFolderEncrypted:isFolderEncrypted]];
-                }
-                
-                dispatch_async(dispatch_get_main_queue(), ^{
-                    completion(account, metadatas, metadataFolder, nil, 0);
-                });
-            });
-        }
-    
-    } failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *token, NSString *redirectedServer) {
-        
-        NSString *message;
-        NSInteger errorCode = response.statusCode;
-        
-        if (errorCode == 0 || (errorCode >= 200 && errorCode < 300))
-            errorCode = error.code;
-        
-        // Server Unauthorized
-        if (errorCode == kOCErrorServerUnauthorized || errorCode == kOCErrorServerForbidden) {
-            [[OCNetworking sharedManager] checkRemoteUser:account function:@"read file or folder" errorCode:errorCode];
-        } else if (errorCode == NSURLErrorServerCertificateUntrusted) {
-            [CCUtility setCertificateError:account error:YES];
-        }
-        
-        // Error
-        if (errorCode == 503)
-            message = NSLocalizedString(@"_server_error_retry_", nil);
-        else
-            message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
-        
-        completion(account, nil, nil, message, errorCode);
-    }];
-}
-*/
-
 #pragma --------------------------------------------------------------------------------------------
 #pragma mark ===== Share =====
 #pragma --------------------------------------------------------------------------------------------
@@ -2049,43 +1662,6 @@
     }];
 }
 
-/*
- - (void)middlewarePing
- {
- OCCommunication *communication = [CCNetworking sharedNetworking].sharedOCCommunication;
- 
- [communication setCredentialsWithUser:_activeUser andPassword:_activePassword];
- [communication setUserAgent:[CCUtility getUserAgent]];
- 
- [communication getMiddlewarePing:_metadataNet.serverUrl onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *listOfExternalSites, NSString *redirectedServer) {
- 
- [self complete];
- 
- } failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
- 
- NSInteger errorCode = response.statusCode;
- if (errorCode == 0 || (errorCode >= 200 && errorCode < 300))
- errorCode = error.code;
- 
- // Error
- if ([self.delegate respondsToSelector:@selector(getExternalSitesServerFailure:message:errorCode:)]) {
- 
- if (errorCode == 503)
- [self.delegate getExternalSitesServerFailure:_metadataNet message:NSLocalizedString(@"_server_error_retry_", nil) errorCode:errorCode];
- else
- [self.delegate getExternalSitesServerFailure:_metadataNet message:[error.userInfo valueForKey:@"NSLocalizedDescription"] errorCode:errorCode];
- }
- 
- // Request trusted certificated
- if ([error code] == NSURLErrorServerCertificateUntrusted && self.delegate)
- [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:[error localizedDescription] viewController:(UIViewController *)self.delegate delegate:self];
- 
- [self complete];
- }];
- 
- }
- */
-
 #pragma --------------------------------------------------------------------------------------------
 #pragma mark =====  didReceiveChallenge =====
 #pragma --------------------------------------------------------------------------------------------