CCGlobal.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  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. // Login Flow
  52. #define k_flowEndpoint @"/index.php/login/flow"
  53. // Avatar
  54. #define k_avatar_size 128
  55. // Passphrase test EndToEnd Encryption
  56. #define k_passphrase_test @"more over television factory tendency independence international intellectual impress interest sentence pony"
  57. #define k_dismissAfterSecond 4
  58. #define k_dismissAfterSecondLong 10
  59. #define k_daysOfActivity 7
  60. #define k_sizePreview 1024
  61. #define k_sizeIcon 512
  62. // Database Realm
  63. #define k_databaseDefault @"nextcloud.realm"
  64. #define k_databaseSchemaVersion 143
  65. // Intro selector
  66. #define k_intro_login 0
  67. #define k_intro_signup 1
  68. // Login
  69. #define k_login_Add 0
  70. #define k_login_Add_Forced 1
  71. #define k_login_Add_SignUp 2
  72. // define Nextcloud IOS
  73. #define k_share_link_middle_part_url_after_version_8 @"index.php/s/"
  74. // serverUrl root
  75. #define k_serverUrl_root @".."
  76. // Constants to identify the different permissions of a file
  77. #define k_permission_shared @"S"
  78. #define k_permission_can_share @"R"
  79. #define k_permission_mounted @"M"
  80. #define k_permission_file_can_write @"W"
  81. #define k_permission_can_create_file @"C"
  82. #define k_permission_can_create_folder @"K"
  83. #define k_permission_can_delete @"D"
  84. #define k_permission_can_rename @"N"
  85. #define k_permission_can_move @"V"
  86. // Service Key Share
  87. #define k_serviceShareKeyChain @"Crypto Cloud"
  88. #define k_metadataKeyedUnarchiver @"it.twsweb.nextcloud.metadata"
  89. // TaskStatus
  90. #define k_taskStatusCancel -1
  91. #define k_taskStatusResume -2
  92. #define k_taskStatusSuspend -3
  93. // Metadata : Status
  94. //
  95. // 1) wait download/upload
  96. // 2) in download/upload
  97. // 3) downloading/uploading
  98. // 4) done or error
  99. //
  100. #define k_metadataStatusNormal 0
  101. #define k_metadataStatustypeDownload 1
  102. #define k_metadataStatusWaitDownload 2
  103. #define k_metadataStatusInDownload 3
  104. #define k_metadataStatusDownloading 4
  105. #define k_metadataStatusDownloadError 5
  106. #define k_metadataStatusTypeUpload 6
  107. #define k_metadataStatusWaitUpload 7
  108. #define k_metadataStatusInUpload 8
  109. #define k_metadataStatusUploading 9
  110. #define k_metadataStatusUploadError 10
  111. #define k_metadataStatusUploadForcedStart 11
  112. // Timer
  113. #define k_timerAutoUpload 5
  114. #define k_timerUpdateApplicationIconBadgeNumber 5
  115. #define k_timerErrorNetworking 3
  116. // ConcurrentOperation
  117. #define k_maxHTTPConnectionsPerHost 5
  118. #define k_maxConcurrentOperation 5
  119. // Max Size Operation
  120. #define k_maxSizeOperationUpload 524288000 // 500 MB
  121. // Max Cache Proxy Video
  122. #define k_maxHTTPCache 10737418240 // 10GB
  123. // Error
  124. #define k_CCErrorInternalError -99999
  125. #define k_CCErrorFileNotSaved -99998
  126. #define k_CCErrorDecodeMetadata -99997
  127. #define k_CCErrorE2EENotEnabled -99996
  128. #define k_CCErrorE2EENotMove -99995
  129. #define k_CCErrorOffline -99994
  130. #define k_CCErrorCharactersForbidden -99993
  131. #define k_CCErrorCreationFile -99992
  132. // Search
  133. #define k_minCharsSearch 2
  134. // Selector
  135. #define selectorDownloadFile @"downloadFile"
  136. #define selectorDownloadAllFile @"downloadAllFile"
  137. #define selectorReadFile @"readFile"
  138. #define selectorListingFavorite @"listingFavorite"
  139. #define selectorLoadFileView @"loadFileView"
  140. #define selectorLoadFileViewFavorite @"loadFileViewFavorite"
  141. #define selectorLoadFileQuickLook @"loadFileQuickLook"
  142. #define selectorLoadCopy @"loadCopy"
  143. #define selectorLoadOffline @"loadOffline"
  144. #define selectorOpenIn @"openIn"
  145. #define selectorOpenInDetail @"openInDetail"
  146. #define selectorSaveAlbum @"saveAlbum"
  147. #define selectorUploadAutoUpload @"uploadAutoUpload"
  148. #define selectorUploadAutoUploadAll @"uploadAutoUploadAll"
  149. #define selectorUploadFile @"uploadFile"
  150. // Metadata : FileType
  151. #define k_metadataTypeFile_audio @"audio"
  152. #define k_metadataTypeFile_compress @"compress"
  153. #define k_metadataTypeFile_directory @"directory"
  154. #define k_metadataTypeFile_document @"document"
  155. #define k_metadataTypeFile_image @"image"
  156. #define k_metadataTypeFile_unknown @"unknow"
  157. #define k_metadataTypeFile_video @"video"
  158. #define k_metadataTypeFile_imagemeter @"imagemeter"
  159. // TabBar button
  160. #define k_tabBarApplicationIndexFile 0
  161. #define k_tabBarApplicationIndexFavorite 1
  162. #define k_tabBarApplicationIndexPlusHide 2
  163. #define k_tabBarApplicationIndexMedia 3
  164. #define k_tabBarApplicationIndexMore 4
  165. // Filename Mask and Type
  166. #define k_keyFileNameMask @"fileNameMask"
  167. #define k_keyFileNameType @"fileNameType"
  168. #define k_keyFileNameAutoUploadMask @"fileNameAutoUploadMask"
  169. #define k_keyFileNameAutoUploadType @"fileNameAutoUploadType"
  170. #define k_keyFileNameOriginal @"fileNameOriginal"
  171. #define k_keyFileNameOriginalAutoUpload @"fileNameOriginalAutoUpload"
  172. // Activity
  173. #define k_activityVerboseDefault 0
  174. #define k_activityVerboseHigh 1
  175. #define k_activityTypeInfo @"info"
  176. #define k_activityTypeSuccess @"success"
  177. #define k_activityTypeFailure @"error"
  178. #define k_activityDebugActionDownload @"Download"
  179. #define k_activityDebugActionDownloadPicker @"Download Picker"
  180. #define k_activityDebugActionUpload @"Upload"
  181. #define k_activityDebugActionUploadPicker @"Upload Picker"
  182. #define k_activityDebugActionUploadShare @"Upload Share"
  183. #define k_activityDebugActionAutoUpload @"Auto Upload"
  184. #define k_activityDebugActionReadFolder @"Read Folder"
  185. #define k_activityDebugActionListingFavorites @"Listing Favorites"
  186. #define k_activityDebugActionCreateFolder @"Create Folder"
  187. #define k_activityDebugActionDeleteFileFolder @"Delete File-Folder"
  188. #define k_activityDebugActionGetNotification @"Get Notification Server"
  189. #define k_activityDebugActionSubscribingServerPush @"Subscribing Server Push"
  190. #define k_activityDebugActionUnsubscribingServerPush @"Unsubscribing Server Push"
  191. #define k_activityDebugActionSubscribingPushProxy @"Subscribing Push Proxy"
  192. #define k_activityDebugActionUnsubscribingPushProxy @"Unsubscribing Push Proxy"
  193. #define k_activityDebugActionCapabilities @"Capabilities Of Server"
  194. #define k_activityDebugActionEndToEndEncryption @"End To End Encryption "
  195. // E2EE
  196. #define k_max_filesize_E2EE 524288000 // 500 MB
  197. #define k_E2EE_API @"1.1"
  198. // Flow Version
  199. #define k_flow_version_available 12
  200. // Trash Version
  201. #define k_trash_version_available 14
  202. #define k_trash_version_available_more_fix 15
  203. // Toolbar Detail
  204. #define k_detail_Toolbar_Height 49
  205. //Share permission
  206. //permissions - (int) 1 = read; 2 = update; 4 = create; 8 = delete; 16 = share; 31 = all (default: 31, for public shares: 1)
  207. #define k_read_share_permission 1
  208. #define k_update_share_permission 2
  209. #define k_create_share_permission 4
  210. #define k_delete_share_permission 8
  211. #define k_share_share_permission 16
  212. #define k_min_file_share_permission 1
  213. #define k_max_file_share_permission 19
  214. #define k_min_folder_share_permission 1
  215. #define k_max_folder_share_permission 31
  216. #define k_default_file_remote_share_permission_no_support_share_option 3
  217. #define k_default_folder_remote_share_permission_no_support_share_option 15
  218. // Layout
  219. #define k_layout_list @"typeLayoutList"
  220. #define k_layout_grid @"typeLayoutGrid"
  221. #define k_layout_view_move @"LayoutMove"
  222. #define k_layout_view_richdocument @"LayoutRichdocument"
  223. #define k_layout_view_trash @"LayoutTrash"
  224. #define k_layout_view_offline @"LayoutOffline"
  225. #define k_layout_view_favorite @"LayoutFavorite"
  226. #define k_layout_view_main @"LayoutMain"
  227. #define k_layout_view_transfers @"LayoutTransfers"
  228. // Rich Workspace
  229. #define k_fileNameRichWorkspace @"Readme.md"
  230. // Text - OnlyOffice - Collabora
  231. #define k_editor_text @"text"
  232. #define k_editor_onlyoffice @"onlyoffice"
  233. #define k_editor_collabora @"collabora"
  234. #define k_onlyoffice_docx @"onlyoffice_docx"
  235. #define k_onlyoffice_xlsx @"onlyoffice_xlsx"
  236. #define k_onlyoffice_pptx @"onlyoffice_pptx"
  237. // Template
  238. #define k_template_document @"document"
  239. #define k_template_spreadsheet @"spreadsheet"
  240. #define k_template_presentation @"presentation"
  241. // Nextcloud unsupported
  242. #define k_nextcloud_unsupported 13
  243. // Nextcloud version
  244. #define k_nextcloud_version_12_0 12
  245. #define k_nextcloud_version_13_0 13
  246. #define k_nextcloud_version_14_0 14
  247. #define k_nextcloud_version_15_0 15
  248. #define k_nextcloud_version_16_0 16
  249. #define k_nextcloud_version_17_0 17
  250. #define k_nextcloud_version_18_0 18
  251. #define k_nextcloud_version_19_0 19
  252. // Notification Center
  253. #define k_notificationCenter_applicationDidEnterBackground @"applicationDidEnterBackground"
  254. #define k_notificationCenter_applicationWillEnterForeground @"applicationWillEnterForeground"
  255. #define k_notificationCenter_initializeMain @"initializeMain"
  256. #define k_notificationCenter_setTitleMain @"setTitleMain"
  257. #define k_notificationCenter_changeTheming @"changeTheming"
  258. #define k_notificationCenter_splitViewChangeDisplayMode @"splitViewChangeDisplayMode"
  259. #define k_notificationCenter_changeUserProfile @"changeUserProfile"
  260. #define k_notificationCenter_richdocumentGrabFocus @"richdocumentGrabFocus"
  261. #define k_notificationCenter_reloadDataNCShare @"reloadDataNCShare"
  262. #define k_notificationCenter_reloadDataSource @"reloadDataSource" // userInfo: ocId?, serverUrl?
  263. #define k_notificationCenter_reloadMediaDataSource @"reloadMediaDataSource"
  264. #define k_notificationCenter_mediaFileNotFound @"mediaFileNotFound" // userInfo: metadata
  265. #define k_notificationCenter_downloadStartFile @"downloadStartFile" // userInfo: metadata
  266. #define k_notificationCenter_downloadedFile @"downloadedFile" // userInfo: metadata, selector, errorCode, errorDescription
  267. #define k_notificationCenter_downloadCancelFile @"downloadCancelFile" // userInfo: metadata
  268. #define k_notificationCenter_uploadStartFile @"uploadStartFile" // userInfo: metadata
  269. #define k_notificationCenter_uploadedFile @"uploadedFile" // userInfo: metadata, ocIdTemp, errorCode, errorDescription
  270. #define k_notificationCenter_uploadCancelFile @"uploadCancelFile" // userInfo: metadata
  271. #define k_notificationCenter_progressTask @"progressTask" // userInfo: account, ocId, serverUrl, status, progress, totalBytes, totalBytesExpected
  272. #define k_notificationCenter_createFolder @"createFolder" // userInfo: metadata
  273. #define k_notificationCenter_deleteFile @"deleteFile" // userInfo: metadata, onlyLocal
  274. #define k_notificationCenter_renameFile @"renameFile" // userInfo: metadata, errorCode, errorDescription
  275. #define k_notificationCenter_moveFile @"moveFile" // userInfo: metadata, metadataNew
  276. #define k_notificationCenter_copyFile @"copyFile" // userInfo: metadata, serverUrlTo
  277. #define k_notificationCenter_favoriteFile @"favoriteFile" // userInfo: metadata
  278. #define k_notificationCenter_menuSearchTextPDF @"menuSearchTextPDF"
  279. #define k_notificationCenter_menuDownloadImage @"menuDownloadImage" // userInfo: metadata
  280. #define k_notificationCenter_menuSaveLivePhoto @"menuSaveLivePhoto" // userInfo: metadata, metadataMov
  281. #define k_notificationCenter_menuDetailClose @"menuDetailClose"
  282. // -----------------------------------------------------------------------------------------------------------
  283. // INTERNAL
  284. // -----------------------------------------------------------------------------------------------------------
  285. #define k_fileProvider_domain 0