CCGlobal.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. //
  2. // CCGlobal.h
  3. // Nextcloud iOS
  4. //
  5. // Created by Marino Faggiana on 13/10/14.
  6. // Copyright (c) 2017 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. #ifndef EXTENSION
  25. //AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
  26. //#define app ((AppDelegate *)[[UIApplication sharedApplication] delegate])
  27. //dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  28. //dispatch_async(dispatch_get_main_queue(), ^{
  29. //dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.3 * NSEC_PER_SEC), dispatch_get_main_queue(), ^(void) {
  30. //DispatchQueue.main.async
  31. //DispatchQueue.main.asyncAfter(deadline: .now() + 0.1)
  32. //DispatchQueue.global().async
  33. #define CALL_ORIGIN NSLog(@"Origin: [%@]", [[[[NSThread callStackSymbols] objectAtIndex:1] componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"[]"]] objectAtIndex:1])
  34. #endif
  35. // Directory on Group
  36. #define k_appApplicationSupport @"Library/Application Support"
  37. #define k_appDatabaseNextcloud @"Library/Application Support/Nextcloud"
  38. #define k_appUserData @"Library/Application Support/UserData"
  39. #define k_appCertificates @"Library/Application Support/Certificates"
  40. #define k_appScan @"Library/Application Support/Scan"
  41. #define k_DirectoryProviderStorage @"File Provider Storage"
  42. // Server Status
  43. #define k_serverStatus @"/status.php"
  44. // webDAV & DAV
  45. #define k_webDAV @"/remote.php/webdav"
  46. #define k_dav @"/remote.php/dav"
  47. // Login Flow
  48. #define k_flowEndpoint @"/index.php/login/flow"
  49. // Passphrase test EndToEnd Encryption
  50. #define k_passphrase_test @"more over television factory tendency independence international intellectual impress interest sentence pony"
  51. // UUID
  52. #define k_UUID_SIM @"4BACFE4A-61A6-44B1-9A85-13FD167565AB"
  53. #define k_dismissAfterSecond 4
  54. #define k_daysOfActivity 7
  55. #define k_maxErrorAutoUploadAll 100
  56. // Name Default DB
  57. #define k_databaseDefault @"nextcloud.realm"
  58. // Intro selector
  59. #define k_intro_login 0
  60. #define k_intro_signup 1
  61. // Login
  62. #define k_login_Add 0
  63. #define k_login_Add_Forced 1
  64. #define k_login_Add_SignUp 2
  65. #define k_login_Modify_Password 3
  66. // Picker select image
  67. #define k_pickerControllerMax 1000.0
  68. // define Nextcloud IOS
  69. #define k_share_link_middle_part_url_after_version_8 @"index.php/s/"
  70. // Constants to identify the different permissions of a file
  71. #define k_permission_shared @"S"
  72. #define k_permission_can_share @"R"
  73. #define k_permission_mounted @"M"
  74. #define k_permission_file_can_write @"W"
  75. #define k_permission_can_create_file @"C"
  76. #define k_permission_can_create_folder @"K"
  77. #define k_permission_can_delete @"D"
  78. #define k_permission_can_rename @"N"
  79. #define k_permission_can_move @"V"
  80. // Session
  81. #define k_domain_session_queue @"it.twsweb.Crypto-Cloud"
  82. #define k_download_session @"it.twsweb.Crypto-Cloud.download.session"
  83. #define k_download_session_foreground @"it.twsweb.Crypto-Cloud.download.sessionforeground"
  84. #define k_download_session_wwan @"it.twsweb.Crypto-Cloud.download.sessionwwan"
  85. #define k_upload_session @"it.twsweb.Crypto-Cloud.upload.session"
  86. #define k_upload_session_wwan @"it.twsweb.Crypto-Cloud.upload.sessionwwan"
  87. #define k_upload_session_foreground @"it.twsweb.Crypto-Cloud.upload.sessionforeground"
  88. // Session Download Upload Extension
  89. #define k_download_session_extension @"com.nextcloud.download.session.extension"
  90. #define k_upload_session_extension @"com.nextcloud.upload.session.extension"
  91. // OperationQueue
  92. #define k_queue @"it.twsweb.Crypto-Cloud.queue"
  93. #define k_download_queue @"it.twsweb.Crypto-Cloud.download.queue"
  94. #define k_download_queuewwan @"it.twsweb.Crypto-Cloud.download.queuewwan"
  95. #define k_upload_queue @"it.twsweb.Crypto-Cloud.upload.queue"
  96. #define k_upload_queuewwan @"it.twsweb.Crypto-Cloud.upload.queuewwan"
  97. // Service Key Share
  98. #define k_serviceShareKeyChain @"Crypto Cloud"
  99. #define k_metadataKeyedUnarchiver @"it.twsweb.nextcloud.metadata"
  100. // TaskIdentifier
  101. #define k_taskIdentifierDone 0
  102. // TaskStatus
  103. #define k_taskStatusCancel -1
  104. #define k_taskStatusResume -2
  105. #define k_taskStatusSuspend -3
  106. // Metadata : Status
  107. //
  108. // 1) wait download/upload
  109. // 2) in download/upload
  110. // 3) downloading/uploading
  111. // 4) done or error
  112. //
  113. #define k_metadataStatusNormal 0
  114. #define k_metadataStatusHide 1
  115. #define k_metadataStatusWaitDownload 2
  116. #define k_metadataStatusInDownload 3
  117. #define k_metadataStatusDownloading 4
  118. #define k_metadataStatusDownloadError 5
  119. #define k_metadataStatusWaitUpload 6
  120. #define k_metadataStatusInUpload 7
  121. #define k_metadataStatusUploading 8
  122. #define k_metadataStatusUploadError 9
  123. // Timer
  124. #define k_timerProcessAutoDownloadUpload 5
  125. #define k_timerUpdateApplicationIconBadgeNumber 3
  126. // ConcurrentOperation
  127. #define k_maxHTTPConnectionsPerHost 5
  128. #define k_maxConcurrentOperation 10
  129. #define k_maxConcurrentOperationDownload 5
  130. #define k_maxConcurrentOperationUpload 5
  131. // Max Size Operation
  132. #define k_maxSizeOperationUpload 524288000 // 500 MB
  133. // Max Cache Proxy Video
  134. #define k_maxHTTPCache 10737418240 // 10GB
  135. // Error
  136. #define k_CCErrorTaskNil -9999
  137. #define k_CCErrorTaskDownloadNotFound -9998
  138. #define k_CCErrorUserNotAvailble -9997
  139. #define k_CCErrorInternalError -9996
  140. #define k_CCErrorFileAlreadyInDownload -9995
  141. #define k_CCErrorWebdavResponseError -9994
  142. // Search
  143. #define k_minCharsSearch 2
  144. // Metadata.Net SELECTOR
  145. #define selectorDownloadSynchronize @"downloadSynchronize"
  146. #define selectorGetUserAndGroup @"getUserAndGroup"
  147. #define selectorLoadFileView @"loadFileView"
  148. #define selectorLoadModelView @"loadModelView"
  149. #define selectorLoadViewImage @"loadViewImage"
  150. #define selectorLoadCopy @"loadCopy"
  151. #define selectorMove @"move"
  152. #define selectorOpenIn @"openIn"
  153. #define selectorOpenWindowShare @"openWindowShare"
  154. #define selectorReadFile @"readFile"
  155. #define selectorReadFileWithDownload @"readFileWithDownload"
  156. #define selectorReadFileReloadFolder @"readFileReloadFolder"
  157. #define selectorReadFileFolder @"readFileFolder"
  158. #define selectorReadFileFolderWithDownload @"readFileFolderWithDownload"
  159. #define selectorReadFolder @"readFolder"
  160. #define selectorReadFolderWithDownload @"readFolderWithDownload"
  161. #define selectorReadShare @"readShare"
  162. #define selectorRename @"rename"
  163. #define selectorSave @"save"
  164. #define selectorShare @"share"
  165. #define selectorSearchFiles @"searchFiles"
  166. #define selectorSearchContentType @"searchContentType"
  167. #define selectorUnshare @"unshare"
  168. #define selectorUpdateShare @"updateShare"
  169. #define selectorUploadAutoUpload @"uploadAutoUpload"
  170. #define selectorUploadAutoUploadAll @"uploadAutoUploadAll"
  171. #define selectorUploadFile @"uploadFile"
  172. // Metadata.Net ACTION
  173. #define actionGetActivityServer @"getActivityServer"
  174. #define actionGetCapabilities @"getCapabilitiesOfServer"
  175. #define actionGetUserAndGroup @"getUserAndGroup"
  176. #define actionGetUserProfile @"getUserProfile"
  177. #define actionGetNotificationServer @"getNotificationServer"
  178. #define actionGetSharePermissionsFile @"getSharePermissionsFile"
  179. #define actionGetExternalSitesServer @"getExternalSitesServer"
  180. #define actionMiddlewarePing @"middlewarePing"
  181. #define actionMoveFileOrFolder @"moveFileOrFolder"
  182. #define actionReadFile @"readFile"
  183. #define actionReadFolder @"readFolder"
  184. #define actionReadShareServer @"readShareServer"
  185. #define actionSearch @"search"
  186. #define actionSetNotificationServer @"setNotificationServer"
  187. #define actionShare @"share"
  188. #define actionShareWith @"shareWith"
  189. #define actionUnShare @"unShare"
  190. #define actionUpdateShare @"updateShare"
  191. #define actionGetEndToEndPublicKeys @"getEndToEndPublicKeys"
  192. #define actionGetEndToEndPrivateKeyCipher @"getEndToEndPrivateKeyCipher"
  193. #define actionSignEndToEndPublicKey @"signEndToEndPublicKey"
  194. #define actionStoreEndToEndPrivateKeyCipher @"storeEndToEndPrivateKeyCipher"
  195. #define actionDeleteEndToEndPublicKey @"deleteEndToEndPublicKey"
  196. #define actionDeleteEndToEndPrivateKey @"deleteEndToEndPrivateKey"
  197. #define actionGetEndToEndServerPublicKey @"getEndToEndServerPublicKey"
  198. // Metadata : FileType
  199. #define k_metadataTypeFile_audio @"audio"
  200. #define k_metadataTypeFile_compress @"compress"
  201. #define k_metadataTypeFile_directory @"directory"
  202. #define k_metadataTypeFile_document @"document"
  203. #define k_metadataTypeFile_image @"image"
  204. #define k_metadataTypeFile_unknown @"unknow"
  205. #define k_metadataTypeFile_video @"video"
  206. // TabBar button
  207. #define k_tabBarApplicationIndexFile 0
  208. #define k_tabBarApplicationIndexFavorite 1
  209. #define k_tabBarApplicationIndexPlusHide 2
  210. #define k_tabBarApplicationIndexMedia 3
  211. #define k_tabBarApplicationIndexMore 4
  212. // Filename Mask and Type
  213. #define k_keyFileNameMask @"fileNameMask"
  214. #define k_keyFileNameType @"fileNameType"
  215. #define k_keyFileNameAutoUploadMask @"fileNameAutoUploadMask"
  216. #define k_keyFileNameAutoUploadType @"fileNameAutoUploadType"
  217. #define k_keyFileNameOriginal @"fileNameOriginal"
  218. #define k_keyFileNameOriginalAutoUpload @"fileNameOriginalAutoUpload"
  219. // Activity
  220. #define k_activityVerboseDefault 0
  221. #define k_activityVerboseHigh 1
  222. #define k_activityTypeInfo @"info"
  223. #define k_activityTypeSuccess @"success"
  224. #define k_activityTypeFailure @"error"
  225. #define k_activityDebugActionDownload @"Download"
  226. #define k_activityDebugActionDownloadPicker @"Download Picker"
  227. #define k_activityDebugActionUpload @"Upload"
  228. #define k_activityDebugActionUploadPicker @"Upload Picker"
  229. #define k_activityDebugActionUploadShare @"Upload Share"
  230. #define k_activityDebugActionAutoUpload @"Auto Upload"
  231. #define k_activityDebugActionReadFolder @"Read Folder"
  232. #define k_activityDebugActionListingFavorites @"Listing Favorites"
  233. #define k_activityDebugActionCreateFolder @"Create Folder"
  234. #define k_activityDebugActionDeleteFileFolder @"Delete File-Folder"
  235. #define k_activityDebugActionGetNotification @"Get Notification Server"
  236. #define k_activityDebugActionSubscribingServerPush @"Subscribing Server Push"
  237. #define k_activityDebugActionUnsubscribingServerPush @"Unsubscribing Server Push"
  238. #define k_activityDebugActionSubscribingPushProxy @"Subscribing Push Proxy"
  239. #define k_activityDebugActionUnsubscribingPushProxy @"Unsubscribing Push Proxy"
  240. #define k_activityDebugActionCapabilities @"Capabilities Of Server"
  241. #define k_activityDebugActionEndToEndEncryption @"End To End Encryption "
  242. // E2EE
  243. #define k_max_filesize_E2E 524288000 // 500 MB
  244. // Flow Version
  245. #define k_flow_version_available 12
  246. // Trash Version
  247. #define k_trash_version_available 14
  248. // Cell Reload Data Source
  249. #define k_action_NULL 0
  250. #define k_action_MOD 1
  251. #define k_action_DEL 2
  252. // Nextcloud unsupported
  253. #define k_nextcloud_unsupported 12
  254. // Toolbar Detail
  255. #define k_detail_Toolbar_Height 49
  256. // -----------------------------------------------------------------------------------------------------------
  257. // -----------------------------------------------------------------------------------------------------------