CCGlobal.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. //
  2. // CCGlobal.h
  3. // Crypto Cloud Technology Nextcloud
  4. //
  5. // Created by Marino Faggiana on 13/10/14.
  6. // Copyright (c) 2014 TWS. All rights reserved.
  7. //
  8. // Author Marino Faggiana <m.faggiana@twsweb.it>
  9. //
  10. // This program is free software: you can redistribute it and/or modify
  11. // it under the terms of the GNU General Public License as published by
  12. // the Free Software Foundation, either version 3 of the License, or
  13. // (at your option) any later version.
  14. //
  15. // This program is distributed in the hope that it will be useful,
  16. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. // GNU General Public License for more details.
  19. //
  20. // You should have received a copy of the GNU General Public License
  21. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. //
  23. #import <UIKit/UIKit.h>
  24. #import "CCImages.h"
  25. extern NSString *const appApplicationSupport;
  26. extern NSString *const appDatabase;
  27. extern NSString *const appCertificates;
  28. extern NSString *const webDAV;
  29. extern NSString *const typeCloudNextcloud;
  30. extern NSString *const typeCloudOwnCloud;
  31. extern NSString *const appKeyCryptoCloud;
  32. extern NSString *const appSecretCryptoCloud;
  33. extern NSString *const urlBaseDownloadDB;
  34. extern NSString *const urlBaseUploadDB;
  35. extern NSString *const BKPasscodeKeychainServiceName;
  36. #ifndef EXTENSION
  37. //AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
  38. #define app ((AppDelegate *)[[UIApplication sharedApplication] delegate])
  39. #define CALL_ORIGIN NSLog(@"Origin: [%@]", [[[[NSThread callStackSymbols] objectAtIndex:1] componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"[]"]] objectAtIndex:1])
  40. #endif
  41. // Version Protocol plist
  42. #define versionProtocolPlist @"1.3"
  43. // UUID
  44. #define UUID_SIM @"4BACFE4A-61A6-44B1-9A85-13FD167565AB"
  45. // Capabilities Group & Service Key Share
  46. #define capabilitiesGroups @"group.it.twsweb.Crypto-Cloud"
  47. #define serviceShareKeyChain @"Crypto Cloud"
  48. // BRAND
  49. #ifdef CC
  50. #define _brand_ @"Crypto Cloud"
  51. #define _mail_me_ @"cryptocloud@twsweb.it"
  52. #endif
  53. #ifdef NC
  54. #define _brand_ @"Nextcloud"
  55. #define _mail_me_ @"ios@nextcloud.com"
  56. #endif
  57. // COLOR
  58. #ifdef CC // CRYPTOCLOUD ORANGE
  59. #define COLOR_BRAND [UIColor colorWithRed:241.0/255.0 green:90.0/255.0 blue:34.0/255.0 alpha:1.0] // #F15A22 - A 1.0
  60. #define COLOR_BRAND_MESSAGE [UIColor colorWithRed:241.0/255.0 green:90.0/255.0 blue:34.0/255.0 alpha:0.90] // #F15A22 - A 1.0
  61. #define COLOR_SELECT_BACKGROUND [UIColor colorWithRed:241.0/255.0 green:90.0/255.0 blue:34.0/255.0 alpha:0.1] // #F15A22 - A 0.1
  62. #define COLOR_TRANSFER_BACKGROUND [UIColor colorWithRed:252.0/255.0 green:242.0/255.0 blue:238.0/255.0 alpha:0.5] // Arancio chiarissimo
  63. #define COLOR_GROUPBY_BAR [UIColor colorWithRed:241.0/255.0 green:90.0/255.0 blue:34.0/255.0 alpha:0.2] // #F15A22 - A 0.2
  64. #define COLOR_GROUPBY_BAR_NO_BLUR [UIColor colorWithRed:255.0/255.0 green:153.0/255.0 blue:102.0/255.0 alpha:0.3] // #FF9966
  65. #endif
  66. #ifdef NC // NEXTCLOUD BLUE
  67. #define COLOR_BRAND [UIColor colorWithRed:0.0/255.0 green:130.0/255.0 blue:201.0/255.0 alpha:1.0]
  68. #define COLOR_BRAND_MESSAGE [UIColor colorWithRed:0.0/255.0 green:130.0/255.0 blue:201.0/255.0 alpha:0.90]
  69. #define COLOR_SELECT_BACKGROUND [UIColor colorWithRed:0.0/255.0 green:130.0/255.0 blue:201.0/255.0 alpha:0.1]
  70. #define COLOR_TRANSFER_BACKGROUND [UIColor colorWithRed:178.0/255.0 green:244.0/255.0 blue:258.0/255.0 alpha:0.1] // Blu chiarissimo
  71. #define COLOR_GROUPBY_BAR [UIColor colorWithRed:0.0/255.0 green:130.0/255.0 blue:201.0/255.0 alpha:0.2]
  72. #define COLOR_GROUPBY_BAR_NO_BLUR [UIColor colorWithRed:0.0/255.0 green:130.0/255.0 blue:201.0/255.0 alpha:0.3]
  73. #endif
  74. #define COLOR_CRYPTOCLOUD [UIColor colorWithRed:241.0/255.0 green:90.0/255.0 blue:34.0/255.0 alpha:1.0] // Arancio
  75. #define COLOR_NEXTCLOUD [UIColor colorWithRed:0.0/255.0 green:130.0/255.0 blue:201.0/255.0 alpha:1.0] // Blue #0082c9
  76. #define COLOR_ENCRYPTED [UIColor colorWithRed:241.0/255.0 green:90.0/255.0 blue:34.0/255.0 alpha:1.0] // #F15A22 - A 1.0
  77. #define COLOR_GRAY [UIColor colorWithRed:65.0/255.0 green:64.0/255.0 blue:66.0/255.0 alpha:1.0] // #414042 - A 1.0
  78. #define COLOR_CLEAR [UIColor colorWithRed:65.0/255.0 green:64.0/255.0 blue:66.0/255.0 alpha:1.0]
  79. #define COLOR_BAR [UIColor colorWithRed:(248.0f/255.0f) green:(248.0f/255.0f) blue:(248.0f/255.0f) alpha:1.0]
  80. #define COLOR_SEPARATOR_TABLE [UIColor colorWithRed:153.0/255.0 green:153.0/255.0 blue:153.0/255.0 alpha:0.2] // Grigio chiaro
  81. #define COLOR_NO_CONNECTION [UIColor colorWithRed:204.0/255.0 green:204.0/255.0 blue:204.0/255.0 alpha:1.0]
  82. #define COLOR_NAVBAR_IOS7 [UIColor colorWithRed:247.0/255.0 green:247.0/255.0 blue:247.0/255.0 alpha:1.0]
  83. #define dismissAfterSecond 4
  84. #define MaxDimensionUpload 524288000 // 500 MB
  85. #define dayForceReadFolder 3
  86. #define MaxGroupBySessionUploadDatasource 50
  87. #define MaxGroupBySessionDownloadDatasource 50
  88. #define returnCreateFolderPlain 0
  89. #define returnCreateFotoVideoPlain 1
  90. #define returnCreateFilePlain 2
  91. #define returnCreateFolderEncrypted 3
  92. #define returnCreateFotoVideoEncrypted 4
  93. #define returnCreateFileEncrypted 5
  94. #define returnCartaDiCredito 6
  95. #define returnBancomat 7
  96. #define returnContoCorrente 8
  97. #define returnAccountWeb 9
  98. #define returnNote 10
  99. #define returnPatenteGuida 11
  100. #define returnCartaIdentita 12
  101. #define returnPassaporto 13
  102. #define RalewayBold(s) [UIFont fontWithName:@"Raleway-Bold" size:s]
  103. #define RalewayExtraBold(s) [UIFont fontWithName:@"Raleway-ExtraBold" size:s]
  104. #define RalewayExtraLight(s) [UIFont fontWithName:@"Raleway-ExtraLight" size:s]
  105. #define RalewayHeavy(s) [UIFont fontWithName:@"Raleway-Heavy" size:s]
  106. #define RalewayLight(s) [UIFont fontWithName:@"Raleway-Light" size:s]
  107. #define RalewayMedium(s) [UIFont fontWithName:@"Raleway-Medium" size:s]
  108. #define RalewayRegular(s) [UIFont fontWithName:@"Raleway-Regular" size:s]
  109. #define RalewaySemiBold(s) [UIFont fontWithName:@"Raleway-SemiBold" size:s]
  110. #define RalewayThin(s) [UIFont fontWithName:@"Raleway-Thin" size:s]
  111. // File Name Const
  112. #define folderDefaultCameraUpload @"Photos"
  113. // Picker select image
  114. #define pickerControllerMax 500.0
  115. // define ownCloud IOS
  116. #define server_version_with_new_shared_schema 8
  117. #define k_share_link_middle_part_url_before_version_8 @"public.php?service=files&t="
  118. #define k_share_link_middle_part_url_after_version_8 @"index.php/s/"
  119. // Constants to identify the different permissions of a file
  120. #define k_permission_shared @"S"
  121. #define k_permission_can_share @"R"
  122. #define k_permission_mounted @"M"
  123. #define k_permission_file_can_write @"W"
  124. #define k_permission_can_create_file @"C"
  125. #define k_permission_can_create_folder @"K"
  126. #define k_permission_can_delete @"D"
  127. #define k_permission_can_rename @"N"
  128. #define k_permission_can_move @"V"
  129. // Session
  130. #define download_session @"it.twsweb.download.session"
  131. #define download_session_foreground @"it.twsweb.download.sessionforeground"
  132. #define download_session_wwan @"it.twsweb.download.sessionwwan"
  133. #define upload_session @"it.twsweb.upload.session"
  134. #define upload_session_foreground @"it.twsweb.upload.sessionforeground"
  135. #define upload_session_wwan @"it.twsweb.upload.sessionwwan"
  136. #define networkingSessionNotification @"networkingSessionNotification"
  137. // TaskIdentifier
  138. #define taskIdentifierDone -1
  139. #define taskIdentifierStop -2
  140. #define taskIdentifierError -9999
  141. #define taskIdentifierNULL 9999
  142. // TaskStatus
  143. #define taskStatusNone 0
  144. #define taskStatusCancel -1
  145. #define taskStatusResume -2
  146. #define taskStatusSuspend -3
  147. #define timerVerifySession 15.0
  148. // OperationQueue
  149. #define netQueueName @"it.twsweb.cryptocloud.queue"
  150. #define netQueueDownloadName @"it.twsweb.cryptocloud.queueDownload"
  151. #define netQueueDownloadWWanName @"it.twsweb.cryptocloud.queueDownloadWWan"
  152. #define netQueueUploadName @"it.twsweb.cryptocloud.queueUpload"
  153. #define netQueueUploadWWanName @"it.twsweb.cryptocloud.queueUploadWWan"
  154. #define maxConcurrentOperation 10
  155. #define maxConcurrentOperationDownloadUpload 10
  156. // Error
  157. #define CCErrorTaskNil -9999
  158. #define CCErrorTaskDownloadNotFound -9998
  159. #define CCErrorFileUploadNotFound -9997
  160. #define CCErrorInternalError -9996
  161. // Metadata ed ID
  162. #define uploadSessionID @"ID_UPLOAD_"
  163. // Metadata.Net SELECTOR
  164. #define selectorAddFavorite @"addFavorite"
  165. #define selectorAddLocal @"addLocal"
  166. #define selectorBrowseImages @"browseImages"
  167. #define selectorCreateFolder @"createFolder"
  168. #define selectorDecryptFile @"decryptFile"
  169. #define selectorDelete @"delete"
  170. #define selectorDeleteCrypto @"deleteCrypto"
  171. #define selectorDeletePlist @"deletePlist"
  172. #define selectorDownloadThumbnail @"downloadThumbnail"
  173. #define selectorDownloadSynchronized @"downloadSynchronized"
  174. #define selectorEncryptFile @"encryptFile"
  175. #define selectorGetUserAndGroup @"getUserAndGroup"
  176. #define selectorLoadFileView @"loadFileView"
  177. #define selectorLoadModelView @"loadModelView"
  178. #define selectorLoadPlist @"loadPlist"
  179. #define selectorLoadViewImage @"loadViewImage"
  180. #define selectorMove @"move"
  181. #define selectorMoveCrypto @"moveCrypto"
  182. #define selectorMovePlist @"movePlist"
  183. #define selectorOpenIn @"openIn"
  184. #define selectorOpenWindowShare @"openWindowShare"
  185. #define selectorReadFile @"readFile"
  186. #define selectorReadFileFavorite @"readFileFavorite"
  187. #define selectorReadFileFolder @"readFileFolder"
  188. #define selectorReadFileUploadFile @"readFileUploadFile"
  189. #define selectorReadFileVerifyUpload @"readFileVerifyUpload"
  190. #define selectorReadFolder @"readFolder"
  191. #define selectorReadFolderForced @"readFolderForced"
  192. #define selectorReadShare @"readShare"
  193. #define selectorReload @"reload"
  194. #define selectorRename @"rename"
  195. #define selectorSave @"save"
  196. #define selectorShare @"share"
  197. #define selectorSynchronizedFolder @"synchronizedFolder"
  198. #define selectorUnshare @"unshare"
  199. #define selectorUpdateShare @"updateShare"
  200. #define selectorUploadAutomatic @"uploadAutomatic"
  201. #define selectorUploadAutomaticAll @"uploadAutomaticAll"
  202. #define selectorUploadFile @"uploadFile"
  203. #define selectorUploadFileCrypto @"uploadFileCrypto"
  204. #define selectorUploadFilePlist @"uploadFilePlist"
  205. #define selectorUploadRemovePhoto @"uploadRemovePhoto"
  206. // Metadata.Net ACTION
  207. #define actionCreateFolder @"createFolder"
  208. #define actionDeleteFileDirectory @"deleteFileOrFolder"
  209. #define actionDownloadFile @"downloadFile"
  210. #define actionDownloadThumbnail @"downloadThumbnail"
  211. #define actionGetCapabilities @"getCapabilitiesOfServer"
  212. #define actionGetFeaturesSuppServer @"getFeaturesSupportedByServer"
  213. #define actionGetUserAndGroup @"getUserAndGroup"
  214. #define actionMoveFileOrFolder @"moveFileOrFolder"
  215. #define actionReadFile @"readFile"
  216. #define actionReadFolder @"readFolder"
  217. #define actionReadShareServer @"readShareServer"
  218. #define actionShare @"share"
  219. #define actionShareWith @"shareWith"
  220. #define actionUnShare @"unShare"
  221. #define actionUpdateShare @"updateShare"
  222. #define actionUploadFile @"uploadFile"
  223. #define actionUploadAsset @"uploadAsset"
  224. #define actionUploadTemplate @"uploadTemplate"
  225. #define actionUploadOnlyPlist @"uploadOnlyPlist"
  226. // Tipi di sorgente directory
  227. #define sorceDirectoryAccount 0
  228. #define sorceDirectoryLocal 1
  229. #define sorceDirectoryFavorite 2
  230. // Metadata : FileType
  231. #define metadataTypeFile_audio @"audio"
  232. #define metadataTypeFile_compress @"compress"
  233. #define metadataTypeFile_directory @"directory"
  234. #define metadataTypeFile_document @"document"
  235. #define metadataTypeFile_image @"image"
  236. #define metadataTypeFile_template @"template"
  237. #define metadataTypeFile_unknown @"unknow"
  238. #define metadataTypeFile_video @"video"
  239. // Metadata : Type
  240. #define metadataType_file @"file"
  241. #define metadataType_model @"model"
  242. #define metadataType_local @"local"
  243. // Metadata : Filename Type
  244. #define metadataTypeFilenamePlain 0
  245. #define metadataTypeFilenamePlist 1
  246. #define metadataTypeFilenameCrypto 2
  247. #define TabBarApplicationIndexFile 0
  248. #define TabBarApplicationIndexFavorite 1
  249. #define TabBarApplicationIndexHide 2
  250. #define TabBarApplicationIndexPhotos 3
  251. #define TabBarApplicationIndexSettings 4
  252. @interface CCAspect : NSObject
  253. + (void)aspectNavigationControllerBar:(UINavigationBar *)nav hidden:(BOOL)hidden;
  254. + (void)aspectTabBar:(UITabBar *)tab hidden:(BOOL)hidden;
  255. @end