CCGlobal.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. //
  2. // CCGlobal.h
  3. // Nextcloud
  4. //
  5. // Created by Marino Faggiana on 13/10/14.
  6. // Copyright (c) 2014 Marino Faggiana. All rights reserved.
  7. //
  8. // Author Marino Faggiana <marino.faggiana@nextcloud.com>
  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. //NSString *language = [[NSLocale preferredLanguages] objectAtIndex:0];
  34. //NSDictionary *languageDic = [NSLocale componentsFromLocaleIdentifier:language];
  35. //NSString *languageCode = [languageDic objectForKey:@"kCFLocaleLanguageCodeKey"];
  36. //#if targetEnvironment(simulator)
  37. //#endif
  38. //#if TARGET_OS_SIMULATOR
  39. //#endif
  40. #define CALL_ORIGIN NSLog(@"Origin: [%@]", [[[[NSThread callStackSymbols] objectAtIndex:1] componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"[]"]] objectAtIndex:1])
  41. #endif
  42. // Directory on Group
  43. #define k_appApplicationSupport @"Library/Application Support"
  44. #define k_appDatabaseNextcloud @"Library/Application Support/Nextcloud"
  45. #define k_appUserData @"Library/Application Support/UserData"
  46. #define k_appCertificates @"Library/Application Support/Certificates"
  47. #define k_appScan @"Library/Application Support/Scan"
  48. #define k_DirectoryProviderStorage @"File Provider Storage"
  49. // Server Status
  50. #define k_serverStatus @"/status.php"
  51. // webDAV & DAV
  52. #define k_webDAV @"/remote.php/webdav"
  53. #define k_dav @"/remote.php/dav"
  54. // Login Flow
  55. #define k_flowEndpoint @"/index.php/login/flow"
  56. // Avatar
  57. #define k_avatar_size 128
  58. // Passphrase test EndToEnd Encryption
  59. #define k_passphrase_test @"more over television factory tendency independence international intellectual impress interest sentence pony"
  60. #define k_dismissAfterSecond 4
  61. #define k_dismissAfterSecondLong 10
  62. #define k_daysOfActivity 7
  63. #define k_maxErrorAutoUploadAll 100
  64. #define k_sizePreview 1024
  65. // Database Realm
  66. #define k_databaseDefault @"nextcloud.realm"
  67. #define k_databaseSchemaVersion 108
  68. // Intro selector
  69. #define k_intro_login 0
  70. #define k_intro_signup 1
  71. // Login
  72. #define k_login_Add 0
  73. #define k_login_Add_Forced 1
  74. #define k_login_Add_SignUp 2
  75. // define Nextcloud IOS
  76. #define k_share_link_middle_part_url_after_version_8 @"index.php/s/"
  77. // serverUrl root
  78. #define k_serverUrl_root @".."
  79. // Constants to identify the different permissions of a file
  80. #define k_permission_shared @"S"
  81. #define k_permission_can_share @"R"
  82. #define k_permission_mounted @"M"
  83. #define k_permission_file_can_write @"W"
  84. #define k_permission_can_create_file @"C"
  85. #define k_permission_can_create_folder @"K"
  86. #define k_permission_can_delete @"D"
  87. #define k_permission_can_rename @"N"
  88. #define k_permission_can_move @"V"
  89. // Session
  90. #define k_upload_session @"it.twsweb.Crypto-Cloud.upload.session"
  91. #define k_upload_session_wwan @"it.twsweb.Crypto-Cloud.upload.sessionwwan"
  92. // Service Key Share
  93. #define k_serviceShareKeyChain @"Crypto Cloud"
  94. #define k_metadataKeyedUnarchiver @"it.twsweb.nextcloud.metadata"
  95. // TaskIdentifier
  96. #define k_taskIdentifierDone 0
  97. // TaskStatus
  98. #define k_taskStatusCancel -1
  99. #define k_taskStatusResume -2
  100. #define k_taskStatusSuspend -3
  101. // Metadata : Status
  102. //
  103. // 1) wait download/upload
  104. // 2) in download/upload
  105. // 3) downloading/uploading
  106. // 4) done or error
  107. //
  108. #define k_metadataStatusNormal 0
  109. #define k_metadataStatusWaitDownload 2
  110. #define k_metadataStatusInDownload 3
  111. #define k_metadataStatusDownloading 4
  112. #define k_metadataStatusDownloadError 5
  113. #define k_metadataStatusWaitUpload 6
  114. #define k_metadataStatusInUpload 7
  115. #define k_metadataStatusUploading 8
  116. #define k_metadataStatusUploadError 9
  117. #define k_metadataStatusUploadForcedStart 10
  118. // Timer
  119. #define k_timerProcessAutoUpload 5
  120. #define k_timerUpdateApplicationIconBadgeNumber 3
  121. #define k_timerErrorNetworking 3
  122. // ConcurrentOperation
  123. #define k_maxHTTPConnectionsPerHost 5
  124. #define k_maxConcurrentOperation 5
  125. // Max Size Operation
  126. #define k_maxSizeOperationUpload 524288000 // 500 MB
  127. // Max Cache Proxy Video
  128. #define k_maxHTTPCache 10737418240 // 10GB
  129. // Error
  130. #define k_CCErrorTaskNil -9999
  131. #define k_CCErrorTaskDownloadNotFound -9998
  132. #define k_CCErrorUserNotAvailble -9997
  133. #define k_CCErrorInternalError -9996
  134. #define k_CCErrorFileAlreadyInDownload -9995
  135. #define k_CCErrorWebdavResponseError -9994
  136. #define k_CCErrorNotPermission -9993
  137. // Search
  138. #define k_minCharsSearch 2
  139. // Selector
  140. #define selectorDownloadSynchronize @"downloadSynchronize"
  141. #define selectorLoadFileView @"loadFileView"
  142. #define selectorLoadFileViewFavorite @"loadFileViewFavorite"
  143. #define selectorLoadFileQuickLook @"loadFileQuickLook"
  144. #define selectorLoadCopy @"loadCopy"
  145. #define selectorLoadOffline @"loadOffline"
  146. #define selectorOpenIn @"openIn"
  147. #define selectorOpenInDetail @"openInDetail"
  148. #define selectorReadFile @"readFile"
  149. #define selectorReadFileWithDownload @"readFileWithDownload"
  150. #define selectorReadFolder @"readFolder"
  151. #define selectorReadFolderWithDownload @"readFolderWithDownload"
  152. #define selectorSave @"save"
  153. #define selectorUploadAutoUpload @"uploadAutoUpload"
  154. #define selectorUploadAutoUploadAll @"uploadAutoUploadAll"
  155. #define selectorUploadFile @"uploadFile"
  156. // Metadata : FileType
  157. #define k_metadataTypeFile_audio @"audio"
  158. #define k_metadataTypeFile_compress @"compress"
  159. #define k_metadataTypeFile_directory @"directory"
  160. #define k_metadataTypeFile_document @"document"
  161. #define k_metadataTypeFile_image @"image"
  162. #define k_metadataTypeFile_unknown @"unknow"
  163. #define k_metadataTypeFile_video @"video"
  164. #define k_metadataTypeFile_imagemeter @"imagemeter"
  165. // TabBar button
  166. #define k_tabBarApplicationIndexFile 0
  167. #define k_tabBarApplicationIndexFavorite 1
  168. #define k_tabBarApplicationIndexPlusHide 2
  169. #define k_tabBarApplicationIndexMedia 3
  170. #define k_tabBarApplicationIndexMore 4
  171. // Filename Mask and Type
  172. #define k_keyFileNameMask @"fileNameMask"
  173. #define k_keyFileNameType @"fileNameType"
  174. #define k_keyFileNameAutoUploadMask @"fileNameAutoUploadMask"
  175. #define k_keyFileNameAutoUploadType @"fileNameAutoUploadType"
  176. #define k_keyFileNameOriginal @"fileNameOriginal"
  177. #define k_keyFileNameOriginalAutoUpload @"fileNameOriginalAutoUpload"
  178. // Activity
  179. #define k_activityVerboseDefault 0
  180. #define k_activityVerboseHigh 1
  181. #define k_activityTypeInfo @"info"
  182. #define k_activityTypeSuccess @"success"
  183. #define k_activityTypeFailure @"error"
  184. #define k_activityDebugActionDownload @"Download"
  185. #define k_activityDebugActionDownloadPicker @"Download Picker"
  186. #define k_activityDebugActionUpload @"Upload"
  187. #define k_activityDebugActionUploadPicker @"Upload Picker"
  188. #define k_activityDebugActionUploadShare @"Upload Share"
  189. #define k_activityDebugActionAutoUpload @"Auto Upload"
  190. #define k_activityDebugActionReadFolder @"Read Folder"
  191. #define k_activityDebugActionListingFavorites @"Listing Favorites"
  192. #define k_activityDebugActionCreateFolder @"Create Folder"
  193. #define k_activityDebugActionDeleteFileFolder @"Delete File-Folder"
  194. #define k_activityDebugActionGetNotification @"Get Notification Server"
  195. #define k_activityDebugActionSubscribingServerPush @"Subscribing Server Push"
  196. #define k_activityDebugActionUnsubscribingServerPush @"Unsubscribing Server Push"
  197. #define k_activityDebugActionSubscribingPushProxy @"Subscribing Push Proxy"
  198. #define k_activityDebugActionUnsubscribingPushProxy @"Unsubscribing Push Proxy"
  199. #define k_activityDebugActionCapabilities @"Capabilities Of Server"
  200. #define k_activityDebugActionEndToEndEncryption @"End To End Encryption "
  201. // E2EE
  202. #define k_max_filesize_E2EE 524288000 // 500 MB
  203. // Flow Version
  204. #define k_flow_version_available 12
  205. // Trash Version
  206. #define k_trash_version_available 14
  207. #define k_trash_version_available_more_fix 15
  208. // Toolbar Detail
  209. #define k_detail_Toolbar_Height 49
  210. // Template Nextcloud Text
  211. // Layout
  212. #define k_layout_list @"typeLayoutList"
  213. #define k_layout_grid @"typeLayoutGrid"
  214. #define k_layout_view_move @"LayoutMove"
  215. #define k_layout_view_richdocument @"LayoutRichdocument"
  216. #define k_layout_view_trash @"LayoutTrash"
  217. #define k_layout_view_offline @"LayoutOffline"
  218. // Rich Workspace
  219. #define k_fileNameRichWorkspace @"Readme.md"
  220. // Text - OnlyOffice - Collabora
  221. #define k_editor_text @"text"
  222. #define k_editor_onlyoffice @"onlyoffice"
  223. #define k_editor_collabora @"collabora"
  224. #define k_onlyoffice_docx @"onlyoffice_docx"
  225. #define k_onlyoffice_xlsx @"onlyoffice_xlsx"
  226. #define k_onlyoffice_pptx @"onlyoffice_pptx"
  227. // Template
  228. #define k_template_document @"document"
  229. #define k_template_spreadsheet @"spreadsheet"
  230. #define k_template_presentation @"presentation"
  231. // Nextcloud unsupported
  232. #define k_nextcloud_unsupported 13
  233. // Nextcloud version
  234. #define k_nextcloud_version_12_0 12
  235. #define k_nextcloud_version_13_0 13
  236. #define k_nextcloud_version_14_0 14
  237. #define k_nextcloud_version_15_0 15
  238. #define k_nextcloud_version_16_0 16
  239. #define k_nextcloud_version_17_0 17
  240. #define k_nextcloud_version_18_0 18
  241. #define k_nextcloud_version_19_0 19
  242. // Notification Center
  243. #define k_notificationCenter_applicationDidEnterBackground @"applicationDidEnterBackground"
  244. #define k_notificationCenter_initializeMain @"initializeMain"
  245. #define k_notificationCenter_setTitleMain @"setTitleMain"
  246. #define k_notificationCenter_changeTheming @"changeTheming"
  247. #define k_notificationCenter_splitViewChangeDisplayMode @"splitViewChangeDisplayMode"
  248. #define k_notificationCenter_synchronizationMedia @"synchronizationMedia" // userInfo: metadata, type
  249. #define k_notificationCenter_changeUserProfile @"changeUserProfile"
  250. #define k_notificationCenter_richdocumentGrabFocus @"richdocumentGrabFocus"
  251. #define k_notificationCenter_reloadDataNCShare @"reloadDataNCShare"
  252. #define k_notificationCenter_reloadDataSource @"reloadDataSource" // userInfo: ocId?, serverUrl?
  253. #define k_notificationCenter_uploadFileStart @"uploadFileStart" // userInfo: ocId, task, serverUrl, account
  254. #define k_notificationCenter_uploadedFile @"uploadedFile" // userInfo: metadata, errorCode, errorDescription
  255. #define k_notificationCenter_downloadFileStart @"downloadFileStart" // userInfo: ocId, serverUrl, account
  256. #define k_notificationCenter_downloadedFile @"downloadedFile" // userInfo: metadata, selector, errorCode, errorDescription
  257. #define k_notificationCenter_progressTask @"progressTask" // userInfo: account, ocId, serverUrl, status, progress, totalBytes, totalBytesExpected
  258. #define k_notificationCenter_createFolder @"createFolder" // userInfo: fileName, serverUrl, errorCode, errorDescription
  259. #define k_notificationCenter_deleteFile @"deleteFile" // userInfo: metadata, errorCode, errorDescription
  260. #define k_notificationCenter_renameFile @"renameFile" // userInfo: metadata, errorCode, errorDescription
  261. #define k_notificationCenter_moveFile @"moveFile" // userInfo: metadata, metadataNew, errorCode, errorDescription
  262. #define k_notificationCenter_copyFile @"copyFile" // userInfo: metadata, serverUrlTo, errorCode, errorDescription
  263. #define k_notificationCenter_favoriteFile @"favoriteFile" // userInfo: metadata, favorite, errorCode, errorDescription
  264. #define k_notificationCenter_menuSearchTextPDF @"menuSearchTextPDF"
  265. #define k_notificationCenter_menuDownloadImage @"menuDownloadImage" // userInfo: metadata
  266. #define k_notificationCenter_menuSaveLivePhoto @"menuSaveLivePhoto" // UserInfo: metadata, metadataMov
  267. #define k_notificationCenter_menuDetailClose @"menuDetailClose"
  268. // -----------------------------------------------------------------------------------------------------------
  269. // INTERNAL
  270. // -----------------------------------------------------------------------------------------------------------
  271. #define k_fileProvider_domain 0