Constants.h 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. // _____ _
  2. // |_ _| |_ _ _ ___ ___ _ __ __ _
  3. // | | | ' \| '_/ -_) -_) ' \/ _` |_
  4. // |_| |_||_|_| \___\___|_|_|_\__,_(_)
  5. //
  6. // Threema iOS Client
  7. // Copyright (c) 2014-2020 Threema GmbH
  8. //
  9. // This program is free software: you can redistribute it and/or modify
  10. // it under the terms of the GNU Affero General Public License, version 3,
  11. // as published by the Free Software Foundation.
  12. //
  13. // This program is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. // GNU Affero General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU Affero General Public License
  19. // along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. #ifndef Threema_Constants_h
  21. #define Threema_Constants_h
  22. #pragma mark - iOS version makros
  23. #define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
  24. #define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
  25. #define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
  26. #define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
  27. #define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)
  28. #define SYSTEM_IS_IPAD ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)
  29. #define SYSTEM_IS_IPHONE_X (([[UIDevice currentDevice]userInterfaceIdiom] == UIUserInterfaceIdiomPhone) && ((int)[[UIScreen mainScreen] nativeBounds].size.height) == 2436)
  30. #define THREEMA_FRAMEWORK_IDENTIFIER @"ch.threema.ThreemaFramework"
  31. #define SHARE_FILE_PREFIX @"share"
  32. #define MEDIA_EXTENSION_AUDIO @"m4a"
  33. #define MEDIA_EXTENSION_IMAGE @"jpg"
  34. #define MEDIA_EXTENSION_VIDEO @"mp4"
  35. #pragma mark - notifications
  36. #define kNotificationShowConversation @"ThreemaShowConversation"
  37. #define kNotificationDeletedConversation @"ThreemaDeletedConversation"
  38. #define kNotificationShowContact @"ThreemaShowContact"
  39. #define kNotificationDeletedContact @"ThreemaDeletedContact"
  40. #define kNotificationAddedContact @"ThreemaAddedContact"
  41. #define kNotificationBlockedContact @"ThreemaBlockedContact"
  42. #define kNotificationShowGroup @"ThreemaShowGroup"
  43. #define kNotificationUpdatedGroup @"ThreemaUpdatedGroup"
  44. #define kNotificationCreatedIdentity @"ThreemaCreatedIdentity"
  45. #define kNotificationDestroyedIdentity @"ThreemaDestroyedIdentity"
  46. #define kNotificationIdentityAvatarChanged @"ThreemaIdentityAvatarChanged"
  47. #define kNotificationLicenseMissing @"ThreemaLicenseMissing"
  48. #define kNotificationWallpaperChanged @"ThreemaWallpaperChanged"
  49. #define kNotificationFontSizeChanged @"ThreemaChatFontSizeChanged"
  50. #define kNotificationShowTimestampSettingsChanged @"ThreemaShowTimestampSettingsChanged"
  51. #define kNotificationColorThemeChanged @"ThreemaColorThemeChanged"
  52. #define kNotificationShowProfilePictureChanged @"ShowProfilePictureChanged"
  53. #define kNotificationCallInBackground @"ThreemaCallInBackground"
  54. #define kNotificationCallInBackgroundTimeChanged @"ThreemaCallInBackgroundTimeChanged"
  55. #define kNotificationUpdateDraftForCell @"ThreemaUpdateDraftForCell"
  56. #define kPushNotificationDeviceToken @"PushNotificationDeviceToken"
  57. #define kVoIPPushNotificationDeviceToken @"VoIPPushNotificationDeviceToken"
  58. #define kPushNotificationEncryptionKey @"PushNotificationEncryptionKey"
  59. #define kNotificationServerMessage @"ThreemaServerMessage"
  60. #define kNotificationQueueSendComplete @"ThreemaQueueSendComplete"
  61. #define kNotificationErrorConnectionFailed @"ThreemaErrorConnectionFaild"
  62. #define kNotificationErrorUnknownGroup @"ThreemaErrorUnknownGroup"
  63. #define kNotificationErrorPublicKeyMismatch @"ThreemaErrorPublicKeyMismatch"
  64. #define kNotificationDBRefreshedDirtyObject @"ThreemaDBRefreshedDirtyObject"
  65. #define kNotificationRefreshWorkContactTableView @"RefreshWorkContactTableView"
  66. #define kNotificationAddressbookSyncronized @"AddressbookSyncronized"
  67. #define kNotificationRefreshContactSortIndices @"RefreshContactSortIndices"
  68. #define kVoIPCallStartRinging @"ThreemaVoIPCallStartRinging"
  69. #define kVoIPCallStatusChanged @"ThreemaVoIPCallStatusChanged"
  70. #define kVoIPCallIncomingCall @"ThreemaVoIPCallIncomingCall"
  71. #define kVoIPCallStartDebugMode @"ThreemaVoIPCallStartDebugMode"
  72. #define kAppClosedByUserBackgroundTask @"ThreemaAppClosedByUserBackgroundTask"
  73. #define kAppVoIPBackgroundTask @"ThreemaVoIPBackgroundTask"
  74. #define kAppVoIPIncomCallBackgroundTask @"ThreemaVoIPIncomCallBackgroundTask"
  75. #define kAppWCBackgroundTask @"ThreemaWCBackgroundTask"
  76. #define kAppPushBackgroundTask @"ThreemaPushBackgroundTask"
  77. #define kAppSendingBackgroundTask @"ThreemaSendingBackgroundTask"
  78. #define kAppAckBackgroundTask @"ThreemaAckBackgroundTask"
  79. #define kAppPushReplyBackgroundTask @"ThreemaPushReplyBackgroundTask"
  80. #define kAppCoreDataSaveBackgroundTask @"ThreemaCoreDataSaveBackgroundTask"
  81. #define kAppCoreDataProcessMessageBackgroundTask @"ThreemaCoreDataProcessMessageTask"
  82. #define kSafeBackgroundTask @"ThreemaSafeBackgroundTask"
  83. #define kMediaPreviewPauseVideo @"MediaPreviewPauseVideo"
  84. #define kAppClosedByUserBackgroundTaskTime 5
  85. #define kAppPushBackgroundTaskTime 40
  86. #define kAppWCBackgroundTaskTime 30
  87. #define kAppPushReplyBackgroundTaskTime 30
  88. #define kAppVoIPBackgroundTaskTime 5
  89. #define kAppAckBackgroundTaskTime 2
  90. #define kAppCoreDataSaveBackgroundTaskTime 15
  91. #define kAppSendingBackgroundTaskTime 170
  92. #define kAppVoIPIncomCallBackgroundTaskTime 80
  93. #define kAppCoreDataProcessMessageBackgroundTaskTime 10
  94. static NSString * const kNotificationProfilePictureChanged = @"ProfilePictureChanged";
  95. static NSString * const kNotificationProfileNicknameChanged = @"ProfileNicknameChanged";
  96. #pragma mark - notification info keys
  97. #define kKeyContact @"contact"
  98. #define kKeyGroup @"group"
  99. #define kKeyConversation @"conversation"
  100. #define kKeyForceCompose @"forceCompose"
  101. #define kKeyText @"text"
  102. #define kKeyImage @"image"
  103. #define kKeyMessage @"message"
  104. #define kKeyObjectID @"objectID"
  105. #define kCNContactKeys @[CNContactFamilyNameKey, CNContactGivenNameKey, CNContactMiddleNameKey, CNContactOrganizationNameKey, CNContactPhoneNumbersKey, CNContactEmailAddressesKey, CNContactImageDataKey, CNContactImageDataAvailableKey, CNContactThumbnailImageDataKey, [CNContactFormatter descriptorForRequiredKeysForStyle:CNContactFormatterStyleFullName]]
  106. #pragma mark - ThreemaWeb
  107. #define kWebPageSize 50
  108. #pragma mark - ThreemaSAFE
  109. static NSString * const kSafeBackupTrigger = @"ThreemaSafeBackupTrigger";
  110. static NSString * const kSafeBackupUIRefresh = @"ThreemaSafeBackupUIRefresh";
  111. #define kSafeSetupUI @"ThreemaSafeSetupUI"
  112. #pragma mark - Threema Calls
  113. static NSString * const kThreemaVideoCallsQualitySettingChanged = @"ThreemaVideoCallsQualitySettingChanged";
  114. #pragma mark - UserDefault Keys
  115. #define kLastPushOverrideSendDate @"LastPushOverrideSendDate"
  116. #pragma mark - Push notification keys
  117. typedef NSString *ThreemaPushNotificationDictionary NS_STRING_ENUM;
  118. extern ThreemaPushNotificationDictionary const ThreemaPushNotificationDictionaryKey;
  119. extern ThreemaPushNotificationDictionary const ThreemaPushNotificationDictionaryCommandKey;
  120. extern ThreemaPushNotificationDictionary const ThreemaPushNotificationDictionaryFromKey;
  121. extern ThreemaPushNotificationDictionary const ThreemaPushNotificationDictionaryNicknameKey;
  122. extern ThreemaPushNotificationDictionary const ThreemaPushNotificationDictionaryMessageIdKey;
  123. extern ThreemaPushNotificationDictionary const ThreemaPushNotificationDictionaryVoipKey;
  124. typedef NSString *ThreemaPushNotificationDictionaryBool NS_STRING_ENUM NS_SWIFT_NAME(ThreemaPushNotificationDictionary.Bool);
  125. extern ThreemaPushNotificationDictionaryBool const ThreemaPushNotificationDictionaryBoolTrue;
  126. extern ThreemaPushNotificationDictionaryBool const ThreemaPushNotificationDictionaryBoolFalse;
  127. typedef NSString *ThreemaPushNotificationDictionaryCommand NS_STRING_ENUM NS_SWIFT_NAME(ThreemaPushNotificationDictionary.Command);
  128. extern ThreemaPushNotificationDictionaryCommand const ThreemaPushNotificationDictionaryCommandNewMessage;
  129. extern ThreemaPushNotificationDictionaryCommand const ThreemaPushNotificationDictionaryCommandNewGroupMessage;
  130. #endif