CCGlobal.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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. //if indexPath.section < collectionView.numberOfSections && indexPath.row < collectionView.numberOfItems(inSection: indexPath.section)
  41. #define CALL_ORIGIN NSLog(@"Origin: [%@]", [[[[NSThread callStackSymbols] objectAtIndex:1] componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"[]"]] objectAtIndex:1])
  42. #endif
  43. // Constants to identify the different permissions of a file
  44. #define k_permission_shared @"S"
  45. #define k_permission_can_share @"R"
  46. #define k_permission_mounted @"M"
  47. #define k_permission_file_can_write @"W"
  48. #define k_permission_can_create_file @"C"
  49. #define k_permission_can_create_folder @"K"
  50. #define k_permission_can_delete @"D"
  51. #define k_permission_can_rename @"N"
  52. #define k_permission_can_move @"V"
  53. // Metadata : Status
  54. //
  55. // 1) wait download/upload
  56. // 2) in download/upload
  57. // 3) downloading/uploading
  58. // 4) done or error
  59. //
  60. // Selector
  61. #define selectorDownloadFile @"downloadFile"
  62. #define selectorDownloadAllFile @"downloadAllFile"
  63. #define selectorReadFile @"readFile"
  64. #define selectorListingFavorite @"listingFavorite"
  65. #define selectorLoadFileView @"loadFileView"
  66. #define selectorLoadFileQuickLook @"loadFileQuickLook"
  67. #define selectorLoadCopy @"loadCopy"
  68. #define selectorLoadOffline @"loadOffline"
  69. #define selectorOpenIn @"openIn"
  70. #define selectorUploadAutoUpload @"uploadAutoUpload"
  71. #define selectorUploadAutoUploadAll @"uploadAutoUploadAll"
  72. #define selectorUploadFile @"uploadFile"
  73. #define selectorSaveAlbum @"saveAlbum"
  74. // Metadata : FileType
  75. #define k_metadataTypeFile_audio @"audio"
  76. #define k_metadataTypeFile_compress @"compress"
  77. #define k_metadataTypeFile_directory @"directory"
  78. #define k_metadataTypeFile_document @"document"
  79. #define k_metadataTypeFile_image @"image"
  80. #define k_metadataTypeFile_unknown @"unknow"
  81. #define k_metadataTypeFile_video @"video"
  82. #define k_metadataTypeFile_imagemeter @"imagemeter"
  83. // Filename Mask and Type
  84. #define k_keyFileNameMask @"fileNameMask"
  85. #define k_keyFileNameType @"fileNameType"
  86. #define k_keyFileNameAutoUploadMask @"fileNameAutoUploadMask"
  87. #define k_keyFileNameAutoUploadType @"fileNameAutoUploadType"
  88. #define k_keyFileNameOriginal @"fileNameOriginal"
  89. #define k_keyFileNameOriginalAutoUpload @"fileNameOriginalAutoUpload"
  90. // Activity
  91. #define k_activityVerboseDefault 0
  92. #define k_activityVerboseHigh 1
  93. #define k_activityTypeInfo @"info"
  94. #define k_activityTypeSuccess @"success"
  95. #define k_activityTypeFailure @"error"
  96. #define k_activityDebugActionDownload @"Download"
  97. #define k_activityDebugActionDownloadPicker @"Download Picker"
  98. #define k_activityDebugActionUpload @"Upload"
  99. #define k_activityDebugActionUploadPicker @"Upload Picker"
  100. #define k_activityDebugActionUploadShare @"Upload Share"
  101. #define k_activityDebugActionAutoUpload @"Auto Upload"
  102. #define k_activityDebugActionReadFolder @"Read Folder"
  103. #define k_activityDebugActionListingFavorites @"Listing Favorites"
  104. #define k_activityDebugActionCreateFolder @"Create Folder"
  105. #define k_activityDebugActionDeleteFileFolder @"Delete File-Folder"
  106. #define k_activityDebugActionGetNotification @"Get Notification Server"
  107. #define k_activityDebugActionSubscribingServerPush @"Subscribing Server Push"
  108. #define k_activityDebugActionUnsubscribingServerPush @"Unsubscribing Server Push"
  109. #define k_activityDebugActionSubscribingPushProxy @"Subscribing Push Proxy"
  110. #define k_activityDebugActionUnsubscribingPushProxy @"Unsubscribing Push Proxy"
  111. #define k_activityDebugActionCapabilities @"Capabilities Of Server"
  112. #define k_activityDebugActionEndToEndEncryption @"End To End Encryption "
  113. //Share permission
  114. //permissions - (int) 1 = read; 2 = update; 4 = create; 8 = delete; 16 = share; 31 = all (default: 31, for public shares: 1)
  115. #define k_read_share_permission 1
  116. #define k_update_share_permission 2
  117. #define k_create_share_permission 4
  118. #define k_delete_share_permission 8
  119. #define k_share_share_permission 16
  120. #define k_min_file_share_permission 1
  121. #define k_max_file_share_permission 19
  122. #define k_min_folder_share_permission 1
  123. #define k_max_folder_share_permission 31
  124. #define k_default_file_remote_share_permission_no_support_share_option 3
  125. #define k_default_folder_remote_share_permission_no_support_share_option 15
  126. // Notification Center
  127. #define k_notificationCenter_applicationDidEnterBackground @"applicationDidEnterBackground"
  128. #define k_notificationCenter_applicationWillEnterForeground @"applicationWillEnterForeground"
  129. #define k_notificationCenter_initializeMain @"initializeMain"
  130. #define k_notificationCenter_setTitleMain @"setTitleMain"
  131. #define k_notificationCenter_changeTheming @"changeTheming"
  132. #define k_notificationCenter_changeUserProfile @"changeUserProfile"
  133. #define k_notificationCenter_richdocumentGrabFocus @"richdocumentGrabFocus"
  134. #define k_notificationCenter_reloadDataNCShare @"reloadDataNCShare"
  135. #define k_notificationCenter_closeRichWorkspaceWebView @"closeRichWorkspaceWebView"
  136. #define k_notificationCenter_reloadDataSource @"reloadDataSource" // userInfo: ocId?, serverUrl?
  137. #define k_notificationCenter_reloadDataSourceNetworkForced @"reloadDataSourceNetworkForced" // userInfo: serverUrl?
  138. #define k_notificationCenter_changeStatusFolderE2EE @"changeStatusFolderE2EE" // userInfo: serverUrl
  139. #define k_notificationCenter_downloadStartFile @"downloadStartFile" // userInfo: ocId
  140. #define k_notificationCenter_downloadedFile @"downloadedFile" // userInfo: ocId, selector, errorCode, errorDescription
  141. #define k_notificationCenter_downloadCancelFile @"downloadCancelFile" // userInfo: ocId
  142. #define k_notificationCenter_uploadStartFile @"uploadStartFile" // userInfo: ocId
  143. #define k_notificationCenter_uploadedFile @"uploadedFile" // userInfo: ocId, ocIdTemp, errorCode, errorDescription
  144. #define k_notificationCenter_uploadCancelFile @"uploadCancelFile" // userInfo: ocId
  145. #define k_notificationCenter_progressTask @"progressTask" // userInfo: account, ocId, serverUrl, status, progress, totalBytes, totalBytesExpected
  146. #define k_notificationCenter_createFolder @"createFolder" // userInfo: ocId
  147. #define k_notificationCenter_deleteFile @"deleteFile" // userInfo: ocId, fileNameView, typeFile, onlyLocal
  148. #define k_notificationCenter_renameFile @"renameFile" // userInfo: ocId, errorCode, errorDescription
  149. #define k_notificationCenter_moveFile @"moveFile" // userInfo: ocId, serverUrlTo
  150. #define k_notificationCenter_copyFile @"copyFile" // userInfo: ocId, serverUrlFrom
  151. #define k_notificationCenter_favoriteFile @"favoriteFile" // userInfo: ocId
  152. #define k_notificationCenter_menuSearchTextPDF @"menuSearchTextPDF"
  153. #define k_notificationCenter_menuSaveLivePhoto @"menuSaveLivePhoto" // userInfo: ocId, ocIdMov
  154. #define k_notificationCenter_menuDetailClose @"menuDetailClose"