CCGlobal.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  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 typeCloudDropbox;
  30. extern NSString *const typeCloudNextcloud;
  31. extern NSString *const typeCloudOwnCloud;
  32. extern NSString *const appKeyCryptoCloud;
  33. extern NSString *const appSecretCryptoCloud;
  34. extern NSString *const urlBaseDownloadDB;
  35. extern NSString *const urlBaseUploadDB;
  36. extern NSString *const BKPasscodeKeychainServiceName;
  37. #ifndef SHARE_IN
  38. //AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
  39. #define app ((AppDelegate *)[[UIApplication sharedApplication] delegate])
  40. #define CALL_ORIGIN NSLog(@"Origin: [%@]", [[[[NSThread callStackSymbols] objectAtIndex:1] componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"[]"]] objectAtIndex:1])
  41. #endif
  42. // Version Protocol plist
  43. #define versionProtocolPlist @"1.3"
  44. // UUID
  45. #define UUID_SIM @"4BACFE4A-61A6-44B1-9A85-13FD167565AB"
  46. // Capabilities Group & Service Key Share
  47. #define capabilitiesGroups @"group.it.twsweb.Crypto-Cloud"
  48. #define serviceShareKeyChain @"Crypto Cloud"
  49. // BRAND
  50. #ifdef CC
  51. #define _brand_ @"Crypto Cloud"
  52. #define _mail_me_ @"cryptocloud@twsweb.it"
  53. #endif
  54. #ifdef NC
  55. #define _brand_ @"Nextcloud"
  56. #define _mail_me_ @"ios@nextcloud.com"
  57. #endif
  58. // COLOR
  59. #ifdef CC // CRYPTOCLOUD ORANGE
  60. #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
  61. #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
  62. #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
  63. #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
  64. #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
  65. #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
  66. #endif
  67. #ifdef NC // NEXTCLOUD BLUE
  68. #define COLOR_BRAND [UIColor colorWithRed:0.0/255.0 green:130.0/255.0 blue:201.0/255.0 alpha:1.0]
  69. #define COLOR_BRAND_MESSAGE [UIColor colorWithRed:0.0/255.0 green:130.0/255.0 blue:201.0/255.0 alpha:0.90]
  70. #define COLOR_SELECT_BACKGROUND [UIColor colorWithRed:0.0/255.0 green:130.0/255.0 blue:201.0/255.0 alpha:0.1]
  71. #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
  72. #define COLOR_GROUPBY_BAR [UIColor colorWithRed:0.0/255.0 green:130.0/255.0 blue:201.0/255.0 alpha:0.2]
  73. #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]
  74. #endif
  75. #define COLOR_CRYPTOCLOUD [UIColor colorWithRed:241.0/255.0 green:90.0/255.0 blue:34.0/255.0 alpha:1.0] // Arancio
  76. #define COLOR_NEXTCLOUD [UIColor colorWithRed:0.0/255.0 green:130.0/255.0 blue:201.0/255.0 alpha:1.0] // Blue #0082c9
  77. #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
  78. #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
  79. #define COLOR_CLEAR [UIColor colorWithRed:65.0/255.0 green:64.0/255.0 blue:66.0/255.0 alpha:1.0]
  80. #define COLOR_BAR [UIColor colorWithRed:(248.0f/255.0f) green:(248.0f/255.0f) blue:(248.0f/255.0f) alpha:1.0]
  81. #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
  82. #define COLOR_NO_CONNECTION [UIColor colorWithRed:204.0/255.0 green:204.0/255.0 blue:204.0/255.0 alpha:1.0]
  83. #define COLOR_NAVBAR_IOS7 [UIColor colorWithRed:247.0/255.0 green:247.0/255.0 blue:247.0/255.0 alpha:1.0]
  84. #define dismissAfterSecond 4
  85. #define MaxDimensionUpload 524288000 // 500 MB
  86. #define dayForceReadFolder 3
  87. #define MaxGroupBySessionUploadDatasource 50
  88. #define MaxGroupBySessionDownloadDatasource 50
  89. #define returnCreaCartellaChiaro 0
  90. #define returnCreaFotoVideoChiaro 1
  91. #define returnCreaCartellaCriptata 2
  92. #define returnCreaFotoVideoCriptato 3
  93. #define returnCartaDiCredito 4
  94. #define returnBancomat 5
  95. #define returnContoCorrente 6
  96. #define returnAccountWeb 7
  97. #define returnNote 8
  98. #define returnPatenteGuida 9
  99. #define returnCartaIdentita 10
  100. #define returnPassaporto 11
  101. #define RalewayBold(s) [UIFont fontWithName:@"Raleway-Bold" size:s]
  102. #define RalewayExtraBold(s) [UIFont fontWithName:@"Raleway-ExtraBold" size:s]
  103. #define RalewayExtraLight(s) [UIFont fontWithName:@"Raleway-ExtraLight" size:s]
  104. #define RalewayHeavy(s) [UIFont fontWithName:@"Raleway-Heavy" size:s]
  105. #define RalewayLight(s) [UIFont fontWithName:@"Raleway-Light" size:s]
  106. #define RalewayMedium(s) [UIFont fontWithName:@"Raleway-Medium" size:s]
  107. #define RalewayRegular(s) [UIFont fontWithName:@"Raleway-Regular" size:s]
  108. #define RalewaySemiBold(s) [UIFont fontWithName:@"Raleway-SemiBold" size:s]
  109. #define RalewayThin(s) [UIFont fontWithName:@"Raleway-Thin" size:s]
  110. // File Name Const
  111. #define folderDefaultCameraUpload @"Photos"
  112. // Picker select image
  113. #define pickerControllerMax 500.0
  114. // define ownCloud IOS
  115. #define server_version_with_new_shared_schema 8
  116. #define k_share_link_middle_part_url_before_version_8 @"public.php?service=files&t="
  117. #define k_share_link_middle_part_url_after_version_8 @"index.php/s/"
  118. //Constants to identify the different permissions of a file
  119. #define k_permission_shared @"S"
  120. #define k_permission_can_share @"R"
  121. #define k_permission_mounted @"M"
  122. #define k_permission_file_can_write @"W"
  123. #define k_permission_can_create_file @"C"
  124. #define k_permission_can_create_folder @"K"
  125. #define k_permission_can_delete @"D"
  126. #define k_permission_can_rename @"N"
  127. #define k_permission_can_move @"V"
  128. // session
  129. #define download_session @"it.twsweb.download.session"
  130. #define download_session_foreground @"it.twsweb.download.sessionforeground"
  131. #define download_session_wwan @"it.twsweb.download.sessionwwan"
  132. #define upload_session @"it.twsweb.upload.session"
  133. #define upload_session_foreground @"it.twsweb.upload.sessionforeground"
  134. #define upload_session_wwan @"it.twsweb.upload.sessionwwan"
  135. #define networkingSessionNotification @"networkingSessionNotification"
  136. // TaskIdentifier
  137. #define taskIdentifierDone -1
  138. #define taskIdentifierStop -2
  139. #define taskIdentifierError -9999
  140. #define taskIdentifierNULL 9999
  141. // TaskStatus
  142. #define taskStatusNone 0
  143. #define taskStatusCancel -1
  144. #define taskStatusResume -2
  145. #define taskStatusSuspend -3
  146. #define timerVerifySession 15.0
  147. #define maxConcurrentOperation 10
  148. #define maxConcurrentOperationDownloadUpload 10
  149. // Error
  150. #define CCErrorTaskNil -9999
  151. #define CCErrorTaskDownloadNotFound -9998
  152. #define CCErrorFileUploadNotFound -9997
  153. // Metadata ed ID
  154. #define uploadSessionID @"ID_UPLOAD_"
  155. // Metadata.Net SELECTOR
  156. #define selectorAddFavorite @"addFavorite"
  157. #define selectorAddLocal @"addLocal"
  158. #define selectorBrowseImages @"browseImages"
  159. #define selectorCreateFolder @"createFolder"
  160. #define selectorDecryptFile @"decryptFile"
  161. #define selectorDelete @"delete"
  162. #define selectorDeleteCrypto @"deleteCrypto"
  163. #define selectorDeletePlist @"deletePlist"
  164. #define selectorDownloadThumbnail @"downloadThumbnail"
  165. #define selectorDownloadSynchronized @"downloadSynchronized"
  166. #define selectorEncryptFile @"encryptFile"
  167. #define selectorGetUserAndGroup @"getUserAndGroup"
  168. #define selectorLoadFileView @"loadFileView"
  169. #define selectorLoadModelView @"loadModelView"
  170. #define selectorLoadPlist @"loadPlist"
  171. #define selectorLoadViewImage @"loadViewImage"
  172. #define selectorMove @"move"
  173. #define selectorMoveCrypto @"moveCrypto"
  174. #define selectorMovePlist @"movePlist"
  175. #define selectorOpenIn @"openIn"
  176. #define selectorOpenWindowShare @"openWindowShare"
  177. #define selectorReadFile @"readFile"
  178. #define selectorReadFileFavorite @"readFileFavorite"
  179. #define selectorReadFileFolder @"readFileFolder"
  180. #define selectorReadFileUploadFile @"readFileUploadFile"
  181. #define selectorReadFileVerifyUpload @"readFileVerifyUpload"
  182. #define selectorReadFolder @"readFolder"
  183. #define selectorReadFolderForced @"readFolderForced"
  184. #define selectorReadShare @"readShare"
  185. #define selectorReload @"reload"
  186. #define selectorRename @"rename"
  187. #define selectorSave @"save"
  188. #define selectorShare @"share"
  189. #define selectorSynchronizedFolder @"synchronizedFolder"
  190. #define selectorUnshare @"unshare"
  191. #define selectorUpdateShare @"updateShare"
  192. #define selectorUploadCameraAllPhoto @"uploadCameraAllPhoto"
  193. #define selectorUploadCameraSnapshot @"uploadCameraSnapshot"
  194. #define selectorUploadFile @"uploadFile"
  195. #define selectorUploadFileCrypto @"uploadFileCrypto"
  196. #define selectorUploadFilePlist @"uploadFilePlist"
  197. #define selectorUploadRemovePhoto @"uploadRemovePhoto"
  198. // Metadata.Net ACTION
  199. #define actionCreateFolder @"createFolder"
  200. #define actionDeleteFileDirectory @"deleteFileOrFolder"
  201. #define actionDownloadFile @"downloadFile"
  202. #define actionDownloadThumbnail @"downloadThumbnail"
  203. #define actionGetCapabilities @"getCapabilitiesOfServer"
  204. #define actionGetFeaturesSuppServer @"getFeaturesSupportedByServer"
  205. #define actionGetUserAndGroup @"getUserAndGroup"
  206. #define actionMoveFileOrFolder @"moveFileOrFolder"
  207. #define actionReadFile @"readFile"
  208. #define actionReadFolder @"readFolder"
  209. #define actionReadShareServer @"readShareServer"
  210. #define actionShare @"share"
  211. #define actionShareWith @"shareWith"
  212. #define actionUnShare @"unShare"
  213. #define actionUpdateShare @"updateShare"
  214. #define actionUploadFile @"uploadFile"
  215. #define actionUploadAsset @"uploadAsset"
  216. #define actionUploadTemplate @"uploadTemplate"
  217. #define actionUploadOnlyPlist @"uploadOnlyPlist"
  218. // Tipi di sorgente directory
  219. #define sorceDirectoryAccount 0
  220. #define sorceDirectoryLocal 1
  221. #define sorceDirectoryFavorite 2
  222. // Metadata : FileType
  223. #define metadataTypeFile_audio @"audio"
  224. #define metadataTypeFile_compress @"compress"
  225. #define metadataTypeFile_directory @"directory"
  226. #define metadataTypeFile_document @"document"
  227. #define metadataTypeFile_image @"image"
  228. #define metadataTypeFile_template @"template"
  229. #define metadataTypeFile_unknown @"unknow"
  230. #define metadataTypeFile_video @"video"
  231. // Metadata : Type
  232. #define metadataType_file @"file"
  233. #define metadataType_model @"model"
  234. #define metadataType_local @"local"
  235. // Metadata : Filename Type
  236. #define metadataTypeFilenamePlain 0
  237. #define metadataTypeFilenamePlist 1
  238. #define metadataTypeFilenameCrypto 2
  239. #define TabBarApplicationIndexFile 0
  240. #define TabBarApplicationIndexFavorite 1
  241. #define TabBarApplicationIndexPhotos 2
  242. #define TabBarApplicationIndexSettings 3
  243. @interface CCAspect : NSObject
  244. + (void)aspectNavigationControllerBar:(UINavigationBar *)nav hidden:(BOOL)hidden;
  245. + (void)aspectTabBar:(UITabBar *)tab hidden:(BOOL)hidden;
  246. @end