123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- //
- // CCNetworking.h
- // Crypto Cloud Technology Nextcloud
- //
- // Created by Marino Faggiana on 01/06/15.
- // Copyright (c) 2017 TWS. All rights reserved.
- //
- // Author Marino Faggiana <m.faggiana@twsweb.it>
- //
- // This program is free software: you can redistribute it and/or modify
- // it under the terms of the GNU General Public License as published by
- // the Free Software Foundation, either version 3 of the License, or
- // (at your option) any later version.
- //
- // This program is distributed in the hope that it will be useful,
- // but WITHOUT ANY WARRANTY; without even the implied warranty of
- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- // GNU General Public License for more details.
- //
- // You should have received a copy of the GNU General Public License
- // along with this program. If not, see <http://www.gnu.org/licenses/>.
- //
- #import <Foundation/Foundation.h>
- #import <Photos/Photos.h>
- #import "OCCommunication.h"
- #import "OCFrameworkConstants.h"
- #import "AFURLSessionManager.h"
- #import "TWMessageBarManager.h"
- #import "PHAsset+Utility.h"
- #import "CCCoreData.h"
- #import "CCCrypto.h"
- #import "CCExifGeo.h"
- #import "CCGraphics.h"
- #import "CCError.h"
- @class tableMetadata;
- @class CCMetadataNet;
- @protocol CCNetworkingDelegate;
- @interface CCNetworking : NSObject <NSURLSessionTaskDelegate, NSURLSessionDelegate, NSURLSessionDownloadDelegate>
- @property (nonatomic, weak) id <CCNetworkingDelegate> delegate;
- @property (nonatomic, strong) NSMutableDictionary *delegates;
- + (CCNetworking *)sharedNetworking;
- - (void)settingDelegate:(id <CCNetworkingDelegate>)delegate;
- - (void)settingAccount;
- // Sessions - Task
- - (OCCommunication *)sharedOCCommunication;
- - (NSURLSession *)getSessionfromSessionDescription:(NSString *)sessionDescription;
- - (void)invalidateAndCancelAllSession;
- - (void)settingSessionsDownload:(BOOL)download upload:(BOOL)upload taskStatus:(NSInteger)taskStatus activeAccount:(NSString *)activeAccount activeUser:(NSString *)activeUser activeUrl:(NSString *)activeUrl;
- - (void)settingSession:(NSString *)sessionDescription sessionTaskIdentifier:(NSUInteger)sessionTaskIdentifier taskStatus:(NSInteger)taskStatus;
- // Download
- - (void)downloadFile:(NSString *)etag serverUrl:(NSString *)serverUrl downloadData:(BOOL)downloadData downloadPlist:(BOOL)downloadPlist selector:(NSString *)selector selectorPost:(NSString *)selectorPost session:(NSString *)session taskStatus:(NSInteger)taskStatus delegate:(id)delegate;
- // Upload
- - (void)uploadFileFromAssetLocalIdentifier:(NSString *)assetLocalIdentifier fileName:(NSString *)fileName serverUrl:(NSString *)serverUrl cryptated:(BOOL)cryptated session:(NSString *)session taskStatus:(NSInteger)taskStatus selector:(NSString *)selector selectorPost:(NSString *)selectorPost errorCode:(NSInteger)errorCode delegate:(id)delegate;
- - (void)uploadFile:(NSString *)fileName serverUrl:(NSString *)serverUrl cryptated:(BOOL)cryptated onlyPlist:(BOOL)onlyPlist session:(NSString *)session taskStatus:(NSInteger)taskStatus selector:(NSString *)selector selectorPost:(NSString *)selectorPost errorCode:(NSInteger)errorCode delegate:(id)delegate;
- - (void)uploadTemplate:(NSString *)fileNamePrint fileNameCrypto:(NSString *)fileNameCrypto serverUrl:(NSString *)serverUrl session:(NSString *)session taskStatus:(NSInteger)taskStatus selector:(NSString *)selector selectorPost:(NSString *)selectorPost errorCode:(NSInteger)errorCode delegate:(id)delegate;
- - (void)uploadFileMetadata:(tableMetadata *)metadata taskStatus:(NSInteger)taskStatus;
- // Verify
- - (void)verifyDownloadInProgress;
- - (void)verifyUploadInProgress;
- @end
- @protocol CCNetworkingDelegate <NSObject>
- @optional - (void)reloadDatasource:(NSString *)serverUrl etag:(NSString *)etag selector:(NSString *)selector;
- @optional - (void)comandoCreaCartella:(NSString *)fileNameFolder cameraUpload:(BOOL)cameraUpload;
- @optional - (void)downloadTaskSave:(NSURLSessionDownloadTask *)downloadTask;
- @optional - (void)downloadFileSuccess:(NSString *)etag serverUrl:(NSString *)serverUrl selector:(NSString *)selector selectorPost:(NSString *)selectorPost;
- @optional - (void)downloadFileFailure:(NSString *)etag serverUrl:(NSString *)serverUrl selector:(NSString *)selector message:(NSString *)message errorCode:(NSInteger)errorCode;
- @optional - (void)uploadTaskSave:(NSURLSessionUploadTask *)uploadTask;
- @optional - (void)uploadFileSuccess:(CCMetadataNet *)metadataNet etag:(NSString *)etag serverUrl:(NSString *)serverUrl selector:(NSString *)selector selectorPost:(NSString *)selectorPost;
- @optional - (void)uploadFileFailure:(CCMetadataNet *)metadataNet etag:(NSString *)etag serverUrl:(NSString *)serverUrl selector:(NSString *)selector message:(NSString *)message errorCode:(NSInteger)errorCode;
- @end
- #pragma --------------------------------------------------------------------------------------------
- #pragma mark ===== CCMetadataNet =====
- #pragma --------------------------------------------------------------------------------------------
- @interface CCMetadataNet : NSObject <NSCopying>
- @property (nonatomic, strong) NSString *account;
- @property (nonatomic, strong) NSString *action;
- @property BOOL cryptated;
- @property (nonatomic, strong) NSDate *date;
- @property (nonatomic, weak) id delegate;
- @property BOOL directory;
- @property (nonatomic, strong) NSString *directoryID;
- @property (nonatomic, strong) NSString *directoryIDTo;
- @property BOOL downloadData;
- @property BOOL downloadPlist;
- @property NSInteger errorCode;
- @property NSInteger errorRetry;
- @property (nonatomic, strong) NSString *expirationTime;
- @property (nonatomic, strong) NSString *etag;
- @property (nonatomic, strong) NSString *fileName;
- @property (nonatomic, strong) NSString *fileNameTo;
- @property (nonatomic, strong) NSString *fileNameLocal;
- @property (nonatomic, strong) NSString *fileNamePrint;
- @property (nonatomic, strong) NSString *assetLocalIdentifier;
- @property (nonatomic, strong) id options;
- @property (nonatomic, strong) NSString *password;
- @property (nonatomic, strong) NSString *pathFolder;
- @property NSInteger priority;
- @property (nonatomic, strong) NSOperationQueue *queue;
- @property (nonatomic, strong) NSString *rev;
- @property (nonatomic, strong) NSString *serverUrl;
- @property (nonatomic, strong) NSString *serverUrlTo;
- @property (nonatomic, strong) NSString *selector;
- @property (nonatomic, strong) NSString *selectorPost;
- @property (nonatomic, strong) NSString *session;
- @property (nonatomic, strong) NSString *sessionID;
- @property (nonatomic, strong) NSString *share;
- @property NSInteger shareeType;
- @property NSInteger sharePermission;
- @property long size;
- @property NSInteger taskStatus;
- - (id)initWithAccount:(NSString *)withAccount;
- - (id)copyWithZone:(NSZone *)zone;
- @end
|