CCGlobal.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  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 appKeyCryptoCloud;
  30. extern NSString *const appSecretCryptoCloud;
  31. extern NSString *const urlBaseDownloadDB;
  32. extern NSString *const urlBaseUploadDB;
  33. extern NSString *const BKPasscodeKeychainServiceName;
  34. #ifndef EXTENSION
  35. //AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
  36. #define app ((AppDelegate *)[[UIApplication sharedApplication] delegate])
  37. #define CALL_ORIGIN NSLog(@"Origin: [%@]", [[[[NSThread callStackSymbols] objectAtIndex:1] componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"[]"]] objectAtIndex:1])
  38. #endif
  39. // Version Protocol plist
  40. #define k_versionProtocolPlist @"1.3"
  41. // UUID
  42. #define k_UUID_SIM @"4BACFE4A-61A6-44B1-9A85-13FD167565AB"
  43. // Capabilities Group & Service Key Share
  44. #define k_capabilitiesGroups @"group.it.twsweb.Crypto-Cloud"
  45. #define k_serviceShareKeyChain @"Crypto Cloud"
  46. // BRAND
  47. #ifdef NC
  48. #define _brand_ @"Nextcloud"
  49. #define _mail_me_ @"ios@nextcloud.com"
  50. #endif
  51. #define k_dismissAfterSecond 4
  52. #define k_MaxDimensionUpload 524288000 // 500 MB
  53. #define k_dayForceReadFolder 3
  54. #define k_MaxGroupBySessionUploadDatasource 50
  55. #define k_MaxGroupBySessionDownloadDatasource 50
  56. #define k_returnCreateFolderPlain 0
  57. #define k_returnCreateFotoVideoPlain 1
  58. #define k_returnCreateFilePlain 2
  59. #define k_returnCreateFolderEncrypted 3
  60. #define k_returnCreateFotoVideoEncrypted 4
  61. #define k_returnCreateFileEncrypted 5
  62. #define k_returnCartaDiCredito 6
  63. #define k_returnBancomat 7
  64. #define k_returnContoCorrente 8
  65. #define k_returnAccountWeb 9
  66. #define k_returnNote 10
  67. #define k_returnPatenteGuida 11
  68. #define k_returnCartaIdentita 12
  69. #define k_returnPassaporto 13
  70. // File Name Const
  71. #define k_folderDefaultCameraUpload @"Photos"
  72. // Picker select image
  73. #define k_pickerControllerMax 100.0
  74. // define ownCloud IOS
  75. #define server_version_with_new_shared_schema 8
  76. #define k_share_link_middle_part_url_before_version_8 @"public.php?service=files&t="
  77. #define k_share_link_middle_part_url_after_version_8 @"index.php/s/"
  78. // Constants to identify the different permissions of a file
  79. #define k_permission_shared @"S"
  80. #define k_permission_can_share @"R"
  81. #define k_permission_mounted @"M"
  82. #define k_permission_file_can_write @"W"
  83. #define k_permission_can_create_file @"C"
  84. #define k_permission_can_create_folder @"K"
  85. #define k_permission_can_delete @"D"
  86. #define k_permission_can_rename @"N"
  87. #define k_permission_can_move @"V"
  88. // Session
  89. #define k_download_session @"it.twsweb.download.session"
  90. #define k_download_session_foreground @"it.twsweb.download.sessionforeground"
  91. #define k_download_session_wwan @"it.twsweb.download.sessionwwan"
  92. #define k_upload_session @"it.twsweb.upload.session"
  93. #define k_upload_session_foreground @"it.twsweb.upload.sessionforeground"
  94. #define k_upload_session_wwan @"it.twsweb.upload.sessionwwan"
  95. #define k_networkingSessionNotification @"networkingSessionNotification"
  96. // TaskIdentifier
  97. #define k_taskIdentifierDone -1
  98. #define k_taskIdentifierStop -2
  99. #define k_taskIdentifierError -99999
  100. #define k_taskIdentifierNULL 99999
  101. // TaskStatus
  102. #define k_taskStatusNone 0
  103. #define k_taskStatusCancel -1
  104. #define k_taskStatusResume -2
  105. #define k_taskStatusSuspend -3
  106. #define k_timerVerifySession 15.0
  107. // OperationQueue
  108. #define k_netQueueName @"it.twsweb.cryptocloud.queue"
  109. #define k_netQueueDownloadName @"it.twsweb.cryptocloud.queueDownload"
  110. #define k_netQueueDownloadWWanName @"it.twsweb.cryptocloud.queueDownloadWWan"
  111. #define k_netQueueUploadName @"it.twsweb.cryptocloud.queueUpload"
  112. #define k_netQueueUploadWWanName @"it.twsweb.cryptocloud.queueUploadWWan"
  113. #define k_maxConcurrentOperation 10
  114. #define k_maxConcurrentOperationDownloadUpload 10
  115. // Error
  116. #define k_CCErrorTaskNil -9999
  117. #define k_CCErrorTaskDownloadNotFound -9998
  118. #define k_CCErrorFileUploadNotFound -9997
  119. #define k_CCErrorInternalError -9996
  120. // Metadata ed ID
  121. #define k_uploadSessionID @"ID_UPLOAD_"
  122. // Metadata.Net SELECTOR
  123. #define selectorAddOffline @"addOffline"
  124. #define selectorAddLocal @"addLocal"
  125. #define selectorCreateFolder @"createFolder"
  126. #define selectorDecryptFile @"decryptFile"
  127. #define selectorDelete @"delete"
  128. #define selectorDeleteCrypto @"deleteCrypto"
  129. #define selectorDeletePlist @"deletePlist"
  130. #define selectorDownloadThumbnail @"downloadThumbnail"
  131. #define selectorDownloadOffline @"downloadOffline"
  132. #define selectorEncryptFile @"encryptFile"
  133. #define selectorGetUserAndGroup @"getUserAndGroup"
  134. #define selectorLoadFileView @"loadFileView"
  135. #define selectorLoadModelView @"loadModelView"
  136. #define selectorLoadPlist @"loadPlist"
  137. #define selectorLoadViewImage @"loadViewImage"
  138. #define selectorLoadCopy @"loadCopy"
  139. #define selectorMove @"move"
  140. #define selectorMoveCrypto @"moveCrypto"
  141. #define selectorMovePlist @"movePlist"
  142. #define selectorOpenIn @"openIn"
  143. #define selectorOpenWindowShare @"openWindowShare"
  144. #define selectorReadFile @"readFile"
  145. #define selectorReadFileOffline @"readFileOffline"
  146. #define selectorReadFileFolder @"readFileFolder"
  147. #define selectorReadFileUploadFile @"readFileUploadFile"
  148. #define selectorReadFileVerifyUpload @"readFileVerifyUpload"
  149. #define selectorReadFolder @"readFolder"
  150. #define selectorReadFolderForced @"readFolderForced"
  151. #define selectorReadShare @"readShare"
  152. #define selectorReload @"reload"
  153. #define selectorRename @"rename"
  154. #define selectorSave @"save"
  155. #define selectorShare @"share"
  156. #define selectorSearch @"search"
  157. #define selectorUnshare @"unshare"
  158. #define selectorUpdateShare @"updateShare"
  159. #define selectorUploadAutomatic @"uploadAutomatic"
  160. #define selectorUploadAutomaticAll @"uploadAutomaticAll"
  161. #define selectorUploadFile @"uploadFile"
  162. #define selectorUploadFileCrypto @"uploadFileCrypto"
  163. #define selectorUploadFilePlist @"uploadFilePlist"
  164. #define selectorUploadRemovePhoto @"uploadRemovePhoto"
  165. // Metadata.Net ACTION
  166. #define actionCreateFolder @"createFolder"
  167. #define actionDeleteFileDirectory @"deleteFileOrFolder"
  168. #define actionDownloadFile @"downloadFile"
  169. #define actionDownloadThumbnail @"downloadThumbnail"
  170. #define actionGetCapabilities @"getCapabilitiesOfServer"
  171. #define actionGetFeaturesSuppServer @"getFeaturesSupportedByServer"
  172. #define actionGetUserAndGroup @"getUserAndGroup"
  173. #define actionGetUserProfile @"getUserProfile"
  174. #define actionGetNotificationServer @"getNotificationServer"
  175. #define actionSetNotificationServer @"setNotificationServer"
  176. #define actionMoveFileOrFolder @"moveFileOrFolder"
  177. #define actionReadFile @"readFile"
  178. #define actionReadFolder @"readFolder"
  179. #define actionReadShareServer @"readShareServer"
  180. #define actionSearch @"search"
  181. #define actionShare @"share"
  182. #define actionShareWith @"shareWith"
  183. #define actionUnShare @"unShare"
  184. #define actionUpdateShare @"updateShare"
  185. #define actionUploadFile @"uploadFile"
  186. #define actionUploadAsset @"uploadAsset"
  187. #define actionUploadTemplate @"uploadTemplate"
  188. #define actionUploadOnlyPlist @"uploadOnlyPlist"
  189. // Metadata : FileType
  190. #define k_metadataTypeFile_audio @"audio"
  191. #define k_metadataTypeFile_compress @"compress"
  192. #define k_metadataTypeFile_directory @"directory"
  193. #define k_metadataTypeFile_document @"document"
  194. #define k_metadataTypeFile_image @"image"
  195. #define k_metadataTypeFile_template @"template"
  196. #define k_metadataTypeFile_unknown @"unknow"
  197. #define k_metadataTypeFile_video @"video"
  198. // Metadata : Type
  199. #define k_metadataType_file @"file"
  200. #define k_metadataType_template @"model"
  201. #define k_metadataType_local @"local"
  202. // Metadata : Filename Type
  203. #define k_metadataTypeFilenamePlain 0
  204. #define k_metadataTypeFilenamePlist 1
  205. #define k_metadataTypeFilenameCrypto 2
  206. #define k_tabBarApplicationIndexFile 0
  207. #define k_tabBarApplicationIndexOffline 1
  208. #define k_tabBarApplicationIndexHide 2
  209. #define k_tabBarApplicationIndexPhotos 3
  210. #define k_tabBarApplicationIndexSettings 4
  211. #define k_keyFileNameMask @"fileNameMask"
  212. #define k_keyFileNameMaskAutomaticPhotos @"fileNameMaskAutomaticPhotos"
  213. // Type of page Offline
  214. #define k_pageOfflineOffline @"Offline"
  215. #define k_pageOfflineLocal @"Local"
  216. // Search
  217. #define k_minCharsSearch 2
  218. // -----------------------------------------------------------------------------------------------------------
  219. // COLOR
  220. // -----------------------------------------------------------------------------------------------------------
  221. // NEXTCLOUD COLOR [DEFAULT]
  222. #ifdef NC
  223. #define COLOR_BRAND [UIColor colorWithRed:0.0/255.0 green:130.0/255.0 blue:201.0/255.0 alpha:1.0]
  224. #define COLOR_BRAND_MESSAGE [UIColor colorWithRed:0.0/255.0 green:130.0/255.0 blue:201.0/255.0 alpha:0.90]
  225. #define COLOR_SELECT_BACKGROUND [UIColor colorWithRed:0.0/255.0 green:130.0/255.0 blue:201.0/255.0 alpha:0.1]
  226. #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
  227. #define COLOR_GROUPBY_BAR [UIColor colorWithRed:0.0/255.0 green:130.0/255.0 blue:201.0/255.0 alpha:0.2]
  228. #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]
  229. #define COLOR_BRAND_NAVIGATIONBAR [UIColor greenColor]; //[UIColor colorWithRed:(0.0/255.0) green:(130.0/255.0) blue:(201/255.0) alpha:1.0]
  230. #define COLOR_BRAND_NAVIGATIONBAR_TEXT [UIColor whiteColor]
  231. #endif
  232. // GENERAL COLOR
  233. #define COLOR_CRYPTOCLOUD [UIColor colorWithRed:241.0/255.0 green:90.0/255.0 blue:34.0/255.0 alpha:1.0] // Arancio
  234. #define COLOR_NEXTCLOUD [UIColor colorWithRed:0.0/255.0 green:130.0/255.0 blue:201.0/255.0 alpha:1.0] // Blue #0082c9
  235. #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
  236. #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
  237. #define COLOR_CLEAR [UIColor colorWithRed:65.0/255.0 green:64.0/255.0 blue:66.0/255.0 alpha:1.0]
  238. #define COLOR_NAVIGATIONBAR [UIColor colorWithRed:(247.0f/255.0f) green:(247.0f/255.0f) blue:(247.0f/255.0f) alpha:1.0]
  239. #define COLOR_NAVIGATIONBAR_TEXT [UIColor blackColor]
  240. #define COLOR_TABBAR [UIColor colorWithRed:(247.0f/255.0f) green:(247.0f/255.0f) blue:(247.0f/255.0f) alpha:1.0]
  241. #define COLOR_SEPARATOR_TABLE [UIColor colorWithRed:247.0/255.0 green:247.0/255.0 blue:247.0/255.0 alpha:1] // iOS 7
  242. #define COLOR_NO_CONNECTION [UIColor colorWithRed:204.0/255.0 green:204.0/255.0 blue:204.0/255.0 alpha:1.0]
  243. // -----------------------------------------------------------------------------------------------------------
  244. // -----------------------------------------------------------------------------------------------------------
  245. @interface CCAspect : NSObject
  246. + (void)aspectNavigationControllerBar:(UINavigationBar *)nav encrypted:(BOOL)encrypted online:(BOOL)online hidden:(BOOL)hidden;
  247. + (void)aspectTabBar:(UITabBar *)tab hidden:(BOOL)hidden;
  248. @end